Merge pull request #8418 from abcdefg30/newlua_other_cool_stuff
Added even more lua functions
This commit is contained in:
@@ -12,10 +12,11 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenRA.Effects;
|
using OpenRA.Effects;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
|
using OpenRA.Scripting;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Effects
|
namespace OpenRA.Mods.Common.Effects
|
||||||
{
|
{
|
||||||
public class Beacon : IEffect
|
public class Beacon : IEffect, IScriptBindable
|
||||||
{
|
{
|
||||||
static readonly int MaxArrowHeight = 512;
|
static readonly int MaxArrowHeight = 512;
|
||||||
|
|
||||||
|
|||||||
@@ -213,6 +213,7 @@
|
|||||||
<Compile Include="Scripting\Media.cs" />
|
<Compile Include="Scripting\Media.cs" />
|
||||||
<Compile Include="Scripting\ScriptTriggers.cs" />
|
<Compile Include="Scripting\ScriptTriggers.cs" />
|
||||||
<Compile Include="Scripting\Global\ActorGlobal.cs" />
|
<Compile Include="Scripting\Global\ActorGlobal.cs" />
|
||||||
|
<Compile Include="Scripting\Global\BeaconGlobal.cs" />
|
||||||
<Compile Include="Scripting\Global\CameraGlobal.cs" />
|
<Compile Include="Scripting\Global\CameraGlobal.cs" />
|
||||||
<Compile Include="Scripting\Global\CoordinateGlobals.cs" />
|
<Compile Include="Scripting\Global\CoordinateGlobals.cs" />
|
||||||
<Compile Include="Scripting\Global\DateTimeGlobal.cs" />
|
<Compile Include="Scripting\Global\DateTimeGlobal.cs" />
|
||||||
|
|||||||
47
OpenRA.Mods.Common/Scripting/Global/BeaconGlobal.cs
Normal file
47
OpenRA.Mods.Common/Scripting/Global/BeaconGlobal.cs
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
#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 System.Linq;
|
||||||
|
using OpenRA.Mods.Common.Effects;
|
||||||
|
using OpenRA.Mods.Common.Traits;
|
||||||
|
using OpenRA.Scripting;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.Common.Scripting
|
||||||
|
{
|
||||||
|
[ScriptGlobal("Beacon")]
|
||||||
|
public class BeaconGlobal : ScriptGlobal
|
||||||
|
{
|
||||||
|
readonly RadarPings radarPings;
|
||||||
|
|
||||||
|
public BeaconGlobal(ScriptContext context) : base(context)
|
||||||
|
{
|
||||||
|
radarPings = context.World.WorldActor.TraitOrDefault<RadarPings>();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Desc("Creates a new beacon that stays for the specified time at the specified WPos." +
|
||||||
|
"Does not remove player set beacons, nor gets removed by placing them.")]
|
||||||
|
public Beacon New(Player owner, WPos position, int duration = 30 * 25, bool showRadarPings = true, string palettePrefix = "player")
|
||||||
|
{
|
||||||
|
var playerBeacon = new Beacon(owner, position, duration, palettePrefix);
|
||||||
|
owner.PlayerActor.World.AddFrameEndTask(w => w.Add(playerBeacon));
|
||||||
|
|
||||||
|
if (showRadarPings && radarPings != null)
|
||||||
|
{
|
||||||
|
radarPings.Add(
|
||||||
|
() => owner.IsAlliedWith(owner.World.RenderPlayer),
|
||||||
|
position,
|
||||||
|
owner.Color.RGB,
|
||||||
|
duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
return playerBeacon;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -54,5 +54,12 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
{
|
{
|
||||||
Self.Trait<Mobile>().Nudge(Self, Self, true);
|
Self.Trait<Mobile>().Nudge(Self, Self, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ScriptActorPropertyActivity]
|
||||||
|
[Desc("Move to and enter the transport.")]
|
||||||
|
public void EnterTransport(Actor transport)
|
||||||
|
{
|
||||||
|
Self.QueueActivity(new EnterTransport(Self, transport, 1, true));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -95,8 +95,7 @@ Expand = function()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
mcvGG.IsInWorld = false
|
mcvGG.EnterTransport(mcvtransport)
|
||||||
mcvtransport.LoadPassenger(mcvGG)
|
|
||||||
mcvtransport.Move(GGUnloadPoint.Location)
|
mcvtransport.Move(GGUnloadPoint.Location)
|
||||||
mcvtransport.UnloadPassengers()
|
mcvtransport.UnloadPassengers()
|
||||||
Trigger.AfterDelay(DateTime.Seconds(12), function()
|
Trigger.AfterDelay(DateTime.Seconds(12), function()
|
||||||
|
|||||||
@@ -263,6 +263,7 @@ TimerExpired = function()
|
|||||||
SpawningInfantry = false
|
SpawningInfantry = false
|
||||||
SpawnNavalUnits = false
|
SpawnNavalUnits = false
|
||||||
|
|
||||||
|
Beacon.New(allies, SovietEntryPoint7.CenterPosition - WVec.New(3 * 1024, 0, 0))
|
||||||
Media.PlaySpeechNotification(allies, "AlliedReinforcementsArrived")
|
Media.PlaySpeechNotification(allies, "AlliedReinforcementsArrived")
|
||||||
Reinforcements.Reinforce(allies, FrenchReinforcements, { SovietEntryPoint7.Location, Alliesbase.Location })
|
Reinforcements.Reinforce(allies, FrenchReinforcements, { SovietEntryPoint7.Location, Alliesbase.Location })
|
||||||
|
|
||||||
|
|||||||
@@ -151,6 +151,7 @@ end
|
|||||||
|
|
||||||
SendFrenchReinforcements = function()
|
SendFrenchReinforcements = function()
|
||||||
local camera = Actor.Create("camera", true, { Owner = allies, Location = SovietRally1.Location })
|
local camera = Actor.Create("camera", true, { Owner = allies, Location = SovietRally1.Location })
|
||||||
|
Beacon.New(allies, FranceEntry.CenterPosition - WVec.New(0, 3 * 1024, 0))
|
||||||
Media.PlaySpeechNotification(allies, "AlliedReinforcementsArrived")
|
Media.PlaySpeechNotification(allies, "AlliedReinforcementsArrived")
|
||||||
Reinforcements.Reinforce(allies, FrenchSquad, { FranceEntry.Location, FranceRally.Location })
|
Reinforcements.Reinforce(allies, FrenchSquad, { FranceEntry.Location, FranceRally.Location })
|
||||||
Trigger.AfterDelay(DateTime.Seconds(3), function() camera.Destroy() end)
|
Trigger.AfterDelay(DateTime.Seconds(3), function() camera.Destroy() end)
|
||||||
|
|||||||
Reference in New Issue
Block a user