Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Attack.js
Show First 20 Lines • Show All 256 Lines • ▼ Show 20 Lines | Attack.prototype.CanAttack = function(target, wantedTypes) | ||||
if (cmpFormation) | if (cmpFormation) | ||||
return true; | return true; | ||||
let cmpThisPosition = Engine.QueryInterface(this.entity, IID_Position); | let cmpThisPosition = Engine.QueryInterface(this.entity, IID_Position); | ||||
let cmpTargetPosition = Engine.QueryInterface(target, IID_Position); | let cmpTargetPosition = Engine.QueryInterface(target, IID_Position); | ||||
if (!cmpThisPosition || !cmpTargetPosition || !cmpThisPosition.IsInWorld() || !cmpTargetPosition.IsInWorld()) | if (!cmpThisPosition || !cmpTargetPosition || !cmpThisPosition.IsInWorld() || !cmpTargetPosition.IsInWorld()) | ||||
return false; | return false; | ||||
let cmpIdentity = QueryMiragedInterface(target, IID_Identity); | let cmpIdentity = Engine.QueryInterface(target, IID_Identity); | ||||
elexis: (correct, as the `QueryMiragedInterface` returns the stuff copied in the `CopyFoo` functions… | |||||
if (!cmpIdentity) | if (!cmpIdentity) | ||||
return false; | return false; | ||||
let cmpHealth = QueryMiragedInterface(target, IID_Health); | let cmpHealth = QueryMiragedInterface(target, IID_Health); | ||||
let targetClasses = cmpIdentity.GetClassesList(); | let targetClasses = cmpIdentity.GetClassesList(); | ||||
if (targetClasses.indexOf("Domestic") != -1 && this.template.Slaughter && cmpHealth && cmpHealth.GetHitpoints() && | if (targetClasses.indexOf("Domestic") != -1 && this.template.Slaughter && cmpHealth && cmpHealth.GetHitpoints() && | ||||
(!wantedTypes || !wantedTypes.filter(wType => wType.indexOf("!") != 0).length)) | (!wantedTypes || !wantedTypes.filter(wType => wType.indexOf("!") != 0).length)) | ||||
return true; | return true; | ||||
▲ Show 20 Lines • Show All 420 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
(correct, as the QueryMiragedInterface returns the stuff copied in the CopyFoo functions with priority, but we don't copy it anymore there).