Initial commit: OpenRA game engine
Fork from OpenRA/OpenRA with one-click launch script (start-ra.cmd) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright (c) The OpenRA Developers and Contributors
|
||||
* 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, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Primitives;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds color names to the editor history list.
|
||||
/// </summary>
|
||||
public class EditorMarkerTileLabels : UpdateRule, IBeforeUpdateActors
|
||||
{
|
||||
public override string Name => "Add labels to MarkerLayerOverlay colors.";
|
||||
public override string Description => "Adds color names to the editor history list.";
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNodeBuilder actorNode)
|
||||
{
|
||||
foreach (var layerNode in actorNode.ChildrenMatching("MarkerLayerOverlay"))
|
||||
{
|
||||
foreach (var colorsNode in layerNode.ChildrenMatching("Colors"))
|
||||
{
|
||||
var colors = FieldLoader.GetValue<Color[]>("Colors", colorsNode.Value.Value);
|
||||
colorsNode.Value.Value = null;
|
||||
foreach (var color in colors)
|
||||
{
|
||||
var c = FieldSaver.FormatValue(color);
|
||||
colorsNode.AddNode("notification-added-marker-tiles-markers." + c, c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright (c) The OpenRA Developers and Contributors
|
||||
* 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, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class RemoveAlwaysVisible : UpdateRule
|
||||
{
|
||||
public override string Name => "Remove AlwaysVisible";
|
||||
public override string Description => "AlwaysVisible trait was removed and now is the default behavior.";
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNodeBuilder actorNode)
|
||||
{
|
||||
actorNode.RemoveNodes("AlwaysVisible");
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright (c) The OpenRA Developers and Contributors
|
||||
* 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, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
sealed class RemoveBarracksTypesAndVehiclesTypesInBaseBuilderBotModule : UpdateRule
|
||||
{
|
||||
public override string Name => "Remove BarracksTypes and VehiclesTypes in BaseBuilderBotModule";
|
||||
public override string Description => "BarracksTypes and VehiclesTypes were removed and now BaseBuilderBotModule check by using ProductionTypes.";
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNodeBuilder actorNode)
|
||||
{
|
||||
foreach (var baseBuilder in actorNode.ChildrenMatching("BaseBuilderBotModule"))
|
||||
{
|
||||
baseBuilder.RemoveNodes("BarracksTypes");
|
||||
baseBuilder.RemoveNodes("VehiclesFactoryTypes");
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright (c) The OpenRA Developers and Contributors
|
||||
* 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, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
/// <summary>
|
||||
/// Replaces the BaseAttackNotifier with a new AttackNotifier that uses the
|
||||
/// new attack system.
|
||||
/// </summary>
|
||||
public class RemoveBuildingInfoAllowPlacementOnResources : UpdateRule, IBeforeUpdateActors
|
||||
{
|
||||
public override string Name => "Remove AllowPlacementOnResources from BuildingInfo";
|
||||
public override string Description => "Removes AllowPlacementOnResources from BuildingInfo and adds terrains with resources" +
|
||||
"to TerrainTypes (if a Building trait uses AllowPlacementOnResources: true).";
|
||||
|
||||
readonly HashSet<string> terrainTypesWithResources = [];
|
||||
|
||||
IEnumerable<string> IBeforeUpdateActors.BeforeUpdateActors(ModData modData, List<MiniYamlNodeBuilder> resolvedActors)
|
||||
{
|
||||
var resourceLayerInfo = modData.DefaultRules.Actors[SystemActors.World].TraitInfoOrDefault<ResourceLayerInfo>();
|
||||
if (resourceLayerInfo == null)
|
||||
yield break;
|
||||
|
||||
foreach (var resourceType in resourceLayerInfo.ResourceTypes.Values)
|
||||
{
|
||||
terrainTypesWithResources.Add(resourceType.TerrainType);
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNodeBuilder actorNode)
|
||||
{
|
||||
foreach (var buildingInfo in actorNode.ChildrenMatching("Building"))
|
||||
{
|
||||
if (buildingInfo.RemoveNodes("AllowPlacementOnResources") == 0)
|
||||
continue;
|
||||
|
||||
var terrainTypesNode = buildingInfo.Value.NodeWithKeyOrDefault("TerrainTypes");
|
||||
if (terrainTypesNode == null)
|
||||
{
|
||||
terrainTypesNode = new MiniYamlNodeBuilder("TerrainTypes", "");
|
||||
buildingInfo.AddNode(terrainTypesNode);
|
||||
}
|
||||
|
||||
var allowedTerrainTypes = terrainTypesNode?.NodeValue<List<string>>() ?? [];
|
||||
foreach (var terrainType in terrainTypesWithResources)
|
||||
{
|
||||
if (!allowedTerrainTypes.Contains(terrainType))
|
||||
allowedTerrainTypes.Add(terrainType);
|
||||
}
|
||||
|
||||
terrainTypesNode.ReplaceValue(string.Join(", ", allowedTerrainTypes));
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright (c) The OpenRA Developers and Contributors
|
||||
* 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, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
/// <summary>
|
||||
/// Replaces the BaseAttackNotifier with a new AttackNotifier that uses the
|
||||
/// new attack system.
|
||||
/// </summary>
|
||||
public class ReplaceBaseAttackNotifier : UpdateRule, IBeforeUpdateActors
|
||||
{
|
||||
public override string Name => "Replace BaseAttackNotifier with DamageNotifier";
|
||||
public override string Description => "Replaces the BaseAttackNotifier with a new DamageNotifier that uses BaseBuilding target type.";
|
||||
|
||||
bool any = false;
|
||||
readonly HashSet<string> definedNotifications = [];
|
||||
|
||||
IEnumerable<string> IBeforeUpdateActors.BeforeUpdateActors(ModData modData, List<MiniYamlNodeBuilder> resolvedActors)
|
||||
{
|
||||
any = false;
|
||||
foreach (var actor in resolvedActors)
|
||||
foreach (var notifier in actor.ChildrenMatching("BaseAttackNotifier"))
|
||||
if (notifier.LastChildMatching("Notification", false) != null)
|
||||
definedNotifications.Add(actor.Key + ":" + notifier.Key);
|
||||
|
||||
yield break;
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNodeBuilder actorNode)
|
||||
{
|
||||
foreach (var notifier in actorNode.ChildrenMatching("BaseAttackNotifier"))
|
||||
{
|
||||
any = true;
|
||||
notifier.AddNode("ValidTargets", "BaseBuilding");
|
||||
if (!definedNotifications.Contains(actorNode.Key + ":" + notifier.Key))
|
||||
notifier.AddNode("Notification", "BaseAttack");
|
||||
|
||||
notifier.RenameKey("DamageNotifier");
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
|
||||
public override IEnumerable<string> AfterUpdate(ModData modData)
|
||||
{
|
||||
if (!any)
|
||||
yield break;
|
||||
|
||||
yield return "BaseAttackNotifier has been replaced by DamageNotifier with ValidTargets: BaseBuilding" +
|
||||
"\nPlease replace the target type or add it to actor types as needed.";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright (c) The OpenRA Developers and Contributors
|
||||
* 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, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class WithDamageOverlayPropertyRename : UpdateRule, IBeforeUpdateActors
|
||||
{
|
||||
public override string Name => "Renamed `WithDamageOverlay`'s `IdleSequence` to `StartSequence`.";
|
||||
|
||||
public override string Description => "WithDamageOverlay's property `IdleSequence` was renamed to `StartSequence`"
|
||||
+ " and functionality of WithDamageOverlay changed.";
|
||||
|
||||
readonly List<(string, string)> hasIdleDefault = [];
|
||||
readonly List<(string, string)> hasEndDefault = [];
|
||||
|
||||
public IEnumerable<string> BeforeUpdateActors(ModData modData, List<MiniYamlNodeBuilder> resolvedActors)
|
||||
{
|
||||
foreach (var actorNode in resolvedActors)
|
||||
foreach (var damage in actorNode.ChildrenMatching("WithDamageOverlay"))
|
||||
if (damage.HasChild("IdleSequence") || damage.HasChild("StartSequence"))
|
||||
hasIdleDefault.Add((actorNode.Key, damage.Key));
|
||||
|
||||
foreach (var actorNode in resolvedActors)
|
||||
foreach (var damage in actorNode.ChildrenMatching("WithDamageOverlay"))
|
||||
if (damage.HasChild("EndSequence"))
|
||||
hasEndDefault.Add((actorNode.Key, damage.Key));
|
||||
|
||||
yield break;
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNodeBuilder actorNode)
|
||||
{
|
||||
foreach (var damage in actorNode.ChildrenMatching("WithDamageOverlay"))
|
||||
{
|
||||
var renamed = false;
|
||||
foreach (var start in damage.ChildrenMatching("IdleSequence"))
|
||||
{
|
||||
start.RenameKey("StartSequence");
|
||||
renamed = true;
|
||||
}
|
||||
|
||||
if (!renamed && !hasIdleDefault.Contains((actorNode.Key, damage.Key)))
|
||||
damage.AddNode("StartSequence", "idle");
|
||||
|
||||
damage.AddNode("LoopCount", 1);
|
||||
|
||||
if (!hasEndDefault.Contains((actorNode.Key, damage.Key)))
|
||||
damage.AddNode("EndSequence", "end");
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user