Remove CrateEffect in favor of using updated SpriteEffect
This commit is contained in:
@@ -1,48 +0,0 @@
|
|||||||
#region Copyright & License Information
|
|
||||||
/*
|
|
||||||
* Copyright 2007-2018 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.Collections.Generic;
|
|
||||||
using OpenRA.Effects;
|
|
||||||
using OpenRA.Graphics;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Effects
|
|
||||||
{
|
|
||||||
public class CrateEffect : IEffect, ISpatiallyPartitionable
|
|
||||||
{
|
|
||||||
readonly string palette;
|
|
||||||
readonly Actor a;
|
|
||||||
readonly Animation anim;
|
|
||||||
|
|
||||||
public CrateEffect(Actor a, string seq, string palette)
|
|
||||||
{
|
|
||||||
this.a = a;
|
|
||||||
this.palette = palette;
|
|
||||||
|
|
||||||
anim = new Animation(a.World, "crate-effects");
|
|
||||||
anim.PlayThen(seq, () => a.World.AddFrameEndTask(w => { w.Remove(this); w.ScreenMap.Remove(this); }));
|
|
||||||
a.World.ScreenMap.Add(this, a.CenterPosition, anim.Image);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Tick(World world)
|
|
||||||
{
|
|
||||||
anim.Tick();
|
|
||||||
world.ScreenMap.Update(this, a.CenterPosition, anim.Image);
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<IRenderable> Render(WorldRenderer wr)
|
|
||||||
{
|
|
||||||
if (!a.IsInWorld || a.World.FogObscures(a.CenterPosition))
|
|
||||||
return SpriteRenderable.None;
|
|
||||||
|
|
||||||
return anim.Render(a.CenterPosition, wr.Palette(palette));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -139,7 +139,6 @@
|
|||||||
<Compile Include="AudioLoaders\WavLoader.cs" />
|
<Compile Include="AudioLoaders\WavLoader.cs" />
|
||||||
<Compile Include="Effects\Beacon.cs" />
|
<Compile Include="Effects\Beacon.cs" />
|
||||||
<Compile Include="Effects\ContrailFader.cs" />
|
<Compile Include="Effects\ContrailFader.cs" />
|
||||||
<Compile Include="Effects\CrateEffect.cs" />
|
|
||||||
<Compile Include="Effects\RevealShroudEffect.cs" />
|
<Compile Include="Effects\RevealShroudEffect.cs" />
|
||||||
<Compile Include="Effects\FlashTarget.cs" />
|
<Compile Include="Effects\FlashTarget.cs" />
|
||||||
<Compile Include="Effects\FloatingText.cs" />
|
<Compile Include="Effects\FloatingText.cs" />
|
||||||
@@ -942,6 +941,7 @@
|
|||||||
<Compile Include="UpdateRules\Rules\20180923\AddRearmable.cs" />
|
<Compile Include="UpdateRules\Rules\20180923\AddRearmable.cs" />
|
||||||
<Compile Include="UpdateRules\Rules\20180923\MergeAttackPlaneAndHeli.cs" />
|
<Compile Include="UpdateRules\Rules\20180923\MergeAttackPlaneAndHeli.cs" />
|
||||||
<Compile Include="UpdateRules\Rules\20180923\ExtractHackyAIModules.cs" />
|
<Compile Include="UpdateRules\Rules\20180923\ExtractHackyAIModules.cs" />
|
||||||
|
<Compile Include="UpdateRules\Rules\20180923\DefineLevelUpImageDefault.cs" />
|
||||||
<Compile Include="Traits\Player\PlayerResources.cs" />
|
<Compile Include="Traits\Player\PlayerResources.cs" />
|
||||||
<Compile Include="UtilityCommands\DumpSequenceSheetsCommand.cs" />
|
<Compile Include="UtilityCommands\DumpSequenceSheetsCommand.cs" />
|
||||||
<Compile Include="Traits\Render\WithBuildingRepairDecoration.cs" />
|
<Compile Include="Traits\Render\WithBuildingRepairDecoration.cs" />
|
||||||
|
|||||||
@@ -20,8 +20,11 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Chance of getting this crate, assuming the collector is compatible.")]
|
[Desc("Chance of getting this crate, assuming the collector is compatible.")]
|
||||||
public readonly int SelectionShares = 10;
|
public readonly int SelectionShares = 10;
|
||||||
|
|
||||||
[Desc("An animation defined in sequence yaml(s) to draw.")]
|
[Desc("Image containing the crate effect animation sequence.")]
|
||||||
public readonly string Effect = null;
|
public readonly string Image = "crate-effects";
|
||||||
|
|
||||||
|
[Desc("Animation sequence played when collected. Leave empty for no effect.")]
|
||||||
|
[SequenceReference("Image")] public readonly string Sequence = null;
|
||||||
|
|
||||||
[Desc("Palette to draw the animation in.")]
|
[Desc("Palette to draw the animation in.")]
|
||||||
[PaletteReference] public readonly string Palette = "effect";
|
[PaletteReference] public readonly string Palette = "effect";
|
||||||
@@ -84,8 +87,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
Game.Sound.PlayNotification(self.World.Map.Rules, collector.Owner, "Speech",
|
Game.Sound.PlayNotification(self.World.Map.Rules, collector.Owner, "Speech",
|
||||||
Info.Notification, collector.Owner.Faction.InternalName);
|
Info.Notification, collector.Owner.Faction.InternalName);
|
||||||
|
|
||||||
if (Info.Effect != null)
|
if (Info.Image != null && Info.Sequence != null)
|
||||||
collector.World.AddFrameEndTask(w => w.Add(new CrateEffect(collector, Info.Effect, Info.Palette)));
|
collector.World.AddFrameEndTask(w => w.Add(new SpriteEffect(collector, w, Info.Image, Info.Sequence, Info.Palette)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,12 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[GrantedConditionReference]
|
[GrantedConditionReference]
|
||||||
public IEnumerable<string> LinterConditions { get { return Conditions.Values; } }
|
public IEnumerable<string> LinterConditions { get { return Conditions.Values; } }
|
||||||
|
|
||||||
|
[Desc("Image for the level up sprite.")]
|
||||||
|
public readonly string LevelUpImage = null;
|
||||||
|
|
||||||
|
[Desc("Sequence for the level up sprite. Needs to be present on Image.")]
|
||||||
|
[SequenceReference("Image")] public readonly string LevelUpSequence = "levelup";
|
||||||
|
|
||||||
[Desc("Palette for the level up sprite.")]
|
[Desc("Palette for the level up sprite.")]
|
||||||
[PaletteReference] public readonly string LevelUpPalette = "effect";
|
[PaletteReference] public readonly string LevelUpPalette = "effect";
|
||||||
|
|
||||||
@@ -107,7 +113,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (!silent)
|
if (!silent)
|
||||||
{
|
{
|
||||||
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", info.LevelUpNotification, self.Owner.Faction.InternalName);
|
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", info.LevelUpNotification, self.Owner.Faction.InternalName);
|
||||||
self.World.AddFrameEndTask(w => w.Add(new CrateEffect(self, "levelup", info.LevelUpPalette)));
|
if (info.LevelUpImage != null && info.LevelUpSequence != null)
|
||||||
|
self.World.AddFrameEndTask(w => w.Add(new SpriteEffect(self, w, info.LevelUpImage, info.LevelUpSequence, info.LevelUpPalette)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2018 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.Collections.Generic;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||||
|
{
|
||||||
|
public class DefineLevelUpImageDefault : UpdateRule
|
||||||
|
{
|
||||||
|
public override string Name { get { return "Unhardcoded LevelUpImage and LevelUpSequence on GainsExperience"; } }
|
||||||
|
public override string Description
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return "GainsExperience was hardcoded to play a 'levelup' crate effect from 'crate-effects' image.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static readonly string[] CrateActionTraits =
|
||||||
|
{
|
||||||
|
"DuplicateUnitCrateAction",
|
||||||
|
"ExplodeCrateAction",
|
||||||
|
"GiveCashCrateAction",
|
||||||
|
"GiveMcvCrateAction",
|
||||||
|
"GiveUnitCrateAction",
|
||||||
|
"GrantExternalConditionCrateAction",
|
||||||
|
"HealUnitsCrateAction",
|
||||||
|
"HideMapCrateAction",
|
||||||
|
"LevelUpCrateAction",
|
||||||
|
"RevealMapCrateAction",
|
||||||
|
"SupportPowerCrateAction"
|
||||||
|
};
|
||||||
|
|
||||||
|
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||||
|
{
|
||||||
|
var levelUpImageNode = new MiniYamlNode("LevelUpImage", "crate-effects");
|
||||||
|
foreach (var ge in actorNode.ChildrenMatching("GainsExperience"))
|
||||||
|
ge.AddNode(levelUpImageNode);
|
||||||
|
|
||||||
|
foreach (var t in CrateActionTraits)
|
||||||
|
{
|
||||||
|
foreach (var ca in actorNode.ChildrenMatching(t))
|
||||||
|
{
|
||||||
|
var effect = ca.LastChildMatching("Effect");
|
||||||
|
if (effect != null)
|
||||||
|
effect.RenameKey("Sequence");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -108,6 +108,7 @@ namespace OpenRA.Mods.Common.UpdateRules
|
|||||||
new ExtractHackyAIModules(),
|
new ExtractHackyAIModules(),
|
||||||
new RemoveNegativeDamageFullHealthCheck(),
|
new RemoveNegativeDamageFullHealthCheck(),
|
||||||
new RemoveResourceExplodeModifier(),
|
new RemoveResourceExplodeModifier(),
|
||||||
|
new DefineLevelUpImageDefault(),
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@
|
|||||||
400: rank-veteran
|
400: rank-veteran
|
||||||
800: rank-veteran
|
800: rank-veteran
|
||||||
1600: rank-veteran
|
1600: rank-veteran
|
||||||
|
LevelUpImage: crate-effects
|
||||||
GrantCondition@RANK-ELITE:
|
GrantCondition@RANK-ELITE:
|
||||||
RequiresCondition: rank-veteran >= 4
|
RequiresCondition: rank-veteran >= 4
|
||||||
Condition: rank-elite
|
Condition: rank-elite
|
||||||
|
|||||||
@@ -12,13 +12,13 @@ CRATE:
|
|||||||
UseCashTick: yes
|
UseCashTick: yes
|
||||||
RevealMapCrateAction:
|
RevealMapCrateAction:
|
||||||
SelectionShares: 1
|
SelectionShares: 1
|
||||||
Effect: reveal-map
|
Sequence: reveal-map
|
||||||
ExplodeCrateAction@fire:
|
ExplodeCrateAction@fire:
|
||||||
Weapon: Napalm.Crate
|
Weapon: Napalm.Crate
|
||||||
SelectionShares: 5
|
SelectionShares: 5
|
||||||
GrantExternalConditionCrateAction@cloak:
|
GrantExternalConditionCrateAction@cloak:
|
||||||
SelectionShares: 5
|
SelectionShares: 5
|
||||||
Effect: cloak
|
Sequence: cloak
|
||||||
Condition: cloak-crate-collected
|
Condition: cloak-crate-collected
|
||||||
GiveMcvCrateAction:
|
GiveMcvCrateAction:
|
||||||
SelectionShares: 0
|
SelectionShares: 0
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
400: rank-veteran
|
400: rank-veteran
|
||||||
800: rank-veteran
|
800: rank-veteran
|
||||||
1600: rank-veteran
|
1600: rank-veteran
|
||||||
|
LevelUpImage: crate-effects
|
||||||
GrantCondition@RANK-ELITE:
|
GrantCondition@RANK-ELITE:
|
||||||
RequiresCondition: rank-veteran >= 4
|
RequiresCondition: rank-veteran >= 4
|
||||||
Condition: rank-elite
|
Condition: rank-elite
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ crate:
|
|||||||
SelectionShares: 5
|
SelectionShares: 5
|
||||||
HideMapCrateAction:
|
HideMapCrateAction:
|
||||||
SelectionShares: 5
|
SelectionShares: 5
|
||||||
Effect: hide-map
|
Sequence: hide-map
|
||||||
LevelUpCrateAction:
|
LevelUpCrateAction:
|
||||||
SelectionShares: 40
|
SelectionShares: 40
|
||||||
RevealMapCrateAction:
|
RevealMapCrateAction:
|
||||||
SelectionShares: 2
|
SelectionShares: 2
|
||||||
Effect: reveal-map
|
Sequence: reveal-map
|
||||||
GiveUnitCrateAction@LightInfantry:
|
GiveUnitCrateAction@LightInfantry:
|
||||||
SelectionShares: 15
|
SelectionShares: 15
|
||||||
Units: light_inf, light_inf, light_inf, light_inf, light_inf
|
Units: light_inf, light_inf, light_inf, light_inf, light_inf
|
||||||
|
|||||||
@@ -63,11 +63,11 @@ FORTCRATE:
|
|||||||
SupportPowerCrateAction@parabombs:
|
SupportPowerCrateAction@parabombs:
|
||||||
SelectionShares: 30
|
SelectionShares: 30
|
||||||
Proxy: powerproxy.parabombs
|
Proxy: powerproxy.parabombs
|
||||||
Effect: parabombs
|
Sequence: parabombs
|
||||||
HealUnitsCrateAction:
|
HealUnitsCrateAction:
|
||||||
SelectionShares: 30
|
SelectionShares: 30
|
||||||
Sound: heal2.aud
|
Sound: heal2.aud
|
||||||
Effect: heal
|
Sequence: heal
|
||||||
GiveCashCrateAction:
|
GiveCashCrateAction:
|
||||||
Amount: 400
|
Amount: 400
|
||||||
UseCashTick: true
|
UseCashTick: true
|
||||||
@@ -77,7 +77,7 @@ FORTCRATE:
|
|||||||
SelectionShares: 10
|
SelectionShares: 10
|
||||||
GrantExternalConditionCrateAction@ironcurtain:
|
GrantExternalConditionCrateAction@ironcurtain:
|
||||||
SelectionShares: 10
|
SelectionShares: 10
|
||||||
Effect: invuln
|
Sequence: invuln
|
||||||
Sound: ironcur9.aud
|
Sound: ironcur9.aud
|
||||||
Condition: invulnerability
|
Condition: invulnerability
|
||||||
Duration: 1200
|
Duration: 1200
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
400: rank-veteran
|
400: rank-veteran
|
||||||
800: rank-veteran
|
800: rank-veteran
|
||||||
1600: rank-veteran
|
1600: rank-veteran
|
||||||
|
LevelUpImage: crate-effects
|
||||||
GrantCondition@RANK-ELITE:
|
GrantCondition@RANK-ELITE:
|
||||||
RequiresCondition: rank-veteran >= 4
|
RequiresCondition: rank-veteran >= 4
|
||||||
Condition: rank-elite
|
Condition: rank-elite
|
||||||
|
|||||||
@@ -31,14 +31,14 @@ CRATE:
|
|||||||
SelectionShares: 5
|
SelectionShares: 5
|
||||||
HideMapCrateAction:
|
HideMapCrateAction:
|
||||||
SelectionShares: 5
|
SelectionShares: 5
|
||||||
Effect: hide-map
|
Sequence: hide-map
|
||||||
HealUnitsCrateAction:
|
HealUnitsCrateAction:
|
||||||
Sound: heal2.aud
|
Sound: heal2.aud
|
||||||
SelectionShares: 2
|
SelectionShares: 2
|
||||||
Effect: heal
|
Sequence: heal
|
||||||
RevealMapCrateAction:
|
RevealMapCrateAction:
|
||||||
SelectionShares: 1
|
SelectionShares: 1
|
||||||
Effect: reveal-map
|
Sequence: reveal-map
|
||||||
DuplicateUnitCrateAction:
|
DuplicateUnitCrateAction:
|
||||||
SelectionShares: 10
|
SelectionShares: 10
|
||||||
MaxAmount: 5
|
MaxAmount: 5
|
||||||
@@ -104,7 +104,7 @@ CRATE:
|
|||||||
TimeDelay: 4500
|
TimeDelay: 4500
|
||||||
GrantExternalConditionCrateAction@invuln:
|
GrantExternalConditionCrateAction@invuln:
|
||||||
SelectionShares: 5
|
SelectionShares: 5
|
||||||
Effect: invuln
|
Sequence: invuln
|
||||||
Sound: ironcur9.aud
|
Sound: ironcur9.aud
|
||||||
Condition: invulnerability
|
Condition: invulnerability
|
||||||
Duration: 600
|
Duration: 600
|
||||||
@@ -127,7 +127,7 @@ HEALCRATE:
|
|||||||
HealUnitsCrateAction:
|
HealUnitsCrateAction:
|
||||||
Sound: heal2.aud
|
Sound: heal2.aud
|
||||||
SelectionShares: 1
|
SelectionShares: 1
|
||||||
Effect: heal
|
Sequence: heal
|
||||||
|
|
||||||
WCRATE:
|
WCRATE:
|
||||||
Inherits: ^Crate
|
Inherits: ^Crate
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
Conditions:
|
Conditions:
|
||||||
500: rank
|
500: rank
|
||||||
1000: rank
|
1000: rank
|
||||||
|
LevelUpImage: crate-effects
|
||||||
GrantCondition@RANK-VETERAN:
|
GrantCondition@RANK-VETERAN:
|
||||||
RequiresCondition: rank == 1
|
RequiresCondition: rank == 1
|
||||||
Condition: rank-veteran
|
Condition: rank-veteran
|
||||||
|
|||||||
@@ -69,37 +69,37 @@ CRATE:
|
|||||||
GiveCashCrateAction:
|
GiveCashCrateAction:
|
||||||
Amount: 1000
|
Amount: 1000
|
||||||
SelectionShares: 50
|
SelectionShares: 50
|
||||||
Effect: dollar
|
Sequence: dollar
|
||||||
UseCashTick: true
|
UseCashTick: true
|
||||||
LevelUpCrateAction:
|
LevelUpCrateAction:
|
||||||
SelectionShares: 40
|
SelectionShares: 40
|
||||||
Effect: levelup
|
Sequence: levelup
|
||||||
HideMapCrateAction:
|
HideMapCrateAction:
|
||||||
SelectionShares: 5
|
SelectionShares: 5
|
||||||
Effect: hide-map
|
Sequence: hide-map
|
||||||
HealUnitsCrateAction:
|
HealUnitsCrateAction:
|
||||||
SelectionShares: 2
|
SelectionShares: 2
|
||||||
Effect: heal
|
Sequence: heal
|
||||||
RevealMapCrateAction:
|
RevealMapCrateAction:
|
||||||
SelectionShares: 1
|
SelectionShares: 1
|
||||||
Effect: reveal-map
|
Sequence: reveal-map
|
||||||
GiveMcvCrateAction:
|
GiveMcvCrateAction:
|
||||||
SelectionShares: 0
|
SelectionShares: 0
|
||||||
NoBaseSelectionShares: 100
|
NoBaseSelectionShares: 100
|
||||||
Units: mcv
|
Units: mcv
|
||||||
GrantExternalConditionCrateAction@cloak:
|
GrantExternalConditionCrateAction@cloak:
|
||||||
SelectionShares: 5
|
SelectionShares: 5
|
||||||
Effect: stealth
|
Sequence: stealth
|
||||||
Condition: crate-cloak
|
Condition: crate-cloak
|
||||||
Sound: cloak5.aud
|
Sound: cloak5.aud
|
||||||
GrantExternalConditionCrateAction@firepower:
|
GrantExternalConditionCrateAction@firepower:
|
||||||
SelectionShares: 5
|
SelectionShares: 5
|
||||||
Effect: firepower
|
Sequence: firepower
|
||||||
Condition: crate-firepower
|
Condition: crate-firepower
|
||||||
Notification: UnitFirepowerUpgraded
|
Notification: UnitFirepowerUpgraded
|
||||||
GrantExternalConditionCrateAction@armor:
|
GrantExternalConditionCrateAction@armor:
|
||||||
SelectionShares: 5
|
SelectionShares: 5
|
||||||
Effect: armor
|
Sequence: armor
|
||||||
Condition: crate-damage
|
Condition: crate-damage
|
||||||
Notification: UnitArmourUpgraded
|
Notification: UnitArmourUpgraded
|
||||||
GrantExternalConditionCrateAction@speed:
|
GrantExternalConditionCrateAction@speed:
|
||||||
|
|||||||
Reference in New Issue
Block a user