rename WRange to WDist in the Lua API

This commit is contained in:
Matthias Mailänder
2015-07-09 12:36:15 +02:00
parent 31892dd104
commit ff7fe2bab5
6 changed files with 11 additions and 12 deletions

View File

@@ -110,7 +110,7 @@ namespace OpenRA
WDist a; WDist a;
WDist b; WDist b;
if (!left.TryGetClrValue<WDist>(out a) || !right.TryGetClrValue<WDist>(out b)) if (!left.TryGetClrValue<WDist>(out a) || !right.TryGetClrValue<WDist>(out b))
throw new LuaException("Attempted to call WRange.Add(WRange, WRange) with invalid arguments."); throw new LuaException("Attempted to call WDist.Add(WDist, WDist) with invalid arguments.");
return new LuaCustomClrObject(a + b); return new LuaCustomClrObject(a + b);
} }
@@ -120,7 +120,7 @@ namespace OpenRA
WDist a; WDist a;
WDist b; WDist b;
if (!left.TryGetClrValue<WDist>(out a) || !right.TryGetClrValue<WDist>(out b)) if (!left.TryGetClrValue<WDist>(out a) || !right.TryGetClrValue<WDist>(out b))
throw new LuaException("Attempted to call WRange.Subtract(WRange, WRange) with invalid arguments."); throw new LuaException("Attempted to call WDist.Subtract(WDist, WDist) with invalid arguments.");
return new LuaCustomClrObject(a - b); return new LuaCustomClrObject(a - b);
} }
@@ -130,7 +130,7 @@ namespace OpenRA
WDist a; WDist a;
WDist b; WDist b;
if (!left.TryGetClrValue<WDist>(out a) || !right.TryGetClrValue<WDist>(out b)) if (!left.TryGetClrValue<WDist>(out a) || !right.TryGetClrValue<WDist>(out b))
throw new LuaException("Attempted to call WRange.Equals(WRange, WRange) with invalid arguments."); throw new LuaException("Attempted to call WDist.Equals(WDist, WDist) with invalid arguments.");
return a == b; return a == b;
} }
@@ -141,15 +141,14 @@ namespace OpenRA
{ {
switch (key.ToString()) switch (key.ToString())
{ {
case "Range": return Length; case "Length": return Length;
default: throw new LuaException("WPos does not define a member '{0}'".F(key));
default: throw new LuaException("WDist does not define a member '{0}'".F(key)); default: throw new LuaException("WDist does not define a member '{0}'".F(key));
} }
} }
set set
{ {
throw new LuaException("WRange is read-only. Use WRange.New to create a new value"); throw new LuaException("WDist is read-only. Use WDist.New to create a new value");
} }
} }
#endregion #endregion

View File

@@ -332,7 +332,7 @@ getAirstrikeTarget = function()
local list = Nod.GetGroundAttackers() local list = Nod.GetGroundAttackers()
local target = list[DateTime.GameTime % #list + 1].CenterPosition local target = list[DateTime.GameTime % #list + 1].CenterPosition
local sams = Map.ActorsInCircle(target, WRange.New(8 * 1024), function(actor) local sams = Map.ActorsInCircle(target, WDist.New(8 * 1024), function(actor)
return actor.Type == "sam" end) return actor.Type == "sam" end)
if #sams == 0 then if #sams == 0 then

View File

@@ -284,7 +284,7 @@ InitTriggers = function()
USSRTruk.Move(BaseCameraWaypoint.Location) USSRTruk.Move(BaseCameraWaypoint.Location)
end end
end) end)
Trigger.OnEnteredProximityTrigger(BaseCameraWaypoint.CenterPosition, WRange.New(7 * 1024), function(a, id) Trigger.OnEnteredProximityTrigger(BaseCameraWaypoint.CenterPosition, WDist.New(7 * 1024), function(a, id)
if a.Type == "truk" and not baseCamera then if a.Type == "truk" and not baseCamera then
Trigger.RemoveProximityTrigger(id) Trigger.RemoveProximityTrigger(id)
baseCamera = Actor.Create("camera", true, { Owner = player, Location = BaseCameraWaypoint.Location }) baseCamera = Actor.Create("camera", true, { Owner = player, Location = BaseCameraWaypoint.Location })

View File

@@ -391,7 +391,7 @@ InitTriggers = function()
end) end)
local tanksLeft = 0 local tanksLeft = 0
Trigger.OnExitedProximityTrigger(ProvingGroundsCameraPoint.CenterPosition, WRange.New(10 * 1024), function(a, id) Trigger.OnExitedProximityTrigger(ProvingGroundsCameraPoint.CenterPosition, WDist.New(10 * 1024), function(a, id)
if a.Type == "5tnk" then if a.Type == "5tnk" then
tanksLeft = tanksLeft + 1 tanksLeft = tanksLeft + 1
if tanksLeft == 3 then if tanksLeft == 3 then

View File

@@ -240,7 +240,7 @@ WorldLoaded = function()
end) end)
end) end)
Trigger.OnEnteredProximityTrigger(USSRExpansionPoint.CenterPosition, WRange.New(4 * 1024), function(unit, id) Trigger.OnEnteredProximityTrigger(USSRExpansionPoint.CenterPosition, WDist.New(4 * 1024), function(unit, id)
if unit.Owner == player and Radar.Owner == player then if unit.Owner == player and Radar.Owner == player then
Trigger.RemoveProximityTrigger(id) Trigger.RemoveProximityTrigger(id)

View File

@@ -243,8 +243,8 @@ SetupBridges = function()
Media.DisplayMessage("Commander! The Soviets destroyed the bridges to disable our reinforcements. Repair them for additional reinforcements.", "Incoming Report") Media.DisplayMessage("Commander! The Soviets destroyed the bridges to disable our reinforcements. Repair them for additional reinforcements.", "Incoming Report")
RepairBridges = allies.AddSecondaryObjective("Repair the two southern bridges.") RepairBridges = allies.AddSecondaryObjective("Repair the two southern bridges.")
local bridgeA = Map.ActorsInCircle(BrokenBridge1.CenterPosition, WRange.FromCells(1), function(self) return self.Type == "bridge1" end) local bridgeA = Map.ActorsInCircle(BrokenBridge1.CenterPosition, WDist.FromCells(1), function(self) return self.Type == "bridge1" end)
local bridgeB = Map.ActorsInCircle(BrokenBridge2.CenterPosition, WRange.FromCells(1), function(self) return self.Type == "bridge1" end) local bridgeB = Map.ActorsInCircle(BrokenBridge2.CenterPosition, WDist.FromCells(1), function(self) return self.Type == "bridge1" end)
Utils.Do(bridgeA, function(bridge) Utils.Do(bridgeA, function(bridge)
Trigger.OnDamaged(bridge, function() Trigger.OnDamaged(bridge, function()