Powered down buildings now display a "powered off" animation
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
using OpenRA.Mods.RA.Effects;
|
||||||
|
|
||||||
namespace OpenRA.Mods.RA.Buildings
|
namespace OpenRA.Mods.RA.Buildings
|
||||||
{
|
{
|
||||||
@@ -40,6 +41,10 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
Sound.PlayToPlayer(self.Owner, disabled ? eva.EnablePower : eva.DisablePower);
|
Sound.PlayToPlayer(self.Owner, disabled ? eva.EnablePower : eva.DisablePower);
|
||||||
|
|
||||||
PowerManager.UpdateActor(self, disabled ? 0 : normalPower);
|
PowerManager.UpdateActor(self, disabled ? 0 : normalPower);
|
||||||
|
|
||||||
|
if (disabled)
|
||||||
|
self.World.AddFrameEndTask(
|
||||||
|
w => w.Add(new PowerdownIndicator(self)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
44
OpenRA.Mods.RA/Effects/PowerdownIndicator.cs
Normal file
44
OpenRA.Mods.RA/Effects/PowerdownIndicator.cs
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2011 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 OpenRA.Effects;
|
||||||
|
using OpenRA.Graphics;
|
||||||
|
using OpenRA.Mods.RA.Buildings;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.RA.Effects
|
||||||
|
{
|
||||||
|
class PowerdownIndicator : IEffect
|
||||||
|
{
|
||||||
|
Actor a;
|
||||||
|
Animation anim = new Animation("poweroff");
|
||||||
|
|
||||||
|
public PowerdownIndicator(Actor a)
|
||||||
|
{
|
||||||
|
this.a = a; anim.PlayRepeating("offline");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Tick(World world)
|
||||||
|
{
|
||||||
|
if (!a.IsInWorld || a.IsDead() || !a.Trait<CanPowerDown>().Disabled)
|
||||||
|
world.AddFrameEndTask(w => w.Remove(this));
|
||||||
|
|
||||||
|
anim.Tick();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Renderable> Render()
|
||||||
|
{
|
||||||
|
if (!a.Destroyed)
|
||||||
|
yield return new Renderable(anim.Image,
|
||||||
|
a.CenterLocation - .5f * anim.Image.size, "chrome", (int)a.CenterLocation.Y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@@ -67,6 +67,7 @@
|
|||||||
<Compile Include="Air\EjectOnDeath.cs" />
|
<Compile Include="Air\EjectOnDeath.cs" />
|
||||||
<Compile Include="Effects\CashTick.cs" />
|
<Compile Include="Effects\CashTick.cs" />
|
||||||
<Compile Include="Effects\GpsDot.cs" />
|
<Compile Include="Effects\GpsDot.cs" />
|
||||||
|
<Compile Include="Effects\PowerdownIndicator.cs" />
|
||||||
<Compile Include="GivesBounty.cs" />
|
<Compile Include="GivesBounty.cs" />
|
||||||
<Compile Include="Lint\LintBuildablePrerequisites.cs" />
|
<Compile Include="Lint\LintBuildablePrerequisites.cs" />
|
||||||
<Compile Include="Lint\CheckAutotargetWiring.cs" />
|
<Compile Include="Lint\CheckAutotargetWiring.cs" />
|
||||||
|
|||||||
BIN
mods/ra/bits/poweroff.shp
Normal file
BIN
mods/ra/bits/poweroff.shp
Normal file
Binary file not shown.
@@ -1540,6 +1540,12 @@ select:
|
|||||||
repair:
|
repair:
|
||||||
Start: 2
|
Start: 2
|
||||||
|
|
||||||
|
poweroff:
|
||||||
|
offline:
|
||||||
|
Start: 0
|
||||||
|
Length: *
|
||||||
|
Tick: 160
|
||||||
|
|
||||||
tabs:
|
tabs:
|
||||||
left-normal:
|
left-normal:
|
||||||
Start: 0
|
Start: 0
|
||||||
|
|||||||
Reference in New Issue
Block a user