Merge pull request #8275 from abcdefg30/FacingGlobal

Add default facings to lua
This commit is contained in:
Oliver Brakmann
2015-05-27 23:51:10 +02:00
5 changed files with 45 additions and 12 deletions

View File

@@ -177,6 +177,7 @@
<Compile Include="Orders\UnitOrderTargeter.cs" /> <Compile Include="Orders\UnitOrderTargeter.cs" />
<Compile Include="Pathfinder\CellInfo.cs" /> <Compile Include="Pathfinder\CellInfo.cs" />
<Compile Include="PlayerExtensions.cs" /> <Compile Include="PlayerExtensions.cs" />
<Compile Include="Scripting\Global\FacingGlobal.cs" />
<Compile Include="Scripting\Global\HSLColorGlobal.cs" /> <Compile Include="Scripting\Global\HSLColorGlobal.cs" />
<Compile Include="Scripting\Global\UserInterfaceGlobal.cs" /> <Compile Include="Scripting\Global\UserInterfaceGlobal.cs" />
<Compile Include="ServerTraits\ColorValidator.cs" /> <Compile Include="ServerTraits\ColorValidator.cs" />

View File

@@ -0,0 +1,30 @@
#region Copyright & License Information
/*
* Copyright 2007-2015 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using OpenRA.Scripting;
namespace OpenRA.Mods.Common.Scripting.Global
{
[ScriptGlobal("Facing")]
public class FacingGlobal : ScriptGlobal
{
public FacingGlobal(ScriptContext context)
: base(context) { }
public int North { get { return 0; } }
public int NorthWest { get { return 32; } }
public int West { get { return 64; } }
public int SouthWest { get { return 96; } }
public int South { get { return 128; } }
public int SouthEast { get { return 160; } }
public int East { get { return 192; } }
public int NorthEast { get { return 224; } }
}
}

View File

@@ -46,7 +46,7 @@ SendGDIAirstrike = function()
local target = getAirstrikeTarget() local target = getAirstrikeTarget()
if target then if target then
Radar.SendAirstrike(target, false, 256 - 28) Radar.SendAirstrike(target, false, Facing.NorthEast + 4)
Trigger.AfterDelay(AirstrikeDelay, SendGDIAirstrike) Trigger.AfterDelay(AirstrikeDelay, SendGDIAirstrike)
else else
Trigger.AfterDelay(AirstrikeDelay/4, SendGDIAirstrike) Trigger.AfterDelay(AirstrikeDelay/4, SendGDIAirstrike)

View File

@@ -76,7 +76,7 @@ Atk3TriggerFunction = function()
local target = targets[DateTime.GameTime % #targets + 1].CenterPosition local target = targets[DateTime.GameTime % #targets + 1].CenterPosition
if target then if target then
Radar.SendAirstrike(target, false, 256 - 28) Radar.SendAirstrike(target, false, Facing.NorthEast + 4)
end end
end end
end end

View File

@@ -149,27 +149,29 @@ SpawnAndAttack = function(types, entry)
return units return units
end end
SendFrenchReinforcements = function()
local camera = Actor.Create("camera", true, { Owner = allies, Location = SovietRally1.Location })
Media.PlaySpeechNotification(allies, "AlliedReinforcementsArrived")
Reinforcements.Reinforce(allies, FrenchSquad, { FranceEntry.Location, FranceRally.Location })
Trigger.AfterDelay(DateTime.Seconds(3), function() camera.Destroy() end)
end
FrenchReinforcements = function() FrenchReinforcements = function()
Camera.Position = SovietRally1.CenterPosition Camera.Position = SovietRally1.CenterPosition
local camera = Actor.Create("camera", true, { Owner = allies, Location = SovietRally1.Location })
if drum1.IsDead or drum2.IsDead or drum3.IsDead then if drum1.IsDead or drum2.IsDead or drum3.IsDead then
Media.PlaySpeechNotification(allies, "AlliedReinforcementsArrived") SendFrenchReinforcements()
Reinforcements.Reinforce(allies, FrenchSquad, { FranceEntry.Location, FranceRally.Location })
Trigger.AfterDelay(DateTime.Seconds(3), function() camera.Destroy() end)
return return
end end
powerproxy = Actor.Create("powerproxy.parabombs", false, { Owner = allies }) powerproxy = Actor.Create("powerproxy.parabombs", false, { Owner = allies })
powerproxy.SendAirstrike(drum1.CenterPosition, false, 256 - 28) powerproxy.SendAirstrike(drum1.CenterPosition, false, Facing.NorthEast + 4)
powerproxy.SendAirstrike(drum2.CenterPosition, false, 256 - 32) powerproxy.SendAirstrike(drum2.CenterPosition, false, Facing.NorthEast)
powerproxy.SendAirstrike(drum3.CenterPosition, false, 256 - 36) powerproxy.SendAirstrike(drum3.CenterPosition, false, Facing.NorthEast - 4)
powerproxy.Destroy() powerproxy.Destroy()
Trigger.AfterDelay(DateTime.Seconds(3), function() Trigger.AfterDelay(DateTime.Seconds(3), function()
Media.PlaySpeechNotification(allies, "AlliedReinforcementsArrived") SendFrenchReinforcements()
Reinforcements.Reinforce(allies, FrenchSquad, { FranceEntry.Location, FranceRally.Location })
Trigger.AfterDelay(DateTime.Seconds(3), function() camera.Destroy() end)
end) end)
end end