Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/data/abilities/effects/Gates.js
- This file was added.
const GATE_ACTIONS = ["lock", "unlock"]; | |||||
function GateAction(state) | |||||
{ | |||||
this.state = state; | |||||
this.name = "gate-" + GATE_ACTIONS[this.state]; | |||||
this.schema = "<empty/>"; | |||||
} | |||||
GateAction.prototype.GetIcon = function(entity, templateData) | |||||
{ | |||||
return "icons/lock_" + GATE_ACTIONS[this.state] + "ed.png"; | |||||
} | |||||
GateAction.prototype.GetTooltip = function(entity, templateData) | |||||
{ | |||||
} | |||||
GateAction.prototype.OnFire = function(entity, templateData, commandData) | |||||
{ | |||||
let cmpGate = Engine.QueryInterface(entity, IID_Gate); | |||||
if (!cmpGate) | |||||
return; | |||||
let quiet = false; | |||||
if (commandData && commandData.quiet) | |||||
quiet = commandData.quiet; | |||||
if (!this.state) | |||||
cmpGate.LockGate(quiet); | |||||
else | |||||
cmpGate.UnlockGate(quiet); | |||||
} | |||||
GateAction.prototype.IsFinished = function(entity, templateData, commandData) | |||||
{ | |||||
return false; | |||||
} | |||||
var GateLock = new GateAction(0); | |||||
var GateUnlock = new GateAction(1); | |||||
AbilityEffects.RegisterEffect(GateLock); | |||||
AbilityEffects.RegisterEffect(GateUnlock); |
Wildfire Games · Phabricator