Fix secfab being able to print protolathe items (#17443)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Content.Shared.Lathe;
|
||||
using Content.Shared.Materials;
|
||||
using Content.Shared.Research.Prototypes;
|
||||
@@ -53,7 +54,7 @@ public sealed partial class LatheMenu : DefaultWindow
|
||||
|
||||
if (_entityManager.TryGetComponent<LatheComponent>(owner.Lathe, out var latheComponent))
|
||||
{
|
||||
if (latheComponent.DynamicRecipes == null)
|
||||
if (!latheComponent.DynamicRecipes.Any())
|
||||
{
|
||||
ServerListButton.Visible = false;
|
||||
ServerSyncButton.Visible = false;
|
||||
@@ -132,7 +133,7 @@ public sealed partial class LatheMenu : DefaultWindow
|
||||
sb.Append('\n');
|
||||
|
||||
var adjustedAmount = SharedLatheSystem.AdjustMaterial(amount, prototype.ApplyMaterialDiscount, component.MaterialUseMultiplier);
|
||||
|
||||
|
||||
sb.Append(adjustedAmount);
|
||||
sb.Append(' ');
|
||||
sb.Append(Loc.GetString(proto.Name));
|
||||
|
||||
@@ -53,13 +53,14 @@ namespace Content.Server.Lathe
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
foreach (var (comp, lathe) in EntityQuery<LatheProducingComponent, LatheComponent>())
|
||||
var query = EntityQueryEnumerator<LatheProducingComponent, LatheComponent>();
|
||||
while(query.MoveNext(out var uid, out var comp, out var lathe))
|
||||
{
|
||||
if (lathe.CurrentRecipe == null)
|
||||
continue;
|
||||
|
||||
if ( _timing.CurTime - comp.StartTime >= comp.ProductionLength)
|
||||
FinishProducing(comp.Owner, lathe);
|
||||
FinishProducing(uid, lathe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,9 +109,7 @@ namespace Content.Server.Lathe
|
||||
|
||||
public List<string> GetAllBaseRecipes(LatheComponent component)
|
||||
{
|
||||
return component.DynamicRecipes == null
|
||||
? component.StaticRecipes
|
||||
: component.StaticRecipes.Union(component.DynamicRecipes).ToList();
|
||||
return component.StaticRecipes.Union(component.DynamicRecipes).ToList();
|
||||
}
|
||||
|
||||
public bool TryAddToQueue(EntityUid uid, LatheRecipePrototype recipe, LatheComponent? component = null)
|
||||
@@ -191,10 +190,15 @@ namespace Content.Server.Lathe
|
||||
|
||||
private void OnGetRecipes(EntityUid uid, TechnologyDatabaseComponent component, LatheGetRecipesEvent args)
|
||||
{
|
||||
if (uid != args.Lathe || !TryComp<LatheComponent>(uid, out var latheComponent) || latheComponent.DynamicRecipes == null)
|
||||
if (uid != args.Lathe || !TryComp<LatheComponent>(uid, out var latheComponent))
|
||||
return;
|
||||
|
||||
args.Recipes = args.Recipes.Union(component.UnlockedRecipes.Where(r => latheComponent.DynamicRecipes.Contains(r))).ToList();
|
||||
foreach (var recipe in latheComponent.DynamicRecipes)
|
||||
{
|
||||
if (!component.UnlockedRecipes.Contains(recipe))
|
||||
continue;
|
||||
args.Recipes.Add(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMaterialAmountChanged(EntityUid uid, LatheComponent component, ref MaterialAmountChangedEvent args)
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Content.Shared.Lathe
|
||||
/// All of the recipes that the lathe is capable of researching
|
||||
/// </summary>
|
||||
[DataField("dynamicRecipes", customTypeSerializer: typeof(PrototypeIdListSerializer<LatheRecipePrototype>))]
|
||||
public readonly List<string>? DynamicRecipes;
|
||||
public readonly List<string> DynamicRecipes = new();
|
||||
|
||||
/// <summary>
|
||||
/// The lathe's construction queue
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Shared.Lathe;
|
||||
using Content.Shared.Research.Prototypes;
|
||||
using Content.Shared.Research.Systems;
|
||||
using Robust.Shared.GameStates;
|
||||
@@ -6,7 +7,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototy
|
||||
|
||||
namespace Content.Shared.Research.Components;
|
||||
|
||||
[RegisterComponent, NetworkedComponent, Access(typeof(SharedResearchSystem)), AutoGenerateComponentState]
|
||||
[RegisterComponent, NetworkedComponent, Access(typeof(SharedResearchSystem), typeof(SharedLatheSystem)), AutoGenerateComponentState]
|
||||
public sealed partial class TechnologyDatabaseComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,6 +1,56 @@
|
||||
- type: entity
|
||||
id: BaseLathe
|
||||
parent: [ BaseMachinePowered, ConstructibleMachine ]
|
||||
abstract: true
|
||||
name: lathe
|
||||
components:
|
||||
- type: Appearance
|
||||
- type: WiresVisuals
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
fix1:
|
||||
shape:
|
||||
!type:PhysShapeAabb
|
||||
bounds: "-0.4,-0.4,0.4,0.4"
|
||||
density: 190
|
||||
mask:
|
||||
- MachineMask
|
||||
layer:
|
||||
- MachineLayer
|
||||
- type: Lathe
|
||||
- type: MaterialStorage
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
- trigger:
|
||||
!type:DamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:ChangeConstructionNodeBehavior
|
||||
node: machineFrame
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
- type: WiresPanel
|
||||
- type: Wires
|
||||
BoardName: "Autolathe"
|
||||
LayoutId: Autolathe
|
||||
- type: ActivatableUI
|
||||
key: enum.LatheUiKey.Key
|
||||
- type: ActivatableUIRequiresPower
|
||||
- type: UserInterface
|
||||
interfaces:
|
||||
- key: enum.LatheUiKey.Key
|
||||
type: LatheBoundUserInterface
|
||||
- type: Transform
|
||||
anchored: true
|
||||
- type: Pullable
|
||||
- type: StaticPrice
|
||||
price: 800
|
||||
- type: ResearchClient
|
||||
- type: TechnologyDatabase
|
||||
|
||||
- type: entity
|
||||
id: Autolathe
|
||||
parent: BaseLathe
|
||||
name: autolathe
|
||||
description: It produces items using metal and glass.
|
||||
components:
|
||||
@@ -17,31 +67,6 @@
|
||||
map: ["enum.MaterialStorageVisualLayers.Inserting"]
|
||||
- state: panel
|
||||
map: ["enum.WiresVisualLayers.MaintenancePanel"]
|
||||
- type: Appearance
|
||||
- type: WiresVisuals
|
||||
- type: Physics
|
||||
bodyType: Static
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
fix1:
|
||||
shape:
|
||||
!type:PhysShapeAabb
|
||||
bounds: "-0.4,-0.4,0.4,0.4"
|
||||
density: 190
|
||||
mask:
|
||||
- MachineMask
|
||||
layer:
|
||||
- MachineLayer
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
- trigger:
|
||||
!type:DamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:ChangeConstructionNodeBehavior
|
||||
node: machineFrame
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
- type: Machine
|
||||
board: AutolatheMachineCircuitboard
|
||||
- type: MaterialStorage
|
||||
@@ -50,20 +75,6 @@
|
||||
- Sheet
|
||||
- RawMaterial
|
||||
- Ingot
|
||||
- type: WiresPanel
|
||||
- type: Wires
|
||||
BoardName: "Autolathe"
|
||||
LayoutId: Autolathe
|
||||
- type: ActivatableUI
|
||||
key: enum.LatheUiKey.Key
|
||||
- type: ActivatableUIRequiresPower
|
||||
- type: UserInterface
|
||||
interfaces:
|
||||
- key: enum.LatheUiKey.Key
|
||||
type: LatheBoundUserInterface
|
||||
- type: Transform
|
||||
anchored: true
|
||||
- type: Pullable
|
||||
- type: Lathe
|
||||
idleState: icon
|
||||
runningState: building
|
||||
@@ -111,12 +122,10 @@
|
||||
- SubstationMachineCircuitboard
|
||||
- CellRechargerCircuitboard
|
||||
- WeaponCapacitorRechargerCircuitboard
|
||||
- type: StaticPrice
|
||||
price: 800
|
||||
|
||||
- type: entity
|
||||
parent: [ BaseMachinePowered, ConstructibleMachine ]
|
||||
id: Protolathe
|
||||
parent: BaseLathe
|
||||
name: protolathe
|
||||
description: Converts raw materials into useful objects.
|
||||
components:
|
||||
@@ -133,57 +142,17 @@
|
||||
map: ["enum.MaterialStorageVisualLayers.Inserting"]
|
||||
- state: panel
|
||||
map: ["enum.WiresVisualLayers.MaintenancePanel"]
|
||||
- type: Appearance
|
||||
- type: WiresVisuals
|
||||
- type: Physics
|
||||
bodyType: Static
|
||||
- type: Fixtures
|
||||
fixtures:
|
||||
fix1:
|
||||
shape:
|
||||
!type:PhysShapeAabb
|
||||
bounds: "-0.4,-0.4,0.4,0.4"
|
||||
density: 190
|
||||
mask:
|
||||
- MachineMask
|
||||
layer:
|
||||
- MachineLayer
|
||||
- type: ResearchClient
|
||||
- type: Destructible
|
||||
thresholds:
|
||||
- trigger:
|
||||
!type:DamageTrigger
|
||||
damage: 100
|
||||
behaviors:
|
||||
- !type:ChangeConstructionNodeBehavior
|
||||
node: machineFrame
|
||||
- !type:DoActsBehavior
|
||||
acts: ["Destruction"]
|
||||
- type: Machine
|
||||
board: ProtolatheMachineCircuitboard
|
||||
- type: WiresPanel
|
||||
- type: Wires
|
||||
BoardName: "Protolathe"
|
||||
LayoutId: Protolathe
|
||||
- type: TechnologyDatabase
|
||||
- type: MaterialStorage
|
||||
whitelist:
|
||||
tags:
|
||||
- Sheet
|
||||
- RawMaterial
|
||||
- Ingot
|
||||
- type: ActivatableUI
|
||||
key: enum.LatheUiKey.Key #Yes only having 1 of them here doesn't break anything
|
||||
- type: ActivatableUIRequiresPower
|
||||
- type: UserInterface
|
||||
interfaces:
|
||||
- key: enum.LatheUiKey.Key
|
||||
type: LatheBoundUserInterface
|
||||
- key: enum.ResearchClientUiKey.Key
|
||||
type: ResearchClientBoundUserInterface
|
||||
- type: Transform
|
||||
anchored: true
|
||||
- type: Pullable
|
||||
- type: Lathe
|
||||
idleState: icon
|
||||
runningState: building
|
||||
@@ -257,8 +226,8 @@
|
||||
- JawsOfLife
|
||||
|
||||
- type: entity
|
||||
parent: Protolathe
|
||||
id: CircuitImprinter
|
||||
parent: BaseLathe
|
||||
name: circuit imprinter
|
||||
description: Prints circuit boards for machines.
|
||||
components:
|
||||
@@ -351,8 +320,8 @@
|
||||
- Ingot
|
||||
|
||||
- type: entity
|
||||
parent: Protolathe
|
||||
id: ExosuitFabricator
|
||||
parent: BaseLathe
|
||||
name: exosuit fabricator
|
||||
description: Creates parts for robotics and other mechanical needs
|
||||
components:
|
||||
@@ -405,10 +374,9 @@
|
||||
guides:
|
||||
- Robotics
|
||||
|
||||
|
||||
- type: entity
|
||||
parent: Protolathe
|
||||
id: SecurityTechFab
|
||||
parent: BaseLathe
|
||||
name: security techfab
|
||||
description: Prints equipment for use by security crew.
|
||||
components:
|
||||
@@ -497,8 +465,8 @@
|
||||
- Ingot
|
||||
|
||||
- type: entity
|
||||
parent: Protolathe
|
||||
id: MedicalTechFab
|
||||
parent: BaseLathe
|
||||
name: medical techfab
|
||||
description: Prints equipment for use by the medbay.
|
||||
components:
|
||||
@@ -559,7 +527,7 @@
|
||||
board: MedicalTechFabCircuitboard
|
||||
|
||||
- type: entity
|
||||
parent: Autolathe
|
||||
parent: BaseLathe
|
||||
id: UniformPrinter
|
||||
name: uniform printer
|
||||
description: Prints new or replacement uniforms.
|
||||
@@ -678,7 +646,7 @@
|
||||
- Ingot
|
||||
|
||||
- type: entity
|
||||
parent: Autolathe
|
||||
parent: BaseLathe
|
||||
id: OreProcessor
|
||||
name: ore processor
|
||||
description: It produces sheets and ingots using ores.
|
||||
@@ -704,6 +672,8 @@
|
||||
tags:
|
||||
- Ore
|
||||
- type: Lathe
|
||||
idleState: icon
|
||||
runningState: building
|
||||
staticRecipes:
|
||||
- SheetSteel30
|
||||
- SheetGlass30
|
||||
@@ -717,7 +687,7 @@
|
||||
- MaterialBananium1
|
||||
|
||||
- type: entity
|
||||
parent: Autolathe
|
||||
parent: BaseLathe
|
||||
id: Sheetifier
|
||||
name: sheet-meister 2000
|
||||
description: A very sheety machine.
|
||||
|
||||
Reference in New Issue
Block a user