Removes prototype construction steps (I HATE PROTOTYPE STEPS) (#11611)

This commit is contained in:
Nemanja
2022-10-08 13:47:54 -04:00
committed by GitHub
parent 79854e59a4
commit 5ba36dad25
38 changed files with 182 additions and 137 deletions

View File

@@ -112,48 +112,5 @@ namespace Content.IntegrationTests.Tests.Construction
}
await pairTracker.CleanReturnAsync();
}
[Test]
public async Task TestStackPrototypeSteps()
{
// People often mistakenly use the prototype-step rather than a material-step, resulting in a whole stack
// being consumed. This checks that if something uses a prototype step, that the relevant prototype does not
// have a stack component.
//
// If, for whatever reason, that is ever required, then this test should probably just support an ignore
// list. Though the test should then also checks that it accepts both the full-stack and single-sheet
// prototypes.
await using var pairTracker = await PoolManager.GetServerClient(new PoolSettings { NoClient = true });
var server = pairTracker.Pair.Server;
var protoMan = server.ResolveDependency<IPrototypeManager>();
var stackName = server.ResolveDependency<IComponentFactory>().GetComponentName(typeof(StackComponent));
Assert.Multiple(() =>
{
// quadruple for loop nesting, what fun.
foreach (var protoGraph in protoMan.EnumeratePrototypes<ConstructionGraphPrototype>())
{
foreach (var node in protoGraph.Nodes.Values)
{
foreach (var edge in node.Edges)
{
foreach (var step in edge.Steps)
{
if (step is not PrototypeConstructionGraphStep protoStep)
continue;
var protoEnt = protoMan.Index<EntityPrototype>(protoStep.Prototype);
Assert.False(protoEnt.Components.ContainsKey(stackName),
$"Construction graph {protoGraph.ID} uses a prototype-step that consumes a stackable entity {protoEnt.ID}");
}
}
}
}
});
await pairTracker.CleanReturnAsync();
}
}
}

View File

@@ -20,11 +20,6 @@ namespace Content.Shared.Construction.Steps
return typeof(ToolConstructionGraphStep);
}
if (node.Has("prototype"))
{
return typeof(PrototypeConstructionGraphStep);
}
if (node.Has("component"))
{
return typeof(ComponentConstructionGraphStep);

View File

@@ -1,31 +0,0 @@
using Content.Shared.Examine;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.Construction.Steps
{
[DataDefinition]
public sealed class PrototypeConstructionGraphStep : ArbitraryInsertConstructionGraphStep
{
[DataField("prototype", customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>), required:true)]
public string Prototype { get; } = string.Empty;
public override bool EntityValid(EntityUid uid, IEntityManager entityManager)
{
return entityManager.GetComponent<MetaDataComponent>(uid).EntityPrototype?.ID == Prototype;
}
public override void DoExamine(ExaminedEvent examinedEvent)
{
examinedEvent.Message.AddMarkup(string.IsNullOrEmpty(Name)
? Loc.GetString(
"construction-insert-prototype-no-name",
("prototypeName", Prototype) // Terrible.
)
: Loc.GetString(
"construction-insert-prototype",
("entityName", Name)
));
}
}
}

View File

@@ -6,11 +6,11 @@ namespace Content.Shared.Construction.Steps
public sealed class TagConstructionGraphStep : ArbitraryInsertConstructionGraphStep
{
[DataField("tag")]
private string? _tag = null;
private string? _tag;
public override bool EntityValid(EntityUid uid, IEntityManager entityManager)
{
var tagSystem = EntitySystem.Get<TagSystem>();
var tagSystem = entityManager.EntitySysManager.GetEntitySystem<TagSystem>();
return !string.IsNullOrEmpty(_tag) && tagSystem.HasTag(uid, _tag);
}
}

View File

@@ -70,6 +70,9 @@
baseSprintSpeed: 0
- type: InputMover
- type: GhostOnMove
- type: Tag
tags:
- Head
- type: entity
id: LeftArmHuman

View File

@@ -68,6 +68,9 @@
baseSprintSpeed: 0
- type: InputMover
- type: GhostOnMove
- type: Tag
tags:
- Head
- type: entity
id: LeftArmReptilian

View File

@@ -70,8 +70,9 @@
0: Alive
# criticalThreshold: 50
# deadThreshold: 120
- type: Tag
tags:
- Head
- type: entity
id: LeftArmSkeleton

View File

@@ -63,6 +63,9 @@
baseSprintSpeed: 0
- type: InputMover
- type: GhostOnMove
- type: Tag
tags:
- Head
- type: entity
id: LeftArmSlime

View File

@@ -71,6 +71,9 @@
baseSprintSpeed: 0
- type: InputMover
- type: GhostOnMove
- type: Tag
tags:
- Head
- type: entity
id: LeftArmVox

View File

@@ -96,6 +96,9 @@
- id: EmergencyMedipen
- id: Flare
- id: FoodTinMRE
- type: Tag
tags:
- BoxHug
- type: entity
name: extended-capacity survival box

View File

@@ -169,7 +169,7 @@
- type: entity
name: box of hugs
parent: BoxCardboard
id: BoxHug
id: BoxHugHealing
description: A special box for sensitive people.
components:
- type: Sprite
@@ -182,6 +182,9 @@
contents:
- id: Brutepack
amount: 6
- type: Tag
tags:
- BoxHug
- type: entity
name: inflatable wall box

View File

@@ -97,6 +97,10 @@
components:
- type: ComputerBoard
prototype: ComputerSurveillanceCameraMonitor
- type: Tag
tags:
- DroneUsable
- SurveillanceCameraMonitorCircuitboard
- type: entity
parent: BaseComputerCircuitboard
@@ -115,6 +119,10 @@
components:
- type: ComputerBoard
prototype: ComputerTelevision
- type: Tag
tags:
- DroneUsable
- ComputerTelevisionCircuitboard
- type: entity
parent: BaseComputerCircuitboard

View File

@@ -7,6 +7,10 @@
- type: Sprite
sprite: Objects/Misc/module.rsi
state: airalarm_electronics
- type: Tag
tags:
- DroneUsable
- AirAlarmElectronics
- type: entity
id: FireAlarmElectronics
@@ -17,3 +21,7 @@
- type: Sprite
sprite: Objects/Misc/module.rsi
state: airalarm_electronics
- type: Tag
tags:
- DroneUsable
- FireAlarmElectronics

View File

@@ -7,3 +7,7 @@
- type: Sprite
sprite: Objects/Misc/module.rsi
state: net_wired
- type: Tag
tags:
- DroneUsable
- MailingUnitElectronics

View File

@@ -8,3 +8,7 @@
sprite: Objects/Misc/module.rsi
state: door_electronics
- type: AccessReader
- type: Tag
tags:
- DoorElectronics
- DroneUsable

View File

@@ -22,6 +22,10 @@
sprite: Objects/Misc/module.rsi
state: charger_APC
netsync: false
- type: Tag
tags:
- DroneUsable
- WallmountSubstationElectronics
# Wallmount Generator
- type: entity
@@ -34,6 +38,10 @@
sprite: Objects/Misc/module.rsi
state: charger_APC
netsync: false
- type: Tag
tags:
- DroneUsable
- WallmountGeneratorElectronics
# APU
- type: entity
@@ -46,6 +54,10 @@
sprite: Objects/Misc/module.rsi
state: charger_APC
netsync: false
- type: Tag
tags:
- DroneUsable
- WallmountGeneratorAPUElectronics
# Solar Tracker Electronics
- type: entity
@@ -58,3 +70,7 @@
sprite: Objects/Misc/module.rsi
state: generic
netsync: false
- type: Tag
tags:
- DroneUsable
- SolarTrackerElectronics

View File

@@ -30,6 +30,7 @@
- type: Tag
tags:
- Payload # yes, you can make re-usable prank grenades
- BikeHorn
- type: MeleeWeapon
soundHit:
collection: BikeHorn

View File

@@ -92,6 +92,10 @@
damage:
types:
Piercing: 5
- type: Tag
tags:
- GlassShard
- Trash
- type: entity
parent: ShardBase

View File

@@ -314,6 +314,9 @@
- type: Sprite
sprite: Objects/Misc/bureaucracy.rsi
state: stamp-clown
- type: Tag
tags:
- ClownRubberStamp
- type: entity
name: chief medical officer's rubber stamp

View File

@@ -8,3 +8,6 @@
- type: Sprite
sprite: Objects/Power/solar_parts.rsi
state: solar_assembly_parts
- type: Tag
tags:
- SolarAssemblyPart

View File

@@ -48,3 +48,6 @@
fillBaseName: fill-
- type: ExaminableSolution
solution: bucket
- type: Tag
tags:
- Bucket

View File

@@ -29,7 +29,7 @@
- to: chairCursed
steps:
- prototype: HeadHuman
- tag: Head
icon:
sprite: Mobs/Species/Human/parts.rsi
state: "head_m"

View File

@@ -48,7 +48,7 @@
conditions:
- !type:EntityAnchored {}
steps:
- prototype: DoorElectronics
- tag: DoorElectronics
store: board
name: "door electronics circuit board"
icon:

View File

@@ -44,7 +44,7 @@
- !type:EntityAnchored
anchored: true
steps:
- prototype: DoorElectronics
- tag: DoorElectronics
name: Door Electronics
icon:
sprite: "Objects/Misc/module.rsi"
@@ -148,7 +148,7 @@
steps:
- tool: Anchoring
doAfter: 1
- node: ShuttersRadiationFrame
edges:
- to: ShuttersRadiation

View File

@@ -25,7 +25,7 @@
conditions:
- !type:EntityAnchored {}
steps:
- prototype: DoorElectronics
- tag: DoorElectronics
store: board
name: "door electronics circuit board"
icon:

View File

@@ -77,7 +77,7 @@
conditions:
- !type:EntityAnchored {}
steps:
- prototype: DoorElectronics
- tag: DoorElectronics
store: board
name: "door electronics circuit board"
icon:
@@ -178,7 +178,7 @@
conditions:
- !type:EntityAnchored { }
steps:
- prototype: DoorElectronics
- tag: DoorElectronics
store: board
name: "door electronics circuit board"
icon:

View File

@@ -36,7 +36,7 @@
edges:
- to: electronics
steps:
- prototype: AirAlarmElectronics
- tag: AirAlarmElectronics
store: board
name: "air alarm electronics"
icon:
@@ -115,7 +115,7 @@
edges:
- to: electronics
steps:
- prototype: FireAlarmElectronics
- tag: FireAlarmElectronics
store: board
name: "fire alarm electronics"
icon:

View File

@@ -70,7 +70,7 @@
doAfter: 0.25
- to: frame_mailing
steps:
- prototype: MailingUnitElectronics
- tag: MailingUnitElectronics
name: Mailing Unit Electronics
icon:
sprite: "Objects/Misc/module.rsi"

View File

@@ -6,9 +6,9 @@
edges:
- to: solarassembly
steps:
- prototype: SolarAssemblyPart
- tag: SolarAssemblyPart
name: Solar Assembly Parts
icon:
icon:
sprite: Objects/Power/solar_parts.rsi
state: solar_assembly_parts
doAfter: 1
@@ -41,9 +41,9 @@
- !type:EntityAnchored
value: true
steps:
- prototype: SolarTrackerElectronics
- tag: SolarTrackerElectronics
name: Solar Tracker Electronics
icon:
icon:
sprite: Objects/Misc/module.rsi
state: id_mod
doAfter: 1
@@ -53,7 +53,7 @@
completed:
- !type:SnapToGrid
offset: Center
- node: solarpanel
entity: SolarPanel
edges:

View File

@@ -31,9 +31,9 @@
- node: parts
edges:
- to: electronics
- to: electronics
steps:
- prototype: WallmountGeneratorElectronics
- tag: WallmountGeneratorElectronics
store: board
name: "wallmount generator circuit board"
icon:
@@ -42,7 +42,7 @@
doAfter: 1
- to: electronicsAPU
steps:
- prototype: WallmountGeneratorAPUElectronics
- tag: WallmountGeneratorAPUElectronics
store: board
name: "wallmount APU circuit board"
icon:
@@ -56,8 +56,8 @@
amount: 5
steps:
- tool: Cutting
doAfter: 1
doAfter: 1
- node: electronics
edges:
@@ -65,14 +65,14 @@
steps:
- tool: Screwing
doAfter: 2
- node: electronicsAPU
edges:
- to: APU
steps:
- tool: Screwing
doAfter: 2
- node: generator
entity: GeneratorWallmountBasic
edges:
@@ -86,7 +86,7 @@
steps:
- tool: Prying
doAfter: 1
- node: APU
entity: GeneratorWallmountAPU
edges:
@@ -99,4 +99,4 @@
- !type:EmptyAllContainers {}
steps:
- tool: Prying
doAfter: 1
doAfter: 1

View File

@@ -31,9 +31,9 @@
- node: parts
edges:
- to: electronics
- to: electronics
steps:
- prototype: WallmountSubstationElectronics
- tag: WallmountSubstationElectronics
store: board
name: "wallmount substation circuit board"
icon:
@@ -47,8 +47,8 @@
amount: 5
steps:
- tool: Cutting
doAfter: 1
doAfter: 1
- node: electronics
edges:
@@ -56,7 +56,7 @@
steps:
- tool: Screwing
doAfter: 2
- node: substation
entity: BaseSubstationWall
edges:
@@ -69,4 +69,4 @@
- !type:EmptyAllContainers {}
steps:
- tool: Prying
doAfter: 1
doAfter: 1

View File

@@ -19,7 +19,7 @@
- material: Cable
amount: 5
doAfter: 3
- to: start
completed:
- !type:GivePrototype
@@ -37,12 +37,12 @@
steps:
- tool: Screwing
doAfter: 2
- prototype: SurveillanceCameraMonitorCircuitboard
- tag: SurveillanceCameraMonitorCircuitboard
name: surveillance camera monitor board
icon:
sprite: Objects/Misc/module.rsi
state: cpuboard
- to: TelescreenFrame
completed:
- !type:GivePrototype
@@ -54,8 +54,8 @@
steps:
- tool: Cutting
doAfter: 2
- node: Screen
entity: WallmountTelescreenFrame
edges:
@@ -108,7 +108,7 @@
- material: Cable
amount: 5
doAfter: 3
- to: start
completed:
- !type:GivePrototype
@@ -126,12 +126,12 @@
steps:
- tool: Screwing
doAfter: 2
- prototype: ComputerTelevisionCircuitboard
- tag: ComputerTelevisionCircuitboard
name: television board
icon:
sprite: Objects/Misc/module.rsi
state: cpuboard
- to: TelevisionFrame
completed:
- !type:GivePrototype
@@ -143,8 +143,8 @@
steps:
- tool: Cutting
doAfter: 2
- node: Screen
entity: WallmountTelevisionFrame
edges:

View File

@@ -18,7 +18,7 @@
steps:
- material: Cable
doAfter: 0.5
- prototype: ProximitySensor
- tag: ProximitySensor
icon:
sprite: Objects/Misc/proximity_sensor.rsi
state: icon

View File

@@ -12,9 +12,9 @@
- material: Cable
amount: 2
doAfter: 1
- prototype: ShardGlass
- tag: GlassShard
name: Glass Shard
icon:
icon:
sprite: Objects/Materials/Shards/shard.rsi
state: shard1
doAfter: 1

View File

@@ -6,12 +6,12 @@
edges:
- to: bot
steps:
- prototype: Bucket
- tag: Bucket
icon:
sprite: Objects/Tools/bucket.rsi
state: icon
name: bucket
- prototype: ProximitySensor
- tag: ProximitySensor
icon:
sprite: Objects/Misc/proximity_sensor.rsi
state: icon

View File

@@ -6,18 +6,18 @@
edges:
- to: bot
steps:
- prototype: BoxHug
- tag: BoxHug
icon:
sprite: Objects/Storage/boxes.rsi
state: box_hug
name: box of hugs
- prototype: RubberStampClown
- tag: ClownRubberStamp
icon:
sprite: Objects/Misc/bureaucracy.rsi
state: stamp-clown
name: clown's rubber stamp
doAfter: 2
- prototype: BikeHorn
- tag: BikeHorn
icon:
sprite: Objects/Fun/bikehorn.rsi
state: icon

View File

@@ -17,7 +17,7 @@
state: analyzer
name: health analyzer
doAfter: 2
- prototype: ProximitySensor
- tag: ProximitySensor
icon:
sprite: Objects/Misc/proximity_sensor.rsi
state: icon

View File

@@ -3,6 +3,9 @@
- type: Tag
id: AirAlarm
- type: Tag
id: AirAlarmElectronics
- type: Tag
id: AirSensor
@@ -16,10 +19,7 @@
id: Bee
- type: Tag
id: BrassInstrument
- type: Tag
id: Brutepack
id: BikeHorn
- type: Tag
id: BodyBag
@@ -39,6 +39,18 @@
- type: Tag
id: Bottle
- type: Tag
id: BoxHug
- type: Tag
id: BrassInstrument
- type: Tag
id: Brutepack
- type: Tag
id: Bucket
- type: Tag
id: BulletFoam
@@ -102,6 +114,9 @@
- type: Tag
id: CigPack
- type: Tag
id: ClownRubberStamp
- type: Tag
id: Crayon
@@ -147,6 +162,9 @@
- type: Tag
id: CombatKnife
- type: Tag
id: ComputerTelevisionCircuitboard
- type: Tag
id: Debug
@@ -162,6 +180,9 @@
- type: Tag
id: DoorBumpOpener
- type: Tag
id: DoorElectronics
- type: Tag
id: DonkPocket
@@ -186,6 +207,9 @@
- type: Tag
id: FireAlarm
- type: Tag
id: FireAlarmElectronics
- type: Tag
id: FireAxe
@@ -228,6 +252,9 @@
- type: Tag
id: GlassBeaker
- type: Tag
id: GlassShard
- type: Tag
id: Grenade
@@ -237,6 +264,9 @@
- type: Tag
id: Handcuffs
- type: Tag
id: Head
- type: Tag
id: HideContextMenu
@@ -317,6 +347,9 @@
- type: Tag
id: MagazinePistolSubMachineGun
- type: Tag
id: MailingUnitElectronics
- type: Tag
id: Matchstick
@@ -438,6 +471,12 @@
- type: Tag
id: Soap
- type: Tag
id: SolarAssemblyPart
- type: Tag
id: SolarTrackerElectronics
- type: Tag
id: Spray
@@ -447,6 +486,9 @@
- type: Tag
id: StringInstrument
- type: Tag
id: SurveillanceCameraMonitorCircuitboard
- type: Tag
id: Syndicate
@@ -471,6 +513,15 @@
- type: Tag
id: Wall
- type: Tag
id: WallmountGeneratorAPUElectronics
- type: Tag
id: WallmountGeneratorElectronics
- type: Tag
id: WallmountSubstationElectronics
- type: Tag
id: Window