#58 fixed
This commit is contained in:
@@ -51,6 +51,7 @@ namespace OpenRa.Game.GameRules
|
||||
public readonly int[] SecondaryOffset = null;
|
||||
public readonly int Recoil = 0;
|
||||
public readonly string SecondaryAnim = null;
|
||||
public readonly bool MuzzleFlash = false;
|
||||
|
||||
public UnitInfo(string name) { Name = name; }
|
||||
|
||||
|
||||
@@ -33,6 +33,9 @@ namespace OpenRa.Game.Traits.Activities
|
||||
}
|
||||
}
|
||||
|
||||
public void Cancel(Actor self, Mobile mobile) { }
|
||||
public void Cancel(Actor self, Mobile mobile)
|
||||
{
|
||||
mobile.InternalSetActivity(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace OpenRa.Game.Traits
|
||||
class RenderUnitTurreted : RenderUnit
|
||||
{
|
||||
public Animation turretAnim;
|
||||
public Animation muzzleFlash;
|
||||
public float primaryRecoil = 0.0f, secondaryRecoil = 0.0f;
|
||||
|
||||
public RenderUnitTurreted(Actor self)
|
||||
@@ -17,8 +18,17 @@ namespace OpenRa.Game.Traits
|
||||
{
|
||||
turretAnim = new Animation(self.unitInfo.Name);
|
||||
if (self.traits.Contains<Turreted>())
|
||||
{
|
||||
if (self.unitInfo.MuzzleFlash)
|
||||
{
|
||||
muzzleFlash = new Animation(self.unitInfo.Name);
|
||||
muzzleFlash.PlayFetchIndex("muzzle",
|
||||
() => (Util.QuantizeFacing(self.traits.Get<Turreted>().turretFacing,8)) * 6 + (int)(primaryRecoil * 6));
|
||||
}
|
||||
|
||||
turretAnim.PlayFetchIndex("turret",
|
||||
() => self.traits.Get<Turreted>().turretFacing / 8);
|
||||
}
|
||||
else
|
||||
turretAnim.PlayRepeating("turret"); /* not really a turret; it's a spinner */
|
||||
}
|
||||
@@ -33,6 +43,10 @@ namespace OpenRa.Game.Traits
|
||||
if (self.unitInfo.SecondaryOffset != null)
|
||||
yield return Util.Centered(turretAnim.Image, self.CenterLocation
|
||||
+ Util.GetTurretPosition(self, self.unitInfo.SecondaryOffset, secondaryRecoil));
|
||||
|
||||
if (muzzleFlash != null && primaryRecoil > 0)
|
||||
yield return Util.Centered(muzzleFlash.Image, self.CenterLocation
|
||||
+ Util.GetTurretPosition(self, self.unitInfo.PrimaryOffset, primaryRecoil));
|
||||
}
|
||||
|
||||
public override void Tick(Actor self)
|
||||
@@ -41,6 +55,8 @@ namespace OpenRa.Game.Traits
|
||||
turretAnim.Tick();
|
||||
primaryRecoil = Math.Max(0f, primaryRecoil - .2f);
|
||||
secondaryRecoil = Math.Max(0f, secondaryRecoil - .2f);
|
||||
if (muzzleFlash != null)
|
||||
muzzleFlash.Tick();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,6 +270,7 @@
|
||||
<unit name="jeep">
|
||||
<sequence name="idle" start="0" length="32" />
|
||||
<sequence name="turret" start="32" length="32" />
|
||||
<sequence name="muzzle" start="0" length="48" src="minigun" />
|
||||
</unit>
|
||||
<!-- apc -->
|
||||
<unit name="apc">
|
||||
|
||||
@@ -52,6 +52,7 @@ Traits=Mobile, McvDeploy, RenderUnit
|
||||
Description=Ranger
|
||||
Traits=Mobile, Turreted, AttackTurreted, RenderUnitTurreted
|
||||
PrimaryOffset=0,0,0,-2
|
||||
MuzzleFlash=yes
|
||||
[APC]
|
||||
Description=Armored Personnel Carrier
|
||||
Traits=Mobile, RenderUnit
|
||||
@@ -323,14 +324,14 @@ Produces=Infantry
|
||||
RallyPoint=1,3
|
||||
[TENT]
|
||||
Description=Allied Barracks
|
||||
Traits=Building, RenderBuilding
|
||||
Traits=Building, RenderBuilding, RallyPoint
|
||||
Dimensions=2,2
|
||||
Footprint=xx xx
|
||||
Produces=Infantry
|
||||
RallyPoint=1,3
|
||||
[KENN]
|
||||
Description=Kennel
|
||||
Traits=Building, RenderBuilding
|
||||
Traits=Building, RenderBuilding, RallyPoint
|
||||
Dimensions=1,1
|
||||
Footprint=x
|
||||
RallyPoint=1,2
|
||||
|
||||
Reference in New Issue
Block a user