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: