diff --git a/OpenRA.Mods.RA/Crate.cs b/OpenRA.Mods.RA/Crate.cs index 8a90c535af..94d65458e2 100644 --- a/OpenRA.Mods.RA/Crate.cs +++ b/OpenRA.Mods.RA/Crate.cs @@ -69,7 +69,7 @@ namespace OpenRA.Mods.RA public void Tick(Actor self) { - var cell = ((1/24f) * self.CenterLocation).ToInt2(); + var cell = Util.CellContaining(self.CenterLocation); var collector = self.World.WorldActor.traits.Get().GetUnitsAt(cell).FirstOrDefault(); if (collector != null) { @@ -88,11 +88,13 @@ namespace OpenRA.Mods.RA public int2 TopLeft {get { return Location; }} int2[] noCells = new int2[] { }; public IEnumerable OccupiedCells() { return noCells; } - - public bool CanEnterCell(int2 location) { return true; } + + public bool CanEnterCell(int2 location) { return self.World.GetTerrainInfo(location).Buildable; } + public float MovementCostForCell(Actor self, int2 cell) { return 0; } public float MovementSpeedForCell(Actor self, int2 cell) { return 1; } public IEnumerable GetCurrentPath(Actor self) { return new float2[] {}; } + public void SetPosition(Actor self, int2 cell) { Location = cell;