Skip to content

Commit

Permalink
Merge pull request #9134 from clemty/docs
Browse files Browse the repository at this point in the history
minor LUA and trait documentation fixes, whitespace fixes
  • Loading branch information
reaperrr committed Aug 24, 2015
2 parents b9f4431 + 2bbc1fc commit 18b8eb3
Show file tree
Hide file tree
Showing 28 changed files with 51 additions and 51 deletions.
2 changes: 1 addition & 1 deletion OpenRA.Game/Map/CellLayer.cs
Expand Up @@ -155,7 +155,7 @@ public MPos Clamp(MPos uv)
// Helper functions
public static class CellLayer
{
/// <summary>Create a new layer by resizing another layer. New cells are filled with defaultValue.</summary>
/// <summary>Create a new layer by resizing another layer. New cells are filled with defaultValue.</summary>
public static CellLayer<T> Resize<T>(CellLayer<T> layer, Size newSize, T defaultValue)
{
var result = new CellLayer<T>(layer.Shape, newSize);
Expand Down
4 changes: 2 additions & 2 deletions OpenRA.Mods.Common/Scripting/Global/BeaconGlobal.cs
Expand Up @@ -25,9 +25,9 @@ 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." +
[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")
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));
Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Mods.Common/Scripting/Global/CoordinateGlobals.cs
Expand Up @@ -67,7 +67,7 @@ public class WDistGlobal : ScriptGlobal
[Desc("Create a new WDist.")]
public WDist New(int r) { return new WDist(r); }

[Desc("Create a new WDist by cell distance")]
[Desc("Create a new WDist by cell distance.")]
public WDist FromCells(int numCells) { return WDist.FromCells(numCells); }
}

Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Mods.Common/Scripting/Global/DateTimeGlobal.cs
Expand Up @@ -26,7 +26,7 @@ public bool IsHalloween
get { return DateTime.Today.Month == 10 && DateTime.Today.Day == 31; }
}

[Desc("Get the current game time (in ticks)")]
[Desc("Get the current game time (in ticks).")]
public int GameTime
{
get { return Context.World.WorldTick; }
Expand Down
Expand Up @@ -63,7 +63,7 @@ void Move(Actor actor, CPos dest)

[Desc("Send reinforcements consisting of multiple units. Supports ground-based, naval and air units. " +
"The first member of the entryPath array will be the units' spawnpoint, " +
"while the last one will be their destination. If actionFunc is given, " +
"while the last one will be their destination. If actionFunc is given, " +
"it will be executed once a unit has reached its destination. actionFunc " +
"will be called as actionFunc(Actor actor)")]
public Actor[] Reinforce(Player owner, string[] actorTypes, CPos[] entryPath, int interval = 25, LuaFunction actionFunc = null)
Expand Down
26 changes: 13 additions & 13 deletions OpenRA.Mods.Common/Scripting/Global/TriggerGlobal.cs
Expand Up @@ -283,8 +283,8 @@ public void OnAllKilledOrCaptured(Actor[] actors, LuaFunction func)
}
}

[Desc("Call a function when a ground-based actor enters this cell footprint." +
"Returns the trigger id for later removal using RemoveFootprintTrigger(int id)." +
[Desc("Call a function when a ground-based actor enters this cell footprint. " +
"Returns the trigger id for later removal using RemoveFootprintTrigger(int id). " +
"The callback function will be called as func(Actor a, int id).")]
public int OnEnteredFootprint(CPos[] cells, LuaFunction func)
{
Expand All @@ -309,8 +309,8 @@ public int OnEnteredFootprint(CPos[] cells, LuaFunction func)
return triggerId;
}

[Desc("Call a function when a ground-based actor leaves this cell footprint." +
"Returns the trigger id for later removal using RemoveFootprintTrigger(int id)." +
[Desc("Call a function when a ground-based actor leaves this cell footprint. " +
"Returns the trigger id for later removal using RemoveFootprintTrigger(int id). " +
"The callback function will be called as func(Actor a, int id).")]
public int OnExitedFootprint(CPos[] cells, LuaFunction func)
{
Expand Down Expand Up @@ -341,8 +341,8 @@ public void RemoveFootprintTrigger(int id)
Context.World.ActorMap.RemoveCellTrigger(id);
}

[Desc("Call a function when an actor enters this range." +
"Returns the trigger id for later removal using RemoveProximityTrigger(int id)." +
[Desc("Call a function when an actor enters this range. " +
"Returns the trigger id for later removal using RemoveProximityTrigger(int id). " +
"The callback function will be called as func(Actor a, int id).")]
public int OnEnteredProximityTrigger(WPos pos, WDist range, LuaFunction func)
{
Expand All @@ -367,8 +367,8 @@ public int OnEnteredProximityTrigger(WPos pos, WDist range, LuaFunction func)
return triggerId;
}

[Desc("Call a function when an actor leaves this range." +
"Returns the trigger id for later removal using RemoveProximityTrigger(int id)." +
[Desc("Call a function when an actor leaves this range. " +
"Returns the trigger id for later removal using RemoveProximityTrigger(int id). " +
"The callback function will be called as func(Actor a, int id).")]
public int OnExitedProximityTrigger(WPos pos, WDist range, LuaFunction func)
{
Expand All @@ -393,7 +393,7 @@ public int OnExitedProximityTrigger(WPos pos, WDist range, LuaFunction func)
return triggerId;
}

[Desc("Removes a previously created proximitry trigger.")]
[Desc("Removes a previously created proximity trigger.")]
public void RemoveProximityTrigger(int id)
{
Context.World.ActorMap.RemoveProximityTrigger(id);
Expand All @@ -407,28 +407,28 @@ public void OnInfiltrated(Actor a, LuaFunction func)
}

[Desc("Call a function when this actor is discovered by an enemy or a player with a Neutral stance. " +
"The callback function will be called as func(Actor discovered, Player discoverer)")]
"The callback function will be called as func(Actor discovered, Player discoverer).")]
public void OnDiscovered(Actor a, LuaFunction func)
{
GetScriptTriggers(a).RegisterCallback(Trigger.OnDiscovered, func, Context);
}

[Desc("Call a function when this player is discovered by an enemy or neutral player. " +
"The callback function will be called as func(Player discovered, Player discoverer, Actor discoveredActor)")]
"The callback function will be called as func(Player discovered, Player discoverer, Actor discoveredActor).")]
public void OnPlayerDiscovered(Player discovered, LuaFunction func)
{
GetScriptTriggers(discovered.PlayerActor).RegisterCallback(Trigger.OnPlayerDiscovered, func, Context);
}

[Desc("Removes all triggers from this actor." +
[Desc("Removes all triggers from this actor. " +
"Note that the removal will only take effect at the end of a tick, " +
"so you must not add new triggers at the same time that you are calling this function.")]
public void ClearAll(Actor a)
{
GetScriptTriggers(a).ClearAll();
}

[Desc("Removes the specified trigger from this actor." +
[Desc("Removes the specified trigger from this actor. " +
"Note that the removal will only take effect at the end of a tick, " +
"so you must not add new triggers at the same time that you are calling this function.")]
public void Clear(Actor a, string triggerName)
Expand Down
Expand Up @@ -49,7 +49,7 @@ public void AttackMove(CPos cell, int closeEnough = 0)
}

[ScriptActorPropertyActivity]
[Desc("Patrol along a set of given waypoints. The action is repeated by default, " +
[Desc("Patrol along a set of given waypoints. The action is repeated by default, " +
"and the actor will wait for `wait` ticks at each waypoint.")]
public void Patrol(CPos[] waypoints, bool loop = true, int wait = 0)
{
Expand Down
Expand Up @@ -108,7 +108,7 @@ public string GetObjectiveType(int id)
}

[ScriptActorPropertyActivity]
[Desc("Returns true if this player has lost all units/actors that have" +
[Desc("Returns true if this player has lost all units/actors that have " +
"the MustBeDestroyed trait (according to the short game option).")]
public bool HasNoRequiredUnits()
{
Expand Down
Expand Up @@ -42,7 +42,7 @@ public void ScriptedMove(CPos cell)
}

[ScriptActorPropertyActivity]
[Desc("Moves from outside the world into the cell grid")]
[Desc("Moves from outside the world into the cell grid.")]
public void MoveIntoWorld(CPos cell)
{
Self.QueueActivity(mobile.MoveIntoWorld(Self, cell, mobile.ToSubCell));
Expand Down
Expand Up @@ -60,7 +60,7 @@ public Actor[] GetGroundAttackers()
.ToArray();
}

[Desc("Returns all living actors of the specified type of this player")]
[Desc("Returns all living actors of the specified type of this player.")]
public Actor[] GetActorsByType(string type)
{
var result = new List<Actor>();
Expand Down
12 changes: 6 additions & 6 deletions OpenRA.Mods.Common/Scripting/Properties/ProductionProperties.cs
Expand Up @@ -54,7 +54,7 @@ public RallyPointProperties(ScriptContext context, Actor self)
rp = self.Trait<RallyPoint>();
}

[Desc("Query or set a factory's rally point")]
[Desc("Query or set a factory's rally point.")]
public CPos RallyPoint
{
get { return rp.Location; }
Expand All @@ -73,7 +73,7 @@ public PrimaryBuildingProperties(ScriptContext context, Actor self)
pb = self.Trait<PrimaryBuilding>();
}

[Desc("Query or set the factory's primary building status")]
[Desc("Query or set the factory's primary building status.")]
public bool IsPrimaryBuilding
{
get { return pb.IsPrimary; }
Expand Down Expand Up @@ -146,7 +146,7 @@ public bool Build(string[] actorTypes, LuaFunction actionFunc = null)
return true;
}

[Desc("Check whether the factory's production queue that builds this type of actor is currently busy." +
[Desc("Check whether the factory's production queue that builds this type of actor is currently busy. " +
"Note: it does not check whether this particular type of actor is being produced.")]
public bool IsProducing(string actorType)
{
Expand Down Expand Up @@ -202,9 +202,9 @@ public ClassicProductionQueueProperties(ScriptContext context, Player player)
[Desc("Build the specified set of actors using classic (RA-style) production queues. " +
"The function will return true if production could be started, false otherwise. " +
"If an actionFunc is given, it will be called as actionFunc(Actor[] actors) once " +
"production of all actors has been completed. The actors array is guaranteed to " +
"production of all actors has been completed. The actors array is guaranteed to " +
"only contain alive actors. Note: This function will fail to work when called " +
"during the first tick")]
"during the first tick.")]
public bool Build(string[] actorTypes, LuaFunction actionFunc = null)
{
var typeToQueueMap = new Dictionary<string, string>();
Expand Down Expand Up @@ -252,7 +252,7 @@ public bool Build(string[] actorTypes, LuaFunction actionFunc = null)
return true;
}

[Desc("Check whether the production queue that builds this type of actor is currently busy." +
[Desc("Check whether the production queue that builds this type of actor is currently busy. " +
"Note: it does not check whether this particular type of actor is being produced.")]
public bool IsProducing(string actorType)
{
Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Mods.Common/Traits/Buildings/Bridge.cs
Expand Up @@ -242,7 +242,7 @@ ushort ChooseTemplate()

var ds = health.DamageState;
return (ds == DamageState.Dead && info.DestroyedTemplate > 0) ? info.DestroyedTemplate :
(ds >= DamageState.Heavy && info.DamagedTemplate > 0) ? info.DamagedTemplate : info.Template;
(ds >= DamageState.Heavy && info.DamagedTemplate > 0) ? info.DamagedTemplate : info.Template;
}

bool killedUnits = false;
Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Mods.Common/Traits/C4Demolition.cs
Expand Up @@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits
{
class C4DemolitionInfo : ITraitInfo
{
[Desc("Delay to demolish the target once the C4 is planted." +
[Desc("Delay to demolish the target once the C4 is planted. " +
"Measured in game ticks. Default is 1.8 seconds.")]
public readonly int C4Delay = 45;

Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Mods.Common/Traits/EmitInfantryOnSell.cs
Expand Up @@ -24,7 +24,7 @@ public class EmitInfantryOnSellInfo : ITraitInfo
[Desc("Be sure to use lowercase. Default value is \"e1\".")]
public readonly string[] ActorTypes = { "e1" };

[Desc("Spawns actors only if the selling player's faction is in this list." +
[Desc("Spawns actors only if the selling player's faction is in this list. " +
"Leave empty to allow all factions by default.")]
public readonly string[] Factions = { };

Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Mods.Common/Traits/Render/WithDecoration.cs
Expand Up @@ -40,7 +40,7 @@ public class WithDecorationInfo : UpgradableTraitInfo
[Desc("Palette to render the sprite in. Reference the world actor's PaletteFrom* traits.")]
[PaletteReference] public readonly string Palette = "chrome";

[Desc("Point in the actor's bounding box used as reference for offsetting the decoration image." +
[Desc("Point in the actor's bounding box used as reference for offsetting the decoration image. " +
"Possible values are any combination of Top, VCenter, Bottom and Left, HCenter, Right separated by a comma.")]
public readonly ReferencePoints ReferencePoint = ReferencePoints.Top | ReferencePoints.Left;

Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Mods.Common/Traits/Upgrades/DeployToUpgrade.cs
Expand Up @@ -22,7 +22,7 @@ public class DeployToUpgradeInfo : ITraitInfo, Requires<UpgradeManagerInfo>
[Desc("The upgrades to grant when deploying and revoke when undeploying.")]
public readonly string[] Upgrades = { };

[Desc("The terrain types that this actor can deploy on to receive these upgrades." +
[Desc("The terrain types that this actor can deploy on to receive these upgrades. " +
"Leave empty to allow any.")]
public readonly string[] AllowedTerrainTypes = { };

Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Mods.Common/Traits/Wanders.cs
Expand Up @@ -72,7 +72,7 @@ CPos PickTargetLocation()
if (++ticksIdle % info.TicksToWaitBeforeReducingMoveRadius == 0)
effectiveMoveRadius--;

return CPos.Zero; // We'll be back the next tick; better to sit idle for a few seconds than prolong this tick indefinitely with a loop
return CPos.Zero; // We'll be back the next tick; better to sit idle for a few seconds than prolong this tick indefinitely with a loop
}

ticksIdle = 0;
Expand Down
6 changes: 3 additions & 3 deletions OpenRA.Mods.Common/UtilityCommands/ExtractLuaDocsCommand.cs
Expand Up @@ -41,9 +41,9 @@ public void Run(ModData modData, string[] args)
"* Global tables provide functions for interacting with the global world state, or performing general helper tasks.\n" +
"They exist in the global namespace, and can be called directly using ```<table name>.<function name>```.\n" +
"* Individual actors expose a collection of properties and commands that query information or modify their state.\n" +
" * Some commands, marked as <em>queued activity</em>, are asynchronous. Activities are queued on the actor, and will run in " +
"sequence until the queue is empty or the Stop command is called. Actors that are not performing an activity are Idle " +
"(actor.IsIdle will return true). The properties and commands available on each actor depends on the traits that the actor " +
" * Some commands, marked as <em>queued activity</em>, are asynchronous. Activities are queued on the actor, and will run in " +
"sequence until the queue is empty or the Stop command is called. Actors that are not performing an activity are Idle " +
"(actor.IsIdle will return true). The properties and commands available on each actor depends on the traits that the actor " +
"specifies in its rule definitions.\n" +
"* Individual players expose a collection of properties and commands that query information or modify their state.\n" +
"The properties and commands available on each actor depends on the traits that the actor specifies in its rule definitions.\n");
Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Mods.RA/Traits/SpawnActorOnDeath.cs
Expand Up @@ -35,7 +35,7 @@ public class SpawnActorOnDeathInfo : ITraitInfo
[Desc("Map player to use when 'InternalName' is defined on 'OwnerType'.")]
public readonly string InternalOwner = null;

[Desc("DeathType that triggers the actor spawn." +
[Desc("DeathType that triggers the actor spawn. " +
"Leave empty to spawn an actor ignoring the DeathTypes.")]
public readonly string DeathType = null;

Expand Down
8 changes: 4 additions & 4 deletions mods/cnc/maps/gdi04a/gdi04a.lua
Expand Up @@ -11,10 +11,10 @@ GDIReinforcements = { "e2", "e2", "e2", "e2", "e2" }
GDIReinforcementsWaypoints = { GDIReinforcementsEntry.Location, GDIReinforcementsWP1.Location }

NodHelis = {
{ DateTime.Seconds(HeliDelay[1]), { NodHeliEntry.Location, NodHeliLZ1.Location }, { "e1", "e1", "e3" } },
{ DateTime.Seconds(HeliDelay[2]), { NodHeliEntry.Location, NodHeliLZ2.Location }, { "e1", "e1", "e1", "e1" } },
{ DateTime.Seconds(HeliDelay[3]), { NodHeliEntry.Location, NodHeliLZ3.Location }, { "e1", "e1", "e3" } }
}
{ DateTime.Seconds(HeliDelay[1]), { NodHeliEntry.Location, NodHeliLZ1.Location }, { "e1", "e1", "e3" } },
{ DateTime.Seconds(HeliDelay[2]), { NodHeliEntry.Location, NodHeliLZ2.Location }, { "e1", "e1", "e1", "e1" } },
{ DateTime.Seconds(HeliDelay[3]), { NodHeliEntry.Location, NodHeliLZ3.Location }, { "e1", "e1", "e3" } }
}

SendHeli = function(heli)
units = Reinforcements.ReinforceWithTransport(nod, "tran", heli[3], heli[2], { heli[2][1] })
Expand Down
2 changes: 1 addition & 1 deletion mods/cnc/maps/nod01/nod01.lua
@@ -1,5 +1,5 @@
InitialForcesA = { "bggy", "e1", "e1", "e1", "e1" }
InitialForcesB = { "e1", "e1", "bggy", "e1", "e1" }
InitialForcesB = { "e1", "e1", "bggy", "e1", "e1" }

RifleInfantryReinforcements = { "e1", "e1" }
RocketInfantryReinforcements = { "e3", "e3", "e3", "e3", "e3" }
Expand Down
2 changes: 1 addition & 1 deletion mods/cnc/maps/nod02b/nod02b.lua
Expand Up @@ -139,7 +139,7 @@ WorldLoaded = function()
end

Tick = function()
if Nod.HasNoRequiredUnits() then
if Nod.HasNoRequiredUnits() then
if DateTime.GameTime > 2 then
GDI.MarkCompletedObjective(GDIObjective)
end
Expand Down
2 changes: 1 addition & 1 deletion mods/cnc/maps/nod03b/nod03b.lua
@@ -1,6 +1,6 @@
NodUnits = { "e1", "e1", "bggy", "bike", "e1", "e1", "bike", "bggy", "e1", "e1" }
Engineers = { "e6", "e6", "e6" }
FirstAttackWaveUnits = { "e1", "e1", "e2" }
FirstAttackWaveUnits = { "e1", "e1", "e2" }
SecondAttackWaveUnits = { "e1", "e1", "e1" }
ThirdAttackWaveUnits = { "e1", "e1", "e1", "e2" }

Expand Down
2 changes: 1 addition & 1 deletion mods/cnc/maps/nod04a/nod04a.lua
Expand Up @@ -289,7 +289,7 @@ WorldLoaded = function()
end

Tick = function()
if Nod.HasNoRequiredUnits() then
if Nod.HasNoRequiredUnits() then
if DateTime.GameTime > 2 then
GDI.MarkCompletedObjective(GDIObjective)
end
Expand Down
2 changes: 1 addition & 1 deletion mods/cnc/maps/nod06b/nod06b.lua
Expand Up @@ -169,7 +169,7 @@ WorldLoaded = function()
end

Tick = function()
if Nod.HasNoRequiredUnits() then
if Nod.HasNoRequiredUnits() then
if DateTime.GameTime > 2 then
GDI.MarkCompletedObjective(GDIObjective)
end
Expand Down
2 changes: 1 addition & 1 deletion mods/ra/maps/allies-03b/allies03b.lua
Expand Up @@ -14,7 +14,7 @@ BeachTriggerArea = { CPos.New(111, 36), CPos.New(112, 36), CPos.New(112, 37), CP
ParadropTriggerArea = { CPos.New(81, 66), CPos.New(82, 66), CPos.New(83, 66), CPos.New(84, 66), CPos.New(85, 66), CPos.New(86, 66), CPos.New(87, 66), CPos.New(93, 64), CPos.New(94, 64), CPos.New(94, 63), CPos.New(95, 63), CPos.New(95, 62), CPos.New(96, 62), CPos.New(96, 61), CPos.New(97, 61), CPos.New(97, 60), CPos.New(98, 60), CPos.New(99, 60), CPos.New(100, 60), CPos.New(101, 60), CPos.New(102, 60), CPos.New(103, 60) }
ReinforcementsTriggerArea = { CPos.New(57, 46), CPos.New(58, 46), CPos.New(66, 35), CPos.New(65, 35), CPos.New(65, 36), CPos.New(64, 36), CPos.New(64, 37), CPos.New(64, 38), CPos.New(64, 39), CPos.New(64, 40), CPos.New(64, 41), CPos.New(63, 41), CPos.New(63, 42), CPos.New(63, 43), CPos.New(62, 43), CPos.New(62, 44) }
Barracks3TriggerArea = { CPos.New(69, 50), CPos.New(69, 51), CPos.New(69, 52), CPos.New(69, 53), CPos.New(69, 54), CPos.New(61, 45), CPos.New(62, 45), CPos.New(62, 46), CPos.New(62, 47), CPos.New(62, 48), CPos.New(63, 48), CPos.New(57, 46), CPos.New(58, 46) }
JeepTriggerArea = { CPos.New(75, 76), CPos.New(76, 76), CPos.New(77, 76), CPos.New(78, 76), CPos.New(79, 76), CPos.New(80, 76), CPos.New(81, 76), CPos.New(82, 76), CPos.New(91, 78), CPos.New(92, 78), CPos.New(93, 78), CPos.New(95, 84), CPos.New(96, 84), CPos.New(97, 84), CPos.New(98, 84), CPos.New(99, 84), CPos.New(100, 84) }
JeepTriggerArea = { CPos.New(75, 76), CPos.New(76, 76), CPos.New(77, 76), CPos.New(78, 76), CPos.New(79, 76), CPos.New(80, 76), CPos.New(81, 76), CPos.New(82, 76), CPos.New(91, 78), CPos.New(92, 78), CPos.New(93, 78), CPos.New(95, 84), CPos.New(96, 84), CPos.New(97, 84), CPos.New(98, 84), CPos.New(99, 84), CPos.New(100, 84) }
JeepBarrels = { JeepBarrel1, JeepBarrel2, JeepBarrel3, JeepBarrel4 }
GuardTanks = { Heavy1, Heavy2, Heavy3 }
CheckpointGuards = { USSRCheckpointGuard1, USSRCheckpointGuard2 }
Expand Down
2 changes: 1 addition & 1 deletion mods/ra/maps/soviet-02a/soviet02a.lua
Expand Up @@ -99,7 +99,7 @@ WorldLoaded = function()
end)

-- Four infantry from the small island move towards the USSR command center and attack it after 24 Seconds
Trigger.AfterDelay(DateTime.Seconds(24), function()
Trigger.AfterDelay(DateTime.Seconds(24), function()
Utils.Do(CmdAtk, function(unit)
unit.AttackMove(AttackWaypoint1.Location)
Trigger.OnIdle(unit, unit.Hunt)
Expand Down

0 comments on commit 18b8eb3

Please sign in to comment.