Add WithDamageOverlayPropertyRename update rule
Also make trees, ships and vehicles burn a random duration
This commit is contained in:
committed by
Gustas Kažukauskas
parent
58088ecabe
commit
d26b9a10ed
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
|
||||
[Desc("How many times should " + nameof(LoopSequence),
|
||||
" be played? A range can be provided to be randomly chosen from.")]
|
||||
public readonly int[] LoopCount = [2];
|
||||
public readonly int[] LoopCount = [1, 3];
|
||||
|
||||
[Desc("Initial delay before animation is enabled",
|
||||
"Two values indicate a random delay range.")]
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright (c) The OpenRA Developers and Contributors
|
||||
* 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.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
{
|
||||
public class WithDamageOverlayPropertyRename : UpdateRule, IBeforeUpdateActors
|
||||
{
|
||||
public override string Name => "Renamed `WithDamageOverlay`'s `IdleSequence` to `StartSequence`.";
|
||||
|
||||
public override string Description => "WithDamageOverlay's property `IdleSequence` was renamed to `StartSequence`"
|
||||
+ " and functionality of WithDamageOverlay changed.";
|
||||
|
||||
readonly List<(string, string)> hasIdleDefault = [];
|
||||
readonly List<(string, string)> hasEndDefault = [];
|
||||
|
||||
public IEnumerable<string> BeforeUpdateActors(ModData modData, List<MiniYamlNodeBuilder> resolvedActors)
|
||||
{
|
||||
foreach (var actorNode in resolvedActors)
|
||||
foreach (var damage in actorNode.ChildrenMatching("WithDamageOverlay"))
|
||||
if (damage.HasChild("IdleSequence") || damage.HasChild("StartSequence"))
|
||||
hasIdleDefault.Add((actorNode.Key, damage.Key));
|
||||
|
||||
foreach (var actorNode in resolvedActors)
|
||||
foreach (var damage in actorNode.ChildrenMatching("WithDamageOverlay"))
|
||||
if (damage.HasChild("EndSequence"))
|
||||
hasEndDefault.Add((actorNode.Key, damage.Key));
|
||||
|
||||
yield break;
|
||||
}
|
||||
|
||||
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNodeBuilder actorNode)
|
||||
{
|
||||
foreach (var damage in actorNode.ChildrenMatching("WithDamageOverlay"))
|
||||
{
|
||||
var renamed = false;
|
||||
foreach (var start in damage.ChildrenMatching("IdleSequence"))
|
||||
{
|
||||
start.RenameKey("StartSequence");
|
||||
renamed = true;
|
||||
}
|
||||
|
||||
if (!renamed && !hasIdleDefault.Contains((actorNode.Key, damage.Key)))
|
||||
damage.AddNode("StartSequence", "idle");
|
||||
|
||||
damage.AddNode("LoopCount", 1);
|
||||
|
||||
if (!hasEndDefault.Contains((actorNode.Key, damage.Key)))
|
||||
damage.AddNode("EndSequence", "end");
|
||||
}
|
||||
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,8 @@ namespace OpenRA.Mods.Common.UpdateRules
|
||||
new RemoveNegativeSequenceLength(),
|
||||
]),
|
||||
|
||||
new("release-20231010", "release-20250303", [
|
||||
new("release-20231010", "release-20250303",
|
||||
[
|
||||
new RemoveValidRelationsFromCapturable(),
|
||||
new ExtractResourceStorageFromHarvester(),
|
||||
new ReplacePaletteModifiers(),
|
||||
@@ -73,6 +74,9 @@ namespace OpenRA.Mods.Common.UpdateRules
|
||||
new RemoveBuildingInfoAllowPlacementOnResources(),
|
||||
new EditorMarkerTileLabels(),
|
||||
new RemoveBarracksTypesAndVehiclesTypesInBaseBuilderBotModule(),
|
||||
|
||||
// Execute these rules last to avoid premature yaml merge crashes.
|
||||
new WithDamageOverlayPropertyRename(),
|
||||
]),
|
||||
];
|
||||
|
||||
|
||||
@@ -252,6 +252,7 @@
|
||||
HiddenUnderFog:
|
||||
AttackMove:
|
||||
WithDamageOverlay:
|
||||
StartSequence: idle
|
||||
WithFacingSpriteBody:
|
||||
FireWarheadsOnDeath:
|
||||
Weapon: UnitExplodeSmall
|
||||
@@ -670,6 +671,7 @@
|
||||
TextNotification: notification-unit-lost
|
||||
AttackMove:
|
||||
WithDamageOverlay:
|
||||
StartSequence: idle
|
||||
FireWarheadsOnDeath:
|
||||
Weapon: UnitExplodeShip
|
||||
EmptyWeapon: UnitExplodeShip
|
||||
@@ -974,16 +976,28 @@
|
||||
Image: burn-s
|
||||
MinimumDamageState: Light
|
||||
MaximumDamageState: Medium
|
||||
StartSequence: start
|
||||
LoopCount: 1, 7
|
||||
InitialDelay: 0, 25
|
||||
EndSequence: end
|
||||
WithDamageOverlay@MediumBurn:
|
||||
DamageTypes: Incendiary
|
||||
Image: burn-m
|
||||
MinimumDamageState: Medium
|
||||
MaximumDamageState: Heavy
|
||||
StartSequence: start
|
||||
LoopCount: 1, 7
|
||||
InitialDelay: 0, 25
|
||||
EndSequence: end
|
||||
WithDamageOverlay@LargeBurn:
|
||||
DamageTypes: Incendiary
|
||||
Image: burn-l
|
||||
MinimumDamageState: Heavy
|
||||
MaximumDamageState: Dead
|
||||
StartSequence: start
|
||||
LoopCount: 1, 7
|
||||
InitialDelay: 0, 25
|
||||
EndSequence: end
|
||||
HiddenUnderShroud:
|
||||
HitShape:
|
||||
MapEditorData:
|
||||
|
||||
@@ -19,8 +19,8 @@ fire:
|
||||
burn-l:
|
||||
Defaults:
|
||||
Filename: burn-l.shp
|
||||
idle:
|
||||
Length: *
|
||||
start:
|
||||
Length: 16
|
||||
ZOffset: 512
|
||||
loop:
|
||||
Start: 16
|
||||
@@ -34,8 +34,8 @@ burn-l:
|
||||
burn-m:
|
||||
Defaults:
|
||||
Filename: burn-m.shp
|
||||
idle:
|
||||
Length: *
|
||||
start:
|
||||
Length: 16
|
||||
ZOffset: 512
|
||||
loop:
|
||||
Start: 16
|
||||
@@ -49,8 +49,8 @@ burn-m:
|
||||
burn-s:
|
||||
Defaults:
|
||||
Filename: burn-s.shp
|
||||
idle:
|
||||
Length: *
|
||||
start:
|
||||
Length: 12
|
||||
ZOffset: 512
|
||||
loop:
|
||||
Start: 12
|
||||
@@ -73,15 +73,15 @@ smoke_m:
|
||||
Length: *
|
||||
Offset: 2, -5
|
||||
ZOffset: 512
|
||||
start:
|
||||
Length: 49
|
||||
Offset: 2, -5
|
||||
ZOffset: 512
|
||||
loop:
|
||||
Start: 49
|
||||
Length: 42
|
||||
Offset: 2, -5
|
||||
ZOffset: 512
|
||||
end:
|
||||
Frames: 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
|
||||
Offset: 2, -5
|
||||
ZOffset: 512
|
||||
|
||||
scorch_flames:
|
||||
large_flame:
|
||||
|
||||
@@ -274,6 +274,7 @@
|
||||
GpsDot:
|
||||
String: Vehicle
|
||||
WithDamageOverlay:
|
||||
StartSequence: start
|
||||
Guard:
|
||||
Guardable:
|
||||
Tooltip:
|
||||
@@ -536,6 +537,7 @@
|
||||
GpsDot:
|
||||
String: Ship
|
||||
WithDamageOverlay:
|
||||
StartSequence: start
|
||||
FireWarheadsOnDeath:
|
||||
Weapon: UnitExplodeShip
|
||||
EmptyWeapon: UnitExplodeShip
|
||||
@@ -575,6 +577,7 @@
|
||||
-MustBeDestroyed:
|
||||
WithDamageOverlay:
|
||||
MinimumDamageState: Critical
|
||||
StartSequence: start
|
||||
|
||||
^NeutralPlane:
|
||||
Inherits@1: ^ExistsInWorld
|
||||
@@ -984,18 +987,30 @@
|
||||
Palette: effect
|
||||
MinimumDamageState: Light
|
||||
MaximumDamageState: Medium
|
||||
StartSequence: start
|
||||
LoopCount: 1, 5
|
||||
InitialDelay: 0, 25
|
||||
EndSequence: end
|
||||
WithDamageOverlay@MediumBurn:
|
||||
DamageTypes: Incendiary
|
||||
Image: burn-m
|
||||
Palette: effect
|
||||
MinimumDamageState: Medium
|
||||
MaximumDamageState: Heavy
|
||||
StartSequence: start
|
||||
LoopCount: 1, 5
|
||||
InitialDelay: 0, 25
|
||||
EndSequence: end
|
||||
WithDamageOverlay@LargeBurn:
|
||||
DamageTypes: Incendiary
|
||||
Image: burn-l
|
||||
Palette: effect
|
||||
MinimumDamageState: Heavy
|
||||
MaximumDamageState: Dead
|
||||
StartSequence: start
|
||||
LoopCount: 1, 5
|
||||
InitialDelay: 0, 25
|
||||
EndSequence: end
|
||||
HiddenUnderShroud:
|
||||
MapEditorData:
|
||||
ExcludeTilesets: INTERIOR
|
||||
|
||||
@@ -83,8 +83,8 @@ explosion:
|
||||
burn-l:
|
||||
Defaults:
|
||||
Filename: burn-l.shp
|
||||
idle:
|
||||
Length: *
|
||||
start:
|
||||
Length: 16
|
||||
ZOffset: 512
|
||||
loop:
|
||||
Start: 16
|
||||
@@ -98,8 +98,8 @@ burn-l:
|
||||
burn-m:
|
||||
Defaults:
|
||||
Filename: burn-m.shp
|
||||
idle:
|
||||
Length: *
|
||||
start:
|
||||
Length: 16
|
||||
ZOffset: 512
|
||||
loop:
|
||||
Start: 16
|
||||
@@ -113,8 +113,8 @@ burn-m:
|
||||
burn-s:
|
||||
Defaults:
|
||||
Filename: burn-s.shp
|
||||
idle:
|
||||
Length: *
|
||||
start:
|
||||
Length: 12
|
||||
ZOffset: 512
|
||||
loop:
|
||||
Start: 12
|
||||
@@ -226,15 +226,15 @@ smoke_m:
|
||||
Length: *
|
||||
Offset: 2, -5
|
||||
ZOffset: 512
|
||||
start:
|
||||
Length: 49
|
||||
Offset: 2, -5
|
||||
ZOffset: 512
|
||||
loop:
|
||||
Start: 49
|
||||
Length: 42
|
||||
Offset: 2, -5
|
||||
ZOffset: 512
|
||||
end:
|
||||
Frames: 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
|
||||
Offset: 2, -5
|
||||
ZOffset: 512
|
||||
|
||||
scorch_flames:
|
||||
large_flame:
|
||||
|
||||
Reference in New Issue
Block a user