Use ExtraData for SetStance and SetUnitStance.
This commit is contained in:
@@ -237,7 +237,7 @@ namespace OpenRA.Network
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var targetPlayer = order.Player.World.Players.FirstOrDefault(p => p.InternalName == order.TargetString);
|
var targetPlayer = order.Player.World.Players.FirstOrDefault(p => p.InternalName == order.TargetString);
|
||||||
var newStance = (Stance)order.TargetLocation.X;
|
var newStance = (Stance)order.ExtraData;
|
||||||
|
|
||||||
SetPlayerStance(world, order.Player, targetPlayer, newStance);
|
SetPlayerStance(world, order.Player, targetPlayer, newStance);
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
if (order.OrderString == "SetUnitStance" && info.EnableStances)
|
if (order.OrderString == "SetUnitStance" && info.EnableStances)
|
||||||
Stance = (UnitStance)order.TargetLocation.X;
|
Stance = (UnitStance)order.ExtraData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Damaged(Actor self, AttackInfo e)
|
public void Damaged(Actor self, AttackInfo e)
|
||||||
|
|||||||
@@ -87,9 +87,11 @@ namespace OpenRA.Mods.RA.Widgets.Logic
|
|||||||
if (!p.World.LobbyInfo.GlobalSettings.FragileAlliances)
|
if (!p.World.LobbyInfo.GlobalSettings.FragileAlliances)
|
||||||
return; // stance changes are banned
|
return; // stance changes are banned
|
||||||
|
|
||||||
// HACK: Abuse of the type system here with `CPos`
|
|
||||||
world.IssueOrder(new Order("SetStance", world.LocalPlayer.PlayerActor, false)
|
world.IssueOrder(new Order("SetStance", world.LocalPlayer.PlayerActor, false)
|
||||||
{ TargetLocation = new CPos((int)ss, 0), TargetString = p.InternalName, SuppressVisualFeedback = true });
|
{
|
||||||
|
ExtraData = (uint)ss,
|
||||||
|
TargetString = p.InternalName,
|
||||||
|
});
|
||||||
|
|
||||||
bw.Text = ss.ToString();
|
bw.Text = ss.ToString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,8 +164,7 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
if (at != null)
|
if (at != null)
|
||||||
at.PredictedStance = nextStance;
|
at.PredictedStance = nextStance;
|
||||||
|
|
||||||
// FIXME: Abuse of the type system here with `CPos`
|
return new Order("SetUnitStance", a, false) { ExtraData = (uint)nextStance };
|
||||||
return new Order("SetUnitStance", a, false) { TargetLocation = new CPos((int)nextStance, 0), SuppressVisualFeedback = true };
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Game.Debug("Unit stance set to: {0}".F(nextStance));
|
Game.Debug("Unit stance set to: {0}".F(nextStance));
|
||||||
|
|||||||
Reference in New Issue
Block a user