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 skirmish mode to RA and D2k to complement TD's skirmish mode.
Added an Extras submenu for miscellaneous game extras. Added an Extras submenu for miscellaneous game extras.
Engineers can now regain control over husks. 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. A player's units, and allied units, now move out of the way when blocking production facilities.
Added cheat button to grow map resources. Added cheat button to grow map resources.
Fixed units staying selected and contributing to control groups when becoming cloaked or hidden in fog. 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. 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. 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. 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: Packaging:
Removed portable install option from Windows installer as the game left without write access breaks content download and error log generation. 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. Added HTML documentation to the Windows installer.

View File

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

View File

@@ -11,6 +11,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Mods.RA.Move; using OpenRA.Mods.RA.Move;
using OpenRA.Traits; using OpenRA.Traits;
@@ -25,7 +26,7 @@ namespace OpenRA.Mods.RA
public int GetInitialFacing() { return 128; } public int GetInitialFacing() { return 128; }
} }
class Husk : IPositionable, IFacing, ISync, INotifyAddedToWorld, INotifyRemovedFromWorld class Husk : IPositionable, IFacing, ISync, INotifyAddedToWorld, INotifyRemovedFromWorld, IDisable
{ {
readonly HuskInfo info; readonly HuskInfo info;
readonly Actor self; readonly Actor self;
@@ -100,6 +101,11 @@ namespace OpenRA.Mods.RA
self.World.ActorMap.RemovePosition(self, this); self.World.ActorMap.RemovePosition(self, this);
self.World.ScreenMap.Remove(self); self.World.ScreenMap.Remove(self);
} }
public bool Disabled
{
get { return true; }
}
} }
public class HuskSpeedInit : IActorInit<int> 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="Buildings\Demolishable.cs" />
<Compile Include="Widgets\Logic\DisconnectWatcherLogic.cs" /> <Compile Include="Widgets\Logic\DisconnectWatcherLogic.cs" />
<Compile Include="Activities\FlyFollow.cs" /> <Compile Include="Activities\FlyFollow.cs" />
<Compile Include="Modifiers\DisabledOverlay.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj"> <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) public RenderBuilding(ActorInitializer init, RenderBuildingInfo info)
: this(init, info, () => 0) { } : this(init, info, () => 0) { }
@@ -54,19 +54,6 @@ namespace OpenRA.Mods.RA.Render
self.QueueActivity(new CallFunc(() => Complete(self))); 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) void Complete(Actor self)
{ {
anim.PlayRepeating(NormalizeSequence(self, "idle")); anim.PlayRepeating(NormalizeSequence(self, "idle"));

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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