Add general rules script for the campaign.
Enable design and minimap only when an HQ exists.master
parent
78dee1c706
commit
4a71db9e9b
|
@ -0,0 +1,37 @@
|
|||
// General rules for the campaign
|
||||
//
|
||||
// * Enable unit design and minimap only when an HQ exists
|
||||
|
||||
function eventStartLevel()
|
||||
{
|
||||
// Disable by default
|
||||
setMiniMap(false);
|
||||
setDesign(false);
|
||||
|
||||
var structlist = enumStruct(me);
|
||||
for (var i = 0; i < structlist.length; i++)
|
||||
{
|
||||
// Simulate build events to enable minimap/unit design when an HQ exists
|
||||
eventStructureBuilt(structlist[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function eventStructureBuilt(struct)
|
||||
{
|
||||
if (struct.player == selectedPlayer && struct.type == STRUCTURE && struct.stattype == HQ)
|
||||
{
|
||||
// Enable unit design and minimap when an HQ gets built
|
||||
setMiniMap(true);
|
||||
setDesign(true);
|
||||
}
|
||||
}
|
||||
|
||||
function eventDestroyed(victim)
|
||||
{
|
||||
if (victim.player == selectedPlayer && victim.type == STRUCTURE && victim.stattype == HQ)
|
||||
{
|
||||
// Disable unit design and minimap when the HQ gets destroyed
|
||||
setMiniMap(false);
|
||||
setDesign(false);
|
||||
}
|
||||
}
|
|
@ -179,3 +179,6 @@ file ANI "cybdpjmp.ani"
|
|||
file ANI "cybdplnd.ani"
|
||||
file ANI "cybdprun.ani"
|
||||
file ANIMCFG "anim.cfg"
|
||||
|
||||
directory "script"
|
||||
file JAVASCRIPT "rules.js"
|
||||
|
|
Loading…
Reference in New Issue