Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Foundation.js
Show First 20 Lines • Show All 270 Lines • ▼ Show 20 Lines | Foundation.prototype.Build = function(builderEnt, work) | ||||
var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction); | var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction); | ||||
// If there are any units in the way, ask them to move away and return early from this method. | // If there are any units in the way, ask them to move away and return early from this method. | ||||
if (cmpObstruction && cmpObstruction.GetBlockMovementFlag()) | if (cmpObstruction && cmpObstruction.GetBlockMovementFlag()) | ||||
{ | { | ||||
// Remove animal corpses | // Remove animal corpses | ||||
for (let ent of cmpObstruction.GetEntitiesDeletedUponConstruction()) | for (let ent of cmpObstruction.GetEntitiesDeletedUponConstruction()) | ||||
Engine.DestroyEntity(ent); | Engine.DestroyEntity(ent); | ||||
let collisions = cmpObstruction.GetEntitiesBlockingConstruction(); | let collisions = cmpObstruction.GetUnitsBlockingMovement(); | ||||
if (collisions.length) | if (collisions.length) | ||||
{ | { | ||||
for (var ent of collisions) | for (var ent of collisions) | ||||
{ | { | ||||
var cmpUnitAI = Engine.QueryInterface(ent, IID_UnitAI); | var cmpUnitAI = Engine.QueryInterface(ent, IID_UnitAI); | ||||
if (cmpUnitAI) | if (cmpUnitAI) | ||||
cmpUnitAI.LeaveFoundation(this.entity); | cmpUnitAI.LeaveFoundation(this.entity); | ||||
▲ Show 20 Lines • Show All 246 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator