Add stance filter to TooltipDescription; Add YAML descriptions.
This commit is contained in:
@@ -20,15 +20,33 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Translate]
|
[Translate]
|
||||||
public readonly string Description = "";
|
public readonly string Description = "";
|
||||||
|
|
||||||
public override object Create(ActorInitializer init) { return new TooltipDescription(this); }
|
[Desc("Player stances who can view the description.")]
|
||||||
|
public readonly Stance ValidStances = Stance.Ally | Stance.Neutral | Stance.Enemy;
|
||||||
|
|
||||||
|
public override object Create(ActorInitializer init) { return new TooltipDescription(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TooltipDescription : ConditionalTrait<TooltipDescriptionInfo>, IProvideTooltipInfo
|
public class TooltipDescription : ConditionalTrait<TooltipDescriptionInfo>, IProvideTooltipInfo
|
||||||
{
|
{
|
||||||
public TooltipDescription(TooltipDescriptionInfo info)
|
readonly Actor self;
|
||||||
: base(info) { }
|
|
||||||
|
|
||||||
public bool IsTooltipVisible(Player forPlayer) { return !IsTraitDisabled; }
|
public TooltipDescription(Actor self, TooltipDescriptionInfo info)
|
||||||
|
: base(info)
|
||||||
|
{
|
||||||
|
this.self = self;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsTooltipVisible(Player forPlayer)
|
||||||
|
{
|
||||||
|
if (IsTraitDisabled)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var stance = forPlayer.Stances[self.Owner];
|
||||||
|
if (!Info.ValidStances.HasStance(stance))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public string TooltipText
|
public string TooltipText
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,6 +8,12 @@ V19:
|
|||||||
HP: 100000
|
HP: 100000
|
||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Oil Derrick
|
Name: Oil Derrick
|
||||||
|
TooltipDescription@ally:
|
||||||
|
Description: Provides additional funds.
|
||||||
|
ValidStances: Ally
|
||||||
|
TooltipDescription@other:
|
||||||
|
Description: Capture to receive additional funds.
|
||||||
|
ValidStances: Neutral, Enemy
|
||||||
SpawnActorOnDeath:
|
SpawnActorOnDeath:
|
||||||
Actor: V19.Husk
|
Actor: V19.Husk
|
||||||
|
|
||||||
@@ -35,6 +41,12 @@ HOSP:
|
|||||||
HP: 250000
|
HP: 250000
|
||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Hospital
|
Name: Hospital
|
||||||
|
TooltipDescription@ally:
|
||||||
|
Description: Provides infantry with self-healing.
|
||||||
|
ValidStances: Ally
|
||||||
|
TooltipDescription@other:
|
||||||
|
Description: Capture to enable self-healing for infantry.
|
||||||
|
ValidStances: Neutral, Enemy
|
||||||
SpawnActorOnDeath:
|
SpawnActorOnDeath:
|
||||||
Actor: HOSP.Husk
|
Actor: HOSP.Husk
|
||||||
WithBuildingBib:
|
WithBuildingBib:
|
||||||
@@ -61,6 +73,12 @@ BIO:
|
|||||||
HP: 250000
|
HP: 250000
|
||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Biological Lab
|
Name: Biological Lab
|
||||||
|
TooltipDescription@ally:
|
||||||
|
Description: Produces Bio-Lab units.
|
||||||
|
ValidStances: Ally
|
||||||
|
TooltipDescription@other:
|
||||||
|
Description: Capture to produce Bio-Lab units.
|
||||||
|
ValidStances: Neutral, Enemy
|
||||||
Exit@1:
|
Exit@1:
|
||||||
SpawnOffset: 0,-426,0
|
SpawnOffset: 0,-426,0
|
||||||
ExitCell: 0,-1
|
ExitCell: 0,-1
|
||||||
|
|||||||
@@ -75,6 +75,12 @@ FCOM:
|
|||||||
Type: Wood
|
Type: Wood
|
||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Forward Command
|
Name: Forward Command
|
||||||
|
TooltipDescription@ally:
|
||||||
|
Description: Provides buildable area.
|
||||||
|
ValidStances: Ally
|
||||||
|
TooltipDescription@other:
|
||||||
|
Description: Capture to give buildable area.
|
||||||
|
ValidStances: Neutral, Enemy
|
||||||
RevealsShroud:
|
RevealsShroud:
|
||||||
Range: 5c0
|
Range: 5c0
|
||||||
RevealGeneratedShroud: False
|
RevealGeneratedShroud: False
|
||||||
@@ -110,6 +116,12 @@ HOSP:
|
|||||||
EngineerRepairable:
|
EngineerRepairable:
|
||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Hospital
|
Name: Hospital
|
||||||
|
TooltipDescription@ally:
|
||||||
|
Description: Provides infantry with self-healing.
|
||||||
|
ValidStances: Ally
|
||||||
|
TooltipDescription@other:
|
||||||
|
Description: Capture to enable self-healing for infantry.
|
||||||
|
ValidStances: Neutral, Enemy
|
||||||
RevealsShroud:
|
RevealsShroud:
|
||||||
Range: 4c0
|
Range: 4c0
|
||||||
WithBuildingBib:
|
WithBuildingBib:
|
||||||
@@ -379,6 +391,12 @@ MISS:
|
|||||||
Type: Wood
|
Type: Wood
|
||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Communications Center
|
Name: Communications Center
|
||||||
|
TooltipDescription@ally:
|
||||||
|
Description: Provides range of vision.
|
||||||
|
ValidStances: Ally
|
||||||
|
TooltipDescription@other:
|
||||||
|
Description: Capture to give visual range.
|
||||||
|
ValidStances: Neutral, Enemy
|
||||||
WithBuildingBib:
|
WithBuildingBib:
|
||||||
ExternalCapturable:
|
ExternalCapturable:
|
||||||
ExternalCapturableBar:
|
ExternalCapturableBar:
|
||||||
@@ -403,6 +421,12 @@ BIO:
|
|||||||
EngineerRepairable:
|
EngineerRepairable:
|
||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Biological Lab
|
Name: Biological Lab
|
||||||
|
TooltipDescription@ally:
|
||||||
|
Description: Provides prerequisite for Bio-Lab units.
|
||||||
|
ValidStances: Ally
|
||||||
|
TooltipDescription@other:
|
||||||
|
Description: Capture to produce Bio-Lab units.
|
||||||
|
ValidStances: Neutral, Enemy
|
||||||
WithDeathAnimation:
|
WithDeathAnimation:
|
||||||
DeathSequence: dead
|
DeathSequence: dead
|
||||||
UseDeathTypeSuffix: false
|
UseDeathTypeSuffix: false
|
||||||
@@ -433,6 +457,12 @@ OILB:
|
|||||||
Amount: 100
|
Amount: 100
|
||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Oil Derrick
|
Name: Oil Derrick
|
||||||
|
TooltipDescription@ally:
|
||||||
|
Description: Provides additional funds.
|
||||||
|
ValidStances: Ally
|
||||||
|
TooltipDescription@other:
|
||||||
|
Description: Capture to receive additional funds.
|
||||||
|
ValidStances: Neutral, Enemy
|
||||||
Explodes:
|
Explodes:
|
||||||
Weapon: BarrelExplode
|
Weapon: BarrelExplode
|
||||||
GpsDot:
|
GpsDot:
|
||||||
|
|||||||
@@ -779,6 +779,12 @@ CAHOSP:
|
|||||||
Inherits@shape: ^3x4Shape
|
Inherits@shape: ^3x4Shape
|
||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Civilian Hospital
|
Name: Civilian Hospital
|
||||||
|
TooltipDescription@ally:
|
||||||
|
Description: Provides infantry with self-healing.
|
||||||
|
ValidStances: Ally
|
||||||
|
TooltipDescription@other:
|
||||||
|
Description: Capture to enable self-healing for infantry.
|
||||||
|
ValidStances: Neutral, Enemy
|
||||||
Building:
|
Building:
|
||||||
Footprint: XxX xxx xxx xxx
|
Footprint: XxX xxx xxx xxx
|
||||||
Dimensions: 3, 4
|
Dimensions: 3, 4
|
||||||
|
|||||||
Reference in New Issue
Block a user