Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/maps/random/danubius_triggers.js
Show First 20 Lines • Show All 430 Lines • ▼ Show 20 Lines | Trigger.prototype.AttackAndPatrol = function(entities, targetClass, triggerPointRef, debugName, attack) | ||||
this.debugLog(debugName + " " + uneval(attackers) + " attack " + uneval(closestTarget)); | this.debugLog(debugName + " " + uneval(attackers) + " attack " + uneval(closestTarget)); | ||||
if (attack && closestTarget) | if (attack && closestTarget) | ||||
ProcessCommand(gaulPlayer, { | ProcessCommand(gaulPlayer, { | ||||
"type": "attack", | "type": "attack", | ||||
"entities": attackers, | "entities": attackers, | ||||
"target": closestTarget, | "target": closestTarget, | ||||
"queued": true, | "prefAttackTypes": ["!Capture"], | ||||
"allowCapture": false | "queued": true | ||||
}); | }); | ||||
let patrolTargets = shuffleArray(this.GetTriggerPoints(triggerPointRef)).slice(0, patrolCount); | let patrolTargets = shuffleArray(this.GetTriggerPoints(triggerPointRef)).slice(0, patrolCount); | ||||
this.debugLog(debugName + " " + uneval(attackers) + " patrol to " + uneval(patrolTargets)); | this.debugLog(debugName + " " + uneval(attackers) + " patrol to " + uneval(patrolTargets)); | ||||
for (let patrolTarget of patrolTargets) | for (let patrolTarget of patrolTargets) | ||||
{ | { | ||||
let targetPos = TriggerHelper.GetEntityPosition2D(patrolTarget); | let targetPos = TriggerHelper.GetEntityPosition2D(patrolTarget); | ||||
ProcessCommand(gaulPlayer, { | ProcessCommand(gaulPlayer, { | ||||
"type": "patrol", | "type": "patrol", | ||||
"entities": attackers, | "entities": attackers, | ||||
"x": targetPos.x, | "x": targetPos.x, | ||||
"z": targetPos.y, | "z": targetPos.y, | ||||
"targetClasses": { | "targetClasses": { | ||||
"attack": targetClass | "attack": targetClass | ||||
}, | }, | ||||
"queued": true, | "prefAttackTypes": ["!Capture"], | ||||
"allowCapture": false | "queued": true | ||||
}); | }); | ||||
} | } | ||||
}; | }; | ||||
/** | /** | ||||
* To avoid unloading unlimited amounts of units on empty riversides, | * To avoid unloading unlimited amounts of units on empty riversides, | ||||
* only add attackers to riversides where player buildings exist that are | * only add attackers to riversides where player buildings exist that are | ||||
* actually targeted. | * actually targeted. | ||||
▲ Show 20 Lines • Show All 174 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator