From a635e8a4d856c693c564caf58a1bb03a5ad1813f Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sun, 17 Jul 2011 17:21:55 +1200 Subject: [PATCH] add Passenger to crate; remove special cases in Cargo to support not having Passenger; #851 --- OpenRA.Mods.RA/Cargo.cs | 10 ++++------ mods/ra/rules/system.yaml | 3 ++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/OpenRA.Mods.RA/Cargo.cs b/OpenRA.Mods.RA/Cargo.cs index 55654ec82b..61d5203540 100644 --- a/OpenRA.Mods.RA/Cargo.cs +++ b/OpenRA.Mods.RA/Cargo.cs @@ -92,14 +92,13 @@ namespace OpenRA.Mods.RA public Actor Peek(Actor self) { return cargo[0]; } + static int GetWeight(Actor a) { return a.Info.Traits.Get().Weight; } + public Actor Unload(Actor self) { var a = cargo[0]; cargo.RemoveAt(0); - - var pi = a.Info.Traits.GetOrDefault(); - totalWeight -= pi != null ? pi.Weight : 1; - + totalWeight -= GetWeight(a); return a; } @@ -130,8 +129,7 @@ namespace OpenRA.Mods.RA public void Load(Actor self, Actor a) { cargo.Add(a); - var pi = a.Info.Traits.GetOrDefault(); - totalWeight += pi != null ? pi.Weight : 1; + totalWeight += GetWeight(a); } public void Killed(Actor self, AttackInfo e) diff --git a/mods/ra/rules/system.yaml b/mods/ra/rules/system.yaml index c06c121d85..7357c0f8cc 100644 --- a/mods/ra/rules/system.yaml +++ b/mods/ra/rules/system.yaml @@ -287,6 +287,7 @@ CRATE: BelowUnits: ProximityCaptor: Types:Crate + Passenger: CAMERA: Aircraft: @@ -338,4 +339,4 @@ mpspawn: waypoint: Waypoint: - RenderEditorOnly: \ No newline at end of file + RenderEditorOnly: