cnc sams rotate to home position before closing, lower ROT to something sane.
This commit is contained in:
@@ -31,18 +31,21 @@ namespace OpenRA.Mods.Cnc
|
|||||||
enum PopupState
|
enum PopupState
|
||||||
{
|
{
|
||||||
Open,
|
Open,
|
||||||
|
Rotating,
|
||||||
Transitioning,
|
Transitioning,
|
||||||
Closed
|
Closed
|
||||||
};
|
};
|
||||||
|
|
||||||
protected Target target;
|
protected Target target;
|
||||||
AttackPopupTurretedInfo Info;
|
AttackPopupTurretedInfo Info;
|
||||||
|
Turreted Turret;
|
||||||
int IdleTicks = 0;
|
int IdleTicks = 0;
|
||||||
PopupState State = PopupState.Open;
|
PopupState State = PopupState.Open;
|
||||||
|
|
||||||
public AttackPopupTurreted(Actor self, AttackPopupTurretedInfo info) : base(self)
|
public AttackPopupTurreted(Actor self, AttackPopupTurretedInfo info) : base(self)
|
||||||
{
|
{
|
||||||
Info = info;
|
Info = info;
|
||||||
|
Turret = self.Trait<Turreted>();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool CanAttack( Actor self, Target target )
|
protected override bool CanAttack( Actor self, Target target )
|
||||||
@@ -69,9 +72,8 @@ namespace OpenRA.Mods.Cnc
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var turreted = self.Trait<Turreted>();
|
Turret.desiredFacing = Util.GetFacing( target.CenterLocation - self.CenterLocation, Turret.turretFacing );
|
||||||
turreted.desiredFacing = Util.GetFacing( target.CenterLocation - self.CenterLocation, turreted.turretFacing );
|
if( Turret.desiredFacing != Turret.turretFacing )
|
||||||
if( turreted.desiredFacing != turreted.turretFacing )
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -86,6 +88,11 @@ namespace OpenRA.Mods.Cnc
|
|||||||
public void TickIdle(Actor self)
|
public void TickIdle(Actor self)
|
||||||
{
|
{
|
||||||
if (State == PopupState.Open && IdleTicks++ > Info.CloseDelay)
|
if (State == PopupState.Open && IdleTicks++ > Info.CloseDelay)
|
||||||
|
{
|
||||||
|
Turret.desiredFacing = 0;
|
||||||
|
State = PopupState.Rotating;
|
||||||
|
}
|
||||||
|
else if (State == PopupState.Rotating && Turret.turretFacing == 0)
|
||||||
{
|
{
|
||||||
State = PopupState.Transitioning;
|
State = PopupState.Transitioning;
|
||||||
var rb = self.Trait<RenderBuilding>();
|
var rb = self.Trait<RenderBuilding>();
|
||||||
@@ -93,6 +100,7 @@ namespace OpenRA.Mods.Cnc
|
|||||||
{
|
{
|
||||||
State = PopupState.Closed;
|
State = PopupState.Closed;
|
||||||
rb.PlayCustomAnimRepeating(self, "closed-idle");
|
rb.PlayCustomAnimRepeating(self, "closed-idle");
|
||||||
|
Turret.desiredFacing = null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -657,7 +657,7 @@ SAM:
|
|||||||
RevealsShroud:
|
RevealsShroud:
|
||||||
Range: 5
|
Range: 5
|
||||||
Turreted:
|
Turreted:
|
||||||
ROT: 30
|
ROT: 7
|
||||||
InitialFacing: 0
|
InitialFacing: 0
|
||||||
RenderBuildingTurreted:
|
RenderBuildingTurreted:
|
||||||
AttackPopupTurreted:
|
AttackPopupTurreted:
|
||||||
|
|||||||
Reference in New Issue
Block a user