Remove DisabledOverlay using WithColoredOverlay & remove IDisable from Husk

This commit is contained in:
atlimit8
2017-03-11 09:08:21 -06:00
parent 3111b2cf9b
commit 770efd710b
16 changed files with 70 additions and 95 deletions

View File

@@ -349,7 +349,6 @@
<Compile Include="Traits\KillsSelf.cs" />
<Compile Include="Traits\AmmoPool.cs" />
<Compile Include="Traits\Mobile.cs" />
<Compile Include="Traits\Modifiers\DisabledOverlay.cs" />
<Compile Include="Traits\Modifiers\FrozenUnderFog.cs" />
<Compile Include="Traits\Modifiers\HiddenUnderFog.cs" />
<Compile Include="Traits\Modifiers\WithColoredOverlay.cs" />

View File

@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits
bool IOccupySpaceInfo.SharesCell { get { return false; } }
}
public class Husk : IPositionable, IFacing, ISync, INotifyCreated, INotifyAddedToWorld, INotifyRemovedFromWorld, IDisable, IDeathActorInitModifier
public class Husk : IPositionable, IFacing, ISync, INotifyCreated, INotifyAddedToWorld, INotifyRemovedFromWorld, IDeathActorInitModifier
{
readonly HuskInfo info;
readonly Actor self;
@@ -120,11 +120,6 @@ namespace OpenRA.Mods.Common.Traits
self.World.RemoveFromMaps(self, this);
}
public bool Disabled
{
get { return true; }
}
public void ModifyDeathActorInit(Actor self, TypeDictionary init)
{
init.Add(new FacingInit(Facing));

View File

@@ -1,44 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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, either version 3 of
* the License, or (at your option) any later version. For more
* information, see COPYING.
*/
#endregion
using System.Collections.Generic;
using OpenRA.Graphics;
using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[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)
{
if (!self.IsDisabled())
return r;
return ModifiedRender(self, wr, r);
}
IEnumerable<IRenderable> ModifiedRender(Actor self, WorldRenderer wr, IEnumerable<IRenderable> r)
{
foreach (var a in r)
{
yield return a;
if (!a.IsDecoration)
yield return a.WithPalette(wr.Palette("disabled"))
.WithZOffset(a.ZOffset + 1)
.AsDecoration();
}
}
}
}

View File

@@ -830,7 +830,8 @@
ForceHealthPercentage: 25
Tooltip:
GenericName: Destroyed Vehicle
DisabledOverlay:
WithColoredOverlay@IDISABLE:
Palette: disabled
ScriptTriggers:
Explodes:
Weapon: UnitExplodeSmall
@@ -892,3 +893,10 @@
-GivesBuildableArea:
MustBeDestroyed:
RequiredForShortGame: false
^DisabledOverlay:
WithColoredOverlay@IDISABLE:
RequiresCondition: disabled
Palette: disabled
GrantConditionOnDisabled@IDISABLE:
Condition: disabled

View File

@@ -441,6 +441,7 @@ HPAD:
HQ:
Inherits: ^BaseBuilding
Inherits@IDISABLE: ^DisabledOverlay
Valued:
Cost: 1000
Tooltip:
@@ -463,7 +464,6 @@ HQ:
CanPowerDown:
PowerupSound: EnablePower
PowerdownSound: DisablePower
DisabledOverlay:
WithSpriteBody:
PauseAnimationWhenDisabled: true
Health:
@@ -500,8 +500,6 @@ HQ:
SupportPowerChargeBar:
Power:
Amount: -50
GrantConditionOnDisabled@IDISABLE:
Condition: disabled
FIX:
Inherits: ^BaseBuilding
@@ -539,6 +537,7 @@ FIX:
EYE:
Inherits: ^BaseBuilding
Inherits@IDISABLE: ^DisabledOverlay
Valued:
Cost: 1800
Tooltip:
@@ -561,7 +560,6 @@ EYE:
CanPowerDown:
PowerupSound: EnablePower
PowerdownSound: DisablePower
DisabledOverlay:
WithSpriteBody:
PauseAnimationWhenDisabled: true
Health:
@@ -592,11 +590,10 @@ EYE:
Power:
Amount: -200
ProvidesPrerequisite@buildingname:
GrantConditionOnDisabled@IDISABLE:
Condition: disabled
TMPL:
Inherits: ^BaseBuilding
Inherits@IDISABLE: ^DisabledOverlay
Valued:
Cost: 2000
Tooltip:
@@ -619,7 +616,6 @@ TMPL:
CanPowerDown:
PowerupSound: EnablePower
PowerdownSound: DisablePower
DisabledOverlay:
Health:
HP: 2100
RevealsShroud:
@@ -697,6 +693,7 @@ GUN:
SAM:
Inherits: ^Defense
Inherits@IDISABLE: ^DisabledOverlay
Valued:
Cost: 650
Tooltip:
@@ -712,7 +709,6 @@ SAM:
Footprint: xx
Dimensions: 2,1
RequiresPower:
DisabledOverlay:
Health:
HP: 400
Armor:
@@ -739,6 +735,7 @@ SAM:
OBLI:
Inherits: ^Defense
Inherits@IDISABLE: ^DisabledOverlay
Valued:
Cost: 1500
Tooltip:
@@ -755,7 +752,6 @@ OBLI:
SelectionDecorations:
VisualBounds: 22,44,0,-10
RequiresPower:
DisabledOverlay:
Health:
HP: 600
Armor:
@@ -818,6 +814,7 @@ GTWR:
ATWR:
Inherits: ^Defense
Inherits@IDISABLE: ^DisabledOverlay
Valued:
Cost: 1000
Tooltip:
@@ -834,7 +831,6 @@ ATWR:
SelectionDecorations:
VisualBounds: 22,48,0,-12
RequiresPower:
DisabledOverlay:
Health:
HP: 550
Armor:

View File

@@ -199,7 +199,8 @@
Targetable:
TargetTypes: Ground, Vehicle
RequiresForceFire: true
DisabledOverlay:
WithColoredOverlay@IDISABLE:
Palette: disabled
Explodes:
Weapon: UnitExplodeMed
EmptyWeapon: UnitExplodeMed
@@ -394,3 +395,10 @@
MustBeDestroyed:
RequiredForShortGame: false
RevealOnFire:
^DisabledOverlay:
WithColoredOverlay@IDISABLE:
RequiresCondition: disabled
Palette: disabled
GrantConditionOnDisabled@IDISABLE:
Condition: disabled

View File

@@ -486,11 +486,11 @@ heavy_factory:
outpost:
Inherits: ^Building
Inherits@IDISABLE: ^DisabledOverlay
RequiresPower:
CanPowerDown:
PowerupSound: EnablePower
PowerdownSound: DisablePower
DisabledOverlay:
Buildable:
Prerequisites: barracks, ~techlevel.medium
Queue: Building
@@ -533,11 +533,10 @@ outpost:
Power:
Amount: -125
ProvidesPrerequisite@buildingname:
GrantConditionOnDisabled@IDISABLE:
Condition: disabled
starport:
Inherits: ^Building
Inherits@IDISABLE: ^DisabledOverlay
Tooltip:
Name: Starport
Buildable:
@@ -583,7 +582,6 @@ starport:
ProductionBar:
PrimaryBuilding:
PrimaryCondition: primary
DisabledOverlay:
ProvidesPrerequisite@atreides:
Prerequisite: starport.atreides
Factions: atreides
@@ -702,6 +700,7 @@ medium_gun_turret:
large_gun_turret:
Inherits: ^Defense
Inherits@IDISABLE: ^DisabledOverlay
Buildable:
Queue: Building
Prerequisites: outpost, upgrade.conyard, ~techlevel.medium
@@ -739,7 +738,6 @@ large_gun_turret:
CanPowerDown:
PowerupSound: EnablePower
PowerdownSound: DisablePower
DisabledOverlay:
Power:
Amount: -60
SelectionDecorations:
@@ -905,6 +903,7 @@ research_centre:
palace:
Inherits: ^Building
Inherits@IDISABLE: ^DisabledOverlay
Buildable:
Prerequisites: research_centre, ~techlevel.high
Queue: Building
@@ -1002,7 +1001,6 @@ palace:
CanPowerDown:
PowerupSound: EnablePower
PowerdownSound: DisablePower
DisabledOverlay:
RequiresPower:
SupportPowerChargeBar:
ProvidesPrerequisite@buildingname:

View File

@@ -786,7 +786,8 @@
CaptureThreshold: 100
TransformOnCapture:
ForceHealthPercentage: 25
DisabledOverlay:
WithColoredOverlay@IDISABLE:
Palette: disabled
Targetable:
TargetTypes: Ground, Husk
RequiresForceFire: true
@@ -925,3 +926,10 @@
TargetTypes: Ground
Immobile:
OccupiesSpace: true
^DisabledOverlay:
WithColoredOverlay@IDISABLE:
RequiresCondition: disabled
Palette: disabled
GrantConditionOnDisabled@IDISABLE:
Condition: disabled

View File

@@ -120,6 +120,7 @@ WEAF:
DOMF:
Inherits: ^FakeBuilding
Inherits@IDISABLE: ^DisabledOverlay
Inherits@infiltrate: ^InfiltratableFake
Tooltip:
Name: Fake Radar Dome
@@ -145,7 +146,6 @@ DOMF:
Armor:
Type: Wood
RequiresPower:
DisabledOverlay:
FIXF:
Inherits: ^FakeBuilding
@@ -207,6 +207,7 @@ FAPW:
ATEF:
Inherits: ^FakeBuilding
Inherits@IDISABLE: ^DisabledOverlay
Tooltip:
Name: Fake Allied Tech Center
GenericName: Allied Tech Center
@@ -231,10 +232,10 @@ ATEF:
Armor:
Type: Wood
RequiresPower:
DisabledOverlay:
PDOF:
Inherits: ^FakeBuilding
Inherits@IDISABLE: ^DisabledOverlay
Tooltip:
Name: Fake Chronosphere
GenericName: Chronosphere
@@ -263,10 +264,10 @@ PDOF:
Explodes:
DamageThreshold: 50
RequiresPower:
DisabledOverlay:
MSLF:
Inherits: ^FakeBuilding
Inherits@IDISABLE: ^DisabledOverlay
Tooltip:
Name: Fake Missile Silo
GenericName: Missile Silo
@@ -293,7 +294,6 @@ MSLF:
Explodes:
DamageThreshold: 50
RequiresPower:
DisabledOverlay:
FACF:
Inherits: ^FakeBuilding

View File

@@ -1,5 +1,6 @@
MSLO:
Inherits: ^ScienceBuilding
Inherits@IDISABLE: ^DisabledOverlay
Valued:
Cost: 2500
Tooltip:
@@ -45,7 +46,6 @@ MSLO:
PowerupSound: EnablePower
PowerdownSound: DisablePower
RequiresPower:
DisabledOverlay:
SupportPowerChargeBar:
Power:
Amount: -150
@@ -54,6 +54,7 @@ MSLO:
GAP:
Inherits: ^ScienceBuilding
Inherits@IDISABLE: ^DisabledOverlay
Valued:
Cost: 800
Tooltip:
@@ -71,7 +72,6 @@ GAP:
CanPowerDown:
PowerupSound: EnablePower
PowerdownSound: DisablePower
DisabledOverlay:
WithSpriteBody:
PauseAnimationWhenDisabled: true
Health:
@@ -284,6 +284,7 @@ SYRD:
IRON:
Inherits: ^ScienceBuilding
Inherits@IDISABLE: ^DisabledOverlay
Buildable:
Queue: Defense
BuildPaletteOrder: 130
@@ -301,7 +302,6 @@ IRON:
CanPowerDown:
PowerupSound: EnablePower
PowerdownSound: DisablePower
DisabledOverlay:
Selectable:
Bounds: 48,28,0,2
SelectionDecorations:
@@ -338,6 +338,7 @@ IRON:
PDOX:
Inherits: ^ScienceBuilding
Inherits@IDISABLE: ^DisabledOverlay
Buildable:
Queue: Defense
BuildPaletteOrder: 120
@@ -355,7 +356,6 @@ PDOX:
CanPowerDown:
PowerupSound: EnablePower
PowerdownSound: DisablePower
DisabledOverlay:
Health:
HP: 1000
Armor:
@@ -412,6 +412,7 @@ PDOX:
TSLA:
Inherits: ^Defense
Inherits@IDISABLE: ^DisabledOverlay
Buildable:
Queue: Defense
BuildPaletteOrder: 80
@@ -429,7 +430,6 @@ TSLA:
CanPowerDown:
PowerupSound: EnablePower
PowerdownSound: DisablePower
DisabledOverlay:
Health:
HP: 400
Armor:
@@ -457,6 +457,7 @@ TSLA:
AGUN:
Inherits: ^Defense
Inherits@IDISABLE: ^DisabledOverlay
Buildable:
Queue: Defense
BuildPaletteOrder: 90
@@ -474,7 +475,6 @@ AGUN:
CanPowerDown:
PowerupSound: EnablePower
PowerdownSound: DisablePower
DisabledOverlay:
Health:
HP: 400
Armor:
@@ -508,6 +508,7 @@ AGUN:
DOME:
Inherits: ^Building
Inherits@IDISABLE: ^DisabledOverlay
Buildable:
Queue: Building
BuildPaletteOrder: 90
@@ -526,7 +527,6 @@ DOME:
CanPowerDown:
PowerupSound: EnablePower
PowerdownSound: DisablePower
DisabledOverlay:
Health:
HP: 1000
Armor:
@@ -739,6 +739,7 @@ FTUR:
SAM:
Inherits: ^Defense
Inherits@IDISABLE: ^DisabledOverlay
Buildable:
Queue: Defense
BuildPaletteOrder: 100
@@ -755,7 +756,6 @@ SAM:
CanPowerDown:
PowerupSound: EnablePower
PowerdownSound: DisablePower
DisabledOverlay:
Health:
HP: 400
Armor:
@@ -785,6 +785,7 @@ SAM:
ATEK:
Inherits: ^ScienceBuilding
Inherits@IDISABLE: ^DisabledOverlay
Buildable:
Queue: Building
BuildPaletteOrder: 140
@@ -820,7 +821,6 @@ ATEK:
DisplayTimerStances: Ally, Neutral, Enemy
SupportPowerChargeBar:
RequiresPower:
DisabledOverlay:
Power:
Amount: -200
ProvidesPrerequisite@buildingname:
@@ -1303,6 +1303,7 @@ AFLD:
POWR:
Inherits: ^Building
Inherits@IDISABLE: ^DisabledOverlay
Buildable:
Queue: Building
BuildPaletteOrder: 10
@@ -1331,13 +1332,13 @@ POWR:
Targetable:
TargetTypes: Ground, Structure, C4, DetonateAttack, SpyInfiltrate
ScalePowerWithHealth:
DisabledOverlay:
WithDeathAnimation:
DeathSequence: dead
UseDeathTypeSuffix: false
APWR:
Inherits: ^Building
Inherits@IDISABLE: ^DisabledOverlay
Buildable:
Queue: Building
BuildPaletteOrder: 110
@@ -1370,7 +1371,6 @@ APWR:
Targetable:
TargetTypes: Ground, Structure, C4, DetonateAttack, SpyInfiltrate
ScalePowerWithHealth:
DisabledOverlay:
WithDeathAnimation:
DeathSequence: dead
UseDeathTypeSuffix: false

View File

@@ -947,3 +947,10 @@
StartDelay: -1
SpawnAtLastPosition: false
RequiresCondition: !inside-tunnel
^DisabledOverlay:
WithColoredOverlay@IDISABLE:
RequiresCondition: disabled
Palette: disabled
GrantConditionOnDisabled@IDISABLE:
Condition: disabled

View File

@@ -1,5 +1,6 @@
GAPOWR:
Inherits: ^Building
Inherits@IDISABLE: ^DisabledOverlay
Buildable:
Queue: Building
BuildPaletteOrder: 10
@@ -35,7 +36,6 @@ GAPOWR:
Targetable:
TargetTypes: Ground, C4, DetonateAttack, SpyInfiltrate
ScalePowerWithHealth:
DisabledOverlay:
Pluggable@pluga:
Offset: 0,1
Conditions:
@@ -370,6 +370,7 @@ GATECH:
GAPLUG:
Inherits: ^Building
Inherits@IDISABLE: ^DisabledOverlay
Valued:
Cost: 1000
Tooltip:
@@ -389,7 +390,6 @@ GAPLUG:
IndicatorPalette: mouse
PowerupSpeech: EnablePower
PowerdownSpeech: DisablePower
DisabledOverlay:
WithIdleOverlay@DISH:
Sequence: idle-dish
WithIdleOverlay@LIGHTS:

View File

@@ -43,6 +43,7 @@ GAGATE_B:
GACTWR:
Inherits: ^Defense
Inherits@IDISABLE: ^DisabledOverlay
-WithSpriteBody:
WithWallSpriteBody:
Type: wall
@@ -58,7 +59,6 @@ GACTWR:
Building:
Selectable:
Bounds: 48, 36, 0, -6
DisabledOverlay:
Health:
HP: 500
Armor:

View File

@@ -1,5 +1,6 @@
NAPOWR:
Inherits: ^Building
Inherits@IDISABLE: ^DisabledOverlay
Buildable:
Queue: Building
BuildPaletteOrder: 20
@@ -33,12 +34,12 @@ NAPOWR:
TargetTypes: Ground, C4, DetonateAttack, SpyInfiltrate
ScalePowerWithHealth:
PowerTooltip:
DisabledOverlay:
SelectionDecorations:
VisualBounds: 88, 80, 2, -12
NAAPWR:
Inherits: ^Building
Inherits@IDISABLE: ^DisabledOverlay
Buildable:
Queue: Building
BuildPaletteOrder: 120
@@ -71,7 +72,6 @@ NAAPWR:
Targetable:
TargetTypes: Ground, C4, DetonateAttack, SpyInfiltrate
ScalePowerWithHealth:
DisabledOverlay:
PowerTooltip:
SelectionDecorations:
VisualBounds: 100, 74, 0, -12

View File

@@ -148,6 +148,7 @@ NAFNCE:
NALASR:
Inherits: ^Defense
Inherits@IDISABLE: ^DisabledOverlay
Valued:
Cost: 300
Tooltip:
@@ -160,7 +161,6 @@ NALASR:
Building:
Selectable:
Bounds: 40, 30, -8, -6
DisabledOverlay:
Health:
HP: 500
Armor:
@@ -188,6 +188,7 @@ NALASR:
NAOBEL:
Inherits: ^Defense
Inherits@IDISABLE: ^DisabledOverlay
Valued:
Cost: 1500
Tooltip:
@@ -203,7 +204,6 @@ NAOBEL:
Selectable:
Bounds: 88, 42, 0, -6
RequiresPower:
DisabledOverlay:
Health:
HP: 725
Armor:
@@ -232,6 +232,7 @@ NAOBEL:
NASAM:
Inherits: ^Defense
Inherits@IDISABLE: ^DisabledOverlay
Valued:
Cost: 500
Tooltip:
@@ -244,7 +245,6 @@ NASAM:
Selectable:
Bounds: 40, 30, -3, -8
RequiresPower:
DisabledOverlay:
Health:
HP: 600
Armor:
@@ -314,6 +314,7 @@ NASTLH:
NAMISL:
Inherits: ^Building
Inherits@IDISABLE: ^DisabledOverlay
Buildable:
Queue: Defense
BuildPaletteOrder: 180
@@ -346,7 +347,6 @@ NAMISL:
PowerupSpeech: EnablePower
PowerdownSpeech: DisablePower
RequiresPower:
DisabledOverlay:
ProvidesPrerequisite@buildingname:
SupportPowerChargeBar:
NukePower:

View File

@@ -1,5 +1,6 @@
NAPULS:
Inherits: ^Defense
Inherits@IDISABLE: ^DisabledOverlay
Valued:
Cost: 1000
Tooltip:
@@ -15,7 +16,6 @@ NAPULS:
Selectable:
Bounds: 78, 54, 0, -12
RequiresPower:
DisabledOverlay:
Health:
HP: 500
Armor: