Fix cargo/passenger interaction
This commit is contained in:
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA
|
||||
public class CargoInfo : TraitInfo<Cargo>
|
||||
{
|
||||
public readonly int Passengers = 0;
|
||||
public readonly string[] PassengerTypes = { };
|
||||
public readonly string[] Types = { };
|
||||
public readonly int UnloadFacing = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,34 +13,36 @@ using OpenRA.Effects;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Traits.Activities;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
class PassengerInfo : TraitInfo<Passenger>
|
||||
{
|
||||
public readonly PipType ColorOfCargoPip = PipType.Green;
|
||||
public readonly string CargoType = null;
|
||||
public readonly PipType PipType = PipType.Green;
|
||||
}
|
||||
|
||||
class Passenger : IIssueOrder, IResolveOrder, IOrderCursor, IOrderVoice
|
||||
{
|
||||
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
|
||||
{
|
||||
// Disable cargo support until someone fixes it
|
||||
return null;
|
||||
{
|
||||
if (mi.Button != MouseButton.Right)
|
||||
return null;
|
||||
|
||||
if (underCursor == null || underCursor.Owner != self.Owner)
|
||||
return null;
|
||||
|
||||
var cargo = underCursor.traits.GetOrDefault<Cargo>();
|
||||
if (cargo == null)
|
||||
return null;
|
||||
|
||||
//if (mi.Button != MouseButton.Right)
|
||||
// return null;
|
||||
|
||||
//if (underCursor == null || underCursor.Owner != self.Owner)
|
||||
// return null;
|
||||
|
||||
//var cargo = underCursor.traits.GetOrDefault<Cargo>();
|
||||
//if (cargo == null)
|
||||
// return null;
|
||||
|
||||
//// Todo: Check if we can enter the transport
|
||||
var pi = self.Info.Traits.Get<PassengerInfo>();
|
||||
var ci = underCursor.Info.Traits.Get<CargoInfo>();
|
||||
if (!ci.Types.Contains(pi.CargoType))
|
||||
return null;
|
||||
|
||||
//return new Order("EnterTransport", self, underCursor);
|
||||
return new Order("EnterTransport", self, underCursor);
|
||||
}
|
||||
|
||||
bool CanEnter(Actor self, Actor a)
|
||||
@@ -85,7 +87,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
public PipType ColorOfCargoPip( Actor self )
|
||||
{
|
||||
return self.Info.Traits.Get<PassengerInfo>().ColorOfCargoPip;
|
||||
return self.Info.Traits.Get<PassengerInfo>().PipType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
Repairable:
|
||||
Chronoshiftable:
|
||||
Passenger:
|
||||
CargoType: Vehicle
|
||||
IronCurtainable:
|
||||
HiddenUnderFog:
|
||||
GainsExperience:
|
||||
@@ -36,6 +37,7 @@
|
||||
Repairable:
|
||||
Chronoshiftable:
|
||||
Passenger:
|
||||
CargoType: Vehicle
|
||||
IronCurtainable:
|
||||
HiddenUnderFog:
|
||||
GainsExperience:
|
||||
@@ -80,6 +82,7 @@
|
||||
RenderInfantry:
|
||||
AutoTarget:
|
||||
Passenger:
|
||||
CargoType: Infantry
|
||||
HiddenUnderFog:
|
||||
PoisonedByTiberium:
|
||||
GainsExperience:
|
||||
|
||||
@@ -128,7 +128,7 @@ E6:
|
||||
HP: 25
|
||||
TakeCover:
|
||||
Passenger:
|
||||
ColorOfCargoPip: Yellow
|
||||
PipType: Yellow
|
||||
EngineerRepair:
|
||||
EngineerCapture:
|
||||
-AutoTarget:
|
||||
|
||||
@@ -78,7 +78,7 @@ APC:
|
||||
WithMuzzleFlash:
|
||||
AutoTarget:
|
||||
Cargo:
|
||||
PassengerTypes: Foot
|
||||
Types: Infantry
|
||||
Passengers: 5
|
||||
UnloadFacing: 220
|
||||
|
||||
@@ -418,7 +418,7 @@ TRAN:
|
||||
SecondaryOffset: 0,-14,0,-2
|
||||
WithShadow:
|
||||
Cargo:
|
||||
PassengerTypes: Foot
|
||||
Types: Infantry
|
||||
Passengers: 5
|
||||
|
||||
HELI:
|
||||
@@ -489,6 +489,7 @@ C17:
|
||||
RenderUnit:
|
||||
WithShadow:
|
||||
Cargo:
|
||||
Types: Infantry, Vehicle
|
||||
Passengers: 10
|
||||
Invulnerable:
|
||||
-Selectable:
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
Repairable:
|
||||
Chronoshiftable:
|
||||
Passenger:
|
||||
CargoType: Vehicle
|
||||
IronCurtainable:
|
||||
HiddenUnderFog:
|
||||
GainsExperience:
|
||||
@@ -36,6 +37,7 @@
|
||||
Repairable:
|
||||
Chronoshiftable:
|
||||
Passenger:
|
||||
CargoType: Vehicle
|
||||
IronCurtainable:
|
||||
HiddenUnderFog:
|
||||
GainsExperience:
|
||||
@@ -62,6 +64,7 @@
|
||||
RenderInfantry:
|
||||
AutoTarget:
|
||||
Passenger:
|
||||
CargoType: Infantry
|
||||
HiddenUnderFog:
|
||||
TeslaInstantKills:
|
||||
GainsExperience:
|
||||
|
||||
@@ -125,7 +125,7 @@ E6:
|
||||
Mobile:
|
||||
Speed: 4
|
||||
Passenger:
|
||||
ColorOfCargoPip: Yellow
|
||||
PipType: Yellow
|
||||
EngineerRepair:
|
||||
EngineerCapture:
|
||||
TakeCover:
|
||||
@@ -151,7 +151,7 @@ SPY:
|
||||
RevealsShroud:
|
||||
Range: 5
|
||||
Passenger:
|
||||
ColorOfCargoPip: Yellow
|
||||
PipType: Yellow
|
||||
RenderSpy:
|
||||
TakeCover:
|
||||
Spy:
|
||||
@@ -204,7 +204,7 @@ MEDI:
|
||||
RevealsShroud:
|
||||
Range: 3
|
||||
Passenger:
|
||||
ColorOfCargoPip: Yellow
|
||||
PipType: Yellow
|
||||
AutoHeal:
|
||||
AttackBase:
|
||||
PrimaryWeapon: Heal
|
||||
|
||||
@@ -13,6 +13,7 @@ BADR:
|
||||
IronCurtainable:
|
||||
Cargo:
|
||||
Passengers: 10
|
||||
Types: Infantry, Vehicle
|
||||
-Selectable:
|
||||
-GainsExperience:
|
||||
|
||||
@@ -307,7 +308,7 @@ APC:
|
||||
WithMuzzleFlash:
|
||||
AutoTarget:
|
||||
Cargo:
|
||||
PassengerTypes: Foot
|
||||
Types: Infantry
|
||||
Passengers: 5
|
||||
UnloadFacing: 220
|
||||
|
||||
@@ -517,7 +518,7 @@ LST:
|
||||
Range: 6
|
||||
RenderUnit:
|
||||
Cargo:
|
||||
PassengerTypes: Foot,Wheel,Track
|
||||
Types: Infantry, Vehicle
|
||||
Passengers: 5
|
||||
IronCurtainable:
|
||||
RepairableNear:
|
||||
@@ -640,7 +641,7 @@ TRAN:
|
||||
SecondaryOffset: 0,-14,0,-2
|
||||
WithShadow:
|
||||
Cargo:
|
||||
PassengerTypes: Foot
|
||||
Types: Infantry
|
||||
Passengers: 5
|
||||
IronCurtainable:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user