Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Capturable.js
Show First 20 Lines • Show All 363 Lines • ▼ Show 20 Lines | if (cmpOwnership && (cmpOwnership.GetOwner() == INVALID_PLAYER || | ||||
cmpOwnership.GetOwner() == msg.playerId)) | cmpOwnership.GetOwner() == msg.playerId)) | ||||
return; | return; | ||||
this.capturePoints[0] += this.capturePoints[msg.playerId]; | this.capturePoints[0] += this.capturePoints[msg.playerId]; | ||||
this.capturePoints[msg.playerId] = 0; | this.capturePoints[msg.playerId] = 0; | ||||
this.RegisterCapturePointsChanged(); | this.RegisterCapturePointsChanged(); | ||||
this.CheckTimer(); | this.CheckTimer(); | ||||
}; | }; | ||||
function CapturableMirage() {} | |||||
CapturableMirage.prototype.Init = function(cmpCapturable) | |||||
{ | |||||
this.capturePoints = clone(cmpCapturable.GetCapturePoints()); | |||||
this.maxCapturePoints = cmpCapturable.GetMaxCapturePoints(); | |||||
}; | |||||
CapturableMirage.prototype.GetCapturePoints = function() { return this.capturePoints; }; | |||||
CapturableMirage.prototype.GetMaxCapturePoints = function() { return this.maxCapturePoints; }; | |||||
CapturableMirage.prototype.CanCapture = Capturable.prototype.CanCapture; | |||||
Engine.RegisterGlobal("CapturableMirage", CapturableMirage); | |||||
Capturable.prototype.Mirage = function() | |||||
{ | |||||
let mirage = new CapturableMirage(); | |||||
mirage.Init(this); | |||||
return mirage; | |||||
}; | |||||
Engine.RegisterComponentType(IID_Capturable, "Capturable", Capturable); | Engine.RegisterComponentType(IID_Capturable, "Capturable", Capturable); |
Wildfire Games · Phabricator