mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-29 15:11:56 +00:00
5b2b149b40
Improved UDBScript to version 5: - Added Plane class - Added BlockMap, BlockEntry, and BlackMapQueryResult classes - Sector class - Added getLabelPositions method to get the position of sector labels (where tags, effects etc. are displayed) - Added support for JavaScript BigInt for UDMF fields. This means it's not necessary anymore to use UniValue to assign integers to new UDMF fields. Instead it can be done like this: sector.fields.my_int_field = 1n; - Added type information file (udbscript.d.ts)
43 lines
No EOL
1.6 KiB
JavaScript
43 lines
No EOL
1.6 KiB
JavaScript
/// <reference path="../../udbscript.d.ts" />
|
|
|
|
`#version 4`;
|
|
|
|
`#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
|
|
let elements = UDB.Map.getSelectedOrHighlightedSectors().concat(UDB.Map.getSidedefsFromSelectedOrHighlightedLinedefs());
|
|
|
|
// 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 ||
|
|
(e instanceof UDB.Sector && (e.floorSelected || e.ceilingSelected)) ||
|
|
(e instanceof UDB.Sidedef && (e.upperSelected || e.middleSelected || e.lowerSelected))
|
|
) return true;
|
|
return false;
|
|
}).forEach(e => {
|
|
// Check for each sector and sidedef which part is selected/highlighted and
|
|
// apply the textures accordingly
|
|
if(e instanceof UDB.Sector)
|
|
{
|
|
if(e.floorSelected || e.floorHighlighted)
|
|
e.floorTexture = 'LAVA1';
|
|
|
|
if(e.ceilingSelected || e.ceilingHighlighted)
|
|
e.ceilingTexture = 'LAVA1';
|
|
}
|
|
else if(e instanceof UDB.Sidedef)
|
|
{
|
|
if(e.lowerSelected || e.lowerHighlighted)
|
|
e.lowerTexture = 'FIREBLU1';
|
|
|
|
if(e.middleSelected || e.middleHighlighted)
|
|
e.middleTexture = 'FIREBLU1';
|
|
|
|
if(e.upperSelected || e.upperHighlighted)
|
|
e.upperTexture = 'FIREBLU1';
|
|
}
|
|
}); |