Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/helpers/Transform.js
Show First 20 Lines • Show All 224 Lines • ▼ Show 20 Lines | if (template.Obstruction && newTemplate.Obstruction) | ||||
{ | { | ||||
var cmpNewObstruction = Engine.QueryInterface(previewEntity, IID_Obstruction); | var cmpNewObstruction = Engine.QueryInterface(previewEntity, IID_Obstruction); | ||||
if (cmpNewObstruction && cmpNewObstruction.GetBlockMovementFlag()) | if (cmpNewObstruction && cmpNewObstruction.GetBlockMovementFlag()) | ||||
{ | { | ||||
// Remove all obstructions at the new entity, especially animal corpses | // Remove all obstructions at the new entity, especially animal corpses | ||||
for (let ent of cmpNewObstruction.GetEntitiesDeletedUponConstruction()) | for (let ent of cmpNewObstruction.GetEntitiesDeletedUponConstruction()) | ||||
Engine.DestroyEntity(ent); | Engine.DestroyEntity(ent); | ||||
let collisions = cmpNewObstruction.GetEntitiesBlockingConstruction(); | let collisions = cmpNewObstruction.GetUnitsBlockingMovement(); | ||||
if (collisions.length) | if (collisions.length) | ||||
return DeleteEntityAndReturn(previewEntity, cmpPosition, pos, angle, cmpNewPosition, true); | return DeleteEntityAndReturn(previewEntity, cmpPosition, pos, angle, cmpNewPosition, true); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
return DeleteEntityAndReturn(previewEntity, cmpPosition, pos, angle, cmpNewPosition, false); | return DeleteEntityAndReturn(previewEntity, cmpPosition, pos, angle, cmpNewPosition, false); | ||||
} | } | ||||
Show All 40 Lines |
Wildfire Games · Phabricator