Upgrade mod rules.

This commit is contained in:
Paul Chote
2017-10-21 14:05:47 +00:00
committed by reaperrr
parent d2f0e5ac2d
commit faf2634e3d
8 changed files with 61 additions and 13 deletions

View File

@@ -15,6 +15,7 @@ using System.IO;
using System.Linq;
using System.Text;
using OpenRA.FileSystem;
using OpenRA.Traits;
namespace OpenRA.Mods.Common.UtilityCommands
{
@@ -1003,6 +1004,55 @@ namespace OpenRA.Mods.Common.UtilityCommands
}
}
if (engineVersion < 20171021)
{
if (node.Key.StartsWith("Capturable", StringComparison.Ordinal) || node.Key.StartsWith("ExternalCapturable", StringComparison.Ordinal))
{
// Type renamed to Types
var type = node.Value.Nodes.FirstOrDefault(n => n.Key == "Type");
if (type != null)
RenameNodeKey(type, "Types");
// Allow(Allies|Neutral|Enemies) replaced with a ValidStances enum
var stance = Stance.Neutral | Stance.Enemy;
var allowAllies = node.Value.Nodes.FirstOrDefault(n => n.Key == "AllowAllies");
if (allowAllies != null)
{
if (FieldLoader.GetValue<bool>("AllowAllies", allowAllies.Value.Value))
stance |= Stance.Ally;
else
stance &= ~Stance.Ally;
node.Value.Nodes.Remove(allowAllies);
}
var allowNeutral = node.Value.Nodes.FirstOrDefault(n => n.Key == "AllowNeutral");
if (allowNeutral != null)
{
if (FieldLoader.GetValue<bool>("AllowNeutral", allowNeutral.Value.Value))
stance |= Stance.Neutral;
else
stance &= ~Stance.Neutral;
node.Value.Nodes.Remove(allowNeutral);
}
var allowEnemies = node.Value.Nodes.FirstOrDefault(n => n.Key == "AllowEnemies");
if (allowEnemies != null)
{
if (FieldLoader.GetValue<bool>("AllowEnemies", allowEnemies.Value.Value))
stance |= Stance.Enemy;
else
stance &= ~Stance.Enemy;
node.Value.Nodes.Remove(allowEnemies);
}
if (stance != (Stance.Neutral | Stance.Enemy))
node.Value.Nodes.Add(new MiniYamlNode("ValidStances", stance.ToString()));
}
}
UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1);
}

View File

@@ -940,9 +940,9 @@
RequiresForceFire: yes
TargetTypes: Ground, Husk
Capturable:
Type: husk
AllowAllies: yes
Types: husk
CaptureThreshold: 100
ValidStances: Enemy, Neutral, Ally
TransformOnCapture:
ForceHealthPercentage: 25
Tooltip:

View File

@@ -20,7 +20,7 @@ World:
^TechBuilding:
Capturable:
Type: ~disabled
Types: ~disabled
powerproxy.paratroopers:
ParatroopersPower:

View File

@@ -20,7 +20,7 @@ World:
^TechBuilding:
Capturable:
Type: ~disabled
Types: ~disabled
powerproxy.paratroopers:
ParatroopersPower:

View File

@@ -81,7 +81,7 @@ TRUK.Hijackable:
TargetTypes: Ground, Repair, Vehicle, NoAutoTarget
-Huntable:
ExternalCapturable:
Type: MissionObjective
Types: MissionObjective
CaptureCompleteTime: 1
-DeliversCash:
RenderSprites:

View File

@@ -23,11 +23,9 @@ MISS:
Tooltip:
Name: Soviet Air Force HQ
Capturable:
Type: building
AllowAllies: False
AllowNeutral: False
AllowEnemies: True
Types: building
CaptureThreshold: 100
ValidStances: Enemy
E6.MOD:
Inherits: E6

View File

@@ -248,7 +248,7 @@
Tooltip:
GenericName: Vehicle
Capturable:
Type: vehicle
Types: vehicle
CaptureThreshold: 100
CancelActivity: True
CaptureNotification:
@@ -893,9 +893,9 @@
Burns:
Damage: 2
Capturable:
Type: husk
AllowAllies: true
Types: husk
CaptureThreshold: 100
ValidStances: Enemy, Neutral, Ally
TransformOnCapture:
ForceHealthPercentage: 25
WithColoredOverlay@IDISABLE:

View File

@@ -725,7 +725,7 @@
HiddenUnderFog:
ActorLostNotification:
Capturable:
Type: Vehicle
Types: Vehicle
CaptureThreshold: 100
CancelActivity: True
Guard: