RenderBuildingCharge -> WithChargeAnimation
This commit is contained in:
@@ -406,7 +406,6 @@
|
|||||||
<Compile Include="Traits\Render\Hovers.cs" />
|
<Compile Include="Traits\Render\Hovers.cs" />
|
||||||
<Compile Include="Traits\Render\LeavesTrails.cs" />
|
<Compile Include="Traits\Render\LeavesTrails.cs" />
|
||||||
<Compile Include="Traits\Render\RenderBuilding.cs" />
|
<Compile Include="Traits\Render\RenderBuilding.cs" />
|
||||||
<Compile Include="Traits\Render\RenderBuildingCharge.cs" />
|
|
||||||
<Compile Include="Traits\Render\RenderBuildingTurreted.cs" />
|
<Compile Include="Traits\Render\RenderBuildingTurreted.cs" />
|
||||||
<Compile Include="Traits\Render\RenderSpritesEditorOnly.cs" />
|
<Compile Include="Traits\Render\RenderSpritesEditorOnly.cs" />
|
||||||
<Compile Include="Traits\Render\RenderNameTag.cs" />
|
<Compile Include="Traits\Render\RenderNameTag.cs" />
|
||||||
@@ -427,6 +426,7 @@
|
|||||||
<Compile Include="Traits\Render\WithMoveAnimation.cs" />
|
<Compile Include="Traits\Render\WithMoveAnimation.cs" />
|
||||||
<Compile Include="Traits\Render\WithBuildingPlacedAnimation.cs" />
|
<Compile Include="Traits\Render\WithBuildingPlacedAnimation.cs" />
|
||||||
<Compile Include="Traits\Render\WithMakeAnimation.cs" />
|
<Compile Include="Traits\Render\WithMakeAnimation.cs" />
|
||||||
|
<Compile Include="Traits\Render\WithChargeAnimation.cs" />
|
||||||
<Compile Include="Traits\Render\WithChargeOverlay.cs" />
|
<Compile Include="Traits\Render\WithChargeOverlay.cs" />
|
||||||
<Compile Include="Traits\Render\WithCrateBody.cs" />
|
<Compile Include="Traits\Render\WithCrateBody.cs" />
|
||||||
<Compile Include="Traits\Render\WithDeathAnimation.cs" />
|
<Compile Include="Traits\Render\WithDeathAnimation.cs" />
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
#region Copyright & License Information
|
|
||||||
/*
|
|
||||||
* Copyright 2007-2015 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. For more information,
|
|
||||||
* see COPYING.
|
|
||||||
*/
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
using OpenRA.Traits;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
|
||||||
{
|
|
||||||
[Desc("Used for tesla coil and obelisk.")]
|
|
||||||
public class RenderBuildingChargeInfo : RenderBuildingInfo
|
|
||||||
{
|
|
||||||
[Desc("Sequence to use for building charge animation.")]
|
|
||||||
[SequenceReference] public readonly string ChargeSequence = "active";
|
|
||||||
|
|
||||||
public override object Create(ActorInitializer init) { return new RenderBuildingCharge(init, this); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class RenderBuildingCharge : RenderBuilding, INotifyCharging
|
|
||||||
{
|
|
||||||
RenderBuildingChargeInfo info;
|
|
||||||
|
|
||||||
public RenderBuildingCharge(ActorInitializer init, RenderBuildingChargeInfo info)
|
|
||||||
: base(init, info)
|
|
||||||
{
|
|
||||||
this.info = info;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Charging(Actor self, Target target)
|
|
||||||
{
|
|
||||||
PlayCustomAnim(self, info.ChargeSequence);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
40
OpenRA.Mods.Common/Traits/Render/WithChargeAnimation.cs
Normal file
40
OpenRA.Mods.Common/Traits/Render/WithChargeAnimation.cs
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2015 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. For more information,
|
||||||
|
* see COPYING.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using OpenRA.Traits;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.Common.Traits
|
||||||
|
{
|
||||||
|
[Desc("This actor displays a charge-up animation before firing.")]
|
||||||
|
public class WithChargeAnimationInfo : ITraitInfo, Requires<WithSpriteBodyInfo>, Requires<RenderSpritesInfo>
|
||||||
|
{
|
||||||
|
[Desc("Sequence to use for charge animation.")]
|
||||||
|
[SequenceReference] public readonly string ChargeSequence = "active";
|
||||||
|
|
||||||
|
public object Create(ActorInitializer init) { return new WithChargeAnimation(init, this); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class WithChargeAnimation : INotifyCharging
|
||||||
|
{
|
||||||
|
readonly WithChargeAnimationInfo info;
|
||||||
|
readonly WithSpriteBody wsb;
|
||||||
|
|
||||||
|
public WithChargeAnimation(ActorInitializer init, WithChargeAnimationInfo info)
|
||||||
|
{
|
||||||
|
this.info = info;
|
||||||
|
wsb = init.Self.Trait<WithSpriteBody>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Charging(Actor self, Target target)
|
||||||
|
{
|
||||||
|
wsb.PlayCustomAnimation(self, info.ChargeSequence);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1810,6 +1810,39 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (engineVersion < 20150826)
|
||||||
|
{
|
||||||
|
// Replaced RenderBuildingCharge with RenderSprites + WithSpriteBody + WithChargeAnimation (+AutoSelectionSize)
|
||||||
|
if (depth == 0)
|
||||||
|
{
|
||||||
|
var childKeySequence = new[] { "ChargeSequence" };
|
||||||
|
var childKeysExcludeFromRS = new[] { "Sequence", "ChargeSequence", "PauseOnLowPower" };
|
||||||
|
|
||||||
|
var rb = node.Value.Nodes.FirstOrDefault(n => n.Key.StartsWith("RenderBuildingCharge"));
|
||||||
|
if (rb != null)
|
||||||
|
{
|
||||||
|
rb.Key = "WithChargeAnimation";
|
||||||
|
|
||||||
|
var rsNodes = rb.Value.Nodes.Where(n => !childKeysExcludeFromRS.Contains(n.Key)).ToList();
|
||||||
|
var wsbNodes = rb.Value.Nodes.Where(n => childKeySequence.Contains(n.Key)).ToList();
|
||||||
|
|
||||||
|
if (rsNodes.Any())
|
||||||
|
node.Value.Nodes.Add(new MiniYamlNode("RenderSprites", new MiniYaml("", rsNodes)));
|
||||||
|
else
|
||||||
|
node.Value.Nodes.Add(new MiniYamlNode("RenderSprites", ""));
|
||||||
|
|
||||||
|
node.Value.Nodes.Add(new MiniYamlNode("AutoSelectionSize", ""));
|
||||||
|
|
||||||
|
rb.Value.Nodes.RemoveAll(n => rsNodes.Contains(n));
|
||||||
|
rb.Value.Nodes.RemoveAll(n => wsbNodes.Contains(n));
|
||||||
|
}
|
||||||
|
|
||||||
|
var rrb = node.Value.Nodes.FirstOrDefault(n => n.Key.StartsWith("-RenderBuildingCharge"));
|
||||||
|
if (rrb != null)
|
||||||
|
rrb.Key = "-WithChargeAnimation";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -730,7 +730,9 @@ OBLI:
|
|||||||
Range: 8c0
|
Range: 8c0
|
||||||
Bib:
|
Bib:
|
||||||
HasMinibib: Yes
|
HasMinibib: Yes
|
||||||
RenderBuildingCharge:
|
RenderSprites:
|
||||||
|
WithSpriteBody:
|
||||||
|
WithChargeAnimation:
|
||||||
Armament:
|
Armament:
|
||||||
Weapon: Laser
|
Weapon: Laser
|
||||||
LocalOffset: 0,0,725
|
LocalOffset: 0,0,725
|
||||||
@@ -745,6 +747,7 @@ OBLI:
|
|||||||
Range: 5
|
Range: 5
|
||||||
Power:
|
Power:
|
||||||
Amount: -150
|
Amount: -150
|
||||||
|
-WithMakeAnimation:
|
||||||
|
|
||||||
GTWR:
|
GTWR:
|
||||||
Inherits: ^Defense
|
Inherits: ^Defense
|
||||||
|
|||||||
@@ -401,7 +401,9 @@ TSLA:
|
|||||||
Range: 8c0
|
Range: 8c0
|
||||||
Bib:
|
Bib:
|
||||||
HasMinibib: Yes
|
HasMinibib: Yes
|
||||||
RenderBuildingCharge:
|
RenderSprites:
|
||||||
|
WithSpriteBody:
|
||||||
|
WithChargeAnimation:
|
||||||
Armament:
|
Armament:
|
||||||
Weapon: TeslaZap
|
Weapon: TeslaZap
|
||||||
LocalOffset: 0,0,427
|
LocalOffset: 0,0,427
|
||||||
@@ -415,6 +417,7 @@ TSLA:
|
|||||||
DetectCloaked:
|
DetectCloaked:
|
||||||
Range: 8
|
Range: 8
|
||||||
ProvidesPrerequisite@buildingname:
|
ProvidesPrerequisite@buildingname:
|
||||||
|
-WithMakeAnimation:
|
||||||
|
|
||||||
AGUN:
|
AGUN:
|
||||||
Inherits: ^Defense
|
Inherits: ^Defense
|
||||||
|
|||||||
Reference in New Issue
Block a user