Merge pull request #5999 from Mailaender/trait-documentation-update-july-2014
Updated the trait documentation for modders
This commit is contained in:
@@ -79,9 +79,12 @@ namespace OpenRA
|
||||
if (t.IsArray)
|
||||
{
|
||||
var elems = ((Array)v).OfType<object>();
|
||||
return elems.JoinWith(",");
|
||||
return elems.JoinWith(", ");
|
||||
}
|
||||
|
||||
if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(OpenRA.Primitives.Cache<,>))
|
||||
return ""; // TODO
|
||||
|
||||
if (t == typeof(DateTime))
|
||||
return ((DateTime)v).ToString("yyyy-MM-dd HH-mm-ss", CultureInfo.InvariantCulture);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 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,
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
[Desc("Checks for pause related desyncs. Attach this to the world actor.")]
|
||||
public class DebugPauseStateInfo : ITraitInfo
|
||||
{
|
||||
public object Create(ActorInitializer init) { return new DebugPauseState(init.world); }
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
[Desc("Attach this to the player actor.")]
|
||||
public class DeveloperModeInfo : ITraitInfo
|
||||
{
|
||||
public int Cash = 20000;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 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,
|
||||
@@ -15,6 +15,7 @@ using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
[Desc("Required for FrozenUnderFog to work. Attach this to the player actor.")]
|
||||
public class FrozenActorLayerInfo : ITraitInfo
|
||||
{
|
||||
public object Create(ActorInitializer init) { return new FrozenActorLayer(init.self); }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 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,
|
||||
@@ -12,6 +12,7 @@ using OpenRA.Network;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
[Desc("Used to detect exploits. Attach this to the world actor.")]
|
||||
public class ValidateOrderInfo : TraitInfo<ValidateOrder> { }
|
||||
|
||||
public class ValidateOrder : IValidateOrder
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 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,
|
||||
@@ -15,6 +15,7 @@ using System.Linq;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
[Desc("Required for shroud and fog visibility checks. Add this to the player actor.")]
|
||||
public class ShroudInfo : ITraitInfo
|
||||
{
|
||||
public object Create(ActorInitializer init) { return new Shroud(init.self); }
|
||||
|
||||
@@ -16,9 +16,9 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.D2k
|
||||
{
|
||||
[Desc("Used to render spice with round borders.")]
|
||||
public class D2kResourceLayerInfo : TraitInfo<D2kResourceLayer> { }
|
||||
|
||||
[Desc("Used to render spice with round borders.")]
|
||||
public class D2kResourceLayer : ResourceLayer
|
||||
{
|
||||
[Flags] enum ClearSides : byte
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 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,
|
||||
@@ -15,6 +15,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Apply palette full screen rotations during chronoshifts. Add this to the world actor.")]
|
||||
class ChronoshiftPaletteEffectInfo : TraitInfo<ChronoshiftPaletteEffect> { }
|
||||
|
||||
public class ChronoshiftPaletteEffect : IPaletteModifier, ITick
|
||||
|
||||
@@ -14,6 +14,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Enables commands triggered by typing them into the chatbox. Attach this to the world actor.")]
|
||||
public class ChatCommandsInfo : TraitInfo<ChatCommands> { }
|
||||
|
||||
public class ChatCommands : INotifyChat
|
||||
|
||||
@@ -14,6 +14,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Enables developer cheats via the chatbox. Attach this to the world actor.")]
|
||||
public class DevCommandsInfo : TraitInfo<DevCommands> { }
|
||||
|
||||
public class DevCommands : IChatCommand, IWorldLoaded
|
||||
|
||||
@@ -14,6 +14,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Shows a list of available commands in the chatbox. Attach this to the world actor.")]
|
||||
public class HelpCommandInfo : TraitInfo<HelpCommand> { }
|
||||
|
||||
public class HelpCommand : IChatCommand, IWorldLoaded
|
||||
|
||||
@@ -13,6 +13,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Allows the player to pause or surrender the game via the chatbox. Attach this to the world actor.")]
|
||||
public class PlayerCommandsInfo : TraitInfo<PlayerCommands> { }
|
||||
|
||||
public class PlayerCommands : IChatCommand, IWorldLoaded
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 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,
|
||||
@@ -13,6 +13,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Leave a \"crate\" actor after destruction.")]
|
||||
public class ContainsCrateInfo : TraitInfo<ContainsCrate> { }
|
||||
|
||||
public class ContainsCrate : INotifyKilled
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 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,
|
||||
@@ -14,6 +14,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Attach this to the world actor.")]
|
||||
public class CreateMPPlayersInfo : TraitInfo<CreateMPPlayers> { }
|
||||
|
||||
public class CreateMPPlayers : ICreatePlayers
|
||||
@@ -72,7 +73,7 @@ namespace OpenRA.Mods.RA
|
||||
if (p.PlayerReference.Enemies.Contains(q.InternalName))
|
||||
return Stance.Enemy;
|
||||
|
||||
// Hack: Map players share a ClientID with the host, so would
|
||||
// HACK: Map players share a ClientID with the host, so would
|
||||
// otherwise take the host's team stance instead of being neutral
|
||||
if (p.PlayerReference.Playable && q.PlayerReference.Playable)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 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,
|
||||
@@ -13,6 +13,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Display a sprite tag \"fake\" when selected.")]
|
||||
class FakeInfo : TraitInfo<Fake> { }
|
||||
|
||||
class Fake : ITags
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 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,
|
||||
@@ -12,6 +12,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Used by SpawnMPUnits. Attach these to the world actor. You can have multiple variants by adding @suffixes.")]
|
||||
public class MPStartUnitsInfo : TraitInfo<MPStartUnits>
|
||||
{
|
||||
public readonly string Class = "none";
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.RA
|
||||
}
|
||||
}
|
||||
|
||||
/* tag trait for stuff that shouldnt trigger mines */
|
||||
[Desc("Tag trait for stuff that should not trigger mines.")]
|
||||
class MineImmuneInfo : TraitInfo<MineImmune> { }
|
||||
class MineImmune { }
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 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,
|
||||
@@ -15,6 +15,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("The actor stays invisible under fog of war.")]
|
||||
public class HiddenUnderFogInfo : TraitInfo<HiddenUnderFog> { }
|
||||
|
||||
public class HiddenUnderFog : IRenderModifier, IVisibilityModifier
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 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,
|
||||
@@ -15,6 +15,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Apply palette full screen rotations during atom bomb explosions. Add this to the world actor.")]
|
||||
class NukePaletteEffectInfo : TraitInfo<NukePaletteEffect> { }
|
||||
|
||||
public class NukePaletteEffect : IPaletteModifier, ITick
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 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,
|
||||
@@ -14,6 +14,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Part of the unfinished group-movement system. Attach this to the player actor.")]
|
||||
class ActorGroupProxyInfo : TraitInfo<ActorGroupProxy> { }
|
||||
|
||||
class ActorGroupProxy : IResolveOrder
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 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,
|
||||
@@ -12,7 +12,9 @@ using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
|
||||
{
|
||||
[Desc("Attach this to the player actor to allow building repair by team mates.")]
|
||||
class AllyRepairInfo : TraitInfo<AllyRepair> { }
|
||||
|
||||
class AllyRepair : IResolveOrder
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 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,
|
||||
@@ -15,6 +15,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Attach this to the player actor to collect observer stats.")]
|
||||
public class PlayerStatisticsInfo : ITraitInfo
|
||||
{
|
||||
public object Create(ActorInitializer init) { return new PlayerStatistics(init.self); }
|
||||
@@ -108,6 +109,7 @@ namespace OpenRA.Mods.RA
|
||||
}
|
||||
}
|
||||
|
||||
[Desc("Attach this to a unit to update observer stats.")]
|
||||
public class UpdatesPlayerStatisticsInfo : TraitInfo<UpdatesPlayerStatistics> { }
|
||||
|
||||
public class UpdatesPlayerStatistics : INotifyKilled
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 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,
|
||||
@@ -13,7 +13,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("This actor provides radar.")]
|
||||
[Desc("This actor enables the radar minimap.")]
|
||||
public class ProvidesRadarInfo : TraitInfo<ProvidesRadar> { }
|
||||
|
||||
public class ProvidesRadar : ITick
|
||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.RA
|
||||
}
|
||||
}
|
||||
|
||||
[Desc("Jams radar signal.")]
|
||||
[Desc("When an actor with this trait is in range of an actor with ProvidesRadar, it will temporarily disable the radar minimap for the enemy player.")]
|
||||
class JamsRadarInfo : TraitInfo<JamsRadar>
|
||||
{
|
||||
[Desc("Range for jamming.")]
|
||||
|
||||
@@ -12,6 +12,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Destroy the actor right after being added to the game world.")]
|
||||
public class RemoveImmediatelyInfo : TraitInfo<RemoveImmediately> {}
|
||||
|
||||
public class RemoveImmediately : INotifyAddedToWorld
|
||||
|
||||
@@ -15,9 +15,13 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
{
|
||||
[Desc("Displays the player name above the unit")]
|
||||
class RenderNameTagInfo : ITraitInfo
|
||||
{
|
||||
public readonly int MaxLength = 10;
|
||||
|
||||
public readonly string Font = "TinyBold";
|
||||
|
||||
public object Create(ActorInitializer init) { return new RenderNameTag(init.self, this); }
|
||||
}
|
||||
|
||||
@@ -29,7 +33,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
|
||||
public RenderNameTag(Actor self, RenderNameTagInfo info)
|
||||
{
|
||||
font = Game.Renderer.Fonts["TinyBold"];
|
||||
font = Game.Renderer.Fonts[info.Font];
|
||||
color = self.Owner.Color.RGB;
|
||||
|
||||
if (self.Owner.PlayerName.Length > info.MaxLength)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 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,
|
||||
@@ -15,21 +15,24 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
{
|
||||
[Desc("Also returns a default selection size that is calculated automatically from the voxel dimensions.")]
|
||||
public class WithVoxelBodyInfo : ITraitInfo, Requires<RenderVoxelsInfo>
|
||||
{
|
||||
public object Create(ActorInitializer init) { return new WithVoxelBody(init.self); }
|
||||
public readonly string Sequence = "idle";
|
||||
|
||||
public object Create(ActorInitializer init) { return new WithVoxelBody(init.self, this); }
|
||||
}
|
||||
|
||||
public class WithVoxelBody : IAutoSelectionSize
|
||||
{
|
||||
int2 size;
|
||||
|
||||
public WithVoxelBody(Actor self)
|
||||
public WithVoxelBody(Actor self, WithVoxelBodyInfo info)
|
||||
{
|
||||
var body = self.Trait<IBodyOrientation>();
|
||||
var rv = self.Trait<RenderVoxels>();
|
||||
|
||||
var voxel = VoxelProvider.GetVoxel(rv.Image, "idle");
|
||||
var voxel = VoxelProvider.GetVoxel(rv.Image, info.Sequence);
|
||||
rv.Add(new VoxelAnimation(voxel, () => WVec.Zero,
|
||||
() => new[]{ body.QuantizeOrientation(self, self.Orientation) },
|
||||
() => false, () => 0));
|
||||
|
||||
@@ -15,6 +15,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Scripting
|
||||
{
|
||||
[Desc("Part of the new Lua API.")]
|
||||
public class LuaScriptInfo : ITraitInfo, Requires<SpawnMapActorsInfo>
|
||||
{
|
||||
public readonly string[] Scripts = { };
|
||||
|
||||
@@ -18,6 +18,7 @@ using OpenRA.Primitives;
|
||||
|
||||
namespace OpenRA.Mods.RA.Scripting
|
||||
{
|
||||
[Desc("Part of the legacy Lua API.")]
|
||||
public sealed class LuaScriptContext : IDisposable
|
||||
{
|
||||
public Lua Lua { get; private set; }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 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,
|
||||
@@ -13,6 +13,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Scripting
|
||||
{
|
||||
[Desc("Part of the legacy Lua API.")]
|
||||
public class LuaScriptEventsInfo : TraitInfo<LuaScriptEvents> { }
|
||||
|
||||
public class LuaScriptEvents : INotifyKilled, INotifyAddedToWorld, INotifyRemovedFromWorld,
|
||||
|
||||
@@ -25,6 +25,7 @@ using WorldRenderer = OpenRA.Graphics.WorldRenderer;
|
||||
|
||||
namespace OpenRA.Mods.RA.Scripting
|
||||
{
|
||||
[Desc("Part of the legacy Lua API.")]
|
||||
public class LuaScriptInterfaceInfo : ITraitInfo, Requires<SpawnMapActorsInfo>
|
||||
{
|
||||
public readonly string[] LuaScripts = { };
|
||||
|
||||
@@ -17,6 +17,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Spawn base actor at the spawnpoint and support units in an annulus around the base actor. Both are defined at MPStartUnits. Attach this to the world actor.")]
|
||||
public class SpawnMPUnitsInfo : TraitInfo<SpawnMPUnits>, Requires<MPStartLocationsInfo>, Requires<MPStartUnitsInfo> { }
|
||||
|
||||
public class SpawnMPUnits : IWorldLoaded
|
||||
@@ -37,7 +38,6 @@ namespace OpenRA.Mods.RA
|
||||
if (unitGroup == null)
|
||||
throw new InvalidOperationException("No starting units defined for country {0} with class {1}".F(p.Country.Race, spawnClass));
|
||||
|
||||
// Spawn base actor at the spawnpoint
|
||||
if (unitGroup.BaseActor != null)
|
||||
{
|
||||
w.CreateActor(unitGroup.BaseActor.ToLowerInvariant(), new TypeDictionary
|
||||
@@ -51,7 +51,6 @@ namespace OpenRA.Mods.RA
|
||||
if (!unitGroup.SupportActors.Any())
|
||||
return;
|
||||
|
||||
// Spawn support units in an annulus around the base actor
|
||||
var supportSpawnCells = w.Map.FindTilesInAnnulus(sp, unitGroup.InnerSupportRadius + 1, unitGroup.OuterSupportRadius);
|
||||
|
||||
foreach (var s in unitGroup.SupportActors)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 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,
|
||||
@@ -16,6 +16,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Required for GpsPower. Attach this to the player actor.")]
|
||||
class GpsWatcherInfo : ITraitInfo
|
||||
{
|
||||
public object Create (ActorInitializer init) { return new GpsWatcher(init.self.Owner); }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 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,
|
||||
@@ -14,19 +14,27 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Display the time remaining until the super weapon attached to the actor is ready to the player and his allies.")]
|
||||
class SupportPowerChargeBarInfo : ITraitInfo
|
||||
{
|
||||
public object Create(ActorInitializer init) { return new SupportPowerChargeBar(init.self); }
|
||||
public readonly Color Color = Color.Magenta;
|
||||
|
||||
public object Create(ActorInitializer init) { return new SupportPowerChargeBar(init.self, this); }
|
||||
}
|
||||
|
||||
class SupportPowerChargeBar : ISelectionBar
|
||||
{
|
||||
Actor self;
|
||||
public SupportPowerChargeBar(Actor self) { this.self = self; }
|
||||
readonly Actor self;
|
||||
readonly SupportPowerChargeBarInfo info;
|
||||
|
||||
public SupportPowerChargeBar(Actor self, SupportPowerChargeBarInfo info)
|
||||
{
|
||||
this.self = self;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public float GetValue()
|
||||
{
|
||||
// only people we like should see our charge status.
|
||||
if (!self.Owner.IsAlliedWith(self.World.RenderPlayer))
|
||||
return 0;
|
||||
|
||||
@@ -38,6 +46,6 @@ namespace OpenRA.Mods.RA
|
||||
return 1 - (float)power.RemainingTime / power.TotalTime;
|
||||
}
|
||||
|
||||
public Color GetColor() { return Color.Magenta; }
|
||||
public Color GetColor() { return info.Color; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Attach this to the player actor.")]
|
||||
public class SupportPowerManagerInfo : ITraitInfo, Requires<DeveloperModeInfo>, Requires<TechTreeInfo>
|
||||
{
|
||||
public object Create(ActorInitializer init) { return new SupportPowerManager(init); }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 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,
|
||||
@@ -17,6 +17,8 @@ namespace OpenRA.Mods.RA
|
||||
public class VoxelNormalsPaletteInfo : ITraitInfo
|
||||
{
|
||||
public readonly string Name = "normals";
|
||||
|
||||
[Desc("Can be TiberianSun or RedAlert2")]
|
||||
public readonly NormalType Type = NormalType.TiberianSun;
|
||||
|
||||
public object Create(ActorInitializer init) { return new VoxelNormalsPalette(this); }
|
||||
|
||||
@@ -14,6 +14,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Attach this to the world actor. Required for LaysTerrain to work.")]
|
||||
public class BuildableTerrainLayerInfo : TraitInfo<BuildableTerrainLayer> { }
|
||||
public class BuildableTerrainLayer : IRenderOverlay, IWorldLoaded, ITickRender
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 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,
|
||||
@@ -17,21 +17,25 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
class ChooseBuildTabOnSelectInfo : ITraitInfo
|
||||
{
|
||||
public object Create(ActorInitializer init) { return new ChooseBuildTabOnSelect(init); }
|
||||
public readonly string BuildPaletteWidgetName = "INGAME_BUILD_PALETTE";
|
||||
|
||||
public object Create(ActorInitializer init) { return new ChooseBuildTabOnSelect(init, this); }
|
||||
}
|
||||
|
||||
class ChooseBuildTabOnSelect : INotifySelection
|
||||
{
|
||||
readonly World world;
|
||||
readonly ChooseBuildTabOnSelectInfo info;
|
||||
|
||||
public ChooseBuildTabOnSelect(ActorInitializer init)
|
||||
public ChooseBuildTabOnSelect(ActorInitializer init, ChooseBuildTabOnSelectInfo info)
|
||||
{
|
||||
world = init.world;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public void SelectionChanged()
|
||||
{
|
||||
var palette = Ui.Root.GetOrNull<BuildPaletteWidget>("INGAME_BUILD_PALETTE");
|
||||
var palette = Ui.Root.GetOrNull<BuildPaletteWidget>(info.BuildPaletteWidgetName);
|
||||
if (palette == null)
|
||||
return;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 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,
|
||||
@@ -18,6 +18,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Required for the A* PathDebug from DeveloperMode. Attach this to the world actor.")]
|
||||
class PathfinderDebugOverlayInfo : TraitInfo<PathfinderDebugOverlay> { }
|
||||
class PathfinderDebugOverlay : IRenderOverlay, IWorldLoaded
|
||||
{
|
||||
|
||||
@@ -4,9 +4,8 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
public sealed class ResourceClaimLayerInfo : TraitInfo<ResourceClaimLayer>
|
||||
{
|
||||
}
|
||||
[Desc("Allows harvesters to coordinate their operations. Attach this to the world actor.")]
|
||||
public sealed class ResourceClaimLayerInfo : TraitInfo<ResourceClaimLayer> { }
|
||||
|
||||
public sealed class ResourceClaimLayer : IWorldLoaded
|
||||
{
|
||||
|
||||
@@ -257,6 +257,9 @@ namespace OpenRA.Utility
|
||||
if (t.IsSubclassOf(typeof(Array)))
|
||||
return "Multiple {0}".F(FriendlyTypeName(t.GetElementType()));
|
||||
|
||||
if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(OpenRA.Primitives.Cache<,>))
|
||||
return "Cached<{0},{1}>".F(t.GetGenericArguments().Select(FriendlyTypeName).ToArray());
|
||||
|
||||
if (t == typeof(int) || t == typeof(uint))
|
||||
return "Integer";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user