Merge pull request #11634 from GraionDilach/fixup-damagedbyterrain

Fixup DamagedByTerrain.
This commit is contained in:
Matthias Mailänder
2016-07-27 09:33:40 +02:00
committed by GitHub
17 changed files with 118 additions and 197 deletions

View File

@@ -1,4 +1,4 @@
#region Copyright & License Information
#region Copyright & License Information
/*
* Copyright 2007-2016 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
@@ -9,6 +9,7 @@
*/
#endregion
using System.Collections.Generic;
using System.Linq;
using OpenRA.GameRules;
using OpenRA.Traits;
@@ -16,10 +17,16 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("This actor receives damage from the given weapon when on the specified terrain type.")]
class DamagedByTerrainInfo : UpgradableTraitInfo, IRulesetLoaded, Requires<HealthInfo>
class DamagedByTerrainInfo : UpgradableTraitInfo, Requires<HealthInfo>
{
[Desc("The weapon which is used to damage the actor.")]
[WeaponReference, FieldLoader.Require] public readonly string Weapon;
[Desc("Amount of damage received per DamageInterval ticks.")]
[FieldLoader.Require] public readonly int Damage = 0;
[Desc("Delay between receiving damage.")]
public readonly int DamageInterval = 0;
[Desc("Apply the damage using these damagetypes.")]
public readonly HashSet<string> DamageTypes = new HashSet<string>();
[Desc("Terrain types where the actor will take damage.")]
[FieldLoader.Require] public readonly string[] Terrain = { };
@@ -30,10 +37,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Inflict damage down to the DamageThreshold when the actor gets created on damaging terrain.")]
public readonly bool StartOnThreshold = false;
public WeaponInfo WeaponInfo { get; private set; }
public override object Create(ActorInitializer init) { return new DamagedByTerrain(init.Self, this); }
public void RulesetLoaded(Ruleset rules, ActorInfo ai) { WeaponInfo = rules.Weapons[Weapon.ToLowerInvariant()]; }
}
class DamagedByTerrain : UpgradableTrait<DamagedByTerrainInfo>, ITick, ISync, INotifyAddedToWorld
@@ -70,7 +74,7 @@ namespace OpenRA.Mods.Common.Traits
// Actors start with maximum damage applied
var delta = health.HP - damageThreshold;
if (delta > 0)
health.InflictDamage(self, self.World.WorldActor, new Damage(delta), false);
self.InflictDamage(self.World.WorldActor, new Damage(delta, Info.DamageTypes));
}
public void Tick(Actor self)
@@ -86,8 +90,8 @@ namespace OpenRA.Mods.Common.Traits
if (!Info.Terrain.Contains(t.Type))
return;
Info.WeaponInfo.Impact(Target.FromActor(self), self.World.WorldActor, Enumerable.Empty<int>());
damageTicks = Info.WeaponInfo.ReloadDelay;
self.InflictDamage(self.World.WorldActor, new Damage(Info.Damage, Info.DamageTypes));
damageTicks = Info.DamageInterval;
}
}
}

View File

@@ -234,8 +234,9 @@ namespace OpenRA.Mods.Common.UtilityCommands
else
node.Value.Nodes.Add(new MiniYamlNode("Terrain", new MiniYaml("Tiberium, BlueTiberium")));
if (!node.Value.Nodes.Any(a => a.Key == "Weapon"))
node.Value.Nodes.Add(new MiniYamlNode("Weapon", new MiniYaml("Tiberium")));
Console.WriteLine("PoisonedByTiberium: Weapon isn't converted. Copy out the appropriate");
Console.WriteLine("weapon's Damage, ReloadDelay and DamageTypes to DamagedByTerrain's Damage,");
Console.WriteLine("DamageInterval and DamageTypes, respectively, then remove the Weapon tag.");
}
}
@@ -244,8 +245,9 @@ namespace OpenRA.Mods.Common.UtilityCommands
node.Key = node.Key.Replace("DamagedWithoutFoundation", "DamagedByTerrain");
if (!node.Key.StartsWith("-"))
{
if (!node.Value.Nodes.Any(a => a.Key == "Weapon"))
node.Value.Nodes.Add(new MiniYamlNode("Weapon", new MiniYaml("weathering")));
Console.WriteLine("DamagedWithoutFoundation: Weapon isn't converted. Copy out the appropriate");
Console.WriteLine("weapon's Damage, ReloadDelay and DamageTypes to DamagedByTerrain's Damage,");
Console.WriteLine("DamageInterval and DamageTypes, respectively, then remove the Weapon tag.");
Console.WriteLine("SafeTerrain isn't converted. Setup an inverted check using Terrain.");

View File

@@ -215,7 +215,9 @@
UpgradeTypes: hazmatsuits
UpgradeMaxEnabledLevel: 0
Terrain: Tiberium, BlueTiberium
Weapon: Tiberium
Damage: 2
DamageInterval: 16
DamageTypes: TiberiumDeath
GlobalUpgradable@BIO:
Upgrades: hazmatsuits
Prerequisites: bio
@@ -420,7 +422,9 @@
Voice: Move
Guardable:
DamagedByTerrain:
Weapon: Heal
Damage: -1
DamageInterval: 4
DamageTypes: TiberiumDeath
Terrain: Tiberium, BlueTiberium
Voiced:
VoiceSet: DinoVoice

View File

@@ -144,13 +144,6 @@ Laser:
SmudgeType: Scorch
InvalidTargets: Vehicle, Structure, Wall, Husk, Trees, Creep
Tiberium:
ReloadDelay: 16
Warhead@1Dam: SpreadDamage
Spread: 42
Damage: 2
DamageTypes: TiberiumDeath
TiberiumExplosion:
Warhead@1Dam: SpreadDamage
Spread: 9
@@ -168,12 +161,6 @@ TiberiumExplosion:
Explosions: chemball
ImpactSounds: xplosml2.aud
Heal:
ReloadDelay: 4
Warhead@1Dam: SpreadDamage
Spread: 42
Damage: -1
Tail:
ReloadDelay: 30
Range: 1c0

View File

@@ -280,7 +280,8 @@
WithCrumbleOverlay:
Demolishable:
DamagedByTerrain:
Weapon: weathering
Damage: 10
DamageInterval: 100
Terrain: Rock
DamageThreshold: 50
StartOnThreshold: true

View File

@@ -216,11 +216,6 @@ grenade:
Explosions: med_explosion
ImpactSounds: EXPLLG5.WAV
Weathering:
ReloadDelay: 100
Warhead@1Dam: SpreadDamage
Damage: 10
GrenDeath:
Warhead@1Dam: SpreadDamage
Spread: 320

View File

@@ -25,6 +25,7 @@ WEEDGUY:
UMAGON:
Inherits: ^Soldier
Inherits@2: ^HealsOnTiberium
Valued:
Cost: 400
Tooltip:
@@ -35,9 +36,6 @@ UMAGON:
Speed: 71
Health:
HP: 150
DamagedByTerrain:
Weapon: TiberiumHeal
Terrain: Tiberium, BlueTiberium
Passenger:
RevealsShroud:
Range: 7c0
@@ -83,6 +81,7 @@ CHAMSPY:
MUTANT:
Inherits: ^Soldier
Inherits@2: ^HealsOnTiberium
Valued:
Cost: 100
Tooltip:
@@ -91,9 +90,6 @@ MUTANT:
VoiceSet: Mutant
Health:
HP: 50
DamagedByTerrain:
Weapon: TiberiumHeal
Terrain: Tiberium, BlueTiberium
Mobile:
Speed: 56
RevealsShroud:
@@ -109,6 +105,7 @@ MUTANT:
MWMN:
Inherits: ^Soldier
Inherits@2: ^HealsOnTiberium
Valued:
Cost: 100
Tooltip:
@@ -117,9 +114,6 @@ MWMN:
VoiceSet: CivilianFemale
Health:
HP: 50
DamagedByTerrain:
Weapon: TiberiumHeal
Terrain: Tiberium, BlueTiberium
Mobile:
Speed: 56
RevealsShroud:
@@ -135,6 +129,7 @@ MWMN:
MUTANT3:
Inherits: ^Soldier
Inherits@2: ^HealsOnTiberium
Valued:
Cost: 100
Tooltip:
@@ -143,9 +138,6 @@ MUTANT3:
VoiceSet: Mutant
Health:
HP: 50
DamagedByTerrain:
Weapon: TiberiumHeal
Terrain: Tiberium, BlueTiberium
Mobile:
Speed: 56
RevealsShroud:
@@ -161,6 +153,7 @@ MUTANT3:
TRATOS:
Inherits: ^Soldier
Inherits@2: ^HealsOnTiberium
Valued:
Cost: 100
Tooltip:
@@ -169,9 +162,6 @@ TRATOS:
VoiceSet: Tratos
Health:
HP: 200
DamagedByTerrain:
Weapon: TiberiumHeal
Terrain: Tiberium, BlueTiberium
Mobile:
Speed: 71
RevealsShroud:
@@ -219,15 +209,13 @@ SLAV:
DOGGIE:
Inherits@1: ^Infantry
Inherits@2: ^RegularInfantryDeath
Inherits@3: ^HealsOnTiberium
Tooltip:
Name: Tiberian Fiend
Health:
HP: 250
Shape: Circle
Radius: 213
DamagedByTerrain:
Weapon: TiberiumHeal
Terrain: Tiberium, BlueTiberium
Valued:
Cost: 100
Armor:

View File

@@ -288,7 +288,9 @@
ActorLostNotification:
DamagedByTerrain:
Terrain: Tiberium, BlueTiberium
Weapon: Tiberium
Damage: 2
DamageInterval: 16
DamageTypes: ExplosionDeath, TriggerVisceroid
Guard:
Voice: Move
Guardable:
@@ -376,6 +378,7 @@
^Cyborg:
Inherits@1: ^Infantry
Inherits@2: ^EmpDisableMobile
Inherits@3: ^HealsOnTiberium
ExplosionOnDamageTransition:
Weapon: CyborgExplode
DamageState: Critical
@@ -387,9 +390,6 @@
RevealsShroud:
Range: 4c0
MustBeDestroyed:
DamagedByTerrain:
Weapon: TiberiumHeal
Terrain: Tiberium, BlueTiberium
WithPermanentInjury:
WithInfantryBody:
AttackSequence: attack
@@ -419,6 +419,7 @@
Inherits@2: ^ExistsInWorld
Inherits@3: ^EmpDisableMobile
Inherits@4: ^Cloakable
Inherits@5: ^DamagedByVeins
DrawLineToTarget:
Mobile:
Crushes: crate
@@ -470,9 +471,6 @@
Weapons: SmallDebris
Pieces: 3, 7
Range: 2c0, 5c0
DamagedByTerrain:
Weapon: Veins
Terrain: Veins
UpgradeOnDamage@DAMAGED:
Upgrades: damagedspeed
ValidDamageStates: Heavy
@@ -609,6 +607,7 @@
^Visceroid:
Inherits@1: ^ExistsInWorld
Inherits@2: ^SpriteActor
Inherits@3: ^HealsOnTiberium
DrawLineToTarget:
Health:
Shape: Circle
@@ -638,9 +637,6 @@
TargetTypes: Ground, Creep
AttackMove:
HiddenUnderFog:
DamagedByTerrain:
Weapon: TiberiumHeal
Terrain: Tiberium, BlueTiberium
Guardable:
WithSpriteBody:
@@ -871,3 +867,23 @@
WallConnections: 0,-1, 0,3
LineBuildNode:
Connections: 0,-1, 0,1
^HealsOnTiberium:
DamagedByTerrain:
Damage: -2
DamageInterval: 16
Terrain: Tiberium, BlueTiberium
^DamagedByVeins:
DamagedByTerrain@VEINS:
Damage: 5
DamageInterval: 16
DamageTypes: BulletDeath
Terrain: Veins
UpgradeOnTerrain@VEINS:
TerrainTypes: Veins
Upgrades: veins
WithIdleOverlay@VEINS:
Sequence: veins
UpgradeTypes: veins
UpgradeMinEnabledLevel: 1

View File

@@ -95,6 +95,7 @@ JUMPJET:
GHOST:
Inherits: ^Soldier
Inherits@2: ^HealsOnTiberium
Valued:
Cost: 1750
Tooltip:
@@ -113,9 +114,6 @@ GHOST:
Speed: 56
Health:
HP: 200
DamagedByTerrain:
Weapon: TiberiumHeal
Terrain: Tiberium, BlueTiberium
Passenger:
RevealsShroud:
Range: 6c0

View File

@@ -93,7 +93,9 @@ HVR:
TrailWhileStationary: True
StationaryInterval: 18
MovingInterval: 6
-DamagedByTerrain:
-DamagedByTerrain@VEINS:
-UpgradeOnTerrain@VEINS:
-WithIdleOverlay@VEINS:
SMECH:
Inherits: ^Vehicle
@@ -132,7 +134,9 @@ SMECH:
MoveSequence: run
Selectable:
Bounds: 20, 32, 0, -8
-DamagedByTerrain:
-DamagedByTerrain@VEINS:
-UpgradeOnTerrain@VEINS:
-WithIdleOverlay@VEINS:
MMCH:
Inherits: ^Tank

View File

@@ -95,6 +95,7 @@ CYC2:
MHIJACK:
Inherits: ^Soldier
Inherits@2: ^HealsOnTiberium
Buildable:
Queue: Infantry
BuildPaletteOrder: 60
@@ -109,9 +110,6 @@ MHIJACK:
VoiceSet: Hijacker
Health:
HP: 300
DamagedByTerrain:
Weapon: TiberiumHeal
Terrain: Tiberium, BlueTiberium
Mobile:
Speed: 99
-Crushable:

View File

@@ -27,7 +27,9 @@ BGGY:
Voice: Attack
AutoTarget:
WithMuzzleOverlay:
-DamagedByTerrain:
-DamagedByTerrain@VEINS:
-UpgradeOnTerrain@VEINS:
-WithIdleOverlay@VEINS:
BIKE:
Inherits: ^VoxelVehicle
@@ -257,7 +259,9 @@ WEED:
-WithVoxelBody:
WithVoxelUnloadBody:
-GainsExperience:
-DamagedByTerrain:
-DamagedByTerrain@VEINS:
-UpgradeOnTerrain@VEINS:
-WithIdleOverlay@VEINS:
SAPC:
Inherits: ^VoxelTank

View File

@@ -96,7 +96,9 @@ HARV:
FactionImages:
gdi: harv.gdi
nod: harv.nod
-DamagedByTerrain:
-DamagedByTerrain@VEINS:
-UpgradeOnTerrain@VEINS:
-WithIdleOverlay@VEINS:
LPST:
Inherits: ^VoxelTank

View File

@@ -168,10 +168,6 @@ explosion:
small_grey_explosion: xgrysml2
medium_grey_explosion: xgrymed1
large_grey_explosion: xgrymed2
veins: veinatac
Length: 12
UseTilesetExtension: true
ZOffset: 1023
discus:
idle:

View File

@@ -1,51 +1,48 @@
mcv.gdi:
^VehicleOverlays:
emp-overlay: emp_fx01
Length: *
BlendMode: Additive
veins: veinatac
Length: 12
UseTilesetExtension: true
ZOffset: 1023
Offset: 0, -12
mcv.gdi:
Inherits: ^VehicleOverlays
icon: sidebar-gdi|mcvicon
mcv.nod:
emp-overlay: emp_fx01
Length: *
BlendMode: Additive
Inherits: ^VehicleOverlays
icon: sidebar-nod|mcvicon
apc:
emp-overlay: emp_fx01
Length: *
BlendMode: Additive
Inherits: ^VehicleOverlays
icon: apcicon
harv.gdi:
emp-overlay: emp_fx01
Length: *
BlendMode: Additive
Inherits: ^VehicleOverlays
harvest: harvestr
Length: *
icon: sidebar-gdi|harvicon
harv.nod:
emp-overlay: emp_fx01
Length: *
BlendMode: Additive
Inherits: ^VehicleOverlays
harvest: harvestr
Length: *
icon: sidebar-nod|harvicon
hvr:
emp-overlay: emp_fx01
Length: *
BlendMode: Additive
Inherits: ^VehicleOverlays
icon: hovricon
4tnk:
emp-overlay: emp_fx01
Length: *
BlendMode: Additive
Inherits: ^VehicleOverlays
muzzle: gunfire
Length: *
lpst.gdi:
Inherits: ^VehicleOverlays
idle: gadpsa
Offset: 0, -12
ShadowStart: 3
@@ -53,12 +50,10 @@ lpst.gdi:
Offset: 0, -12
Length: 36
ShadowStart: 36
emp-overlay: emp_fx01
Length: *
BlendMode: Additive
icon: sidebar-gdi|lpsticon
lpst.nod:
Inherits: ^VehicleOverlays
idle: gadpsa
Offset: 0, -12
ShadowStart: 3
@@ -66,42 +61,30 @@ lpst.nod:
Offset: 0, -12
Length: 36
ShadowStart: 36
emp-overlay: emp_fx01
Length: *
BlendMode: Additive
icon: sidebar-nod|lpsticon
repair:
emp-overlay: emp_fx01
Length: *
BlendMode: Additive
Inherits: ^VehicleOverlays
icon: rboticon
art2:
emp-overlay: emp_fx01
Length: *
BlendMode: Additive
Inherits: ^VehicleOverlays
icon: artyicon
weed:
emp-overlay: emp_fx01
Length: *
BlendMode: Additive
Inherits: ^VehicleOverlays
icon: weedicon
hmec:
emp-overlay: emp_fx01
Length: *
BlendMode: Additive
Inherits: ^VehicleOverlays
icon: hmecicon
bike:
emp-overlay: emp_fx01
Length: *
BlendMode: Additive
Inherits: ^VehicleOverlays
icon: cyclicon
bggy:
Inherits: ^VehicleOverlays
Defaults:
Length: *
muzzle0: mgun-n
@@ -112,29 +95,22 @@ bggy:
muzzle5: mgun-se
muzzle6: mgun-e
muzzle7: mgun-ne
emp-overlay: emp_fx01
BlendMode: Additive
icon: bggyicon
sapc:
emp-overlay: emp_fx01
Length: *
BlendMode: Additive
Inherits: ^VehicleOverlays
icon: sapcicon
subtank:
emp-overlay: emp_fx01
Length: *
BlendMode: Additive
Inherits: ^VehicleOverlays
icon: subticon
sonic:
emp-overlay: emp_fx01
Length: *
BlendMode: Additive
Inherits: ^VehicleOverlays
icon: soniicon
ttnk:
Inherits: ^VehicleOverlays
idle: gatick
ShadowStart: 3
Offset: 0, -12
@@ -148,18 +124,14 @@ ttnk:
Offset: 0, -12
muzzle: gunfire
Length: *
emp-overlay: emp_fx01
Length: *
BlendMode: Additive
icon: tickicon
stnk:
emp-overlay: emp_fx01
Length: *
BlendMode: Additive
Inherits: ^VehicleOverlays
icon: stnkicon
mmch:
Inherits: ^VehicleOverlays
stand:
Facings: -8
Stride: 15
@@ -173,21 +145,17 @@ mmch:
Facings: -32
muzzle: gunfire
Length: *
emp-overlay: emp_fx01
Length: *
BlendMode: Additive
icon: mmchicon
gghunt:
Inherits: ^VehicleOverlays
idle:
Facings: 1
Length: 8
ShadowStart: 8
emp-overlay: emp_fx01
Length: *
BlendMode: Additive
smech:
Inherits: ^VehicleOverlays
Defaults:
Offset: 0,0,8
stand:
@@ -204,67 +172,34 @@ smech:
Facings: -8
ShadowStart: 240
Tick: 100
emp-overlay: emp_fx01
Length: *
BlendMode: Additive
icon: smchicon
trucka:
emp-overlay: emp_fx01
Length: *
ZOffset: 512
BlendMode: Additive
Inherits: ^VehicleOverlays
truckb:
emp-overlay: emp_fx01
Length: *
ZOffset: 512
BlendMode: Additive
Inherits: ^VehicleOverlays
icbm:
emp-overlay: emp_fx01
Length: *
ZOffset: 512
BlendMode: Additive
Inherits: ^VehicleOverlays
bus:
emp-overlay: emp_fx01
Length: *
ZOffset: 512
BlendMode: Additive
Inherits: ^VehicleOverlays
pick:
emp-overlay: emp_fx01
Length: *
ZOffset: 512
BlendMode: Additive
Inherits: ^VehicleOverlays
car:
emp-overlay: emp_fx01
Length: *
ZOffset: 512
BlendMode: Additive
Inherits: ^VehicleOverlays
wini:
emp-overlay: emp_fx01
Length: *
ZOffset: 512
BlendMode: Additive
Inherits: ^VehicleOverlays
locomotive:
emp-overlay: emp_fx01
Length: *
ZOffset: 512
BlendMode: Additive
Inherits: ^VehicleOverlays
traincar:
emp-overlay: emp_fx01
Length: *
ZOffset: 512
BlendMode: Additive
Inherits: ^VehicleOverlays
cargocar:
emp-overlay: emp_fx01
Length: *
ZOffset: 512
BlendMode: Additive
Inherits: ^VehicleOverlays

View File

@@ -23,9 +23,3 @@ Repair:
Spread: 213
Damage: -50
ValidTargets: Repair
TiberiumHeal:
ReloadDelay: 16
Warhead@1Dam: SpreadDamage
Spread: 42
Damage: -2

View File

@@ -61,13 +61,6 @@ SlimeAttack:
Concrete: 20
DamageTypes: Prone100Percent, TriggerProne, SmallExplosionDeath
Tiberium:
ReloadDelay: 16
Warhead@1Dam: SpreadDamage
Spread: 42
Damage: 2
DamageTypes: ExplosionDeath, TriggerVisceroid
Veins:
ReloadDelay: 16
Warhead@Damage: SpreadDamage