move AttackPopupTurreted into RA where it can be fixed.

This commit is contained in:
Chris Forbes
2011-08-21 21:05:22 +12:00
parent 6daeb73471
commit 05d1c8ee82
3 changed files with 13 additions and 20 deletions

View File

@@ -68,7 +68,6 @@
<Compile Include="Activities\HarvesterDockSequence.cs" /> <Compile Include="Activities\HarvesterDockSequence.cs" />
<Compile Include="TiberiumRefinery.cs" /> <Compile Include="TiberiumRefinery.cs" />
<Compile Include="CncWaterPaletteRotation.cs" /> <Compile Include="CncWaterPaletteRotation.cs" />
<Compile Include="AttackPopupTurreted.cs" />
<Compile Include="SpawnViceroid.cs" /> <Compile Include="SpawnViceroid.cs" />
<Compile Include="Widgets\Logic\CncMenuLogic.cs" /> <Compile Include="Widgets\Logic\CncMenuLogic.cs" />
<Compile Include="Widgets\Logic\CncServerBrowserLogic.cs" /> <Compile Include="Widgets\Logic\CncServerBrowserLogic.cs" />

View File

@@ -11,7 +11,6 @@
using System; using System;
using System.Linq; using System.Linq;
using OpenRA.GameRules; using OpenRA.GameRules;
using OpenRA.Mods.RA;
using OpenRA.Mods.RA.Activities; using OpenRA.Mods.RA.Activities;
using OpenRA.Mods.RA.Buildings; using OpenRA.Mods.RA.Buildings;
using OpenRA.Mods.RA.Move; using OpenRA.Mods.RA.Move;
@@ -19,7 +18,7 @@ using OpenRA.Mods.RA.Render;
using OpenRA.Traits; using OpenRA.Traits;
using OpenRA.Traits.Activities; using OpenRA.Traits.Activities;
namespace OpenRA.Mods.Cnc namespace OpenRA.Mods.RA
{ {
class AttackPopupTurretedInfo : AttackBaseInfo class AttackPopupTurretedInfo : AttackBaseInfo
{ {
@@ -31,20 +30,14 @@ namespace OpenRA.Mods.Cnc
class AttackPopupTurreted : AttackBase, INotifyBuildComplete, INotifyIdle, IDamageModifier class AttackPopupTurreted : AttackBase, INotifyBuildComplete, INotifyIdle, IDamageModifier
{ {
enum PopupState enum PopupState { Open, Rotating, Transitioning, Closed };
{
Open,
Rotating,
Transitioning,
Closed
};
protected Target target; protected Target target;
AttackPopupTurretedInfo Info; AttackPopupTurretedInfo Info;
Turreted Turret; Turreted Turret;
int IdleTicks = 0; int IdleTicks = 0;
PopupState State = PopupState.Open; PopupState State = PopupState.Open;
public AttackPopupTurreted(ActorInitializer init, AttackPopupTurretedInfo info) : base(init.self) public AttackPopupTurreted(ActorInitializer init, AttackPopupTurretedInfo info) : base(init.self)
{ {
Info = info; Info = info;
@@ -57,13 +50,13 @@ namespace OpenRA.Mods.Cnc
{ {
if (State == PopupState.Transitioning) if (State == PopupState.Transitioning)
return false; return false;
if( self.HasTrait<Building>() && !buildComplete ) if( self.HasTrait<Building>() && !buildComplete )
return false; return false;
if (!base.CanAttack( self, target )) if (!base.CanAttack( self, target ))
return false; return false;
IdleTicks = 0; IdleTicks = 0;
if (State == PopupState.Closed) if (State == PopupState.Closed)
{ {
@@ -76,7 +69,7 @@ namespace OpenRA.Mods.Cnc
}); });
return false; return false;
} }
Turret.desiredFacing = Util.GetFacing( target.CenterLocation - self.CenterLocation, Turret.turretFacing ); Turret.desiredFacing = Util.GetFacing( target.CenterLocation - self.CenterLocation, Turret.turretFacing );
if( Turret.desiredFacing != Turret.turretFacing ) if( Turret.desiredFacing != Turret.turretFacing )
return false; return false;
@@ -89,7 +82,7 @@ namespace OpenRA.Mods.Cnc
base.Tick(self); base.Tick(self);
DoAttack( self, target ); DoAttack( self, target );
} }
public void TickIdle(Actor self) public void TickIdle(Actor self)
{ {
if (State == PopupState.Open && IdleTicks++ > Info.CloseDelay) if (State == PopupState.Open && IdleTicks++ > Info.CloseDelay)
@@ -109,7 +102,7 @@ namespace OpenRA.Mods.Cnc
}); });
} }
} }
public override Activity GetAttackActivity(Actor self, Target newTarget, bool allowMove) public override Activity GetAttackActivity(Actor self, Target newTarget, bool allowMove)
{ {
return new AttackActivity( newTarget ); return new AttackActivity( newTarget );
@@ -136,12 +129,12 @@ namespace OpenRA.Mods.Cnc
} }
buildComplete = true; buildComplete = true;
} }
public float GetDamageModifier(Actor attacker, WarheadInfo warhead) public float GetDamageModifier(Actor attacker, WarheadInfo warhead)
{ {
return State == PopupState.Closed ? Info.ClosedDamageMultiplier : 1f; return State == PopupState.Closed ? Info.ClosedDamageMultiplier : 1f;
} }
class AttackActivity : Activity class AttackActivity : Activity
{ {
readonly Target target; readonly Target target;

View File

@@ -359,6 +359,7 @@
<Compile Include="ThrowsParticle.cs" /> <Compile Include="ThrowsParticle.cs" />
<Compile Include="Crates\HideMapCrateAction.cs" /> <Compile Include="Crates\HideMapCrateAction.cs" />
<Compile Include="World\PlayMusicOnMapLoad.cs" /> <Compile Include="World\PlayMusicOnMapLoad.cs" />
<Compile Include="AttackPopupTurreted.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj"> <ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">