Setup Tiberian Sun forest fires.
This commit is contained in:
committed by
abcdefg30
parent
b54a724aea
commit
00356b8bbd
69
OpenRA.Mods.Common/Traits/Conditions/SpreadsCondition.cs
Normal file
69
OpenRA.Mods.Common/Traits/Conditions/SpreadsCondition.cs
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2022 The OpenRA Developers (see AUTHORS)
|
||||||
|
* 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.Linq;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.Common.Traits
|
||||||
|
{
|
||||||
|
[Desc("Any actor with this trait enabled has a chance to affect others with this trait.")]
|
||||||
|
public class SpreadsConditionInfo : ConditionalTraitInfo
|
||||||
|
{
|
||||||
|
[Desc("The chance this actor is going to affect an adjacent actor.")]
|
||||||
|
public readonly int Probability = 5;
|
||||||
|
|
||||||
|
[Desc("How far the condition can spread from one actor to another.")]
|
||||||
|
public readonly WDist Range = WDist.FromCells(3);
|
||||||
|
|
||||||
|
[GrantedConditionReference]
|
||||||
|
[Desc("Condition to grant onto another actor in range with the same trait.")]
|
||||||
|
public readonly string SpreadCondition = "spreading";
|
||||||
|
|
||||||
|
[Desc("Time in ticks to wait between spreading further.")]
|
||||||
|
public int Delay = 5;
|
||||||
|
|
||||||
|
public override object Create(ActorInitializer init) { return new SpreadsCondition(this); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SpreadsCondition : ConditionalTrait<SpreadsConditionInfo>, ITick
|
||||||
|
{
|
||||||
|
readonly SpreadsConditionInfo info;
|
||||||
|
|
||||||
|
int delay;
|
||||||
|
|
||||||
|
public SpreadsCondition(SpreadsConditionInfo info)
|
||||||
|
: base(info)
|
||||||
|
{
|
||||||
|
this.info = info;
|
||||||
|
delay = info.Delay;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ITick.Tick(Actor self)
|
||||||
|
{
|
||||||
|
if (IsTraitDisabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (delay-- > 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
delay = info.Delay;
|
||||||
|
|
||||||
|
if (self.World.SharedRandom.Next(100) > info.Probability)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var actorsInRange = self.World.FindActorsInCircle(self.CenterPosition, info.Range)
|
||||||
|
.Where(a => a.TraitOrDefault<SpreadsCondition>() != null);
|
||||||
|
|
||||||
|
var target = actorsInRange.RandomOrDefault(self.World.SharedRandom);
|
||||||
|
target?.GrantCondition(info.SpreadCondition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1035,8 +1035,9 @@
|
|||||||
|
|
||||||
^Tree:
|
^Tree:
|
||||||
Inherits@1: ^SpriteActor
|
Inherits@1: ^SpriteActor
|
||||||
|
Inherits@2: ^ExistsInWorld
|
||||||
Interactable:
|
Interactable:
|
||||||
HiddenUnderShroud:
|
FrozenUnderFog:
|
||||||
RenderSprites:
|
RenderSprites:
|
||||||
Palette: terraindecoration
|
Palette: terraindecoration
|
||||||
WithSpriteBody:
|
WithSpriteBody:
|
||||||
@@ -1049,6 +1050,34 @@
|
|||||||
Categories: Tree
|
Categories: Tree
|
||||||
RequiresSpecificOwners:
|
RequiresSpecificOwners:
|
||||||
ValidOwnerNames: Neutral
|
ValidOwnerNames: Neutral
|
||||||
|
HitShape:
|
||||||
|
Health:
|
||||||
|
HP: 200000
|
||||||
|
Armor:
|
||||||
|
Type: Wood
|
||||||
|
Targetable:
|
||||||
|
TargetTypes: Trees, NoAutoTarget
|
||||||
|
GrantConditionOnDamageState@Small:
|
||||||
|
Condition: small-fire
|
||||||
|
ValidDamageStates: Medium
|
||||||
|
GrantConditionOnDamageState@Large:
|
||||||
|
Condition: large-fire
|
||||||
|
ValidDamageStates: Heavy, Critical
|
||||||
|
WithIdleOverlay@SmallFire:
|
||||||
|
Image: fire2
|
||||||
|
Palette: effect
|
||||||
|
RequiresCondition: small-fire
|
||||||
|
WithIdleOverlay@LargeFire:
|
||||||
|
Image: fire1
|
||||||
|
Palette: effect
|
||||||
|
RequiresCondition: large-fire
|
||||||
|
SpreadsCondition@Fire:
|
||||||
|
RequiresCondition: small-fire || large-fire
|
||||||
|
SpreadCondition: burning
|
||||||
|
ChangesHealth:
|
||||||
|
StartIfBelow: 101
|
||||||
|
Step: -500
|
||||||
|
RequiresCondition: small-fire || large-fire || burning
|
||||||
|
|
||||||
^Rock:
|
^Rock:
|
||||||
Inherits@1: ^SpriteActor
|
Inherits@1: ^SpriteActor
|
||||||
|
|||||||
@@ -708,3 +708,17 @@ podring:
|
|||||||
Frames: 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19
|
Frames: 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19
|
||||||
Length: *
|
Length: *
|
||||||
AlphaFade: True
|
AlphaFade: True
|
||||||
|
|
||||||
|
fire1:
|
||||||
|
idle-overlay:
|
||||||
|
Length: 17
|
||||||
|
BlendMode: Translucent
|
||||||
|
Offset: 0, -24, 24
|
||||||
|
ZOffset: 1023
|
||||||
|
|
||||||
|
fire2:
|
||||||
|
idle-overlay:
|
||||||
|
Length: 17
|
||||||
|
BlendMode: Translucent
|
||||||
|
Offset: 0, -18, 18
|
||||||
|
ZOffset: 1023
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ Grenade:
|
|||||||
ReloadDelay: 60
|
ReloadDelay: 60
|
||||||
Range: 4c512
|
Range: 4c512
|
||||||
-Report:
|
-Report:
|
||||||
|
ValidTargets: Ground, Trees
|
||||||
Projectile: Bullet
|
Projectile: Bullet
|
||||||
Speed: 226
|
Speed: 226
|
||||||
Blockable: true
|
Blockable: true
|
||||||
@@ -150,6 +151,8 @@ Grenade:
|
|||||||
Light: 70
|
Light: 70
|
||||||
Concrete: 28
|
Concrete: 28
|
||||||
DamageTypes: Prone70Percent, TriggerProne, ExplosionDeath
|
DamageTypes: Prone70Percent, TriggerProne, ExplosionDeath
|
||||||
|
ValidTargets: Ground, Trees
|
||||||
Warhead@2Eff: CreateEffect
|
Warhead@2Eff: CreateEffect
|
||||||
Explosions: small_grey_explosion
|
Explosions: small_grey_explosion
|
||||||
ImpactSounds: expnew13.aud
|
ImpactSounds: expnew13.aud
|
||||||
|
ValidTargets: Ground, Trees
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ SonicZap:
|
|||||||
ReloadDelay: 180
|
ReloadDelay: 180
|
||||||
Range: 6c0
|
Range: 6c0
|
||||||
Report: sonic4.aud
|
Report: sonic4.aud
|
||||||
|
ValidTargets: Ground, Trees
|
||||||
Projectile: AreaBeam
|
Projectile: AreaBeam
|
||||||
Speed: 0c128
|
Speed: 0c128
|
||||||
Duration: 90
|
Duration: 90
|
||||||
@@ -74,6 +75,7 @@ SonicZap:
|
|||||||
Damage: 800
|
Damage: 800
|
||||||
AffectsParent: false
|
AffectsParent: false
|
||||||
ValidRelationships: Neutral, Enemy
|
ValidRelationships: Neutral, Enemy
|
||||||
|
ValidTargets: Ground, Trees
|
||||||
Versus:
|
Versus:
|
||||||
Heavy: 80
|
Heavy: 80
|
||||||
Concrete: 60
|
Concrete: 60
|
||||||
@@ -85,6 +87,7 @@ SonicZap:
|
|||||||
InvalidTargets: Disruptor # Does not affect friendly disruptors at all
|
InvalidTargets: Disruptor # Does not affect friendly disruptors at all
|
||||||
AffectsParent: false
|
AffectsParent: false
|
||||||
ValidRelationships: Ally
|
ValidRelationships: Ally
|
||||||
|
ValidTargets: Ground, Trees
|
||||||
Versus:
|
Versus:
|
||||||
Heavy: 80
|
Heavy: 80
|
||||||
Concrete: 60
|
Concrete: 60
|
||||||
@@ -113,6 +116,7 @@ SonicZap:
|
|||||||
|
|
||||||
CyCannon:
|
CyCannon:
|
||||||
Inherits: ^EnergyBlast
|
Inherits: ^EnergyBlast
|
||||||
|
ValidTargets: Ground, Trees
|
||||||
Projectile: Missile
|
Projectile: Missile
|
||||||
MaximumLaunchSpeed: 192
|
MaximumLaunchSpeed: 192
|
||||||
Blockable: false
|
Blockable: false
|
||||||
@@ -124,6 +128,7 @@ CyCannon:
|
|||||||
RangeLimit: 8c0
|
RangeLimit: 8c0
|
||||||
TerrainHeightAware: true
|
TerrainHeightAware: true
|
||||||
Warhead@1Dam: SpreadDamage
|
Warhead@1Dam: SpreadDamage
|
||||||
|
ValidTargets: Ground, Trees
|
||||||
Spread: 43
|
Spread: 43
|
||||||
Damage: 12000
|
Damage: 12000
|
||||||
Versus:
|
Versus:
|
||||||
@@ -133,6 +138,8 @@ CyCannon:
|
|||||||
Heavy: 150
|
Heavy: 150
|
||||||
Concrete: 80
|
Concrete: 80
|
||||||
DamageTypes: Prone350Percent, TriggerProne, EnergyDeath
|
DamageTypes: Prone350Percent, TriggerProne, EnergyDeath
|
||||||
|
Warhead@2Eff: CreateEffect
|
||||||
|
ValidTargets: Ground, Trees
|
||||||
|
|
||||||
Proton:
|
Proton:
|
||||||
Inherits: ^EnergyBlast
|
Inherits: ^EnergyBlast
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
FireballLauncher:
|
FireballLauncher:
|
||||||
|
ValidTargets: Ground, Trees
|
||||||
ReloadDelay: 50
|
ReloadDelay: 50
|
||||||
Range: 4c256
|
Range: 4c256
|
||||||
Report: flamtnk1.aud
|
Report: flamtnk1.aud
|
||||||
@@ -11,6 +12,7 @@ FireballLauncher:
|
|||||||
Warhead@1Dam: SpreadDamage
|
Warhead@1Dam: SpreadDamage
|
||||||
Spread: 288
|
Spread: 288
|
||||||
Falloff: 100, 50, 25, 12, 6, 3, 0
|
Falloff: 100, 50, 25, 12, 6, 3, 0
|
||||||
|
ValidTargets: Ground, Trees
|
||||||
Damage: 2500
|
Damage: 2500
|
||||||
Versus:
|
Versus:
|
||||||
None: 600
|
None: 600
|
||||||
@@ -29,6 +31,7 @@ Bomb:
|
|||||||
BurstDelays: 6
|
BurstDelays: 6
|
||||||
Range: 2c512
|
Range: 2c512
|
||||||
TargetActorCenter: true
|
TargetActorCenter: true
|
||||||
|
ValidTargets: Ground, Trees
|
||||||
Projectile: GravityBomb
|
Projectile: GravityBomb
|
||||||
Velocity: 72, 0, -90
|
Velocity: 72, 0, -90
|
||||||
Acceleration: 0, 0, -8
|
Acceleration: 0, 0, -8
|
||||||
@@ -46,10 +49,11 @@ Bomb:
|
|||||||
Heavy: 32
|
Heavy: 32
|
||||||
Concrete: 100
|
Concrete: 100
|
||||||
DamageTypes: Prone100Percent, TriggerProne, ExplosionDeath
|
DamageTypes: Prone100Percent, TriggerProne, ExplosionDeath
|
||||||
|
ValidTargets: Ground, Trees
|
||||||
Warhead@2Eff: CreateEffect
|
Warhead@2Eff: CreateEffect
|
||||||
Explosions: large_explosion
|
Explosions: large_explosion
|
||||||
ImpactSounds: expnew09.aud
|
ImpactSounds: expnew09.aud
|
||||||
ValidTargets: Ground, Air
|
ValidTargets: Ground, Trees, Air
|
||||||
Warhead@3EffWater: CreateEffect
|
Warhead@3EffWater: CreateEffect
|
||||||
Explosions: small_watersplash
|
Explosions: small_watersplash
|
||||||
ExplosionPalette: player
|
ExplosionPalette: player
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
MultiCluster:
|
MultiCluster:
|
||||||
Inherits: ^DefaultMissile
|
Inherits: ^DefaultMissile
|
||||||
ValidTargets: Ground, Water, Air
|
ValidTargets: Ground, Water, Air, Trees
|
||||||
Projectile: Missile
|
Projectile: Missile
|
||||||
MaximumLaunchSpeed: 120
|
MaximumLaunchSpeed: 120
|
||||||
Inaccuracy: 1c0
|
Inaccuracy: 1c0
|
||||||
@@ -14,7 +14,7 @@ MultiCluster:
|
|||||||
Warhead@1Dam: SpreadDamage
|
Warhead@1Dam: SpreadDamage
|
||||||
Spread: 216
|
Spread: 216
|
||||||
Damage: 13000
|
Damage: 13000
|
||||||
ValidTargets: Ground, Water, Air
|
ValidTargets: Ground, Water, Air, Trees
|
||||||
Versus:
|
Versus:
|
||||||
None: 100
|
None: 100
|
||||||
Wood: 85
|
Wood: 85
|
||||||
@@ -29,12 +29,12 @@ MultiCluster:
|
|||||||
Warhead@ResourceDestruction: DestroyResource
|
Warhead@ResourceDestruction: DestroyResource
|
||||||
|
|
||||||
ClusterMissile:
|
ClusterMissile:
|
||||||
ValidTargets: Ground, Water, Air
|
ValidTargets: Ground, Water, Air, Trees
|
||||||
Warhead@1Dam: SpreadDamage
|
Warhead@1Dam: SpreadDamage
|
||||||
Spread: 512
|
Spread: 512
|
||||||
Falloff: 100, 100, 0
|
Falloff: 100, 100, 0
|
||||||
Damage: 26000
|
Damage: 26000
|
||||||
ValidTargets: Ground, Water, Air
|
ValidTargets: Ground, Water, Air, Trees
|
||||||
Versus:
|
Versus:
|
||||||
None: 100
|
None: 100
|
||||||
Wood: 85
|
Wood: 85
|
||||||
@@ -69,7 +69,7 @@ SuicideBomb:
|
|||||||
ValidTargets: Vehicle, Building, Defense, Infantry
|
ValidTargets: Vehicle, Building, Defense, Infantry
|
||||||
|
|
||||||
IonCannon:
|
IonCannon:
|
||||||
ValidTargets: Ground, Water, Air
|
ValidTargets: Ground, Water, Air, Trees
|
||||||
Warhead@1Dam_impact: SpreadDamage
|
Warhead@1Dam_impact: SpreadDamage
|
||||||
Spread: 1c0
|
Spread: 1c0
|
||||||
Damage: 10000
|
Damage: 10000
|
||||||
@@ -81,7 +81,7 @@ IonCannon:
|
|||||||
Damage: 25000
|
Damage: 25000
|
||||||
Falloff: 100, 50, 25, 0
|
Falloff: 100, 50, 25, 0
|
||||||
Delay: 3
|
Delay: 3
|
||||||
ValidTargets: Ground, Water, Air
|
ValidTargets: Ground, Water, Air, Trees
|
||||||
DamageTypes: Prone50Percent, TriggerProne, EnergyDeath
|
DamageTypes: Prone50Percent, TriggerProne, EnergyDeath
|
||||||
Warhead@3Smu_area: LeaveSmudge
|
Warhead@3Smu_area: LeaveSmudge
|
||||||
SmudgeType: SmallScorch
|
SmudgeType: SmallScorch
|
||||||
|
|||||||
Reference in New Issue
Block a user