cargo: Passenger trait for things that can enter transports

This commit is contained in:
Chris Forbes
2010-01-05 15:10:17 +13:00
parent 37a043bf96
commit 026a33d2e2
4 changed files with 68 additions and 24 deletions

View File

@@ -215,6 +215,7 @@
<Compile Include="Traits\MineImmune.cs" /> <Compile Include="Traits\MineImmune.cs" />
<Compile Include="Traits\Minelayer.cs" /> <Compile Include="Traits\Minelayer.cs" />
<Compile Include="Traits\LimitedAmmo.cs" /> <Compile Include="Traits\LimitedAmmo.cs" />
<Compile Include="Traits\Passenger.cs" />
<Compile Include="Traits\Repairable.cs" /> <Compile Include="Traits\Repairable.cs" />
<Compile Include="Traits\Reservable.cs" /> <Compile Include="Traits\Reservable.cs" />
<Compile Include="Traits\SquishByTank.cs" /> <Compile Include="Traits\SquishByTank.cs" />

View File

@@ -81,6 +81,7 @@ namespace OpenRa.Game.Orders
else else
return Cursor.MoveBlocked; return Cursor.MoveBlocked;
case "Enter": return Cursor.Enter; case "Enter": return Cursor.Enter;
case "EnterTransport": return Cursor.Enter;
case "Deliver": return Cursor.Enter; case "Deliver": return Cursor.Enter;
case "Infiltrate": return Cursor.Enter; case "Infiltrate": return Cursor.Enter;
case "Capture": return Cursor.Capture; case "Capture": return Cursor.Capture;

View File

@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenRa.Game.Traits.Activities;
namespace OpenRa.Game.Traits
{
class Passenger : IOrder
{
public Passenger(Actor self) { }
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
{
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 || cargo.IsFull(underCursor))
return null;
var umt = self.traits.WithInterface<IMovement>().First().GetMovementType();
if (!underCursor.Info.PassengerTypes.Contains(umt))
return null;
return new Order("EnterTransport", self, underCursor, int2.Zero, null);
}
public void ResolveOrder(Actor self, Order order)
{
if (order.OrderString == "EnterTransport")
{
self.CancelActivity();
self.QueueActivity(new Move(order.TargetActor, 0));
// todo: actually enter the transport
}
}
}
}

View File

@@ -16,47 +16,47 @@ MNLY.AT
[V2RL] [V2RL]
Description=V2 Rocket Description=V2 Rocket
Traits=Unit, Mobile, AttackBase, RenderUnitReload, AutoTarget, Repairable, Chronoshiftable Traits=Unit, Mobile, AttackBase, RenderUnitReload, AutoTarget, Repairable, Chronoshiftable, Passenger
Voice=VehicleVoice Voice=VehicleVoice
LongDesc=Long-range rocket artillery.\n Strong vs Infantry, Buildings\n Weak vs Tanks, Aircraft LongDesc=Long-range rocket artillery.\n Strong vs Infantry, Buildings\n Weak vs Tanks, Aircraft
[1TNK] [1TNK]
Description=Light Tank Description=Light Tank
Traits=Unit, Mobile, Turreted, AttackTurreted, RenderUnitTurreted, AutoTarget, Repairable, Chronoshiftable Traits=Unit, Mobile, Turreted, AttackTurreted, RenderUnitTurreted, AutoTarget, Repairable, Chronoshiftable, Passenger
Recoil=2 Recoil=2
Voice=VehicleVoice Voice=VehicleVoice
LongDesc=Light Tank, good for scouting.\n Strong vs Light Vehicles\n Weak vs Tanks, Aircraft LongDesc=Light Tank, good for scouting.\n Strong vs Light Vehicles\n Weak vs Tanks, Aircraft
[2TNK] [2TNK]
Description=Medium Tank Description=Medium Tank
Traits=Unit, Mobile, Turreted, AttackTurreted, RenderUnitTurreted, AutoTarget, Repairable, Chronoshiftable Traits=Unit, Mobile, Turreted, AttackTurreted, RenderUnitTurreted, AutoTarget, Repairable, Chronoshiftable, Passenger
Recoil=3 Recoil=3
Voice=VehicleVoice Voice=VehicleVoice
LongDesc=Allied Main Battle Tank.\n Strong vs Tanks, Light Vehicles\n Weak vs Infantry, Aircraft LongDesc=Allied Main Battle Tank.\n Strong vs Tanks, Light Vehicles\n Weak vs Infantry, Aircraft
[3TNK] [3TNK]
Description=Heavy Tank Description=Heavy Tank
Traits=Unit, Mobile, Turreted, AttackTurreted, RenderUnitTurreted, AutoTarget, Repairable, Chronoshiftable Traits=Unit, Mobile, Turreted, AttackTurreted, RenderUnitTurreted, AutoTarget, Repairable, Chronoshiftable, Passenger
Recoil=3 Recoil=3
Voice=VehicleVoice Voice=VehicleVoice
LongDesc=Soviet Main Battle Tank, with dual cannons\n Strong vs Tanks, Light Vehicles\n Weak vs Infantry, Aircraft LongDesc=Soviet Main Battle Tank, with dual cannons\n Strong vs Tanks, Light Vehicles\n Weak vs Infantry, Aircraft
[4TNK] [4TNK]
Description=Mammoth Tank Description=Mammoth Tank
Traits=Unit, Mobile, Turreted, AttackTurreted, RenderUnitTurreted, AutoTarget, Repairable, Chronoshiftable Traits=Unit, Mobile, Turreted, AttackTurreted, RenderUnitTurreted, AutoTarget, Repairable, Chronoshiftable, Passenger
Voice=VehicleVoice Voice=VehicleVoice
LongDesc=Big and slow tank, with anti-air capability.\n Strong vs Tanks, Aircraft\n Weak vs Infantry LongDesc=Big and slow tank, with anti-air capability.\n Strong vs Tanks, Aircraft\n Weak vs Infantry
[ARTY] [ARTY]
Description=Artillery Description=Artillery
Traits=Unit, Mobile, AttackBase, RenderUnit, Explodes, AutoTarget, Repairable, Chronoshiftable Traits=Unit, Mobile, AttackBase, RenderUnit, Explodes, AutoTarget, Repairable, Chronoshiftable, Passenger
Voice=VehicleVoice Voice=VehicleVoice
LongDesc=Long-range artillery.\n Strong vs Infantry, Buildings\n Weak vs Tanks, Aircraft LongDesc=Long-range artillery.\n Strong vs Infantry, Buildings\n Weak vs Tanks, Aircraft
[JEEP] [JEEP]
Description=Ranger Description=Ranger
Traits=Unit, Mobile, Turreted, AttackTurreted, RenderUnitTurreted, AutoTarget, Repairable, Chronoshiftable Traits=Unit, Mobile, Turreted, AttackTurreted, RenderUnitTurreted, AutoTarget, Repairable, Chronoshiftable, Passenger
PrimaryOffset=0,0,0,-2 PrimaryOffset=0,0,0,-2
MuzzleFlash=yes MuzzleFlash=yes
Voice=VehicleVoice Voice=VehicleVoice
LongDesc=Fast scout & anti-infantry vehicle.\n Strong vs Infantry\n Weak vs Tanks, Aircraft LongDesc=Fast scout & anti-infantry vehicle.\n Strong vs Infantry\n Weak vs Tanks, Aircraft
[APC] [APC]
Description=Armored Personnel Carrier Description=Armored Personnel Carrier
Traits=Unit, Mobile, AttackBase, RenderUnitMuzzleFlash, AutoTarget, Repairable, Chronoshiftable, Cargo Traits=Unit, Mobile, AttackBase, RenderUnitMuzzleFlash, AutoTarget, Repairable, Chronoshiftable, Cargo, Passenger
PrimaryOffset=0,0,0,-4 PrimaryOffset=0,0,0,-4
MuzzleFlash=yes MuzzleFlash=yes
Voice=VehicleVoice Voice=VehicleVoice
@@ -67,40 +67,40 @@ PassengerTypes=Foot
;; non-combat vehicles ;; non-combat vehicles
[MRJ] [MRJ]
Description=Radar Jammer Description=Radar Jammer
Traits=Unit, Mobile, RenderUnitSpinner, Repairable, Chronoshiftable Traits=Unit, Mobile, RenderUnitSpinner, Repairable, Chronoshiftable, Passenger
PrimaryOffset=0,4,0,-6 PrimaryOffset=0,4,0,-6
SelectionPriority=3 SelectionPriority=3
Voice=VehicleVoice Voice=VehicleVoice
LongDesc=Hides nearby units on the enemy's minimap.\n Unarmed LongDesc=Hides nearby units on the enemy's minimap.\n Unarmed
[MGG] [MGG]
Description=Mobile Gap Generator Description=Mobile Gap Generator
Traits=Unit, Mobile, RenderUnitSpinner, Repairable, Chronoshiftable Traits=Unit, Mobile, RenderUnitSpinner, Repairable, Chronoshiftable, Passenger
PrimaryOffset=0,6,0,-3 PrimaryOffset=0,6,0,-3
SelectionPriority=3 SelectionPriority=3
Voice=VehicleVoice Voice=VehicleVoice
LongDesc=Regenerates Fog of War in a small area \naround the unit.\n Unarmed LongDesc=Regenerates Fog of War in a small area \naround the unit.\n Unarmed
[HARV] [HARV]
Description=Ore Truck Description=Ore Truck
Traits=Harvester, Unit, Mobile, RenderUnit, Repairable, Chronoshiftable Traits=Harvester, Unit, Mobile, RenderUnit, Repairable, Chronoshiftable, Passenger
SelectionPriority=7 SelectionPriority=7
Voice=VehicleVoice Voice=VehicleVoice
LongDesc=Collects Ore and Gems for processing.\n Unarmed LongDesc=Collects Ore and Gems for processing.\n Unarmed
[MCV] [MCV]
Description=Mobile Construction Vehicle Description=Mobile Construction Vehicle
Traits=Unit, Mobile, McvDeploy, RenderUnit, Repairable, Chronoshiftable Traits=Unit, Mobile, McvDeploy, RenderUnit, Repairable, Chronoshiftable, Passenger
SelectionPriority=3 SelectionPriority=3
Voice=VehicleVoice Voice=VehicleVoice
LongDesc=Deploys into another Construction Yard.\n Unarmed LongDesc=Deploys into another Construction Yard.\n Unarmed
[MNLY.AP] [MNLY.AP]
Description=Minelayer (Anti-Personnel) Description=Minelayer (Anti-Personnel)
Traits=Unit, Mobile, RenderUnit, Minelayer, MineImmune, Repairable, LimitedAmmo, Chronoshiftable Traits=Unit, Mobile, RenderUnit, Minelayer, MineImmune, Repairable, LimitedAmmo, Chronoshiftable, Passenger
Voice=VehicleVoice Voice=VehicleVoice
LongDesc=Lays mines to destroy unwary enemy units.\n Unarmed LongDesc=Lays mines to destroy unwary enemy units.\n Unarmed
Primary=MINP ;; temporary hack Primary=MINP ;; temporary hack
[MNLY.AT] [MNLY.AT]
Description=Minelayer (Anti-Tank) Description=Minelayer (Anti-Tank)
Traits=Unit, Mobile, RenderUnit, Minelayer, MineImmune, Repairable, LimitedAmmo, Chronoshiftable Traits=Unit, Mobile, RenderUnit, Minelayer, MineImmune, Repairable, LimitedAmmo, Chronoshiftable, Passenger
Voice=VehicleVoice Voice=VehicleVoice
LongDesc=Lays mines to destroy unwary enemy units.\n Unarmed LongDesc=Lays mines to destroy unwary enemy units.\n Unarmed
Primary=MINV ;; temporary hack Primary=MINV ;; temporary hack
@@ -548,62 +548,62 @@ MEDI
Description=Attack Dog Description=Attack Dog
BuiltAt=KENN BuiltAt=KENN
Voice=DogVoice Voice=DogVoice
Traits=Unit, Mobile, RenderInfantry ;; AttackBase, SquishByTank, AutoTarget, dog?? Traits=Unit, Mobile, RenderInfantry, Passenger ;; AttackBase, SquishByTank, AutoTarget, dog??
LongDesc=Anti-infantry unit. Not fooled by the \nSpy's disguise.\n Strong vs Infantry\n Weak vs Vehicles LongDesc=Anti-infantry unit. Not fooled by the \nSpy's disguise.\n Strong vs Infantry\n Weak vs Vehicles
SelectionSize=12,17,-1,-4 SelectionSize=12,17,-1,-4
[E1] [E1]
Description=Rifle Infantry Description=Rifle Infantry
Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, SquishByTank, AutoTarget Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, SquishByTank, AutoTarget, Passenger
LongDesc=General-purpose infantry. Strong vs Infantry\n Weak vs Vehicles LongDesc=General-purpose infantry. Strong vs Infantry\n Weak vs Vehicles
SelectionSize=12,17,0,-9 SelectionSize=12,17,0,-9
[E2] [E2]
Description=Grenadier Description=Grenadier
Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, SquishByTank, AutoTarget Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, SquishByTank, AutoTarget, Passenger
FireDelay=15 FireDelay=15
PrimaryOffset=0,0,0,-13 PrimaryOffset=0,0,0,-13
LongDesc=Infantry armed with grenades. \n Strong vs Buildings, Infantry\n Weak vs Vehicles LongDesc=Infantry armed with grenades. \n Strong vs Buildings, Infantry\n Weak vs Vehicles
SelectionSize=12,17,0,-9 SelectionSize=12,17,0,-9
[E3] [E3]
Description=Rocket Soldier Description=Rocket Soldier
Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, SquishByTank, AutoTarget Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, SquishByTank, AutoTarget, Passenger
PrimaryOffset=0,0,0,-13 PrimaryOffset=0,0,0,-13
LongDesc=Anti-tank/Anti-aircraft infantry.\n Strong vs Tanks, Aircraft\n Weak vs Infantry LongDesc=Anti-tank/Anti-aircraft infantry.\n Strong vs Tanks, Aircraft\n Weak vs Infantry
SelectionSize=12,17,0,-9 SelectionSize=12,17,0,-9
[E4] [E4]
Description=Flamethrower Description=Flamethrower
Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, SquishByTank, AutoTarget Traits=Unit, Mobile, RenderInfantry, AttackBase, TakeCover, SquishByTank, AutoTarget, Passenger
FireDelay=8 FireDelay=8
PrimaryOffset=0,0,0,-7 PrimaryOffset=0,0,0,-7
LongDesc=Advanced Anti-infantry unit.\n Strong vs Infantry, Buildings\n Weak vs Vehicles LongDesc=Advanced Anti-infantry unit.\n Strong vs Infantry, Buildings\n Weak vs Vehicles
SelectionSize=12,17,0,-9 SelectionSize=12,17,0,-9
[E6] [E6]
Description=Engineer Description=Engineer
Traits=Unit, Mobile, EngineerCapture, RenderInfantry, TakeCover, SquishByTank Traits=Unit, Mobile, EngineerCapture, RenderInfantry, TakeCover, SquishByTank, Passenger
Voice=EngineerVoice Voice=EngineerVoice
LongDesc=Infiltrates and captures enemy structures.\n Strong vs Nothing\n Weak vs Everything LongDesc=Infiltrates and captures enemy structures.\n Strong vs Nothing\n Weak vs Everything
SelectionSize=12,17,0,-9 SelectionSize=12,17,0,-9
[SPY] [SPY]
Description=Spy Description=Spy
Voice=SpyVoice Voice=SpyVoice
Traits=Unit, Mobile, RenderInfantry, TakeCover, SquishByTank Traits=Unit, Mobile, RenderInfantry, TakeCover, SquishByTank, Passenger
LongDesc=Infiltrates enemy structures to gather \nintelligence. Exact effect depends on the \nbuilding infiltrated.\n Strong vs Nothing\n Weak vs Everything\n Special Ability: Disguised LongDesc=Infiltrates enemy structures to gather \nintelligence. Exact effect depends on the \nbuilding infiltrated.\n Strong vs Nothing\n Weak vs Everything\n Special Ability: Disguised
SelectionSize=12,17,0,-9 SelectionSize=12,17,0,-9
[THF] [THF]
Description=Thief Description=Thief
Voice=ThiefVoice Voice=ThiefVoice
Traits=Unit, Mobile, RenderInfantry, TakeCover, SquishByTank Traits=Unit, Mobile, RenderInfantry, TakeCover, SquishByTank, Passenger
LongDesc=Infiltrates enemy refineries & \nsilos, and steals money stored there.\n Unarmed LongDesc=Infiltrates enemy refineries & \nsilos, and steals money stored there.\n Unarmed
SelectionSize=12,17,0,-9 SelectionSize=12,17,0,-9
[E7] [E7]
Description=Tanya Description=Tanya
Voice=TanyaVoice Voice=TanyaVoice
Traits=Unit, Mobile, RenderInfantry, C4Demolition, AttackBase, TakeCover, SquishByTank, AutoTarget Traits=Unit, Mobile, RenderInfantry, C4Demolition, AttackBase, TakeCover, SquishByTank, AutoTarget, Passenger
LongDesc=Elite commando infantry, armed with \ndual pistols and C4.\n Strong vs Infantry, Buildings\n Weak vs Vehicles\n Special Ability: Destroy Building with C4 LongDesc=Elite commando infantry, armed with \ndual pistols and C4.\n Strong vs Infantry, Buildings\n Weak vs Vehicles\n Special Ability: Destroy Building with C4
SelectionSize=12,17,0,-9 SelectionSize=12,17,0,-9
[MEDI] [MEDI]
Description=Medic Description=Medic
Voice=MedicVoice Voice=MedicVoice
Traits=Unit, Mobile, RenderInfantry, AutoHeal, AttackBase, TakeCover, SquishByTank Traits=Unit, Mobile, RenderInfantry, AutoHeal, AttackBase, TakeCover, SquishByTank, Passenger
LongDesc=Heals nearby infantry.\n Strong vs Nothing\n Weak vs Everything LongDesc=Heals nearby infantry.\n Strong vs Nothing\n Weak vs Everything
SelectionSize=12,17,0,-9 SelectionSize=12,17,0,-9