Add crushable infantry support, enabled in C&C.
This commit is contained in:
60
OpenRA.Mods.RA/CrushableInfantry.cs
Normal file
60
OpenRA.Mods.RA/CrushableInfantry.cs
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||||
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
|
* available to you under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation. For more information,
|
||||||
|
* see COPYING.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
using OpenRA.Mods.RA.Effects;
|
||||||
|
using OpenRA.Mods.RA.Move;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.RA
|
||||||
|
{
|
||||||
|
class CrushableInfantryInfo : ITraitInfo, Requires<MobileInfo>
|
||||||
|
{
|
||||||
|
public readonly string CrushSound = "squish2.aud";
|
||||||
|
public readonly string CorpseSequence = "die-crushed";
|
||||||
|
public readonly string[] CrushClasses = { "infantry" };
|
||||||
|
public readonly int WarnProbability = 90;
|
||||||
|
public object Create(ActorInitializer init) { return new CrushableInfantry(init.self, this); }
|
||||||
|
}
|
||||||
|
|
||||||
|
class CrushableInfantry : ICrushable
|
||||||
|
{
|
||||||
|
readonly Actor self;
|
||||||
|
readonly CrushableInfantryInfo Info;
|
||||||
|
|
||||||
|
public CrushableInfantry(Actor self, CrushableInfantryInfo info)
|
||||||
|
{
|
||||||
|
this.self = self;
|
||||||
|
this.Info = info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void WarnCrush(Actor crusher)
|
||||||
|
{
|
||||||
|
if (self.World.SharedRandom.Next(100) <= Info.WarnProbability)
|
||||||
|
self.Trait<Mobile>().OnNudge(self, crusher, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnCrush(Actor crusher)
|
||||||
|
{
|
||||||
|
Sound.Play(Info.CrushSound);
|
||||||
|
self.World.AddFrameEndTask(w => w.Add(new Corpse(self, Info.CorpseSequence)));
|
||||||
|
self.Kill(crusher);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CrushableBy(string[] crushClasses, Player crushOwner)
|
||||||
|
{
|
||||||
|
if (crushOwner.Stances[self.Owner] == Stance.Ally)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return Info.CrushClasses.Intersect(crushClasses).Any();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -352,6 +352,7 @@
|
|||||||
<Compile Include="Render\WithBuildingExplosion.cs" />
|
<Compile Include="Render\WithBuildingExplosion.cs" />
|
||||||
<Compile Include="Reloads.cs" />
|
<Compile Include="Reloads.cs" />
|
||||||
<Compile Include="AnnounceOnKill.cs" />
|
<Compile Include="AnnounceOnKill.cs" />
|
||||||
|
<Compile Include="CrushableInfantry.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
^Tank:
|
^Tank:
|
||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
Mobile:
|
Mobile:
|
||||||
Crushes: wall, crate
|
Crushes: wall, crate, infantry
|
||||||
TerrainSpeeds:
|
TerrainSpeeds:
|
||||||
Clear: 80
|
Clear: 80
|
||||||
Rough: 70
|
Rough: 70
|
||||||
@@ -124,6 +124,7 @@
|
|||||||
ActorLostNotification:
|
ActorLostNotification:
|
||||||
Notification: unitlost.aud
|
Notification: unitlost.aud
|
||||||
SpawnViceroid:
|
SpawnViceroid:
|
||||||
|
CrushableInfantry:
|
||||||
|
|
||||||
^CivInfantry:
|
^CivInfantry:
|
||||||
Inherits: ^Infantry
|
Inherits: ^Infantry
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ E1:
|
|||||||
AttackFrontal:
|
AttackFrontal:
|
||||||
PrimaryWeapon: M16
|
PrimaryWeapon: M16
|
||||||
RenderInfantryProne:
|
RenderInfantryProne:
|
||||||
IdleAnimations: idle1,idle2,idle3,idle4
|
IdleAnimations: idle1,idle2,idle3,idle4
|
||||||
|
|
||||||
E2:
|
E2:
|
||||||
Inherits: ^Infantry
|
Inherits: ^Infantry
|
||||||
Valued:
|
Valued:
|
||||||
|
|||||||
@@ -47,6 +47,9 @@ c1:
|
|||||||
Start: 182
|
Start: 182
|
||||||
Length: 4
|
Length: 4
|
||||||
Tick: 80
|
Tick: 80
|
||||||
|
die-crushed: squish
|
||||||
|
Start: 0
|
||||||
|
Length: 1
|
||||||
c2:
|
c2:
|
||||||
stand:
|
stand:
|
||||||
Start: 0
|
Start: 0
|
||||||
@@ -96,7 +99,9 @@ c2:
|
|||||||
Start: 182
|
Start: 182
|
||||||
Length: 4
|
Length: 4
|
||||||
Tick: 80
|
Tick: 80
|
||||||
|
die-crushed: squish
|
||||||
|
Start: 0
|
||||||
|
Length: 1
|
||||||
c3:
|
c3:
|
||||||
stand:
|
stand:
|
||||||
Start: 0
|
Start: 0
|
||||||
@@ -146,7 +151,9 @@ c3:
|
|||||||
Start: 182
|
Start: 182
|
||||||
Length: 4
|
Length: 4
|
||||||
Tick: 80
|
Tick: 80
|
||||||
|
die-crushed: squish
|
||||||
|
Start: 0
|
||||||
|
Length: 1
|
||||||
c4:
|
c4:
|
||||||
stand:
|
stand:
|
||||||
Start: 0
|
Start: 0
|
||||||
@@ -196,7 +203,9 @@ c4:
|
|||||||
Start: 182
|
Start: 182
|
||||||
Length: 4
|
Length: 4
|
||||||
Tick: 80
|
Tick: 80
|
||||||
|
die-crushed: squish
|
||||||
|
Start: 0
|
||||||
|
Length: 1
|
||||||
c5:
|
c5:
|
||||||
stand:
|
stand:
|
||||||
Start: 0
|
Start: 0
|
||||||
@@ -246,7 +255,9 @@ c5:
|
|||||||
Start: 182
|
Start: 182
|
||||||
Length: 4
|
Length: 4
|
||||||
Tick: 80
|
Tick: 80
|
||||||
|
die-crushed: squish
|
||||||
|
Start: 0
|
||||||
|
Length: 1
|
||||||
c6:
|
c6:
|
||||||
stand:
|
stand:
|
||||||
Start: 0
|
Start: 0
|
||||||
@@ -296,7 +307,9 @@ c6:
|
|||||||
Start: 182
|
Start: 182
|
||||||
Length: 4
|
Length: 4
|
||||||
Tick: 80
|
Tick: 80
|
||||||
|
die-crushed: squish
|
||||||
|
Start: 0
|
||||||
|
Length: 1
|
||||||
c7:
|
c7:
|
||||||
stand:
|
stand:
|
||||||
Start: 0
|
Start: 0
|
||||||
@@ -346,7 +359,9 @@ c7:
|
|||||||
Start: 182
|
Start: 182
|
||||||
Length: 4
|
Length: 4
|
||||||
Tick: 80
|
Tick: 80
|
||||||
|
die-crushed: squish
|
||||||
|
Start: 0
|
||||||
|
Length: 1
|
||||||
c8:
|
c8:
|
||||||
stand:
|
stand:
|
||||||
Start: 0
|
Start: 0
|
||||||
@@ -396,7 +411,9 @@ c8:
|
|||||||
Start: 182
|
Start: 182
|
||||||
Length: 4
|
Length: 4
|
||||||
Tick: 80
|
Tick: 80
|
||||||
|
die-crushed: squish
|
||||||
|
Start: 0
|
||||||
|
Length: 1
|
||||||
c9:
|
c9:
|
||||||
stand:
|
stand:
|
||||||
Start: 0
|
Start: 0
|
||||||
@@ -446,7 +463,9 @@ c9:
|
|||||||
Start: 182
|
Start: 182
|
||||||
Length: 4
|
Length: 4
|
||||||
Tick: 80
|
Tick: 80
|
||||||
|
die-crushed: squish
|
||||||
|
Start: 0
|
||||||
|
Length: 1
|
||||||
c10:
|
c10:
|
||||||
stand:
|
stand:
|
||||||
Start: 0
|
Start: 0
|
||||||
@@ -495,4 +514,7 @@ c10:
|
|||||||
die6:
|
die6:
|
||||||
Start: 182
|
Start: 182
|
||||||
Length: 4
|
Length: 4
|
||||||
Tick: 80
|
Tick: 80
|
||||||
|
die-crushed: squish
|
||||||
|
Start: 0
|
||||||
|
Length: 1
|
||||||
@@ -103,6 +103,9 @@ e1:
|
|||||||
Start: 366
|
Start: 366
|
||||||
Length: 11
|
Length: 11
|
||||||
Tick: 80
|
Tick: 80
|
||||||
|
die-crushed: squish
|
||||||
|
Start: 0
|
||||||
|
Length: 1
|
||||||
e2:
|
e2:
|
||||||
stand:
|
stand:
|
||||||
Start: 0
|
Start: 0
|
||||||
@@ -183,6 +186,9 @@ e2:
|
|||||||
Start: 494
|
Start: 494
|
||||||
Length: 11
|
Length: 11
|
||||||
Tick: 80
|
Tick: 80
|
||||||
|
die-crushed: squish
|
||||||
|
Start: 0
|
||||||
|
Length: 1
|
||||||
e3:
|
e3:
|
||||||
stand:
|
stand:
|
||||||
Start: 0
|
Start: 0
|
||||||
@@ -263,6 +269,9 @@ e3:
|
|||||||
Start: 382
|
Start: 382
|
||||||
Length: 11
|
Length: 11
|
||||||
Tick: 80
|
Tick: 80
|
||||||
|
die-crushed: squish
|
||||||
|
Start: 0
|
||||||
|
Length: 1
|
||||||
e4:
|
e4:
|
||||||
stand:
|
stand:
|
||||||
Start: 0
|
Start: 0
|
||||||
@@ -343,11 +352,13 @@ e4:
|
|||||||
Start: 494
|
Start: 494
|
||||||
Length: 10
|
Length: 10
|
||||||
Tick: 80
|
Tick: 80
|
||||||
|
die-crushed: squish
|
||||||
|
Start: 0
|
||||||
|
Length: 1
|
||||||
muzzle: flame
|
muzzle: flame
|
||||||
Start: 0
|
Start: 0
|
||||||
Length: 13
|
Length: 13
|
||||||
Facings: 8
|
Facings: 8
|
||||||
|
|
||||||
e5:
|
e5:
|
||||||
stand:
|
stand:
|
||||||
Start: 0
|
Start: 0
|
||||||
@@ -428,11 +439,13 @@ e5:
|
|||||||
Start: 494
|
Start: 494
|
||||||
Length: 10
|
Length: 10
|
||||||
Tick: 80
|
Tick: 80
|
||||||
|
die-crushed: squish
|
||||||
|
Start: 0
|
||||||
|
Length: 1
|
||||||
muzzle: chem
|
muzzle: chem
|
||||||
Start: 0
|
Start: 0
|
||||||
Length: 13
|
Length: 13
|
||||||
Facings: 8
|
Facings: 8
|
||||||
|
|
||||||
e6:
|
e6:
|
||||||
stand:
|
stand:
|
||||||
Start: 0
|
Start: 0
|
||||||
@@ -505,7 +518,9 @@ e6:
|
|||||||
Start: 130
|
Start: 130
|
||||||
Length: 4
|
Length: 4
|
||||||
Tick: 80
|
Tick: 80
|
||||||
|
die-crushed: squish
|
||||||
|
Start: 0
|
||||||
|
Length: 1
|
||||||
rmbo:
|
rmbo:
|
||||||
stand:
|
stand:
|
||||||
Start: 0
|
Start: 0
|
||||||
@@ -589,4 +604,7 @@ rmbo:
|
|||||||
die6:
|
die6:
|
||||||
Start: 308
|
Start: 308
|
||||||
Length: 4
|
Length: 4
|
||||||
Tick: 80
|
Tick: 80
|
||||||
|
die-crushed: squish
|
||||||
|
Start: 0
|
||||||
|
Length: 1
|
||||||
Reference in New Issue
Block a user