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.Linq;
using System.Text; using System.Text;
using OpenRA.FileSystem; using OpenRA.FileSystem;
using OpenRA.Traits;
namespace OpenRA.Mods.Common.UtilityCommands 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); UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1);
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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