use the disabled palette to render husks

closes #4631
This commit is contained in:
Matthias Mailänder
2014-02-16 21:57:17 +01:00
parent 2165518418
commit 56470b918b
15 changed files with 88 additions and 35 deletions

View File

@@ -12,6 +12,7 @@ NEW:
Added skirmish mode to RA and D2k to complement TD's skirmish mode.
Added an Extras submenu for miscellaneous game extras.
Engineers can now regain control over husks.
Husks are now rendered with a black overlay.
A player's units, and allied units, now move out of the way when blocking production facilities.
Added cheat button to grow map resources.
Fixed units staying selected and contributing to control groups when becoming cloaked or hidden in fog.
@@ -105,6 +106,7 @@ NEW:
Mods that use custom TileSize must specify both width and height.
If you spot black tiles in your Dune 2000 ARRAKIS maps, replace them with the remaining sand and rock tiles. Go to Map → Fix Open Areas to randomize them.
The TestFile check in mod.yaml has been renamed to TestFiles (plural!) and now supports a comma-separated list of assets that are required to load the game.
DisabledOverlay has been split from RenderBuilding. Use it together with RequiresPower and CanPowerDown for buildings or directly with Husk.
Packaging:
Removed portable install option from Windows installer as the game left without write access breaks content download and error log generation.
Added HTML documentation to the Windows installer.

View File

@@ -32,6 +32,7 @@ namespace OpenRA.Mods.RA
Info = info;
var anim = new Animation("fire", () => 0);
anim.IsDecoration = true;
anim.PlayRepeating(Info.Anim);
self.Trait<RenderSprites>().anims.Add("fire", anim);
}

View File

@@ -11,6 +11,7 @@
using System.Collections.Generic;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Mods.RA.Move;
using OpenRA.Traits;
@@ -25,7 +26,7 @@ namespace OpenRA.Mods.RA
public int GetInitialFacing() { return 128; }
}
class Husk : IPositionable, IFacing, ISync, INotifyAddedToWorld, INotifyRemovedFromWorld
class Husk : IPositionable, IFacing, ISync, INotifyAddedToWorld, INotifyRemovedFromWorld, IDisable
{
readonly HuskInfo info;
readonly Actor self;
@@ -100,6 +101,11 @@ namespace OpenRA.Mods.RA
self.World.ActorMap.RemovePosition(self, this);
self.World.ScreenMap.Remove(self);
}
public bool Disabled
{
get { return true; }
}
}
public class HuskSpeedInit : IActorInit<int>

View File

@@ -0,0 +1,36 @@
#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 OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
[Desc("Use together with CanPowerDown/RequiresPower on buildings or Husk for vehicles.")]
public class DisabledOverlayInfo : TraitInfo<DisabledOverlay> { }
public class DisabledOverlay : IRenderModifier
{
public IEnumerable<IRenderable> ModifyRender(Actor self, WorldRenderer wr, IEnumerable<IRenderable> r)
{
var disabled = self.IsDisabled();
foreach (var a in r)
{
yield return a;
if (disabled && !a.IsDecoration)
yield return a.WithPalette(wr.Palette("disabled"))
.WithZOffset(a.ZOffset + 1)
.AsDecoration();
}
}
}
}

View File

@@ -495,6 +495,7 @@
<Compile Include="Buildings\Demolishable.cs" />
<Compile Include="Widgets\Logic\DisconnectWatcherLogic.cs" />
<Compile Include="Activities\FlyFollow.cs" />
<Compile Include="Modifiers\DisabledOverlay.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA.Render
}
}
public class RenderBuilding : RenderSimple, INotifyDamageStateChanged, IRenderModifier
public class RenderBuilding : RenderSimple, INotifyDamageStateChanged
{
public RenderBuilding(ActorInitializer init, RenderBuildingInfo info)
: this(init, info, () => 0) { }
@@ -54,19 +54,6 @@ namespace OpenRA.Mods.RA.Render
self.QueueActivity(new CallFunc(() => Complete(self)));
}
public IEnumerable<IRenderable> ModifyRender(Actor self, WorldRenderer wr, IEnumerable<IRenderable> r)
{
var disabled = self.IsDisabled();
foreach (var a in r)
{
yield return a;
if (disabled && !a.IsDecoration)
yield return a.WithPalette(wr.Palette("disabled"))
.WithZOffset(a.ZOffset + 1)
.AsDecoration();
}
}
void Complete(Actor self)
{
anim.PlayRepeating(NormalizeSequence(self, "idle"));

View File

@@ -523,6 +523,7 @@
BelowUnits:
BodyOrientation:
LuaScriptEvents:
DisabledOverlay:
^HelicopterHusk:
Inherits: ^Husk

View File

@@ -343,8 +343,6 @@ HPAD:
ProductionBar:
HQ:
RequiresPower:
CanPowerDown:
Inherits: ^Building
Valued:
Cost: 1000
@@ -361,6 +359,9 @@ HQ:
Power: -40
Footprint: x_ xx
Dimensions: 2,2
RequiresPower:
CanPowerDown:
DisabledOverlay:
Health:
HP: 750
RevealsShroud:
@@ -408,8 +409,6 @@ FIX:
RallyPoint:
EYE:
RequiresPower:
CanPowerDown:
Inherits: ^Building
Valued:
Cost: 1800
@@ -426,6 +425,9 @@ EYE:
Power: -200
Footprint: x_ xx
Dimensions: 2,2
RequiresPower:
CanPowerDown:
DisabledOverlay:
Health:
HP: 1200
RevealsShroud:
@@ -450,8 +452,6 @@ EYE:
SupportPowerChargeBar:
TMPL:
RequiresPower:
CanPowerDown:
Inherits: ^Building
Valued:
Cost: 2000
@@ -468,6 +468,9 @@ TMPL:
Power: -150
Footprint: ___ xxx xxx
Dimensions: 3,3
RequiresPower:
CanPowerDown:
DisabledOverlay:
Health:
HP: 2000
RevealsShroud:

View File

@@ -61,6 +61,7 @@ PALACEA:
SelectTargetSound:
FlareType:
CanPowerDown:
DisabledOverlay:
RequiresPower:
SupportPowerChargeBar:

View File

@@ -104,6 +104,7 @@
CaptureThreshold: 1.0
TransformOnCapture:
ForceHealthPercentage: 25
DisabledOverlay:
^TowerHusk:
Health:

View File

@@ -99,6 +99,7 @@ PALACEH:
DisplayBeacon: True
DisplayRadarPing: True
CanPowerDown:
DisabledOverlay:
RequiresPower:
SupportPowerChargeBar:

View File

@@ -90,6 +90,7 @@ PALACEO:
SelectTargetSound:
FlareType:
CanPowerDown:
DisabledOverlay:
RequiresPower:
SupportPowerChargeBar:

View File

@@ -263,6 +263,7 @@
Inherits: ^Building
RequiresPower:
CanPowerDown:
DisabledOverlay:
Buildable:
Prerequisites: Barracks
Queue: Building
@@ -335,6 +336,7 @@
PrimaryBuilding:
RequiresPower:
CanPowerDown:
DisabledOverlay:
ProvidesCustomPrerequisite:
Prerequisite: Starport
@@ -477,6 +479,7 @@ WALL:
AutoTarget:
RequiresPower:
CanPowerDown:
DisabledOverlay:
RenderDetectionCircle:
DetectCloaked:
Range: 6

View File

@@ -438,6 +438,7 @@
CaptureThreshold: 1.0
TransformOnCapture:
ForceHealthPercentage: 25
DisabledOverlay:
^HelicopterHusk:
Inherits: ^Husk

View File

@@ -41,12 +41,11 @@ MSLO:
DisplayRadarPing: True
CanPowerDown:
RequiresPower:
DisabledOverlay:
SupportPowerChargeBar:
GAP:
Inherits: ^Building
RequiresPower:
CanPowerDown:
Valued:
Cost: 800
Tooltip:
@@ -62,6 +61,9 @@ GAP:
Power: -60
Footprint: _ x
Dimensions: 1,2
RequiresPower:
CanPowerDown:
DisabledOverlay:
Health:
HP: 1000
Armor:
@@ -188,9 +190,7 @@ SYRD:
ProductionBar:
IRON:
CanPowerDown:
Inherits: ^Building
RequiresPower:
Buildable:
Queue: Defense
BuildPaletteOrder: 120
@@ -207,6 +207,9 @@ IRON:
Power: -200
Footprint: xx
Dimensions: 2,1
RequiresPower:
CanPowerDown:
DisabledOverlay:
Selectable:
Bounds: 50,50,0,-12
Health:
@@ -231,8 +234,6 @@ IRON:
PDOX:
Inherits: ^Building
RequiresPower:
CanPowerDown:
Buildable:
Queue: Defense
BuildPaletteOrder: 120
@@ -249,6 +250,9 @@ PDOX:
Power: -200
Footprint: xx xx
Dimensions: 2,2
RequiresPower:
CanPowerDown:
DisabledOverlay:
Health:
HP: 1000
Armor:
@@ -273,8 +277,6 @@ PDOX:
TSLA:
Inherits: ^Building
RequiresPower:
CanPowerDown:
Buildable:
Queue: Defense
BuildPaletteOrder: 70
@@ -290,6 +292,9 @@ TSLA:
Power: -150
Footprint: _ x
Dimensions: 1,2
RequiresPower:
CanPowerDown:
DisabledOverlay:
-GivesBuildableArea:
Health:
HP: 400
@@ -312,8 +317,6 @@ TSLA:
AGUN:
Inherits: ^Building
RequiresPower:
CanPowerDown:
Buildable:
Queue: Defense
BuildPaletteOrder: 50
@@ -329,6 +332,9 @@ AGUN:
Power: -50
Footprint: _ x
Dimensions: 1,2
RequiresPower:
CanPowerDown:
DisabledOverlay:
-GivesBuildableArea:
Health:
HP: 400
@@ -354,8 +360,6 @@ AGUN:
DrawLineToTarget:
DOME:
RequiresPower:
CanPowerDown:
Inherits: ^Building
Buildable:
Queue: Building
@@ -372,6 +376,9 @@ DOME:
Power: -40
Footprint: xx xx
Dimensions: 2,2
RequiresPower:
CanPowerDown:
DisabledOverlay:
Health:
HP: 1000
Armor:
@@ -772,6 +779,9 @@ SAM:
Power: -40
Footprint: xx
Dimensions: 2,1
RequiresPower:
CanPowerDown:
DisabledOverlay:
-GivesBuildableArea:
Health:
HP: 400
@@ -792,8 +802,6 @@ SAM:
-RenderBuilding:
RenderRangeCircle:
RangeCircleType: aa
RequiresPower:
CanPowerDown:
-AcceptsSupplies:
DrawLineToTarget: