From b3aaacf16bf8b85b128d2d0508be393172dc896b Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Tue, 20 Jul 2010 17:59:42 +1200 Subject: [PATCH] don't drop crates in stupid places --- OpenRA.Mods.RA/Crate.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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;