Migrate SelfHealing.HealIfBelow from float to int percentage
This commit is contained in:
@@ -18,7 +18,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
public readonly int Step = 5;
|
public readonly int Step = 5;
|
||||||
public readonly int Delay = 5;
|
public readonly int Delay = 5;
|
||||||
public readonly float HealIfBelow = .5f;
|
[Desc("Heal if current health is below this percentage of full health.")]
|
||||||
|
public readonly int HealIfBelow = 50;
|
||||||
public readonly int DamageCooldown = 0;
|
public readonly int DamageCooldown = 0;
|
||||||
|
|
||||||
public override object Create(ActorInitializer init) { return new SelfHealing(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new SelfHealing(init.Self, this); }
|
||||||
@@ -42,7 +43,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (self.IsDead || IsTraitDisabled)
|
if (self.IsDead || IsTraitDisabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (health.HP >= Info.HealIfBelow * health.MaxHP)
|
if (health.HP >= Info.HealIfBelow * health.MaxHP / 100)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (damageTicks > 0)
|
if (damageTicks > 0)
|
||||||
|
|||||||
@@ -692,6 +692,22 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Migrated SelfHealing to use int percentage instead of float
|
||||||
|
if (engineVersion < 20160325)
|
||||||
|
{
|
||||||
|
if (node.Key == "SelfHealing")
|
||||||
|
{
|
||||||
|
var healIfBelowNode = node.Value.Nodes.FirstOrDefault(x => x.Key == "HealIfBelow");
|
||||||
|
if (healIfBelowNode != null)
|
||||||
|
{
|
||||||
|
// The HealIfBelow value is now an int percentage, so multiply the float with 100.
|
||||||
|
var oldValue = FieldLoader.GetValue<float>("HealIfBelow", healIfBelowNode.Value.Value);
|
||||||
|
var newValue = (int)(oldValue * 100);
|
||||||
|
healIfBelowNode.Value.Value = newValue.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ RMBO.easy:
|
|||||||
HP: 300
|
HP: 300
|
||||||
SelfHealing:
|
SelfHealing:
|
||||||
Delay: 10
|
Delay: 10
|
||||||
HealIfBelow: 50%
|
HealIfBelow: 50
|
||||||
DamageCooldown: 200
|
DamageCooldown: 200
|
||||||
RenderSprites:
|
RenderSprites:
|
||||||
Image: RMBO
|
Image: RMBO
|
||||||
|
|||||||
@@ -411,7 +411,7 @@ HTNK:
|
|||||||
AutoTarget:
|
AutoTarget:
|
||||||
SelfHealing:
|
SelfHealing:
|
||||||
Delay: 10
|
Delay: 10
|
||||||
HealIfBelow: 50%
|
HealIfBelow: 50
|
||||||
DamageCooldown: 200
|
DamageCooldown: 200
|
||||||
SpawnActorOnDeath:
|
SpawnActorOnDeath:
|
||||||
Actor: HTNK.Husk
|
Actor: HTNK.Husk
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ carryall.reinforce:
|
|||||||
SelfHealing:
|
SelfHealing:
|
||||||
Step: 5
|
Step: 5
|
||||||
Delay: 3
|
Delay: 3
|
||||||
HealIfBelow: 50%
|
HealIfBelow: 50
|
||||||
|
|
||||||
carryall:
|
carryall:
|
||||||
Inherits: carryall.reinforce
|
Inherits: carryall.reinforce
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ mcv:
|
|||||||
SelfHealing:
|
SelfHealing:
|
||||||
Step: 5
|
Step: 5
|
||||||
Delay: 3
|
Delay: 3
|
||||||
HealIfBelow: 50%
|
HealIfBelow: 50
|
||||||
|
|
||||||
harvester:
|
harvester:
|
||||||
Inherits: ^Vehicle
|
Inherits: ^Vehicle
|
||||||
@@ -95,7 +95,7 @@ harvester:
|
|||||||
SelfHealing:
|
SelfHealing:
|
||||||
Step: 5
|
Step: 5
|
||||||
Delay: 3
|
Delay: 3
|
||||||
HealIfBelow: 50%
|
HealIfBelow: 50
|
||||||
|
|
||||||
trike:
|
trike:
|
||||||
Inherits: ^Vehicle
|
Inherits: ^Vehicle
|
||||||
@@ -336,7 +336,7 @@ devastator:
|
|||||||
SelfHealing:
|
SelfHealing:
|
||||||
Step: 5
|
Step: 5
|
||||||
Delay: 3
|
Delay: 3
|
||||||
HealIfBelow: 50%
|
HealIfBelow: 50
|
||||||
|
|
||||||
raider:
|
raider:
|
||||||
Inherits: ^Vehicle
|
Inherits: ^Vehicle
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ MINVV:
|
|||||||
SelfHealing:
|
SelfHealing:
|
||||||
Step: -1
|
Step: -1
|
||||||
Delay: 1
|
Delay: 1
|
||||||
HealIfBelow: 101%
|
HealIfBelow: 101
|
||||||
DamageCooldown: 0
|
DamageCooldown: 0
|
||||||
Explodes:
|
Explodes:
|
||||||
Weapon: CrateNuke
|
Weapon: CrateNuke
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ V2RL:
|
|||||||
SelfHealing:
|
SelfHealing:
|
||||||
Step: 2
|
Step: 2
|
||||||
Delay: 1
|
Delay: 1
|
||||||
HealIfBelow: 40%
|
HealIfBelow: 40
|
||||||
|
|
||||||
BADR.Bomber:
|
BADR.Bomber:
|
||||||
Health:
|
Health:
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ PBOX:
|
|||||||
SelfHealing:
|
SelfHealing:
|
||||||
Step: 1
|
Step: 1
|
||||||
Delay: 1
|
Delay: 1
|
||||||
HealIfBelow: 100%
|
HealIfBelow: 100
|
||||||
DamageCooldown: 150
|
DamageCooldown: 150
|
||||||
Selectable:
|
Selectable:
|
||||||
Bounds: 44,38,0,-4
|
Bounds: 44,38,0,-4
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ V2RL:
|
|||||||
SelfHealing:
|
SelfHealing:
|
||||||
Step: 1
|
Step: 1
|
||||||
Delay: 3
|
Delay: 3
|
||||||
HealIfBelow: 50%
|
HealIfBelow: 50
|
||||||
DamageCooldown: 150
|
DamageCooldown: 150
|
||||||
SelectionDecorations:
|
SelectionDecorations:
|
||||||
VisualBounds: 44,38,0,-4
|
VisualBounds: 44,38,0,-4
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
AutoTarget:
|
AutoTarget:
|
||||||
SelfHealing:
|
SelfHealing:
|
||||||
Delay: 10
|
Delay: 10
|
||||||
HealIfBelow: 50%
|
HealIfBelow: 50
|
||||||
DamageCooldown: 200
|
DamageCooldown: 200
|
||||||
WithVoxelTurret:
|
WithVoxelTurret:
|
||||||
WithVoxelBarrel:
|
WithVoxelBarrel:
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ WEED:
|
|||||||
HP: 600
|
HP: 600
|
||||||
SelfHealing:
|
SelfHealing:
|
||||||
Delay: 10
|
Delay: 10
|
||||||
HealIfBelow: 50%
|
HealIfBelow: 50
|
||||||
DamageCooldown: 200
|
DamageCooldown: 200
|
||||||
Armor:
|
Armor:
|
||||||
Type: Heavy
|
Type: Heavy
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ HARV:
|
|||||||
HP: 1000
|
HP: 1000
|
||||||
SelfHealing:
|
SelfHealing:
|
||||||
Delay: 10
|
Delay: 10
|
||||||
HealIfBelow: 50%
|
HealIfBelow: 50
|
||||||
DamageCooldown: 200
|
DamageCooldown: 200
|
||||||
Armor:
|
Armor:
|
||||||
Type: Heavy
|
Type: Heavy
|
||||||
|
|||||||
Reference in New Issue
Block a user