Make captured hospitals in cnc/ra gradually heal all infantry units on the map
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
@@ -18,6 +19,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public readonly int Ticks = 5;
|
public readonly int Ticks = 5;
|
||||||
public readonly float HealIfBelow = .5f;
|
public readonly float HealIfBelow = .5f;
|
||||||
public readonly int DamageCooldown = 0;
|
public readonly int DamageCooldown = 0;
|
||||||
|
public readonly string RequiresTech = null;
|
||||||
|
|
||||||
public virtual object Create(ActorInitializer init) { return new SelfHealing(this); }
|
public virtual object Create(ActorInitializer init) { return new SelfHealing(this); }
|
||||||
}
|
}
|
||||||
@@ -35,6 +37,10 @@ namespace OpenRA.Mods.RA
|
|||||||
if (self.IsDead())
|
if (self.IsDead())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (Info.RequiresTech != null && !self.World.ActorsWithTrait<SelfHealingTech>()
|
||||||
|
.Any(a => !a.Actor.IsDead() && a.Actor.Owner.IsAlliedWith(self.Owner) && Info.RequiresTech == a.Trait.Type))
|
||||||
|
return;
|
||||||
|
|
||||||
var health = self.Trait<Health>();
|
var health = self.Trait<Health>();
|
||||||
if (health.HP >= Info.HealIfBelow*health.MaxHP)
|
if (health.HP >= Info.HealIfBelow*health.MaxHP)
|
||||||
return;
|
return;
|
||||||
@@ -52,10 +58,29 @@ namespace OpenRA.Mods.RA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Damaged (Actor self, AttackInfo e)
|
public void Damaged(Actor self, AttackInfo e)
|
||||||
{
|
{
|
||||||
if (e.Damage > 0)
|
if (e.Damage > 0)
|
||||||
damageTicks = Info.DamageCooldown;
|
damageTicks = Info.DamageCooldown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SelfHealingTechInfo : ITraitInfo
|
||||||
|
{
|
||||||
|
public readonly string Type = null;
|
||||||
|
|
||||||
|
public object Create(ActorInitializer init) { return new SelfHealingTech(this); }
|
||||||
|
}
|
||||||
|
|
||||||
|
class SelfHealingTech
|
||||||
|
{
|
||||||
|
public string Type { get { return info.Type; } }
|
||||||
|
|
||||||
|
readonly SelfHealingTechInfo info;
|
||||||
|
|
||||||
|
public SelfHealingTech(SelfHealingTechInfo info)
|
||||||
|
{
|
||||||
|
this.info = info;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,13 +146,16 @@
|
|||||||
Probability: 2
|
Probability: 2
|
||||||
CrushableInfantry:
|
CrushableInfantry:
|
||||||
WarnProbability: 60
|
WarnProbability: 60
|
||||||
RepairableNear:
|
|
||||||
Buildings: hosp
|
|
||||||
CloseEnough: 1
|
|
||||||
DebugMuzzlePositions:
|
DebugMuzzlePositions:
|
||||||
Guard:
|
Guard:
|
||||||
Guardable:
|
Guardable:
|
||||||
BodyOrientation:
|
BodyOrientation:
|
||||||
|
SelfHealing:
|
||||||
|
Step: 5
|
||||||
|
Ticks: 100
|
||||||
|
HealIfBelow: 1
|
||||||
|
DamageCooldown: 125
|
||||||
|
RequiresTech: InfantryHealing
|
||||||
|
|
||||||
^CivInfantry:
|
^CivInfantry:
|
||||||
Inherits: ^Infantry
|
Inherits: ^Infantry
|
||||||
|
|||||||
@@ -21,15 +21,20 @@ V19.Husk:
|
|||||||
|
|
||||||
# Hospital
|
# Hospital
|
||||||
HOSP:
|
HOSP:
|
||||||
Inherits: ^CivBuilding
|
Inherits: ^TechBuilding
|
||||||
|
Selectable:
|
||||||
|
Priority: 0
|
||||||
Building:
|
Building:
|
||||||
Footprint: xx xx
|
Footprint: xx xx
|
||||||
Dimensions: 2,2
|
Dimensions: 2,2
|
||||||
|
Health:
|
||||||
|
HP: 1000
|
||||||
|
SelfHealingTech:
|
||||||
|
Type: InfantryHealing
|
||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Hospital
|
Name: Hospital
|
||||||
LeavesHusk:
|
LeavesHusk:
|
||||||
HuskActor: HOSP.Husk
|
HuskActor: HOSP.Husk
|
||||||
RepairsUnits:
|
|
||||||
|
|
||||||
HOSP.Husk:
|
HOSP.Husk:
|
||||||
Inherits: ^CivBuildingHusk
|
Inherits: ^CivBuildingHusk
|
||||||
|
|||||||
@@ -72,12 +72,20 @@ FCOM:
|
|||||||
|
|
||||||
HOSP:
|
HOSP:
|
||||||
Inherits: ^TechBuilding
|
Inherits: ^TechBuilding
|
||||||
|
Selectable:
|
||||||
|
Priority: 0
|
||||||
Building:
|
Building:
|
||||||
Footprint: xx xx
|
Footprint: xx xx
|
||||||
Dimensions: 2,2
|
Dimensions: 2,2
|
||||||
|
Health:
|
||||||
|
HP: 1000
|
||||||
|
Capturable:
|
||||||
|
CapturableBar:
|
||||||
|
EngineerRepairable:
|
||||||
|
SelfHealingTech:
|
||||||
|
Type: InfantryHealing
|
||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Hospital
|
Name: Hospital
|
||||||
RepairsUnits:
|
|
||||||
|
|
||||||
V01:
|
V01:
|
||||||
Inherits: ^CivBuilding
|
Inherits: ^CivBuilding
|
||||||
@@ -299,8 +307,6 @@ OILB:
|
|||||||
Dimensions: 2,2
|
Dimensions: 2,2
|
||||||
Health:
|
Health:
|
||||||
HP: 1000
|
HP: 1000
|
||||||
Armor:
|
|
||||||
Type: Wood
|
|
||||||
Bib:
|
Bib:
|
||||||
RevealsShroud:
|
RevealsShroud:
|
||||||
Range: 3
|
Range: 3
|
||||||
|
|||||||
@@ -121,14 +121,17 @@
|
|||||||
Offset: 0,0,427
|
Offset: 0,0,427
|
||||||
CrushableInfantry:
|
CrushableInfantry:
|
||||||
CrushSound: squishy2.aud
|
CrushSound: squishy2.aud
|
||||||
RepairableNear:
|
|
||||||
Buildings: hosp
|
|
||||||
CloseEnough: 1
|
|
||||||
UpdatesPlayerStatistics:
|
UpdatesPlayerStatistics:
|
||||||
DebugMuzzlePositions:
|
DebugMuzzlePositions:
|
||||||
Guard:
|
Guard:
|
||||||
Guardable:
|
Guardable:
|
||||||
BodyOrientation:
|
BodyOrientation:
|
||||||
|
SelfHealing:
|
||||||
|
Step: 5
|
||||||
|
Ticks: 100
|
||||||
|
HealIfBelow: 1
|
||||||
|
DamageCooldown: 125
|
||||||
|
RequiresTech: InfantryHealing
|
||||||
|
|
||||||
^Ship:
|
^Ship:
|
||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
|
|||||||
Reference in New Issue
Block a user