Fix ra
This commit is contained in:
@@ -45,7 +45,8 @@ namespace OpenRA.Mods.RA
|
||||
public object Create(ActorInitializer init) { return new Crate(init); }
|
||||
}
|
||||
|
||||
class Crate : ITick, IOccupySpace
|
||||
// IMove is required for paradrop
|
||||
class Crate : ITick, IOccupySpace, IMove
|
||||
{
|
||||
readonly Actor self;
|
||||
[Sync]
|
||||
@@ -98,5 +99,15 @@ namespace OpenRA.Mods.RA
|
||||
public int2 TopLeft {get { return Location; }}
|
||||
int2[] noCells = new int2[] { };
|
||||
public IEnumerable<int2> OccupiedCells() { return noCells; }
|
||||
|
||||
public bool CanEnterCell(int2 location) { return true; }
|
||||
public float MovementCostForCell(Actor self, int2 cell) { return 0; }
|
||||
public float MovementSpeedForCell(Actor self, int2 cell) { return 1; }
|
||||
public IEnumerable<float2> GetCurrentPath(Actor self) { return new float2[] {}; }
|
||||
public void SetPosition(Actor self, int2 cell)
|
||||
{
|
||||
Location = cell;
|
||||
self.CenterLocation = Util.CenterOfCell(cell);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Mods.RA.Effects;
|
||||
@@ -30,6 +31,7 @@ namespace OpenRA.Mods.RA
|
||||
public class ParaDropInfo : TraitInfo<ParaDrop>
|
||||
{
|
||||
public readonly int LZRange = 4;
|
||||
public readonly string ChuteSound = "chute1.aud";
|
||||
}
|
||||
|
||||
public class ParaDrop : ITick
|
||||
@@ -47,7 +49,8 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
var r = self.Info.Traits.Get<ParaDropInfo>().LZRange;
|
||||
var info = self.Info.Traits.Get<ParaDropInfo>();
|
||||
var r = info.LZRange;
|
||||
|
||||
if ((self.Location - lz).LengthSquared <= r * r && !droppedAt.Contains(self.Location))
|
||||
{
|
||||
@@ -70,14 +73,14 @@ namespace OpenRA.Mods.RA
|
||||
Util.CenterOfCell(Util.CellContaining(self.CenterLocation)),
|
||||
self.traits.Get<Unit>().Altitude, a)));
|
||||
|
||||
Sound.Play("chute1.aud", self.CenterLocation);
|
||||
Sound.Play(info.ChuteSound, self.CenterLocation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool IsSuitableCell(Actor self, int2 p)
|
||||
{
|
||||
return self.traits.Get<Mobile>().CanEnterCell(p);
|
||||
return self.traits.WithInterface<IMove>().FirstOrDefault().CanEnterCell(p);
|
||||
}
|
||||
|
||||
void FinishedDropping(Actor self)
|
||||
|
||||
Reference in New Issue
Block a user