Remove AlwaysVisible

This commit is contained in:
Gustas
2025-09-02 18:33:50 +03:00
committed by Paul Chote
parent 0230b79269
commit a8b13d012b
41 changed files with 29 additions and 120 deletions

View File

@@ -504,7 +504,7 @@ namespace OpenRA
if (!visibilityModifier.IsVisible(this, player))
return false;
return defaultVisibility.IsVisible(this, player);
return defaultVisibility?.IsVisible(this, player) ?? true;
}
public BitSet<TargetableType> GetAllTargetTypes()

View File

@@ -36,14 +36,11 @@ namespace OpenRA.Mods.Common.Lint
// Catch TypeDictionary errors.
try
{
if (Enum.TryParse<SystemActors>(actorInfo.Key, true, out _))
continue;
var visibilityTypes = actorInfo.Value.TraitInfos<IDefaultVisibilityInfo>();
var count = visibilityTypes.Count;
if (count == 0)
emitError($"Actor type `{actorInfo.Key}` does not define a default visibility type.");
continue;
else if (count > 1)
emitError(
$"Actor type `{actorInfo.Key}` defines multiple default visibility types: " +

View File

@@ -1,25 +0,0 @@
#region Copyright & License Information
/*
* Copyright (c) The OpenRA Developers and Contributors
* 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 OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
[Desc("The actor is always considered visible for targeting and rendering purposes.")]
public class AlwaysVisibleInfo : TraitInfo<AlwaysVisible>, IDefaultVisibilityInfo { }
public class AlwaysVisible : IDefaultVisibility
{
public bool IsVisible(Actor self, Player byPlayer)
{
return true;
}
}
}

View File

@@ -0,0 +1,27 @@
#region Copyright & License Information
/*
* Copyright (c) The OpenRA Developers and Contributors
* 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;
namespace OpenRA.Mods.Common.UpdateRules.Rules
{
public class RemoveAlwaysVisible : UpdateRule
{
public override string Name => "Remove AlwaysVisible";
public override string Description => "AlwaysVisible trait was removed and now is the default behavior.";
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNodeBuilder actorNode)
{
actorNode.RemoveNodes("AlwaysVisible");
yield break;
}
}
}

View File

@@ -115,13 +115,11 @@ AIHProcUpgrade:
ProvidesPrerequisite:
Prerequisite: diffhard
Interactable:
AlwaysVisible:
AINProcUpgrade:
ProvidesPrerequisite:
Prerequisite: diffnorm
Interactable:
AlwaysVisible:
HTNK:
Buildable:

View File

@@ -39,7 +39,6 @@ Player:
# Spawned on Easy difficulty.
VillageTargetableSwitch:
AlwaysVisible:
ProvidesPrerequisite:
Prerequisite: village-targetable-switch

View File

@@ -52,7 +52,6 @@ AIHProcUpgrade:
StoresResources:
Capacity: 25000
Interactable:
AlwaysVisible:
AINProcUpgrade:
ProvidesPrerequisite:
@@ -60,22 +59,18 @@ AINProcUpgrade:
StoresResources:
Capacity: 15000
Interactable:
AlwaysVisible:
AiAnyhqPrerequisite:
ProvidesPrerequisite:
Prerequisite: anyhq
Interactable:
AlwaysVisible:
AiTmplPrerequisite:
ProvidesPrerequisite:
Prerequisite: tmpl
Interactable:
AlwaysVisible:
Astk.proxy:
AlwaysVisible:
AirstrikePower:
StartFullyCharged: True
Prerequisites: ~techlevel.superweapons

View File

@@ -55,7 +55,6 @@ Player:
Type: campaign
airstrike.proxy:
AlwaysVisible:
AirstrikePower:
Icon: airstrike
StartFullyCharged: True

View File

@@ -454,7 +454,6 @@ BRIDGE4:
Bounds: 6144, 4096
BRIDGEHUT:
AlwaysVisible:
Building:
Footprint: __ __
Dimensions: 2,2

View File

@@ -1130,7 +1130,6 @@
^Bridge:
Inherits@shape: ^1x1Shape
AlwaysVisible:
Tooltip:
Name: meta-bridge-name
ShowOwnerRow: false

View File

@@ -51,7 +51,6 @@ mpspawn:
Interactable:
EditorOnlyTooltip:
Name: actor-mpspawn-name
AlwaysVisible:
Immobile:
OccupiesSpace: false
WithSpriteBody:
@@ -67,7 +66,6 @@ waypoint:
Interactable:
EditorOnlyTooltip:
Name: actor-waypoint-name
AlwaysVisible:
Immobile:
OccupiesSpace: false
WithSpriteBody:
@@ -91,7 +89,6 @@ CAMERA:
Interactable:
EditorOnlyTooltip:
Name: actor-camera-name
AlwaysVisible:
WithSpriteBody:
RenderSpritesEditorOnly:
BodyOrientation:
@@ -108,7 +105,6 @@ CAMERA.small:
Interactable:
EditorOnlyTooltip:
Name: actor-camera-small-name
AlwaysVisible:
WithSpriteBody:
RenderSpritesEditorOnly:
Image: camera

View File

@@ -1335,25 +1335,21 @@ BRIK:
Type: concrete
BARRACKS:
AlwaysVisible:
Interactable:
Tooltip:
Name: actor-barracks-name
VEHICLEPRODUCTION:
AlwaysVisible:
Interactable:
Tooltip:
Name: actor-vehicleproduction-name
ANYPOWER:
AlwaysVisible:
Interactable:
Tooltip:
Name: actor-anypower-name
ANYHQ:
AlwaysVisible:
Interactable:
Tooltip:
Name: actor-anyhq-name

View File

@@ -74,7 +74,6 @@ upgrade.conyard:
# HACK: AI units can't attack the sietch if it was on a real rock
tile475:
AlwaysVisible:
Immobile:
OccupiesSpace: false
RenderSprites:
@@ -92,7 +91,6 @@ tile475:
# Placed after the sietch is destroyed so that the cliff is still unpassable
invisibleBlocker:
AlwaysVisible:
Building:
Footprint: xx xx
Dimensions: 2,2

View File

@@ -2,7 +2,6 @@ spicebloom.spawnpoint:
Interactable:
EditorOnlyTooltip:
Name: actor-spicebloom-spawnpoint-name
AlwaysVisible:
RenderSpritesEditorOnly:
Image: spicebloom.editor
WithSpriteBody:

View File

@@ -143,7 +143,6 @@ mpspawn:
Interactable:
EditorOnlyTooltip:
Name: actor-mpspawn-name
AlwaysVisible:
Immobile:
OccupiesSpace: false
RenderSpritesEditorOnly:
@@ -159,7 +158,6 @@ waypoint:
Interactable:
EditorOnlyTooltip:
Name: actor-waypoint-name
AlwaysVisible:
Immobile:
OccupiesSpace: false
RenderSpritesEditorOnly:
@@ -184,7 +182,6 @@ camera:
Interactable:
EditorOnlyTooltip:
Name: actor-camera-name
AlwaysVisible:
RenderSpritesEditorOnly:
WithSpriteBody:
BodyOrientation:
@@ -201,7 +198,6 @@ wormspawner:
Interactable:
EditorOnlyTooltip:
Name: actor-wormspawner-name
AlwaysVisible:
Immobile:
OccupiesSpace: false
RenderSpritesEditorOnly:
@@ -213,7 +209,6 @@ wormspawner:
Categories: System
upgrade.conyard:
AlwaysVisible:
Interactable:
ScriptTriggers:
Tooltip:
@@ -238,7 +233,6 @@ upgrade.conyard:
ProvidesPrerequisite@upgradename:
upgrade.barracks:
AlwaysVisible:
Interactable:
ScriptTriggers:
Tooltip:
@@ -263,7 +257,6 @@ upgrade.barracks:
ProvidesPrerequisite@upgradename:
upgrade.light:
AlwaysVisible:
Interactable:
ScriptTriggers:
Tooltip:
@@ -288,7 +281,6 @@ upgrade.light:
ProvidesPrerequisite@upgradename:
upgrade.heavy:
AlwaysVisible:
Interactable:
ScriptTriggers:
Tooltip:
@@ -314,7 +306,6 @@ upgrade.heavy:
ProvidesPrerequisite@upgradename:
upgrade.hightech:
AlwaysVisible:
Interactable:
ScriptTriggers:
Tooltip:
@@ -334,7 +325,6 @@ upgrade.hightech:
ProvidesPrerequisite@upgradename:
deathhand:
AlwaysVisible:
Interactable:
Tooltip:
Name: actor-deathhand.name

View File

@@ -1,5 +1,4 @@
^concrete:
AlwaysVisible:
Interactable:
D2kBuilding:
TerrainTypes: Rock

View File

@@ -61,7 +61,6 @@ CAMERA.VeryLarge:
Range: 40c0
CAMERA.Jeep:
AlwaysVisible:
Mobile:
Locomotor: immobile
RevealsShroud:

View File

@@ -27,7 +27,6 @@ Player:
PARADROP:
ParatroopersPower:
DropItems: E1, E1, E1, E2, E2
AlwaysVisible:
FCOM:
Capturable:

View File

@@ -18,19 +18,16 @@ INSERTIONDROP:
ParatroopersPower:
DisplayBeacon: False
DropItems: E7, GNRL
AlwaysVisible:
INSERTIONDROPHARD:
ParatroopersPower:
DisplayBeacon: False
DropItems: E7.noautotarget, GNRL.noautotarget
AlwaysVisible:
RIFLEDROP:
ParatroopersPower:
DisplayBeacon: False
DropItems: E1, E1, E1, E1, E1
AlwaysVisible:
LST.Reinforcement:
Inherits: LST

View File

@@ -22,12 +22,10 @@ World:
PARADROP:
ParatroopersPower:
DropItems: E1, E1, E1, E2, E2
AlwaysVisible:
FLAMERDROP:
ParatroopersPower:
DropItems: E2, E2, E4, E4, E4
AlwaysVisible:
^CivInfantry:
Infiltrates:

View File

@@ -29,18 +29,15 @@ TRAN.Reinforcement:
PARADROP1:
ParatroopersPower:
DropItems: E2, E2, E2, E3, E3
AlwaysVisible:
PARADROP2:
ParatroopersPower:
DropItems: E1, E1, SHOK, E4, E4
AlwaysVisible:
PARADROP3:
ParatroopersPower:
DisplayBeacon: False
DropItems: 1TNK, 2TNK
AlwaysVisible:
V01:
SpawnActorOnDeath:

View File

@@ -52,7 +52,6 @@ WEAP:
Prerequisite: givefix
MAINLAND:
AlwaysVisible:
Interactable:
Tooltip:
Name: actor-mainland-name
@@ -68,7 +67,6 @@ FIX:
Prerequisites: givefix
GIVEFIX:
AlwaysVisible:
Interactable:
Tooltip:
Name: actor-givefix-name

View File

@@ -33,7 +33,6 @@ ai.hard:
ProvidesPrerequisite:
Prerequisite: ai.hard
Interactable:
AlwaysVisible:
paradrop.allies:
Inherits: powerproxy.paratroopers
@@ -43,7 +42,6 @@ paradrop.allies:
DisplayBeacon: false
powerproxy.chronoshift:
AlwaysVisible:
ChronoshiftPower:
Dimensions: 1, 1
Footprint: x

View File

@@ -18,7 +18,6 @@ World:
Default: normal
powerproxy.chronoshift:
AlwaysVisible:
ChronoshiftPower:
Dimensions: 1, 1
Footprint: x
@@ -31,20 +30,17 @@ CHALK1:
ParatroopersPower:
DisplayBeacon: False
DropItems: E1, E1, E1, E1, E1
AlwaysVisible:
CHALK2:
ParatroopersPower:
DisplayBeacon: False
DropItems: E3, E3, E3, E3, MEDI
AlwaysVisible:
CHALK3:
ParatroopersPower:
DisplayBeacon: False
DropItems: E1, E1, E1, E1, E1, E1, E1, E1, E1, E1, E1, E1, E1, E1, E1, E1, E1, E1, E1, E1
SquadSize: 4
AlwaysVisible:
CTNK:
Chronoshiftable:

View File

@@ -10,7 +10,6 @@ SHOCKDROP:
ParatroopersPower:
DisplayBeacon: False
DropItems: SHOK, SHOK, SHOK, SHOK, SHOK
AlwaysVisible:
LST.Reinforcement:
Inherits: LST

View File

@@ -28,7 +28,6 @@ MONEYCRATE:
PARATROOPERS:
ParatroopersPower:
DropItems: E1,E1,E1,E2,E2
AlwaysVisible:
MCV:
Buildable:

View File

@@ -38,7 +38,6 @@ SCRIPTEDDROP:
ParatroopersPower:
DisplayBeacon: False
DropItems: E1,E1,E4,E4,E4
AlwaysVisible:
AFLD:
AirstrikePower@parabombs:

View File

@@ -38,7 +38,6 @@ SCRIPTEDDROP:
ParatroopersPower:
DisplayBeacon: False
DropItems: E1,E1,E4,E4,E4
AlwaysVisible:
AFLD:
AirstrikePower@parabombs:

View File

@@ -25,7 +25,6 @@ ENGIDROP:
ParatroopersPower:
DisplayBeacon: False
DropItems: E6, E6, E6
AlwaysVisible:
AFLD:
ParatroopersPower@paratroopers:

View File

@@ -49,7 +49,6 @@ SCAMERA:
Range: 5c512
powerproxy.spyplane:
AlwaysVisible:
AirstrikePower:
OrderName: SovietSpyPlane
Icon: spyplane

View File

@@ -760,7 +760,6 @@ SBRIDGE4:
SpawnOffset: 2,1
BRIDGEHUT:
AlwaysVisible:
Building:
Footprint: __ __
Dimensions: 2,2
@@ -772,7 +771,6 @@ BRIDGEHUT:
TargetTypes: BridgeHut, C4
BRIDGEHUT.small:
AlwaysVisible:
Building:
Footprint: _
Dimensions: 1,1

View File

@@ -1128,7 +1128,6 @@
^Bridge:
Inherits@shape: ^1x1Shape
AlwaysVisible:
Tooltip:
Name: meta-bridge-name
ShowOwnerRow: false

View File

@@ -182,7 +182,6 @@ CAMERA:
Interactable:
EditorOnlyTooltip:
Name: actor-camera-name
AlwaysVisible:
Immobile:
OccupiesSpace: false
RevealsShroud:
@@ -343,7 +342,6 @@ LAR2:
Name: actor-lar2-name
powerproxy.parabombs:
AlwaysVisible:
AirstrikePower:
Icon: parabombs
Name: actor-powerproxy-parabombs.name
@@ -363,7 +361,6 @@ powerproxy.parabombs:
CircleSequence: circles
powerproxy.sonarpulse:
AlwaysVisible:
SpawnActorPower:
Icon: sonar
Name: actor-powerproxy-sonarpulse.name
@@ -385,7 +382,6 @@ powerproxy.sonarpulse:
BlockedCursor: move-blocked
powerproxy.paratroopers:
AlwaysVisible:
ParatroopersPower:
Icon: paratroopers
Name: actor-powerproxy-paratroopers.name
@@ -403,22 +399,18 @@ powerproxy.paratroopers:
CircleSequence: circles
barracks.upgraded:
AlwaysVisible:
ProvidesPrerequisite:
vehicles.upgraded:
AlwaysVisible:
ProvidesPrerequisite:
aircraft.upgraded:
AlwaysVisible:
ProvidesPrerequisite:
mpspawn:
Interactable:
EditorOnlyTooltip:
Name: actor-mpspawn-name
AlwaysVisible:
Immobile:
OccupiesSpace: false
WithSpriteBody:
@@ -434,7 +426,6 @@ waypoint:
Interactable:
EditorOnlyTooltip:
Name: actor-waypoint-name
AlwaysVisible:
Immobile:
OccupiesSpace: false
WithSpriteBody:

View File

@@ -2194,19 +2194,16 @@ WOOD:
Type: woodfence
BARRACKS:
AlwaysVisible:
Interactable:
Tooltip:
Name: actor-barracks-name
TECHCENTER:
AlwaysVisible:
Interactable:
Tooltip:
Name: actor-techcenter-name
ANYPOWER:
AlwaysVisible:
Interactable:
Tooltip:
Name: actor-anypower-name

View File

@@ -23,7 +23,6 @@ CABHUT:
Categories: Bridge
^LowBridgeRamp:
AlwaysVisible:
RenderSprites:
Palette: terraindecoration
WithSpriteBody:
@@ -171,7 +170,6 @@ LOBRDG_R_SW:
Name: actor-lobrdg-r-name
^ElevatedBridgePlaceholder:
AlwaysVisible:
RenderSprites:
Palette: terraindecoration
WithSpriteBody:

View File

@@ -1524,7 +1524,6 @@ INGALITE:
Interactable:
EditorOnlyTooltip:
Name: actor-ingalite-name
AlwaysVisible:
Immobile:
OccupiesSpace: false
RenderSpritesEditorOnly:

View File

@@ -535,7 +535,6 @@
^BuildingPlug:
Interactable:
AlwaysVisible:
Building:
BuildSounds: place2.aud
UndeploySounds: cashturn.aud
@@ -1226,7 +1225,6 @@
Condition: inside-tunnel
^TerrainOverlay:
AlwaysVisible:
Immobile:
OccupiesSpace: False
RenderSprites:
@@ -1257,7 +1255,6 @@
Dimensions: 3, 3
Footprint: ___ ___ ___
Targetable:
AlwaysVisible:
TunnelEntrance:
MapEditorData:
Categories: Tunnel

View File

@@ -83,7 +83,6 @@ GAPOWR:
Height: 48
GAPOWR.SOCKET:
AlwaysVisible:
Interactable:
Tooltip:
Name: actor-gapowr-socket-name
@@ -702,13 +701,11 @@ GAPLUG:
Height: 48
GAPLUG.SOCKET.IONCANNON:
AlwaysVisible:
Interactable:
Tooltip:
Name: actor-gaplug-socket-ioncannon-name
GAPLUG.SOCKET.HUNTERSEEKER:
AlwaysVisible:
Interactable:
Tooltip:
Name: actor-gaplug-socket-hunterseeker-name

View File

@@ -152,7 +152,6 @@ GACTWR:
Height: 48
GACTWR.SOCKET:
AlwaysVisible:
Interactable:
Tooltip:
Name: actor-gactwr-socket-name

View File

@@ -2,7 +2,6 @@ mpspawn:
Interactable:
EditorOnlyTooltip:
Name: actor-mpspawn-name
AlwaysVisible:
Immobile:
OccupiesSpace: false
RenderSpritesEditorOnly:
@@ -18,7 +17,6 @@ waypoint:
Interactable:
EditorOnlyTooltip:
Name: actor-waypoint-name
AlwaysVisible:
Immobile:
OccupiesSpace: false
RenderSpritesEditorOnly:
@@ -59,7 +57,6 @@ CAMERA:
Interactable:
EditorOnlyTooltip:
Name: actor-camera-name
AlwaysVisible:
RenderSpritesEditorOnly:
WithSpriteBody:
BodyOrientation:

View File

@@ -231,31 +231,26 @@ GASILO:
Palette: pips
ANYPOWER:
AlwaysVisible:
Interactable:
Tooltip:
Name: actor-anypower-name
BARRACKS:
AlwaysVisible:
Interactable:
Tooltip:
Name: actor-barracks-name
FACTORY:
AlwaysVisible:
Interactable:
Tooltip:
Name: actor-factory-name
RADAR:
AlwaysVisible:
Interactable:
Tooltip:
Name: actor-radar-name
TECH:
AlwaysVisible:
Interactable:
Tooltip:
Name: actor-tech-name