2022-11-13 00:15:17 +00:00
|
|
|
/// <reference path="../../udbscript.d.ts" />
|
|
|
|
|
2022-01-06 17:46:37 +00:00
|
|
|
`#version 4`;
|
|
|
|
|
UDBScript: Exported the classes Linedef, Sector, Sidedef, Thing, and Vertex, so that they can be used with instanceof
UDBScript: Map class: the getSidedefsFromSelectedLinedefs() method now correctly only returns the Sidedefs of selected Linedefs in visual mode (and not also the highlighted one)
UDBScript: Map class: added a new getSidedefsFromSelectedOrHighlightedLinedefs() method as the equivalent to the other getSelectedOrHighlighted*() methods
UDBScript: Sector class: added new floorSelected, ceilingSelected, floorHighlighted, and ceilingHighlighted properties. Those are mostly useful in visual mode, since they always return true when the Sector is selected or highlighted in the classic modes. The properties are read-only
UDBScript: Sidedef class: added new upperSelected, middleSelected, lowerSelected, upperHighlighted, middleHighlighted, and lowerHighlighted properties. Those are mostly useful in visual mode, since they always return true when the parent Linedef is selected or highlighted in the classic modes. The properties are read-only
UDBScript: added new example to apply textures for floor/ceiling and upper/middle/lower texture for selected map elements
UDBScript: updated documentation
2021-12-25 13:43:56 +00:00
|
|
|
`#name Apply textures to selected surfaces`;
|
|
|
|
|
|
|
|
`#description Applies LAVA1 to the selected floors/ceilings, and FIREBLU1 to the selected upper/middle/lower sidedefs. Mostly useful in visual mode`;
|
|
|
|
|
|
|
|
// Get all selected or highlighted sectors and sidedefs
|
2022-01-06 17:46:37 +00:00
|
|
|
let elements = UDB.Map.getSelectedOrHighlightedSectors().concat(UDB.Map.getSidedefsFromSelectedOrHighlightedLinedefs());
|
UDBScript: Exported the classes Linedef, Sector, Sidedef, Thing, and Vertex, so that they can be used with instanceof
UDBScript: Map class: the getSidedefsFromSelectedLinedefs() method now correctly only returns the Sidedefs of selected Linedefs in visual mode (and not also the highlighted one)
UDBScript: Map class: added a new getSidedefsFromSelectedOrHighlightedLinedefs() method as the equivalent to the other getSelectedOrHighlighted*() methods
UDBScript: Sector class: added new floorSelected, ceilingSelected, floorHighlighted, and ceilingHighlighted properties. Those are mostly useful in visual mode, since they always return true when the Sector is selected or highlighted in the classic modes. The properties are read-only
UDBScript: Sidedef class: added new upperSelected, middleSelected, lowerSelected, upperHighlighted, middleHighlighted, and lowerHighlighted properties. Those are mostly useful in visual mode, since they always return true when the parent Linedef is selected or highlighted in the classic modes. The properties are read-only
UDBScript: added new example to apply textures for floor/ceiling and upper/middle/lower texture for selected map elements
UDBScript: updated documentation
2021-12-25 13:43:56 +00:00
|
|
|
|
|
|
|
// Since the array might contain both selected sectors and highlighted sidedefs (or vice versa)
|
|
|
|
// we have to filter the array, so that we really only work on the correct map elements, i.e.
|
|
|
|
// either the single highlighted one, or all selected ones
|
|
|
|
elements.filter(e => {
|
|
|
|
if( elements.length == 1 ||
|
2022-01-06 17:46:37 +00:00
|
|
|
(e instanceof UDB.Sector && (e.floorSelected || e.ceilingSelected)) ||
|
|
|
|
(e instanceof UDB.Sidedef && (e.upperSelected || e.middleSelected || e.lowerSelected))
|
UDBScript: Exported the classes Linedef, Sector, Sidedef, Thing, and Vertex, so that they can be used with instanceof
UDBScript: Map class: the getSidedefsFromSelectedLinedefs() method now correctly only returns the Sidedefs of selected Linedefs in visual mode (and not also the highlighted one)
UDBScript: Map class: added a new getSidedefsFromSelectedOrHighlightedLinedefs() method as the equivalent to the other getSelectedOrHighlighted*() methods
UDBScript: Sector class: added new floorSelected, ceilingSelected, floorHighlighted, and ceilingHighlighted properties. Those are mostly useful in visual mode, since they always return true when the Sector is selected or highlighted in the classic modes. The properties are read-only
UDBScript: Sidedef class: added new upperSelected, middleSelected, lowerSelected, upperHighlighted, middleHighlighted, and lowerHighlighted properties. Those are mostly useful in visual mode, since they always return true when the parent Linedef is selected or highlighted in the classic modes. The properties are read-only
UDBScript: added new example to apply textures for floor/ceiling and upper/middle/lower texture for selected map elements
UDBScript: updated documentation
2021-12-25 13:43:56 +00:00
|
|
|
) return true;
|
|
|
|
return false;
|
|
|
|
}).forEach(e => {
|
|
|
|
// Check for each sector and sidedef which part is selected/highlighted and
|
|
|
|
// apply the textures accordingly
|
2022-01-06 17:46:37 +00:00
|
|
|
if(e instanceof UDB.Sector)
|
UDBScript: Exported the classes Linedef, Sector, Sidedef, Thing, and Vertex, so that they can be used with instanceof
UDBScript: Map class: the getSidedefsFromSelectedLinedefs() method now correctly only returns the Sidedefs of selected Linedefs in visual mode (and not also the highlighted one)
UDBScript: Map class: added a new getSidedefsFromSelectedOrHighlightedLinedefs() method as the equivalent to the other getSelectedOrHighlighted*() methods
UDBScript: Sector class: added new floorSelected, ceilingSelected, floorHighlighted, and ceilingHighlighted properties. Those are mostly useful in visual mode, since they always return true when the Sector is selected or highlighted in the classic modes. The properties are read-only
UDBScript: Sidedef class: added new upperSelected, middleSelected, lowerSelected, upperHighlighted, middleHighlighted, and lowerHighlighted properties. Those are mostly useful in visual mode, since they always return true when the parent Linedef is selected or highlighted in the classic modes. The properties are read-only
UDBScript: added new example to apply textures for floor/ceiling and upper/middle/lower texture for selected map elements
UDBScript: updated documentation
2021-12-25 13:43:56 +00:00
|
|
|
{
|
|
|
|
if(e.floorSelected || e.floorHighlighted)
|
|
|
|
e.floorTexture = 'LAVA1';
|
|
|
|
|
|
|
|
if(e.ceilingSelected || e.ceilingHighlighted)
|
|
|
|
e.ceilingTexture = 'LAVA1';
|
|
|
|
}
|
2022-01-06 17:46:37 +00:00
|
|
|
else if(e instanceof UDB.Sidedef)
|
UDBScript: Exported the classes Linedef, Sector, Sidedef, Thing, and Vertex, so that they can be used with instanceof
UDBScript: Map class: the getSidedefsFromSelectedLinedefs() method now correctly only returns the Sidedefs of selected Linedefs in visual mode (and not also the highlighted one)
UDBScript: Map class: added a new getSidedefsFromSelectedOrHighlightedLinedefs() method as the equivalent to the other getSelectedOrHighlighted*() methods
UDBScript: Sector class: added new floorSelected, ceilingSelected, floorHighlighted, and ceilingHighlighted properties. Those are mostly useful in visual mode, since they always return true when the Sector is selected or highlighted in the classic modes. The properties are read-only
UDBScript: Sidedef class: added new upperSelected, middleSelected, lowerSelected, upperHighlighted, middleHighlighted, and lowerHighlighted properties. Those are mostly useful in visual mode, since they always return true when the parent Linedef is selected or highlighted in the classic modes. The properties are read-only
UDBScript: added new example to apply textures for floor/ceiling and upper/middle/lower texture for selected map elements
UDBScript: updated documentation
2021-12-25 13:43:56 +00:00
|
|
|
{
|
|
|
|
if(e.lowerSelected || e.lowerHighlighted)
|
|
|
|
e.lowerTexture = 'FIREBLU1';
|
|
|
|
|
|
|
|
if(e.middleSelected || e.middleHighlighted)
|
|
|
|
e.middleTexture = 'FIREBLU1';
|
|
|
|
|
|
|
|
if(e.upperSelected || e.upperHighlighted)
|
|
|
|
e.upperTexture = 'FIREBLU1';
|
|
|
|
}
|
|
|
|
});
|