ChemMaster/Chemistry Dispenser constructability, fixed edition (#5125)

This commit is contained in:
20kdc
2021-11-02 09:04:07 +00:00
committed by GitHub
parent 4d63e4df5f
commit 7220132be3
14 changed files with 180 additions and 71 deletions

View File

@@ -101,6 +101,7 @@ namespace Content.Client.Entry
"SoundOnTrigger",
"TriggerOnCollide",
"DeleteOnTrigger",
"EmptyOnMachineDeconstruct",
"ExplodeOnTrigger",
"Utensil",
"UnarmedCombat",

View File

@@ -73,6 +73,7 @@ namespace Content.Server.Chemistry.Components
UserInterface.OnReceiveMessage += OnUiReceiveMessage;
}
// Name relied upon by construction graph machine.yml to ensure beaker doesn't get deleted
BeakerContainer =
ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, $"{Name}-reagentContainerContainer");
@@ -434,6 +435,11 @@ namespace Content.Server.Chemistry.Components
{
Owner.PopupMessage(args.User,
Loc.GetString("chem-master-component-cannot-put-entity-message", ("entity", activeHandEntity)));
// TBD: This is very definitely hax so that Construction & Wires get a chance to handle things.
// When this is ECS'd, drop this in favour of proper prioritization.
// Since this is a catch-all handler, that means do this last!
// Also note ReagentDispenserComponent did something similar before I got here.
return false;
}
return true;

View File

@@ -83,6 +83,7 @@ namespace Content.Server.Chemistry.Components
UserInterface.OnReceiveMessage += OnUiReceiveMessage;
}
// Name relied upon by construction graph machine.yml to ensure beaker doesn't get deleted
BeakerContainer =
ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, $"{Name}-reagentContainerContainer");

View File

@@ -1,7 +1,9 @@
using Content.Shared.Verbs;
using Content.Server.Chemistry.Components;
using Content.Server.Chemistry.Components.SolutionManager;
using Content.Server.Construction.Components;
using JetBrains.Annotations;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Content.Shared.ActionBlocker;

View File

@@ -1,7 +1,9 @@
using Content.Shared.Verbs;
using Content.Server.Chemistry.Components;
using Content.Server.Chemistry.Components.SolutionManager;
using Content.Server.Construction.Components;
using JetBrains.Annotations;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Content.Shared.ActionBlocker;
@@ -57,12 +59,6 @@ namespace Content.Server.Chemistry.EntitySystems
!_actionBlockerSystem.CanDrop(args.User))
return;
if (!args.Using.HasComponent<FitsInDispenserComponent>() ||
!_solutionContainerSystem.TryGetSolution(args.Using.Uid, "beaker", out _))
{
return;
}
Verb verb = new();
verb.Act = () =>
{

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
namespace Content.Server.Containers
{
/// <summary>
/// Empties a list of containers when the machine is deconstructed via MachineDeconstructedEvent.
/// </summary>
[RegisterComponent]
public class EmptyOnMachineDeconstructComponent : Component
{
public override string Name => "EmptyOnMachineDeconstruct";
[ViewVariables]
[DataField("containers")]
public HashSet<string> Containers { get; set; } = new();
}
}

View File

@@ -0,0 +1,37 @@
using Content.Shared.Verbs;
using Content.Server.Construction.Components;
using JetBrains.Annotations;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
namespace Content.Server.Containers
{
/// <summary>
/// Implements functionality of EmptyOnMachineDeconstructComponent.
/// </summary>
[UsedImplicitly]
public class EmptyOnMachineDeconstructSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<EmptyOnMachineDeconstructComponent, MachineDeconstructedEvent>(OnDeconstruct);
}
private void OnDeconstruct(EntityUid uid, EmptyOnMachineDeconstructComponent component, MachineDeconstructedEvent ev)
{
if (!EntityManager.TryGetComponent<IContainerManager>(uid, out var mComp))
return;
var baseCoords = component.Owner.Transform.Coordinates;
foreach (var v in component.Containers)
{
if (mComp.TryGetContainer(v, out var container))
{
container.EmptyContainer(true, baseCoords);
}
}
}
}
}

View File

@@ -97,6 +97,23 @@
- Dropper
- Syringe
- type: technology
name: "medical machinery"
id: MedicalMachinery
description: More machine power for more healing efficiency.
icon:
sprite: Structures/Machines/cloning.rsi
state: pod_0
requiredPoints: 15000
requiredTechnologies:
- BiologicalTechnology
- ChemistryTechnology
unlockedRecipes:
- CloningPodMachineCircuitboard
- MedicalScannerMachineCircuitboard
- ChemMasterMachineCircuitboard
- ChemDispenserMachineCircuitboard
# Security Technology Tree
- type: technology
@@ -228,7 +245,7 @@
description: Try not to fry yourself.
icon:
sprite: Structures/Power/apc.rsi
state: apcewires
state: apc0
requiredPoints: 10000
requiredTechnologies:
- BasicResearch
@@ -241,8 +258,6 @@
- FirelockElectronics
- DoorElectronics
- APCElectronics
- CloningPodMachineCircuitboard
- MedicalScannerMachineCircuitboard
- HydroponicsTrayMachineCircuitboard
- SolarControlComputerCircuitboard

View File

@@ -58,6 +58,37 @@
Glass: 1
Cable: 1
- type: entity
id: ChemMasterMachineCircuitboard
parent: BaseMachineCircuitboard
name: Chem Master (Machine Board)
components:
- type: MachineBoard
prototype: chem_master
requirements:
Manipulator: 1
materialRequirements:
Glass: 1
tagRequirements:
GlassBeaker:
Amount: 2
DefaultPrototype: Beaker
ExamineName: Glass Beaker
- type: entity
id: ChemDispenserMachineCircuitboard
parent: BaseMachineCircuitboard
name: Chem Dispenser (Machine Board)
components:
- type: MachineBoard
prototype: chem_dispenser
requirements:
Capacitor: 1
Manipulator: 1
MatterBin: 2
materialRequirements:
Glass: 1
- type: entity
id: HydroponicsTrayMachineCircuitboard
parent: BaseMachineCircuitboard

View File

@@ -11,3 +11,26 @@
pack: ChemDispenserStandardInventory
- type: ApcPowerReceiver
- type: ExtensionCableReceiver
- type: Construction
graph: machine
node: machine
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 100
behaviors:
- !type:ChangeConstructionNodeBehavior
node: machineFrame
- !type:DoActsBehavior
acts: ["Destruction"]
- type: Machine
board: ChemDispenserMachineCircuitboard
- type: MaterialStorage
- type: Wires
BoardName: "chem_dispenser"
LayoutId: chem_dispenser
- type: EmptyOnMachineDeconstruct
containers:
- ReagentDispenser-reagentContainerContainer

View File

@@ -1,6 +1,6 @@
- type: entity
id: chem_master
parent: BaseStructure
parent: BaseMachinePowered
name: ChemMaster 4000
description: An industrial grade chemical manipulator with pill and bottle production included.
placement:
@@ -16,10 +16,6 @@
sprite: Structures/Machines/mixer.rsi
state: mixer_loaded
- type: ChemMaster
- type: ApcPowerReceiver
- type: ExtensionCableReceiver
- type: InteractionOutline
- type: Anchorable
- type: Physics
bodyType: Static
fixtures:
@@ -32,73 +28,31 @@
layer:
- Opaque
- MobImpassable
- type: Damageable
damageContainer: Inorganic
damageModifierSet: Metallic
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 50
behaviors:
- !type:SpawnEntitiesBehavior
spawn:
chem_master_broken:
min: 1
max: 1
- !type:ChangeConstructionNodeBehavior
node: machineFrame
- !type:DoActsBehavior
acts: [ "Destruction" ]
- type: UserInterface
interfaces:
- key: enum.ChemMasterUiKey.Key
type: ChemMasterBoundUserInterface
# Machine / Construction stuff
- type: Wires
BoardName: "chem_master"
LayoutId: chem_master
- type: Machine
board: ChemMasterMachineCircuitboard
- type: MaterialStorage
- type: Construction
graph: machine
node: machine
- type: EmptyOnMachineDeconstruct
containers:
- ChemMaster-reagentContainerContainer
- type: entity
id: chem_master_broken
parent: BaseStructureDynamic
name: ChemMaster 4000
description: "An industrial grade chemical manipulator with pill and bottle production included. It's broken."
abstract: true
suffix: Broken
components:
- type: Sprite
sprite: Structures/Machines/mixer.rsi
layers:
- state: mixer_empty
- state: mixer_screen_broken
shader: unshaded
- type: Icon
sprite: Structures/Machines/mixer.rsi
state: mixer_broken
- type: InteractionOutline
- type: Physics
bodyType: Dynamic
fixtures:
- shape:
!type:PhysShapeAabb
bounds: "-0.25,-0.4,0.25,0.4"
mass: 25
mask:
- SmallImpassable
layer:
- Opaque
- MobImpassable
- type: Damageable
damageContainer: Inorganic
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 25
behaviors:
- !type:SpawnEntitiesBehavior
spawn:
SheetSteel1:
min: 1
max: 1
- !type:DoActsBehavior
acts: [ "Destruction" ]
- type: UserInterface
interfaces:
- key: enum.ChemMasterUiKey.Key
type: ChemMasterBoundUserInterface

View File

@@ -174,6 +174,8 @@
- APCElectronics
- CloningPodMachineCircuitboard
- MedicalScannerMachineCircuitboard
- ChemMasterMachineCircuitboard
- ChemDispenserMachineCircuitboard
- HydroponicsTrayMachineCircuitboard
- SolarControlComputerCircuitboard
- Bucket

View File

@@ -91,3 +91,4 @@
steps:
- tool: Prying
doAfter: 0.25

View File

@@ -43,6 +43,24 @@
Steel: 100
Glass: 100
- type: latheRecipe
id: ChemMasterMachineCircuitboard
icon: Objects/Misc/module.rsi/id_mod.png
result: ChemMasterMachineCircuitboard
completetime: 1000
materials:
Steel: 100
Glass: 100
- type: latheRecipe
id: ChemDispenserMachineCircuitboard
icon: Objects/Misc/module.rsi/id_mod.png
result: ChemDispenserMachineCircuitboard
completetime: 1000
materials:
Steel: 100
Glass: 100
- type: latheRecipe
id: SolarControlComputerCircuitboard
icon: Objects/Misc/module.rsi/id_mod.png