#240 declaring war should set the reciprocal state too
This commit is contained in:
@@ -93,13 +93,16 @@ namespace OpenRA.Network
|
|||||||
{
|
{
|
||||||
var targetPlayer = order.Player.World.players[order.TargetLocation.X];
|
var targetPlayer = order.Player.World.players[order.TargetLocation.X];
|
||||||
var oldStance = order.Player.Stances[targetPlayer];
|
var oldStance = order.Player.Stances[targetPlayer];
|
||||||
order.Player.Stances[targetPlayer] = (Stance)order.TargetLocation.Y;
|
var newStance = (Stance)order.TargetLocation.Y;
|
||||||
|
|
||||||
if (targetPlayer == world.LocalPlayer)
|
SetPlayerStance(world, order.Player, targetPlayer, newStance);
|
||||||
world.WorldActor.Trait<Shroud>().UpdatePlayerStance(world, order.Player, oldStance, order.Player.Stances[targetPlayer]);
|
|
||||||
|
// automatically declare war reciprocally
|
||||||
|
if (newStance == Stance.Enemy)
|
||||||
|
SetPlayerStance(world, targetPlayer, order.Player, newStance);
|
||||||
|
|
||||||
Game.Debug("{0} has set diplomatic stance vs {1} to {2}".F(
|
Game.Debug("{0} has set diplomatic stance vs {1} to {2}".F(
|
||||||
order.Player.PlayerName, targetPlayer.PlayerName, order.Player.Stances[targetPlayer]));
|
order.Player.PlayerName, targetPlayer.PlayerName, newStance));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -111,5 +114,13 @@ namespace OpenRA.Network
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void SetPlayerStance(World w, Player a, Player b, Stance s)
|
||||||
|
{
|
||||||
|
var oldStance = a.Stances[b];
|
||||||
|
a.Stances[b] = s;
|
||||||
|
if (b == w.LocalPlayer)
|
||||||
|
w.WorldActor.Trait<Shroud>().UpdatePlayerStance(w, b, oldStance, s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user