mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-12-03 00:52:09 +00:00
5eb438e3ba
Added map scripting capabilities to UDB (#656). Documentation at https://biwa.github.io/udbscript-docs/
10 lines
No EOL
528 B
JavaScript
10 lines
No EOL
528 B
JavaScript
`#name Triangulate Sectors`;
|
|
`#description Triangulates the selected or highlighted sectors into new sectors. Note that the triangulation will not "be beautiful", and that the sectors with islands may cause problems.`;
|
|
|
|
let sectors = Map.getSelectedOrHighlightedSectors();
|
|
|
|
if(sectors.length == 0)
|
|
die('No sectors selected or highlighted');
|
|
|
|
// Draw all triangles. Remember to add the first point at the end so that the drawing will be closed
|
|
sectors.forEach(s => s.getTriangles().forEach(t => Map.drawLines([...t, t[0]]))); |