This commit is contained in:
Paul Chote
2010-06-25 23:07:11 +12:00
parent 2373528ad9
commit cf265c8b58
7 changed files with 62 additions and 98 deletions

View File

@@ -45,7 +45,8 @@ namespace OpenRA.Mods.RA
public object Create(ActorInitializer init) { return new Crate(init); } 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; readonly Actor self;
[Sync] [Sync]
@@ -98,5 +99,15 @@ namespace OpenRA.Mods.RA
public int2 TopLeft {get { return Location; }} public int2 TopLeft {get { return Location; }}
int2[] noCells = new int2[] { }; int2[] noCells = new int2[] { };
public IEnumerable<int2> OccupiedCells() { return noCells; } 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);
}
} }
} }

View File

@@ -19,6 +19,7 @@
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using OpenRA.GameRules; using OpenRA.GameRules;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Effects; using OpenRA.Mods.RA.Effects;
@@ -30,6 +31,7 @@ namespace OpenRA.Mods.RA
public class ParaDropInfo : TraitInfo<ParaDrop> public class ParaDropInfo : TraitInfo<ParaDrop>
{ {
public readonly int LZRange = 4; public readonly int LZRange = 4;
public readonly string ChuteSound = "chute1.aud";
} }
public class ParaDrop : ITick public class ParaDrop : ITick
@@ -47,7 +49,8 @@ namespace OpenRA.Mods.RA
public void Tick(Actor self) 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)) 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)), Util.CenterOfCell(Util.CellContaining(self.CenterLocation)),
self.traits.Get<Unit>().Altitude, a))); self.traits.Get<Unit>().Altitude, a)));
Sound.Play("chute1.aud", self.CenterLocation); Sound.Play(info.ChuteSound, self.CenterLocation);
} }
} }
} }
bool IsSuitableCell(Actor self, int2 p) 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) void FinishedDropping(Actor self)

View File

@@ -3,7 +3,28 @@
Unit: Unit:
ROT: 5 ROT: 5
Mobile: Mobile:
MovementType: Wheel Crushes: atmine
TerrainTypes: Clear, Rough, Road, Tree, Water, Rock, Wall, Ore, Beach, River, Special
TerrainSpeeds: 60%, 40%, 100%, 0%, 0%, 0%, 0%, 90%, 40%, 0%, 100%
Selectable:
Voice: VehicleVoice
Repairable:
Chronoshiftable:
Passenger:
IronCurtainable:
HiddenUnderFog:
RevealsShroud:
GainsExperience:
GivesExperience:
^Tank:
Category: Vehicle
Unit:
ROT: 5
Mobile:
Crushes: wall, atmine
TerrainTypes: Clear, Rough, Road, Tree, Water, Rock, Wall, Ore, Beach, River, Special
TerrainSpeeds: 80%, 70%, 100%, 0%, 0%, 0%, 0%, 90%, 70%, 0%, 100%
Selectable: Selectable:
Voice: VehicleVoice Voice: VehicleVoice
Repairable: Repairable:
@@ -21,7 +42,9 @@
Armor: none Armor: none
Sight: 4 Sight: 4
Mobile: Mobile:
MovementType: Foot Crushes: apmine
TerrainTypes: Clear, Rough, Road, Tree, Water, Rock, Wall, Ore, Beach, River, Special
TerrainSpeeds: 90%, 80%, 100%, 0%, 0%, 0%, 0%, 100%, 80%, 0%, 100%
Selectable: Selectable:
RenderInfantry: RenderInfantry:
AutoTarget: AutoTarget:
@@ -36,7 +59,8 @@
Category: Ship Category: Ship
Unit: Unit:
Mobile: Mobile:
MovementType: Float TerrainTypes: Clear, Rough, Road, Tree, Water, Rock, Wall, Ore, Beach, River, Special
TerrainSpeeds: 0%, 0%, 0%, 0%, 100%, 0%, 0%, 0%, 0%, 0%, 100%
Selectable: Selectable:
HiddenUnderFog: HiddenUnderFog:
RevealsShroud: RevealsShroud:
@@ -71,7 +95,7 @@
Category: Building Category: Building
Building: Building:
Dimensions: 1,1 Dimensions: 1,1
Footprint: y Footprint: x
BuildSounds: placbldg.aud BuildSounds: placbldg.aud
Capturable: false Capturable: false
BaseNormal: no BaseNormal: no
@@ -81,6 +105,7 @@
DestroyedSound: sandbag2.aud DestroyedSound: sandbag2.aud
Adjacent: 4 Adjacent: 4
Wall: Wall:
CrushClasses: wall
LineBuild: LineBuild:
Selectable: Selectable:
Priority: 1 Priority: 1

View File

@@ -854,8 +854,6 @@ SBAG:
Building: Building:
HP: 100 HP: 100
Armor: none Armor: none
Wall:
CrushableBy: Wheel, Track
FENC: FENC:
Category: Defense Category: Defense
@@ -871,8 +869,6 @@ FENC:
Building: Building:
HP: 100 HP: 100
Armor: none Armor: none
Wall:
CrushableBy: Track
BRIK: BRIK:
Category: Defense Category: Defense
@@ -892,7 +888,8 @@ BRIK:
DestroyedSound: kaboom30.aud DestroyedSound: kaboom30.aud
RenderBuildingWall: RenderBuildingWall:
DamageStates: 4 DamageStates: 4
Wall:
CrushClasses: heavywall
CYCL: CYCL:
Inherits: ^Wall Inherits: ^Wall
Building: Building:
@@ -900,21 +897,15 @@ CYCL:
Armor: none Armor: none
RenderBuildingWall: RenderBuildingWall:
DamageStates: 3 DamageStates: 3
Wall:
CrushableBy: Track
BARB: BARB:
Inherits: ^Wall Inherits: ^Wall
Building: Building:
HP: 100 HP: 100
Armor: none Armor: none
Wall:
CrushableBy: Track
WOOD: WOOD:
Inherits: ^Wall Inherits: ^Wall
Building: Building:
HP: 100 HP: 100
Armor: none Armor: none
Wall:
CrushableBy: Track

View File

@@ -227,14 +227,12 @@ World:
ResourceLayer: ResourceLayer:
ResourceType@ore: ResourceType@ore:
ResourceType: 1 ResourceType: 1
MovementTerrainType: Ore
Palette: terrain Palette: terrain
SpriteNames: gold01,gold02,gold03,gold04 SpriteNames: gold01,gold02,gold03,gold04
ValuePerUnit: 25 ValuePerUnit: 25
Name: Ore Name: Ore
ResourceType@gem: ResourceType@gem:
ResourceType: 2 ResourceType: 2
MovementTerrainType: Ore
Palette: terrain Palette: terrain
SpriteNames: gem01,gem02,gem03,gem04 SpriteNames: gem01,gem02,gem03,gem04
ValuePerUnit: 50 ValuePerUnit: 50
@@ -278,7 +276,7 @@ World:
MINP: MINP:
Mine: Mine:
Weapon: APMine Weapon: APMine
TriggeredBy: Foot, Wheel, Track CrushClasses: apmine
AvoidFriendly: yes AvoidFriendly: yes
Unit: Unit:
HP: 1 HP: 1
@@ -291,7 +289,7 @@ MINP:
MINV: MINV:
Mine: Mine:
Weapon: ATMine Weapon: ATMine
TriggeredBy: Wheel, Track CrushClasses: atmine
AvoidFriendly: yes AvoidFriendly: yes
Unit: Unit:
HP: 1 HP: 1

View File

@@ -1,82 +1,38 @@
Clear: Clear:
Foot: 90%
Track: 80%
Wheel: 60%
Float: 0%
Buildable: yes Buildable: yes
Rough: Rough:
Foot: 80%
Track: 70%
Wheel: 40%
Float: 0%
Buildable: no Buildable: no
Road: Road:
Foot: 100%
Track: 100%
Wheel: 100%
Float: 0%
Buildable: yes Buildable: yes
Tree: Tree:
Foot: 0%
Track: 0%
Wheel: 0%
Float: 0%
Buildable: no Buildable: no
AcceptSmudge: no AcceptSmudge: no
Water: Water:
Foot: 0%
Track: 0%
Wheel: 0%
Float: 100%
Buildable: no Buildable: no
AcceptSmudge: no AcceptSmudge: no
Rock: Rock:
Foot: 0%
Track: 0%
Wheel: 0%
Float: 0%
Buildable: no Buildable: no
AcceptSmudge: no AcceptSmudge: no
Wall: Wall:
Foot: 0% Buildable: no
Track: 0%
Wheel: 0% Ore:
Float: 0%
Buildable: no Buildable: no
Beach: Beach:
Foot: 80%
Track: 70%
Wheel: 40%
Float: 0%
Buildable: no Buildable: no
AcceptSmudge: no AcceptSmudge: no
River: River:
Foot: 0%
Track: 0%
Wheel: 0%
Float: 0%
Buildable: no Buildable: no
AcceptSmudge: no AcceptSmudge: no
Ore:
Foot: 100%
Track: 90%
Wheel: 90%
Float: 0%
Buildable: no
Special: Special:
Foot: 100%
Track: 100%
Wheel: 100%
Float: 100%
Buildable: no Buildable: no
AcceptSmudge: no AcceptSmudge: no

View File

@@ -53,8 +53,6 @@ V2RL:
Crewed: yes Crewed: yes
Sight: 5 Sight: 5
Speed: 7 Speed: 7
Mobile:
MovementType: Track
AttackBase: AttackBase:
PrimaryWeapon: SCUD PrimaryWeapon: SCUD
RenderUnitReload: RenderUnitReload:
@@ -64,7 +62,7 @@ V2RL:
EmptyWeapon: EmptyWeapon:
1TNK: 1TNK:
Inherits: ^Vehicle Inherits: ^Tank
Buildable: Buildable:
BuildPaletteOrder: 40 BuildPaletteOrder: 40
Prerequisites: weap Prerequisites: weap
@@ -78,8 +76,6 @@ V2RL:
Crewed: yes Crewed: yes
Sight: 4 Sight: 4
Speed: 9 Speed: 9
Mobile:
MovementType: Track
Turreted: Turreted:
ROT: 5 ROT: 5
AttackTurreted: AttackTurreted:
@@ -94,7 +90,7 @@ V2RL:
HuskActor: 1TNK.Husk HuskActor: 1TNK.Husk
2TNK: 2TNK:
Inherits: ^Vehicle Inherits: ^Tank
Buildable: Buildable:
BuildPaletteOrder: 60 BuildPaletteOrder: 60
Prerequisites: weap Prerequisites: weap
@@ -108,8 +104,6 @@ V2RL:
Crewed: yes Crewed: yes
Sight: 5 Sight: 5
Speed: 8 Speed: 8
Mobile:
MovementType: Track
Turreted: Turreted:
ROT: 5 ROT: 5
AttackTurreted: AttackTurreted:
@@ -124,7 +118,7 @@ V2RL:
HuskActor: 2TNK.Husk HuskActor: 2TNK.Husk
3TNK: 3TNK:
Inherits: ^Vehicle Inherits: ^Tank
Buildable: Buildable:
BuildPaletteOrder: 40 BuildPaletteOrder: 40
Prerequisites: weap,atek Prerequisites: weap,atek
@@ -138,8 +132,6 @@ V2RL:
Crewed: yes Crewed: yes
Sight: 5 Sight: 5
Speed: 6 Speed: 6
Mobile:
MovementType: Track
Turreted: Turreted:
ROT: 5 ROT: 5
AttackTurreted: AttackTurreted:
@@ -154,7 +146,7 @@ V2RL:
HuskActor: 3TNK.Husk HuskActor: 3TNK.Husk
4TNK: 4TNK:
Inherits: ^Vehicle Inherits: ^Tank
Buildable: Buildable:
BuildPaletteOrder: 100 BuildPaletteOrder: 100
Prerequisites: weap,stek Prerequisites: weap,stek
@@ -168,8 +160,6 @@ V2RL:
Crewed: yes Crewed: yes
Sight: 6 Sight: 6
Speed: 3 Speed: 3
Mobile:
MovementType: Track
Turreted: Turreted:
ROT: 2 ROT: 2
AttackTurreted: AttackTurreted:
@@ -191,7 +181,7 @@ V2RL:
HealIfBelow: 50% HealIfBelow: 50%
ARTY: ARTY:
Inherits: ^Vehicle Inherits: ^Tank
Buildable: Buildable:
BuildPaletteOrder: 80 BuildPaletteOrder: 80
Prerequisites: weap Prerequisites: weap
@@ -206,8 +196,6 @@ ARTY:
ROT: 2 ROT: 2
Sight: 5 Sight: 5
Speed: 6 Speed: 6
Mobile:
MovementType: Track
AttackBase: AttackBase:
PrimaryWeapon: 155mm PrimaryWeapon: 155mm
RenderUnit: RenderUnit:
@@ -234,8 +222,6 @@ HARV:
Crewed: yes Crewed: yes
Sight: 4 Sight: 4
Speed: 6 Speed: 6
Mobile:
MovementType: Track
RenderUnit: RenderUnit:
MCV: MCV:
@@ -291,7 +277,7 @@ JEEP:
AutoTarget: AutoTarget:
APC: APC:
Inherits: ^Vehicle Inherits: ^Tank
Buildable: Buildable:
BuildPaletteOrder: 50 BuildPaletteOrder: 50
Prerequisites: weap,tent Prerequisites: weap,tent
@@ -304,8 +290,6 @@ APC:
Armor: heavy Armor: heavy
Sight: 5 Sight: 5
Speed: 10 Speed: 10
Mobile:
MovementType: Track
AttackBase: AttackBase:
PrimaryWeapon: M60mg PrimaryWeapon: M60mg
PrimaryOffset: 0,0,0,-4 PrimaryOffset: 0,0,0,-4
@@ -319,7 +303,7 @@ APC:
UnloadFacing: 220 UnloadFacing: 220
MNLY.AP: MNLY.AP:
Inherits: ^Vehicle Inherits: ^Tank
Buildable: Buildable:
BuildPaletteOrder: 30 BuildPaletteOrder: 30
Prerequisites: weap,fix Prerequisites: weap,fix
@@ -334,8 +318,6 @@ MNLY.AP:
Crewed: yes Crewed: yes
Sight: 5 Sight: 5
Speed: 9 Speed: 9
Mobile:
MovementType: Track
RenderUnit: RenderUnit:
Image: MNLY Image: MNLY
Minelayer: Minelayer:
@@ -345,7 +327,7 @@ MNLY.AP:
Ammo: 5 Ammo: 5
MNLY.AT: MNLY.AT:
Inherits: ^Vehicle Inherits: ^Tank
Buildable: Buildable:
BuildPaletteOrder: 30 BuildPaletteOrder: 30
Prerequisites: weap,fix Prerequisites: weap,fix
@@ -360,8 +342,6 @@ MNLY.AT:
Crewed: yes Crewed: yes
Sight: 5 Sight: 5
Speed: 9 Speed: 9
Mobile:
MovementType: Track
RenderUnit: RenderUnit:
Image: MNLY Image: MNLY
Minelayer: Minelayer: