push turret facing check down to turret
This commit is contained in:
@@ -70,9 +70,7 @@ namespace OpenRA.Mods.RA
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Turret.desiredFacing = Util.GetFacing( target.CenterLocation - self.CenterLocation, Turret.turretFacing );
|
if (!Turret.FaceTarget(self,target)) return false;
|
||||||
if( Turret.desiredFacing != Turret.turretFacing )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,9 +39,7 @@ namespace OpenRA.Mods.RA
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!target.IsValid) return false;
|
if (!target.IsValid) return false;
|
||||||
turret.desiredFacing = Util.GetFacing( target.CenterLocation - self.CenterLocation, turret.turretFacing );
|
if (!turret.FaceTarget(self, target)) return false;
|
||||||
if( turret.desiredFacing != turret.turretFacing )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return base.CanAttack( self, target );
|
return base.CanAttack( self, target );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,5 +50,11 @@ namespace OpenRA.Mods.RA
|
|||||||
var df = desiredFacing ?? ( facing != null ? facing.Facing : turretFacing );
|
var df = desiredFacing ?? ( facing != null ? facing.Facing : turretFacing );
|
||||||
turretFacing = Util.TickFacing(turretFacing, df, info.ROT);
|
turretFacing = Util.TickFacing(turretFacing, df, info.ROT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool FaceTarget( Actor self, Target target )
|
||||||
|
{
|
||||||
|
desiredFacing = Util.GetFacing( target.CenterLocation - self.CenterLocation, turretFacing );
|
||||||
|
return turretFacing == desiredFacing;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user