private static bool ResolveMove(MoveAction action, EncounterState state) { Entity actor = state.GetEntityById(action.ActorId); var positionComponent = state.GetEntityById(action.ActorId).GetComponent <PositionComponent>(); if (positionComponent.EncounterPosition == action.TargetPosition) { GD.PrintErr(string.Format("Entity {0}:{1} tried to move to its current position {2}", actor.EntityName, actor.EntityId, action.TargetPosition)); return(false); } else if (state.IsPositionBlocked(action.TargetPosition)) { var blocker = state.BlockingEntityAtPosition(action.TargetPosition.X, action.TargetPosition.Y); var actorCollision = actor.GetComponent <CollisionComponent>(); if (actorCollision.OnCollisionAttack) { Attack(actor, blocker, state); } if (actorCollision.OnCollisionSelfDestruct) { state.TeleportEntity(actor, action.TargetPosition, ignoreCollision: true); if (state.FoVCache.IsVisible(action.TargetPosition)) { positionComponent.PlayExplosion(); } ResolveAction(new DestroyAction(action.ActorId), state); } return(true); } else { state.TeleportEntity(actor, action.TargetPosition, ignoreCollision: false); return(true); } }