Merge pull request #5373 from Mailaender/repair-overlay
Added the Dune 2000 repair depot active overlay
This commit is contained in:
@@ -69,6 +69,7 @@ namespace OpenRA.Traits
|
|||||||
public interface INotifySold { void Selling(Actor self); void Sold(Actor self); }
|
public interface INotifySold { void Selling(Actor self); void Sold(Actor self); }
|
||||||
public interface INotifyDamage { void Damaged(Actor self, AttackInfo e); }
|
public interface INotifyDamage { void Damaged(Actor self, AttackInfo e); }
|
||||||
public interface INotifyDamageStateChanged { void DamageStateChanged(Actor self, AttackInfo e); }
|
public interface INotifyDamageStateChanged { void DamageStateChanged(Actor self, AttackInfo e); }
|
||||||
|
public interface INotifyRepair { void Repairing(Actor self, Actor host); }
|
||||||
public interface INotifyKilled { void Killed(Actor self, AttackInfo e); }
|
public interface INotifyKilled { void Killed(Actor self, AttackInfo e); }
|
||||||
public interface INotifyAppliedDamage { void AppliedDamage(Actor self, Actor damaged, AttackInfo e); }
|
public interface INotifyAppliedDamage { void AppliedDamage(Actor self, Actor damaged, AttackInfo e); }
|
||||||
public interface INotifyBuildComplete { void BuildingComplete(Actor self); }
|
public interface INotifyBuildComplete { void BuildingComplete(Actor self); }
|
||||||
|
|||||||
@@ -63,9 +63,8 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
|
|
||||||
self.InflictDamage(self, -hpToRepair, null);
|
self.InflictDamage(self, -hpToRepair, null);
|
||||||
|
|
||||||
if (host != null)
|
foreach (var depot in host.TraitsImplementing<INotifyRepair>())
|
||||||
host.Trait<RenderBuilding>()
|
depot.Repairing(self, host);
|
||||||
.PlayCustomAnim(host, "active");
|
|
||||||
|
|
||||||
remainingTicks = repairsUnits.Interval;
|
remainingTicks = repairsUnits.Interval;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -526,6 +526,8 @@
|
|||||||
<Compile Include="Console\DevCommands.cs" />
|
<Compile Include="Console\DevCommands.cs" />
|
||||||
<Compile Include="Console\HelpCommand.cs" />
|
<Compile Include="Console\HelpCommand.cs" />
|
||||||
<Compile Include="Console\PlayerCommands.cs" />
|
<Compile Include="Console\PlayerCommands.cs" />
|
||||||
|
<Compile Include="Render\WithRepairAnimation.cs" />
|
||||||
|
<Compile Include="Render\WithRepairOverlay.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\OpenRA.Game\OpenRA.Game.csproj">
|
<ProjectReference Include="..\OpenRA.Game\OpenRA.Game.csproj">
|
||||||
|
|||||||
49
OpenRA.Mods.RA/Render/WithRepairAnimation.cs
Normal file
49
OpenRA.Mods.RA/Render/WithRepairAnimation.cs
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2014 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 System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using OpenRA.FileFormats;
|
||||||
|
using OpenRA.Graphics;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
using OpenRA.Mods.RA.Buildings;
|
||||||
|
using OpenRA.Effects;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.RA.Render
|
||||||
|
{
|
||||||
|
public class WithRepairAnimationInfo : ITraitInfo, Requires<RenderBuildingInfo>
|
||||||
|
{
|
||||||
|
[Desc("Sequence name to use")]
|
||||||
|
public readonly string Sequence = "active";
|
||||||
|
|
||||||
|
public readonly bool PauseOnLowPower = false;
|
||||||
|
|
||||||
|
public object Create(ActorInitializer init) { return new WithRepairAnimation(init.self, this); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class WithRepairAnimation : INotifyRepair
|
||||||
|
{
|
||||||
|
IEnumerable<IDisable> disabled;
|
||||||
|
WithRepairAnimationInfo info;
|
||||||
|
|
||||||
|
public WithRepairAnimation(Actor self, WithRepairAnimationInfo info)
|
||||||
|
{
|
||||||
|
disabled = self.TraitsImplementing<IDisable>();
|
||||||
|
this.info = info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Repairing(Actor self, Actor host)
|
||||||
|
{
|
||||||
|
var building = host.TraitOrDefault<RenderBuilding>();
|
||||||
|
if (building != null && !(info.PauseOnLowPower && disabled.Any(d => d.Disabled)))
|
||||||
|
building.PlayCustomAnim(host, info.Sequence);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
77
OpenRA.Mods.RA/Render/WithRepairOverlay.cs
Normal file
77
OpenRA.Mods.RA/Render/WithRepairOverlay.cs
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2014 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 System.Linq;
|
||||||
|
using OpenRA.FileFormats;
|
||||||
|
using OpenRA.Graphics;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
using OpenRA.Mods.RA.Buildings;
|
||||||
|
using OpenRA.Effects;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.RA.Render
|
||||||
|
{
|
||||||
|
public class WithRepairOverlayInfo : ITraitInfo, Requires<RenderSpritesInfo>, Requires<IBodyOrientationInfo>
|
||||||
|
{
|
||||||
|
[Desc("Sequence name to use")]
|
||||||
|
public readonly string Sequence = "active";
|
||||||
|
|
||||||
|
[Desc("Position relative to body")]
|
||||||
|
public readonly WVec Offset = WVec.Zero;
|
||||||
|
|
||||||
|
public readonly bool PauseOnLowPower = false;
|
||||||
|
|
||||||
|
public object Create(ActorInitializer init) { return new WithRepairOverlay(init.self, this); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class WithRepairOverlay : INotifyDamageStateChanged, INotifyBuildComplete, INotifySold, INotifyRepair
|
||||||
|
{
|
||||||
|
Animation overlay;
|
||||||
|
bool buildComplete;
|
||||||
|
|
||||||
|
public WithRepairOverlay(Actor self, WithRepairOverlayInfo info)
|
||||||
|
{
|
||||||
|
var rs = self.Trait<RenderSprites>();
|
||||||
|
var body = self.Trait<IBodyOrientation>();
|
||||||
|
var disabled = self.TraitsImplementing<IDisable>();
|
||||||
|
|
||||||
|
buildComplete = !self.HasTrait<Building>(); // always render instantly for units
|
||||||
|
overlay = new Animation(self.World, rs.GetImage(self));
|
||||||
|
overlay.Play(info.Sequence);
|
||||||
|
rs.anims.Add("repair_{0}".F(info.Sequence),
|
||||||
|
new AnimationWithOffset(overlay,
|
||||||
|
() => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))),
|
||||||
|
() => !buildComplete,
|
||||||
|
() => info.PauseOnLowPower && disabled.Any(d => d.Disabled),
|
||||||
|
p => WithTurret.ZOffsetFromCenter(self, p, 1)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void BuildingComplete(Actor self)
|
||||||
|
{
|
||||||
|
self.World.AddFrameEndTask(w => w.Add(new DelayedAction(120, () =>
|
||||||
|
buildComplete = true)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Sold(Actor self) { }
|
||||||
|
public void Selling(Actor self)
|
||||||
|
{
|
||||||
|
buildComplete = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DamageStateChanged(Actor self, AttackInfo e)
|
||||||
|
{
|
||||||
|
overlay.ReplaceAnim(RenderSprites.NormalizeSequence(overlay, e.DamageState, overlay.CurrentSequence.Name));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Repairing(Actor self, Actor host)
|
||||||
|
{
|
||||||
|
overlay.Play(overlay.CurrentSequence.Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -341,6 +341,7 @@ HPAD:
|
|||||||
Produces: Aircraft
|
Produces: Aircraft
|
||||||
Reservable:
|
Reservable:
|
||||||
RepairsUnits:
|
RepairsUnits:
|
||||||
|
WithRepairAnimation:
|
||||||
RallyPoint:
|
RallyPoint:
|
||||||
ProductionQueue:
|
ProductionQueue:
|
||||||
Type: Aircraft
|
Type: Aircraft
|
||||||
@@ -423,6 +424,7 @@ FIX:
|
|||||||
Reservable:
|
Reservable:
|
||||||
RepairsUnits:
|
RepairsUnits:
|
||||||
RallyPoint:
|
RallyPoint:
|
||||||
|
WithRepairAnimation:
|
||||||
|
|
||||||
EYE:
|
EYE:
|
||||||
Inherits: ^BaseBuilding
|
Inherits: ^BaseBuilding
|
||||||
|
|||||||
@@ -578,6 +578,7 @@ WALL:
|
|||||||
RallyPoint: 1,3
|
RallyPoint: 1,3
|
||||||
ProvidesCustomPrerequisite:
|
ProvidesCustomPrerequisite:
|
||||||
Prerequisite: Repair
|
Prerequisite: Repair
|
||||||
|
WithRepairOverlay:
|
||||||
|
|
||||||
^HIGHTECH:
|
^HIGHTECH:
|
||||||
Inherits: ^Building
|
Inherits: ^Building
|
||||||
|
|||||||
@@ -219,17 +219,17 @@ repaira:
|
|||||||
Start: 2571
|
Start: 2571
|
||||||
Offset: -48,48
|
Offset: -48,48
|
||||||
ZOffset: -1c511
|
ZOffset: -1c511
|
||||||
# active: DATA # TODO: overlay
|
active: DATA
|
||||||
# Start: 4746
|
Start: 4746
|
||||||
# Length: 14
|
Length: 14
|
||||||
# Offset: -48,48
|
Offset: -48,48
|
||||||
# ZOffset: -1c511
|
ZOffset: -1c511
|
||||||
# damaged-active: DATA # TODO: overlay
|
damaged-active: DATA
|
||||||
# Start: 4746
|
Start: 4746
|
||||||
# Length: 14
|
Length: 14
|
||||||
# Tick: 60
|
Tick: 60
|
||||||
# Offset: -48,48
|
Offset: -48,48
|
||||||
# ZOffset: -1c511
|
ZOffset: -1c511
|
||||||
damaged-idle: DATA
|
damaged-idle: DATA
|
||||||
Start: 2572
|
Start: 2572
|
||||||
Offset: -48,48
|
Offset: -48,48
|
||||||
@@ -252,17 +252,17 @@ repairh:
|
|||||||
Start: 2731
|
Start: 2731
|
||||||
Offset: -48,48
|
Offset: -48,48
|
||||||
ZOffset: -1c511
|
ZOffset: -1c511
|
||||||
# active: DATA # TODO: overlay
|
active: DATA
|
||||||
# Start: 4746
|
Start: 4746
|
||||||
# Length: 14
|
Length: 14
|
||||||
# Offset: -48,48
|
Offset: -48,48
|
||||||
# ZOffset: -1c511
|
ZOffset: -1c511
|
||||||
# damaged-active: DATA # TODO: overlay
|
damaged-active: DATA
|
||||||
# Start: 4746
|
Start: 4746
|
||||||
# Length: 14
|
Length: 14
|
||||||
# Tick: 60
|
Tick: 60
|
||||||
# Offset: -48,48
|
Offset: -48,48
|
||||||
# ZOffset: -1c511
|
ZOffset: -1c511
|
||||||
damaged-idle: DATA
|
damaged-idle: DATA
|
||||||
Start: 2732
|
Start: 2732
|
||||||
Offset: -48,48
|
Offset: -48,48
|
||||||
@@ -285,17 +285,17 @@ repairo:
|
|||||||
Start: 2891
|
Start: 2891
|
||||||
Offset: -48,48
|
Offset: -48,48
|
||||||
ZOffset: -1c511
|
ZOffset: -1c511
|
||||||
# active: DATA # TODO: overlay
|
active: DATA
|
||||||
# Start: 4746
|
Start: 4746
|
||||||
# Length: 14
|
Length: 14
|
||||||
# Offset: -48,48
|
Offset: -48,48
|
||||||
# ZOffset: -1c511
|
ZOffset: -1c511
|
||||||
# damaged-active: DATA # TODO: overlay
|
damaged-active: DATA
|
||||||
# Start: 4746
|
Start: 4746
|
||||||
# Length: 14
|
Length: 14
|
||||||
# Tick: 60
|
Tick: 60
|
||||||
# Offset: -48,48
|
Offset: -48,48
|
||||||
# ZOffset: -1c511
|
ZOffset: -1c511
|
||||||
damaged-idle: DATA
|
damaged-idle: DATA
|
||||||
Start: 2892
|
Start: 2892
|
||||||
Offset: -48,48
|
Offset: -48,48
|
||||||
|
|||||||
@@ -1197,6 +1197,7 @@ FIX:
|
|||||||
IronCurtainable:
|
IronCurtainable:
|
||||||
RepairsUnits:
|
RepairsUnits:
|
||||||
Interval: 10
|
Interval: 10
|
||||||
|
WithRepairAnimation:
|
||||||
|
|
||||||
FACF:
|
FACF:
|
||||||
Inherits: ^Building
|
Inherits: ^Building
|
||||||
|
|||||||
@@ -189,6 +189,7 @@
|
|||||||
TargetableUnit:
|
TargetableUnit:
|
||||||
TargetTypes: Ground
|
TargetTypes: Ground
|
||||||
Repairable:
|
Repairable:
|
||||||
|
RepairBuildings: gadept
|
||||||
Passenger:
|
Passenger:
|
||||||
CargoType: Vehicle
|
CargoType: Vehicle
|
||||||
AttackMove:
|
AttackMove:
|
||||||
|
|||||||
@@ -709,6 +709,40 @@ NAHPAD:
|
|||||||
WithIdleOverlay@LIGHTS:
|
WithIdleOverlay@LIGHTS:
|
||||||
Sequence: idle-lights
|
Sequence: idle-lights
|
||||||
|
|
||||||
|
GADEPT:
|
||||||
|
Inherits: ^Building
|
||||||
|
Valued:
|
||||||
|
Cost: 1200
|
||||||
|
Tooltip:
|
||||||
|
Name: Service Depot
|
||||||
|
Description: Repairs vehicles
|
||||||
|
Buildable:
|
||||||
|
BuildPaletteOrder: 80
|
||||||
|
Prerequisites: factory
|
||||||
|
Owner: gdi
|
||||||
|
Queue: Building
|
||||||
|
Building:
|
||||||
|
Power: -30
|
||||||
|
Footprint: _x_ xxx _x_
|
||||||
|
Dimensions: 3,3
|
||||||
|
Health:
|
||||||
|
HP: 1100
|
||||||
|
RevealsShroud:
|
||||||
|
Range: 5c0
|
||||||
|
Reservable:
|
||||||
|
RepairsUnits:
|
||||||
|
RallyPoint:
|
||||||
|
WithIdleOverlay@LIGHT:
|
||||||
|
Sequence: idle-light
|
||||||
|
WithIdleOverlay@GROUND:
|
||||||
|
Sequence: ground
|
||||||
|
WithRepairOverlay@CIRCUITS:
|
||||||
|
Sequence: circuits
|
||||||
|
WithRepairOverlay@CRANE:
|
||||||
|
Sequence: crane
|
||||||
|
WithRepairOverlay@PLATFORM:
|
||||||
|
Sequence: platform
|
||||||
|
|
||||||
ANYPOWER:
|
ANYPOWER:
|
||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Power Plant
|
Name: Power Plant
|
||||||
|
|||||||
@@ -645,4 +645,61 @@ proc: # TODO: unused narefn_a, narefn_b
|
|||||||
# Start: 0
|
# Start: 0
|
||||||
# Length: *
|
# Length: *
|
||||||
icon: reficon
|
icon: reficon
|
||||||
|
Start: 0
|
||||||
|
|
||||||
|
gadept:
|
||||||
|
idle:
|
||||||
|
Start: 0
|
||||||
|
ShadowStart: 3
|
||||||
|
damaged-idle:
|
||||||
|
Start: 1
|
||||||
|
ShadowStart: 4
|
||||||
|
critical-idle:
|
||||||
|
Start: 2
|
||||||
|
ShadowStart: 5
|
||||||
|
ground: gadeptbb
|
||||||
|
Start: 0
|
||||||
|
ShadowStart: 3
|
||||||
|
ZOffset: -1c611
|
||||||
|
damaged-ground: gadeptbb
|
||||||
|
Start: 1
|
||||||
|
ShadowStart: 4
|
||||||
|
ZOffset: -1c611
|
||||||
|
critical-ground: gadeptbb
|
||||||
|
Start: 2
|
||||||
|
ShadowStart: 5
|
||||||
|
ZOffset: -1c611
|
||||||
|
idle-light: gadept_b
|
||||||
|
Start: 0
|
||||||
|
Length: 7
|
||||||
|
Tick: 120
|
||||||
|
damaged-idle-light: gadept_b
|
||||||
|
Start: 7
|
||||||
|
Length: 7
|
||||||
|
Tick: 120
|
||||||
|
circuits: gadept_a
|
||||||
|
Start: 0
|
||||||
|
Length: 5
|
||||||
|
ZOffset: -1c511
|
||||||
|
damaged-circuits: gadept_a
|
||||||
|
Start: 5
|
||||||
|
Length: 5
|
||||||
|
ZOffset: -1c511
|
||||||
|
crane: gadept_c
|
||||||
|
Start: 0
|
||||||
|
Length: 16
|
||||||
|
platform: gadept_d
|
||||||
|
Start: 0
|
||||||
|
Length: 7
|
||||||
|
ZOffset: -1c511
|
||||||
|
damaged-platform: gadept_d
|
||||||
|
Start: 7
|
||||||
|
Length: 7
|
||||||
|
ZOffset: -1c511
|
||||||
|
make: gadeptmk
|
||||||
|
Start: 0
|
||||||
|
Length: 10
|
||||||
|
Tick: 60
|
||||||
|
ShadowStart: 10
|
||||||
|
icon: fixicon
|
||||||
Start: 0
|
Start: 0
|
||||||
Reference in New Issue
Block a user