mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-20 19:02:12 +00:00
Add 3 example scripts that recreate ZB actions
This commit is contained in:
parent
01ad1d07f9
commit
2ca05336dd
3 changed files with 68 additions and 0 deletions
13
Build/UDBScript/Scripts/Examples/clearlinedefaction.js
Normal file
13
Build/UDBScript/Scripts/Examples/clearlinedefaction.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
/// <reference path="../udbscript.d.ts" />
|
||||
|
||||
`#version 5`;
|
||||
|
||||
`#name Reset linedef actions`;
|
||||
|
||||
`#description Resets the action of all selected linedefs to 0.`;
|
||||
|
||||
UDB.Map.getSelectedOrHighlightedLinedefs().forEach(line => {
|
||||
if (line.action > 0) {
|
||||
line.action = 0;
|
||||
}
|
||||
});
|
30
Build/UDBScript/Scripts/Examples/clearmidtextures.js
Normal file
30
Build/UDBScript/Scripts/Examples/clearmidtextures.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
/// <reference path="../udbscript.d.ts" />
|
||||
|
||||
`#version 5`;
|
||||
|
||||
`#name Clear linedef midtextures`;
|
||||
|
||||
`#description Clears all midtextures from two-sided linedefs, and optionally removes all flags related to them (Peg Midtexture, Solid Midtexture, Repeat Midtexture)`;
|
||||
|
||||
`#scriptoptions
|
||||
|
||||
clearflags
|
||||
{
|
||||
description = "Remove midtexture-related flags";
|
||||
default = true;
|
||||
type = 3; // Boolean
|
||||
}
|
||||
`;
|
||||
|
||||
UDB.Map.getSelectedOrHighlightedLinedefs().forEach(line => {
|
||||
if (line.front != null && line.back != null) {
|
||||
line.front.middleTexture = "-";
|
||||
line.back.middleTexture = "-";
|
||||
|
||||
if (UDB.ScriptOptions.clearflags) {
|
||||
line.flags['midpeg'] = false;
|
||||
line.flags['midsolid'] = false;
|
||||
line.flags['wrapmidtex'] = false;
|
||||
}
|
||||
}
|
||||
});
|
25
Build/UDBScript/Scripts/Examples/selectextravertices.js
Normal file
25
Build/UDBScript/Scripts/Examples/selectextravertices.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
/// <reference path="../udbscript.d.ts" />
|
||||
|
||||
`#version 5`;
|
||||
|
||||
`#name Select extra vertices`;
|
||||
|
||||
`#description Given a selection of vertices, this only keeps vertices that are not essential to sector geometry selected.`;
|
||||
|
||||
UDB.Map.getSelectedOrHighlightedVertices().forEach(vertex => {
|
||||
let lines = vertex.getLinedefs();
|
||||
if (lines.length == 2)
|
||||
{
|
||||
let l1 = lines[0].angle%180;
|
||||
let l2 = lines[1].angle%180;
|
||||
if (l1 != l2)
|
||||
{
|
||||
vertex.selected = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vertex.selected = false;
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in a new issue