mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-12-01 16:12:33 +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)
31 lines
No EOL
750 B
JavaScript
31 lines
No EOL
750 B
JavaScript
/// <reference path="../../udbscript.d.ts" />
|
|
|
|
`#version 4`;
|
|
|
|
`#name Randomize Selection Order`;
|
|
|
|
`#description Randomize the selection order of the selected map elements.`;
|
|
|
|
// Put all selected map elements into an array
|
|
let elements = [
|
|
...UDB.Map.getSelectedThings(),
|
|
...UDB.Map.getSelectedVertices(),
|
|
...UDB.Map.getSelectedLinedefs(),
|
|
...UDB.Map.getSelectedSectors()
|
|
];
|
|
|
|
// Clear current selection
|
|
UDB.Map.clearAllSelected();
|
|
|
|
// Keep going as long as there are elements in the array
|
|
while(elements.length > 0)
|
|
{
|
|
// Randomly choose one element
|
|
let index = Math.floor(Math.random() * elements.length);
|
|
|
|
// Select it!
|
|
elements[index].selected = true;
|
|
|
|
// Remove it from the array
|
|
elements.splice(index, 1);
|
|
} |