diff --git a/Content.Server/Botany/Components/SeedExtractorComponent.cs b/Content.Server/Botany/Components/SeedExtractorComponent.cs index 803da611aa..cecce43731 100644 --- a/Content.Server/Botany/Components/SeedExtractorComponent.cs +++ b/Content.Server/Botany/Components/SeedExtractorComponent.cs @@ -1,4 +1,7 @@ using Content.Server.Botany.Systems; +using Content.Server.Construction; +using Content.Shared.Construction.Prototypes; +using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; namespace Content.Server.Botany.Components; @@ -6,8 +9,34 @@ namespace Content.Server.Botany.Components; [Access(typeof(SeedExtractorSystem))] public sealed class SeedExtractorComponent : Component { - // TODO: Upgradeable machines. - [DataField("minSeeds")] public int MinSeeds = 1; + /// + /// The minimum amount of seed packets dropped with no machine upgrades. + /// + [DataField("baseMinSeeds"), ViewVariables(VVAccess.ReadWrite)] + public int BaseMinSeeds = 1; - [DataField("maxSeeds")] public int MaxSeeds = 4; + /// + /// The maximum amount of seed packets dropped with no machine upgrades. + /// + [DataField("baseMaxSeeds"), ViewVariables(VVAccess.ReadWrite)] + public int BaseMaxSeeds = 3; + + /// + /// Modifier to the amount of seeds outputted, set on . + /// + [ViewVariables(VVAccess.ReadWrite)] + public float SeedAmountMultiplier; + + /// + /// Machine part whose rating modifies the amount of seed packets dropped. + /// + [DataField("machinePartYieldAmount", customTypeSerializer: typeof(PrototypeIdSerializer))] + public string MachinePartSeedAmount = "Manipulator"; + + /// + /// How much the machine part quality affects the amount of seeds outputted. + /// Going up a tier will multiply the seed output by this amount. + /// + [DataField("partRatingSeedAmountMultiplier"), ViewVariables] + public float PartRatingSeedAmountMultiplier = 1.5f; } diff --git a/Content.Server/Botany/Systems/SeedExtractorSystem.cs b/Content.Server/Botany/Systems/SeedExtractorSystem.cs index f2428f42f2..b65899b56b 100644 --- a/Content.Server/Botany/Systems/SeedExtractorSystem.cs +++ b/Content.Server/Botany/Systems/SeedExtractorSystem.cs @@ -1,6 +1,6 @@ using Content.Server.Botany.Components; +using Content.Server.Construction; using Content.Server.Popups; -using Content.Server.Power.Components; using Content.Server.Power.EntitySystems; using Content.Shared.Interaction; using Content.Shared.Popups; @@ -20,9 +20,10 @@ public sealed class SeedExtractorSystem : EntitySystem base.Initialize(); SubscribeLocalEvent(OnInteractUsing); + SubscribeLocalEvent(OnRefreshParts); } - private void OnInteractUsing(EntityUid uid, SeedExtractorComponent component, InteractUsingEvent args) + private void OnInteractUsing(EntityUid uid, SeedExtractorComponent seedExtractor, InteractUsingEvent args) { if (!this.IsPowered(uid, EntityManager)) return; @@ -40,15 +41,21 @@ public sealed class SeedExtractorSystem : EntitySystem QueueDel(args.Used); - var random = _random.Next(component.MinSeeds, component.MaxSeeds); + var amount = (int) _random.NextFloat(seedExtractor.BaseMinSeeds, seedExtractor.BaseMaxSeeds + 1) * seedExtractor.SeedAmountMultiplier; var coords = Transform(uid).Coordinates; - if (random > 1) + if (amount > 1) seed.Unique = false; - for (var i = 0; i < random; i++) + for (var i = 0; i < amount; i++) { _botanySystem.SpawnSeedPacket(seed, coords); } } + + private void OnRefreshParts(EntityUid uid, SeedExtractorComponent seedExtractor, RefreshPartsEvent args) + { + var manipulatorQuality = args.PartRatings[seedExtractor.MachinePartSeedAmount]; + seedExtractor.SeedAmountMultiplier = MathF.Pow(seedExtractor.PartRatingSeedAmountMultiplier, manipulatorQuality - 1); + } } diff --git a/Resources/Prototypes/Catalog/Research/technologies.yml b/Resources/Prototypes/Catalog/Research/technologies.yml index fb28619f65..b886fb6d09 100644 --- a/Resources/Prototypes/Catalog/Research/technologies.yml +++ b/Resources/Prototypes/Catalog/Research/technologies.yml @@ -66,6 +66,7 @@ - Shovel - ButchCleaver - MicrowaveMachineCircuitboard + - SeedExtractorMachineCircuitboard - type: technology name: technologies-advanced-surgery diff --git a/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml b/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml index 3cb9c7dcfa..5c01376e5d 100644 --- a/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml +++ b/Resources/Prototypes/Entities/Objects/Devices/Circuitboards/Machine/production.yml @@ -308,6 +308,24 @@ DefaultPrototype: Beaker ExamineName: Glass Beaker +- type: entity + id: SeedExtractorMachineCircuitboard + parent: BaseMachineCircuitboard + name: seed extractor machine board + description: A machine printed circuit board for a seed extractor + components: + - type: Sprite + state: service + - type: MachineBoard + prototype: SeedExtractor + requirements: + Manipulator: 2 + Capacitor: 1 + materialRequirements: + # replacing the console screen + Glass: 1 + Cable: 2 + - type: entity id: SMESMachineCircuitboard parent: BaseMachineCircuitboard diff --git a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml index 180cbf441b..06d4140ae7 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml @@ -289,6 +289,7 @@ - WallmountSubstationElectronics - EmitterCircuitboard - GasRecyclerMachineCircuitboard + - SeedExtractorMachineCircuitboard - type: MaterialStorage whitelist: tags: diff --git a/Resources/Prototypes/Entities/Structures/Machines/seed_extractor.yml b/Resources/Prototypes/Entities/Structures/Machines/seed_extractor.yml index 8b6dbc8680..a8fb9d4bd5 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/seed_extractor.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/seed_extractor.yml @@ -1,7 +1,7 @@ - type: entity id: SeedExtractor name: seed extractor - parent: BaseMachinePowered + parent: [ BaseMachinePowered, ConstructibleMachine ] description: Extracts seeds from produce. components: - type: Sprite @@ -33,3 +33,8 @@ True: { visible: true } False: { visible: false } - type: SeedExtractor + - type: Machine + board: SeedExtractorMachineCircuitboard + - type: UpgradePowerDraw + powerDrawMultiplier: 0.75 + scaling: Exponential diff --git a/Resources/Prototypes/Recipes/Lathes/electronics.yml b/Resources/Prototypes/Recipes/Lathes/electronics.yml index eff89e2f1e..1f47c08584 100644 --- a/Resources/Prototypes/Recipes/Lathes/electronics.yml +++ b/Resources/Prototypes/Recipes/Lathes/electronics.yml @@ -404,7 +404,7 @@ materials: Steel: 100 Glass: 900 - + - type: latheRecipe id: GasRecyclerMachineCircuitboard icon: Objects/Misc/module.rsi/id_mod.png @@ -412,4 +412,13 @@ completetime: 4 materials: Steel: 100 - Glass: 900 \ No newline at end of file + Glass: 900 + +- type: latheRecipe + id: SeedExtractorMachineCircuitboard + icon: Objects/Misc/module.rsi/id_mod.png + result: SeedExtractorMachineCircuitboard + completetime: 4 + materials: + Steel: 100 + Glass: 900