Replace Spy* with Disguise* for certain classes
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
* 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
|
* available to you under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation. For more information,
|
* as published by the Free Software Foundation. For more information,
|
||||||
@@ -16,56 +16,59 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
class SpyToolTipInfo : TooltipInfo, Requires<SpyInfo>
|
class DisguiseToolTipInfo : TooltipInfo, Requires<DisguiseInfo>
|
||||||
{
|
{
|
||||||
public override object Create (ActorInitializer init) { return new SpyToolTip(init.self, this); }
|
public override object Create (ActorInitializer init) { return new DisguiseToolTip(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class SpyToolTip : IToolTip
|
class DisguiseToolTip : IToolTip
|
||||||
{
|
{
|
||||||
Actor self;
|
Actor self;
|
||||||
TooltipInfo Info;
|
TooltipInfo info;
|
||||||
Spy spy;
|
Disguise disguise;
|
||||||
|
|
||||||
|
public DisguiseToolTip(Actor self, TooltipInfo info)
|
||||||
|
{
|
||||||
|
this.self = self;
|
||||||
|
this.info = info;
|
||||||
|
disguise = self.Trait<Disguise>();
|
||||||
|
}
|
||||||
|
|
||||||
public string Name()
|
public string Name()
|
||||||
{
|
{
|
||||||
if (spy.Disguised)
|
if (disguise.Disguised)
|
||||||
{
|
{
|
||||||
if (self.Owner == self.World.LocalPlayer)
|
if (self.Owner == self.World.LocalPlayer)
|
||||||
return "{0} ({1})".F(Info.Name, spy.disguisedAsName);
|
return "{0} ({1})".F(info.Name, disguise.AsName);
|
||||||
return spy.disguisedAsName;
|
|
||||||
|
return disguise.AsName;
|
||||||
}
|
}
|
||||||
return Info.Name;
|
return info.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player Owner()
|
public Player Owner()
|
||||||
{
|
{
|
||||||
if (spy.Disguised)
|
if (disguise.Disguised)
|
||||||
{
|
{
|
||||||
if (self.Owner == self.World.LocalPlayer)
|
if (self.Owner == self.World.LocalPlayer)
|
||||||
return self.Owner;
|
return self.Owner;
|
||||||
return spy.disguisedAsPlayer;
|
|
||||||
|
return disguise.AsPlayer;
|
||||||
}
|
}
|
||||||
return self.Owner;
|
return self.Owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpyToolTip( Actor self, TooltipInfo info )
|
|
||||||
{
|
|
||||||
this.self = self;
|
|
||||||
Info = info;
|
|
||||||
spy = self.Trait<Spy>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class DisguiseInfo : TraitInfo<Disguise> { }
|
||||||
|
|
||||||
class SpyInfo : TraitInfo<Spy> { }
|
class Disguise : IEffectiveOwner, IIssueOrder, IResolveOrder, IOrderVoice, IRadarColorModifier, INotifyAttack
|
||||||
|
|
||||||
class Spy : IIssueOrder, IResolveOrder, IOrderVoice, IRadarColorModifier, INotifyAttack
|
|
||||||
{
|
{
|
||||||
public Player disguisedAsPlayer;
|
public Player AsPlayer;
|
||||||
public string disguisedAsSprite, disguisedAsName;
|
public string AsSprite;
|
||||||
|
public string AsName;
|
||||||
|
|
||||||
public bool Disguised { get { return disguisedAsPlayer != null; } }
|
public bool Disguised { get { return AsPlayer != null; } }
|
||||||
|
public Player Owner { get { return AsPlayer; } }
|
||||||
|
|
||||||
public IEnumerable<IOrderTargeter> Orders
|
public IEnumerable<IOrderTargeter> Orders
|
||||||
{
|
{
|
||||||
@@ -79,6 +82,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
if (order.OrderID == "Disguise")
|
if (order.OrderID == "Disguise")
|
||||||
return new Order(order.OrderID, self, queued) { TargetActor = target.Actor };
|
return new Order(order.OrderID, self, queued) { TargetActor = target.Actor };
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +101,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
public string VoicePhraseForOrder(Actor self, Order order)
|
public string VoicePhraseForOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
return (order.OrderString == "Disguise") ? "Attack" : null;
|
return order.OrderString == "Disguise" ? "Attack" : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Color RadarColorOverride(Actor self)
|
public Color RadarColorOverride(Actor self)
|
||||||
@@ -105,25 +109,24 @@ namespace OpenRA.Mods.RA
|
|||||||
if (!Disguised || self.Owner.IsAlliedWith(self.World.RenderPlayer))
|
if (!Disguised || self.Owner.IsAlliedWith(self.World.RenderPlayer))
|
||||||
return self.Owner.Color.RGB;
|
return self.Owner.Color.RGB;
|
||||||
|
|
||||||
return disguisedAsPlayer.Color.RGB;
|
return AsPlayer.Color.RGB;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisguiseAs(Actor target)
|
void DisguiseAs(Actor target)
|
||||||
{
|
{
|
||||||
var tooltip = target.TraitsImplementing<IToolTip>().FirstOrDefault();
|
var tooltip = target.TraitsImplementing<IToolTip>().FirstOrDefault();
|
||||||
disguisedAsName = tooltip.Name();
|
AsName = tooltip.Name();
|
||||||
disguisedAsPlayer = tooltip.Owner();
|
AsPlayer = tooltip.Owner();
|
||||||
disguisedAsSprite = target.Trait<RenderSprites>().GetImage(target);
|
AsSprite = target.Trait<RenderSprites>().GetImage(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DropDisguise()
|
void DropDisguise()
|
||||||
{
|
{
|
||||||
disguisedAsName = null;
|
AsName = null;
|
||||||
disguisedAsPlayer = null;
|
AsPlayer = null;
|
||||||
disguisedAsSprite = null;
|
AsSprite = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* lose our disguise if we attack anything */
|
|
||||||
public void Attacking(Actor self, Target target, Armament a, Barrel barrel) { DropDisguise(); }
|
public void Attacking(Actor self, Target target, Armament a, Barrel barrel) { DropDisguise(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
* 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
|
* available to you under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation. For more information,
|
* as published by the Free Software Foundation. For more information,
|
||||||
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.RA.Effects
|
|||||||
|
|
||||||
Lazy<HiddenUnderFog> huf;
|
Lazy<HiddenUnderFog> huf;
|
||||||
Lazy<FrozenUnderFog> fuf;
|
Lazy<FrozenUnderFog> fuf;
|
||||||
Lazy<Spy> spy;
|
Lazy<Disguise> disguise;
|
||||||
Lazy<Cloak> cloak;
|
Lazy<Cloak> cloak;
|
||||||
Cache<Player, GpsWatcher> watcher;
|
Cache<Player, GpsWatcher> watcher;
|
||||||
Cache<Player, FrozenActorLayer> frozen;
|
Cache<Player, FrozenActorLayer> frozen;
|
||||||
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.RA.Effects
|
|||||||
|
|
||||||
huf = Lazy.New(() => self.TraitOrDefault<HiddenUnderFog>());
|
huf = Lazy.New(() => self.TraitOrDefault<HiddenUnderFog>());
|
||||||
fuf = Lazy.New(() => self.TraitOrDefault<FrozenUnderFog>());
|
fuf = Lazy.New(() => self.TraitOrDefault<FrozenUnderFog>());
|
||||||
spy = Lazy.New(() => self.TraitOrDefault<Spy>());
|
disguise = Lazy.New(() => self.TraitOrDefault<Disguise>());
|
||||||
cloak = Lazy.New(() => self.TraitOrDefault<Cloak>());
|
cloak = Lazy.New(() => self.TraitOrDefault<Cloak>());
|
||||||
|
|
||||||
watcher = new Cache<Player, GpsWatcher>(p => p.PlayerActor.Trait<GpsWatcher>());
|
watcher = new Cache<Player, GpsWatcher>(p => p.PlayerActor.Trait<GpsWatcher>());
|
||||||
@@ -65,7 +65,7 @@ namespace OpenRA.Mods.RA.Effects
|
|||||||
if (cloak.Value != null && cloak.Value.Cloaked)
|
if (cloak.Value != null && cloak.Value.Cloaked)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (spy.Value != null && spy.Value.Disguised)
|
if (disguise.Value != null && disguise.Value.Disguised)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (huf.Value != null && !huf.Value.IsVisible(self, self.World.RenderPlayer))
|
if (huf.Value != null && !huf.Value.IsVisible(self, self.World.RenderPlayer))
|
||||||
|
|||||||
@@ -320,7 +320,7 @@
|
|||||||
<Compile Include="Render\RenderHarvester.cs" />
|
<Compile Include="Render\RenderHarvester.cs" />
|
||||||
<Compile Include="Render\RenderInfantry.cs" />
|
<Compile Include="Render\RenderInfantry.cs" />
|
||||||
<Compile Include="Render\RenderInfantryPanic.cs" />
|
<Compile Include="Render\RenderInfantryPanic.cs" />
|
||||||
<Compile Include="Render\RenderSpy.cs" />
|
<Compile Include="Render\RenderDisguise.cs" />
|
||||||
<Compile Include="Render\RenderLandingCraft.cs" />
|
<Compile Include="Render\RenderLandingCraft.cs" />
|
||||||
<Compile Include="Render\RenderUnit.cs" />
|
<Compile Include="Render\RenderUnit.cs" />
|
||||||
<Compile Include="Render\RenderUnitReload.cs" />
|
<Compile Include="Render\RenderUnitReload.cs" />
|
||||||
@@ -348,7 +348,7 @@
|
|||||||
<Compile Include="SmokeTrailWhenDamaged.cs" />
|
<Compile Include="SmokeTrailWhenDamaged.cs" />
|
||||||
<Compile Include="SpawnMPUnits.cs" />
|
<Compile Include="SpawnMPUnits.cs" />
|
||||||
<Compile Include="SpawnMapActors.cs" />
|
<Compile Include="SpawnMapActors.cs" />
|
||||||
<Compile Include="Spy.cs" />
|
<Compile Include="Disguise.cs" />
|
||||||
<Compile Include="StoresOre.cs" />
|
<Compile Include="StoresOre.cs" />
|
||||||
<Compile Include="StrategicVictoryConditions.cs" />
|
<Compile Include="StrategicVictoryConditions.cs" />
|
||||||
<Compile Include="SupplyTruck.cs" />
|
<Compile Include="SupplyTruck.cs" />
|
||||||
|
|||||||
50
OpenRA.Mods.RA/Render/RenderDisguise.cs
Normal file
50
OpenRA.Mods.RA/Render/RenderDisguise.cs
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
#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
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.RA.Render
|
||||||
|
{
|
||||||
|
class RenderDisguiseInfo : RenderInfantryProneInfo
|
||||||
|
{
|
||||||
|
public override object Create(ActorInitializer init) { return new RenderDisguise(init.self, this); }
|
||||||
|
}
|
||||||
|
|
||||||
|
class RenderDisguise : RenderInfantryProne
|
||||||
|
{
|
||||||
|
RenderDisguiseInfo info;
|
||||||
|
string intendedSprite;
|
||||||
|
Disguise disguise;
|
||||||
|
|
||||||
|
public RenderDisguise(Actor self, RenderDisguiseInfo info)
|
||||||
|
: base(self, info)
|
||||||
|
{
|
||||||
|
this.info = info;
|
||||||
|
disguise = self.Trait<Disguise>();
|
||||||
|
intendedSprite = disguise.AsSprite;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string PaletteName(Actor self)
|
||||||
|
{
|
||||||
|
var player = disguise.AsPlayer ?? self.Owner;
|
||||||
|
return info.Palette ?? info.PlayerPalette + player.InternalName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Tick(Actor self)
|
||||||
|
{
|
||||||
|
if (disguise.AsSprite != intendedSprite)
|
||||||
|
{
|
||||||
|
intendedSprite = disguise.AsSprite;
|
||||||
|
anim.ChangeImage(intendedSprite ?? GetImage(self), info.StandAnimations.Random(Game.CosmeticRandom));
|
||||||
|
UpdatePalette();
|
||||||
|
}
|
||||||
|
|
||||||
|
base.Tick(self);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
#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
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.RA.Render
|
|
||||||
{
|
|
||||||
class RenderSpyInfo : RenderInfantryProneInfo
|
|
||||||
{
|
|
||||||
public override object Create(ActorInitializer init) { return new RenderSpy(init.self, this); }
|
|
||||||
}
|
|
||||||
|
|
||||||
class RenderSpy : RenderInfantryProne
|
|
||||||
{
|
|
||||||
RenderSpyInfo info;
|
|
||||||
string disguisedAsSprite;
|
|
||||||
Spy spy;
|
|
||||||
|
|
||||||
public RenderSpy(Actor self, RenderSpyInfo info) : base(self, info)
|
|
||||||
{
|
|
||||||
this.info = info;
|
|
||||||
spy = self.Trait<Spy>();
|
|
||||||
disguisedAsSprite = spy.disguisedAsSprite;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override string PaletteName(Actor self)
|
|
||||||
{
|
|
||||||
var player = spy.disguisedAsPlayer ?? self.Owner;
|
|
||||||
return info.Palette ?? info.PlayerPalette + player.InternalName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Tick(Actor self)
|
|
||||||
{
|
|
||||||
if (spy.disguisedAsSprite != disguisedAsSprite)
|
|
||||||
{
|
|
||||||
disguisedAsSprite = spy.disguisedAsSprite;
|
|
||||||
anim.ChangeImage(disguisedAsSprite ?? GetImage(self), info.StandAnimations.Random(Game.CosmeticRandom));
|
|
||||||
UpdatePalette();
|
|
||||||
}
|
|
||||||
base.Tick(self);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -150,6 +150,19 @@ namespace OpenRA.Utility
|
|||||||
node.Key = "Immobile";
|
node.Key = "Immobile";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Spy was renamed to Disguise
|
||||||
|
if (engineVersion < 20140314)
|
||||||
|
{
|
||||||
|
if (depth == 1 && node.Key == "Spy")
|
||||||
|
node.Key = "Disguise";
|
||||||
|
|
||||||
|
if (depth == 1 && node.Key == "SpyToolTip")
|
||||||
|
node.Key = "DisguiseToolTip";
|
||||||
|
|
||||||
|
if (depth == 1 && node.Key == "RenderSpy")
|
||||||
|
node.Key = "RenderDisguise";
|
||||||
|
}
|
||||||
|
|
||||||
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ SPY:
|
|||||||
Hotkey: p
|
Hotkey: p
|
||||||
Valued:
|
Valued:
|
||||||
Cost: 500
|
Cost: 500
|
||||||
SpyToolTip:
|
DisguiseToolTip:
|
||||||
Name: Spy
|
Name: Spy
|
||||||
Description: Infiltrates enemy structures to gather \nintelligence. Exact effect depends on the \nbuilding infiltrated.\n Strong vs Nothing\n Weak vs Everything\n Special Ability: Disguised
|
Description: Infiltrates enemy structures to gather \nintelligence. Exact effect depends on the \nbuilding infiltrated.\n Strong vs Nothing\n Weak vs Everything\n Special Ability: Disguised
|
||||||
Selectable:
|
Selectable:
|
||||||
@@ -207,12 +207,12 @@ SPY:
|
|||||||
Passenger:
|
Passenger:
|
||||||
PipType: Yellow
|
PipType: Yellow
|
||||||
TakeCover:
|
TakeCover:
|
||||||
Spy:
|
Disguise:
|
||||||
Infiltrates:
|
Infiltrates:
|
||||||
Types: Cash, SupportPower, Exploration
|
Types: Cash, SupportPower, Exploration
|
||||||
-AutoTarget:
|
-AutoTarget:
|
||||||
-RenderInfantry:
|
-RenderInfantry:
|
||||||
RenderSpy:
|
RenderDisguise:
|
||||||
IdleAnimations: idle1,idle2
|
IdleAnimations: idle1,idle2
|
||||||
StandAnimations: stand,stand2
|
StandAnimations: stand,stand2
|
||||||
Armament:
|
Armament:
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ CHAMSPY:
|
|||||||
Hotkey: p
|
Hotkey: p
|
||||||
Valued:
|
Valued:
|
||||||
Cost: 700
|
Cost: 700
|
||||||
SpyToolTip:
|
DisguiseToolTip:
|
||||||
Name: Chameleon Spy
|
Name: Chameleon Spy
|
||||||
Description: Infiltrates enemy structures to gather \nintelligence. Exact effect depends on the \nbuilding infiltrated.\n Strong vs Nothing\n Weak vs Everything\n Special Ability: Disguised
|
Description: Infiltrates enemy structures to gather \nintelligence. Exact effect depends on the \nbuilding infiltrated.\n Strong vs Nothing\n Weak vs Everything\n Special Ability: Disguised
|
||||||
Selectable:
|
Selectable:
|
||||||
@@ -287,12 +287,12 @@ CHAMSPY:
|
|||||||
Range: 9c0
|
Range: 9c0
|
||||||
Passenger:
|
Passenger:
|
||||||
TakeCover:
|
TakeCover:
|
||||||
Spy:
|
Disguise:
|
||||||
Infiltrates:
|
Infiltrates:
|
||||||
Types: Cash, SupportPower, Exploration
|
Types: Cash, SupportPower, Exploration
|
||||||
-AutoTarget:
|
-AutoTarget:
|
||||||
-RenderInfantry:
|
-RenderInfantry:
|
||||||
RenderSpy:
|
RenderDisguise:
|
||||||
IdleAnimations: idle1,idle2
|
IdleAnimations: idle1,idle2
|
||||||
|
|
||||||
CYBORG:
|
CYBORG:
|
||||||
|
|||||||
Reference in New Issue
Block a user