Fix gunboat

This commit is contained in:
Paul Chote
2010-08-16 21:17:19 +12:00
parent 50d5936846
commit 73dadbc873
6 changed files with 86 additions and 10 deletions

View File

@@ -60,6 +60,7 @@
<Compile Include="TiberiumRefineryDockAction.cs" />
<Compile Include="DeadBuildingState.cs" />
<Compile Include="Missions\Gdi01Script.cs" />
<Compile Include="RenderGunboat.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">

View File

@@ -0,0 +1,71 @@
#region Copyright & License Information
/*
* Copyright 2007-2010 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 LICENSE.
*/
#endregion
using OpenRA.Graphics;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Render
{
class RenderGunboatInfo : RenderUnitInfo
{
public override object Create(ActorInitializer init) { return new RenderGunboat(init.self); }
}
class RenderGunboat : RenderSimple, INotifyDamage
{
IFacing facing;
public RenderGunboat(Actor self)
: base(self, () => self.HasTrait<Turreted>() ? self.Trait<Turreted>().turretFacing : 0)
{
facing = self.Trait<IFacing>();
anim.Play("left");
anims.Add( "smoke", new AnimationWithOffset( new Animation( "smoke_m" ), null, () => !isSmoking ) );
}
string lastDir = "left";
string lastDamage = "";
public override void Tick(Actor self)
{
var dir = (facing.Facing > 128) ? "right" : "left";
if (dir != lastDir)
anim.ReplaceAnim((lastDir = dir)+lastDamage);
base.Tick(self);
}
bool isSmoking;
public void Damaged(Actor self, AttackInfo e)
{
// Damagestate
if (e.DamageStateChanged)
{
if (e.DamageState >= DamageState.Critical)
lastDamage = "-critical";
else if (e.DamageState >= DamageState.Heavy)
lastDamage = "-damaged";
else if (e.DamageState < DamageState.Heavy)
lastDamage = "";
anim.ReplaceAnim(lastDir+lastDamage);
}
// Smoking
if (e.DamageState < DamageState.Heavy) return;
if (isSmoking) return;
isSmoking = true;
var smoke = anims[ "smoke" ].Animation;
smoke.PlayThen( "idle",
() => smoke.PlayThen( "loop",
() => smoke.PlayBackwardsThen( "end",
() => isSmoking = false ) ) );
}
}
}

View File

@@ -136,6 +136,8 @@
Crushes: crate
TerrainTypes: Clear, Rough, Road, Tree, Water, Rock, Wall, Ore, Beach, River
TerrainSpeeds: 0%, 0%, 0%, 0%, 100%, 0%, 0%, 0%, 0%, 0%
Selectable:
Voice: GenericVoice
Targetable:
TargetTypes: Ground, Water
HiddenUnderFog:

View File

@@ -109,14 +109,12 @@
</unit>
<!-- Gunboat -->
<unit name="boat">
<sequence name="idle" start="0" length="32" />
<sequence name="turret" start="0" length="32" />
<sequence name="left" start="0" length="32" />
<sequence name="left-damaged" start="32" length="32" />
<sequence name="left-critical" start="64" length="32" />
<sequence name="right" start="96" length="32" />
<sequence name="right-damaged" start="128" length="32" />
<sequence name="right-critical" start="160" length="32" />
<sequence name="left" start="0" facings="32" />
<sequence name="left-damaged" start="32" facings="32" />
<sequence name="left-critical" start="64" facings="32" />
<sequence name="right" start="96" facings="32" />
<sequence name="right-damaged" start="128" facings="32" />
<sequence name="right-critical" start="160" facings="32" />
</unit>
<unit name="a10">
<sequence name="idle" start="0" facings="32" />

View File

@@ -533,7 +533,9 @@ BOAT:
ROT: 7
AttackTurreted:
PrimaryWeapon: BoatMissile
RenderUnitTurreted:
PrimaryOffset: 0,-15,0,-4
PrimaryLocalOffset: -3,-5,0,3,-5,0,0,-5,0
RenderGunboat:
AutoTarget:
LST:

View File

@@ -382,6 +382,8 @@ MachineGun:
BoatMissile:
ROF: 35
Range: 8
Burst: 6
BurstDelay: 7
Report: ROCKET2
Missile:
Arm: 5
@@ -401,7 +403,7 @@ BoatMissile:
Explosion: 5
ImpactSound: xplos
SmudgeType: Crater
Damage: 60
Damage: 10
Tomahawk:
ROF: 40