Added two diplomacy functions to lua
...and sneaked into AUTHORS
This commit is contained in:
@@ -239,7 +239,7 @@ namespace OpenRA.Network
|
||||
var targetPlayer = order.Player.World.Players.FirstOrDefault(p => p.InternalName == order.TargetString);
|
||||
var newStance = (Stance)order.ExtraData;
|
||||
|
||||
SetPlayerStance(world, order.Player, targetPlayer, newStance);
|
||||
order.Player.SetStance(targetPlayer, newStance);
|
||||
|
||||
Game.Debug("{0} has set diplomatic stance vs {1} to {2}",
|
||||
order.Player.PlayerName, targetPlayer.PlayerName, newStance);
|
||||
@@ -247,7 +247,7 @@ namespace OpenRA.Network
|
||||
// automatically declare war reciprocally
|
||||
if (newStance == Stance.Enemy && targetPlayer.Stances[order.Player] == Stance.Ally)
|
||||
{
|
||||
SetPlayerStance(world, targetPlayer, order.Player, newStance);
|
||||
targetPlayer.SetStance(order.Player, newStance);
|
||||
Game.Debug("{0} has reciprocated",targetPlayer.PlayerName);
|
||||
}
|
||||
|
||||
@@ -275,17 +275,6 @@ namespace OpenRA.Network
|
||||
}
|
||||
}
|
||||
|
||||
static void SetPlayerStance(World w, Player p, Player target, Stance s)
|
||||
{
|
||||
var oldStance = p.Stances[target];
|
||||
p.Stances[target] = s;
|
||||
target.Shroud.UpdatePlayerStance(w, p, oldStance, s);
|
||||
p.Shroud.UpdatePlayerStance(w, target, oldStance, s);
|
||||
|
||||
foreach (var nsc in w.ActorsWithTrait<INotifyStanceChanged>())
|
||||
nsc.Trait.StanceChanged(nsc.Actor, p, target, oldStance, s);
|
||||
}
|
||||
|
||||
static void SetOrderLag(OrderManager o)
|
||||
{
|
||||
if (o.FramesAhead != o.LobbyInfo.GlobalSettings.OrderLatency && !o.GameStarted)
|
||||
|
||||
@@ -111,6 +111,17 @@ namespace OpenRA
|
||||
return p == null || Stances[p] == Stance.Ally;
|
||||
}
|
||||
|
||||
public void SetStance(Player target, Stance s)
|
||||
{
|
||||
var oldStance = Stances[target];
|
||||
Stances[target] = s;
|
||||
target.Shroud.UpdatePlayerStance(World, this, oldStance, s);
|
||||
Shroud.UpdatePlayerStance(World, target, oldStance, s);
|
||||
|
||||
foreach (var nsc in World.ActorsWithTrait<INotifyStanceChanged>())
|
||||
nsc.Trait.StanceChanged(nsc.Actor, this, target, oldStance, s);
|
||||
}
|
||||
|
||||
#region Scripting interface
|
||||
|
||||
Lazy<ScriptPlayerInterface> luaInterface;
|
||||
|
||||
Reference in New Issue
Block a user