Rip out remaining machine upgrades (#24413)
* Rip out remaining machine upgrades * eek
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
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;
|
||||
|
||||
@@ -10,33 +7,14 @@ namespace Content.Server.Botany.Components;
|
||||
public sealed partial class SeedExtractorComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The minimum amount of seed packets dropped with no machine upgrades.
|
||||
/// The minimum amount of seed packets dropped.
|
||||
/// </summary>
|
||||
[DataField("baseMinSeeds"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public int BaseMinSeeds = 1;
|
||||
|
||||
/// <summary>
|
||||
/// The maximum amount of seed packets dropped with no machine upgrades.
|
||||
/// The maximum amount of seed packets dropped.
|
||||
/// </summary>
|
||||
[DataField("baseMaxSeeds"), ViewVariables(VVAccess.ReadWrite)]
|
||||
public int BaseMaxSeeds = 3;
|
||||
|
||||
/// <summary>
|
||||
/// Modifier to the amount of seeds outputted, set on <see cref="RefreshPartsEvent"/>.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float SeedAmountMultiplier;
|
||||
|
||||
/// <summary>
|
||||
/// Machine part whose rating modifies the amount of seed packets dropped.
|
||||
/// </summary>
|
||||
[DataField("machinePartYieldAmount", customTypeSerializer: typeof(PrototypeIdSerializer<MachinePartPrototype>))]
|
||||
public string MachinePartSeedAmount = "Manipulator";
|
||||
|
||||
/// <summary>
|
||||
/// How much the machine part quality affects the amount of seeds outputted.
|
||||
/// Going up a tier will multiply the seed output by this amount.
|
||||
/// </summary>
|
||||
[DataField("partRatingSeedAmountMultiplier")]
|
||||
public float PartRatingSeedAmountMultiplier = 1.5f;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
using Content.Server.Botany.Components;
|
||||
using Content.Server.Construction;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.Botany.Systems;
|
||||
@@ -20,8 +18,6 @@ public sealed class SeedExtractorSystem : EntitySystem
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<SeedExtractorComponent, InteractUsingEvent>(OnInteractUsing);
|
||||
SubscribeLocalEvent<SeedExtractorComponent, RefreshPartsEvent>(OnRefreshParts);
|
||||
SubscribeLocalEvent<SeedExtractorComponent, UpgradeExamineEvent>(OnUpgradeExamine);
|
||||
}
|
||||
|
||||
private void OnInteractUsing(EntityUid uid, SeedExtractorComponent seedExtractor, InteractUsingEvent args)
|
||||
@@ -29,7 +25,8 @@ public sealed class SeedExtractorSystem : EntitySystem
|
||||
if (!this.IsPowered(uid, EntityManager))
|
||||
return;
|
||||
|
||||
if (!TryComp(args.Used, out ProduceComponent? produce)) return;
|
||||
if (!TryComp(args.Used, out ProduceComponent? produce))
|
||||
return;
|
||||
if (!_botanySystem.TryGetSeed(produce, out var seed) || seed.Seedless)
|
||||
{
|
||||
_popupSystem.PopupCursor(Loc.GetString("seed-extractor-component-no-seeds",("name", args.Used)),
|
||||
@@ -42,7 +39,7 @@ public sealed class SeedExtractorSystem : EntitySystem
|
||||
|
||||
QueueDel(args.Used);
|
||||
|
||||
var amount = (int) _random.NextFloat(seedExtractor.BaseMinSeeds, seedExtractor.BaseMaxSeeds + 1) * seedExtractor.SeedAmountMultiplier;
|
||||
var amount = _random.Next(seedExtractor.BaseMinSeeds, seedExtractor.BaseMaxSeeds + 1);
|
||||
var coords = Transform(uid).Coordinates;
|
||||
|
||||
if (amount > 1)
|
||||
@@ -53,15 +50,4 @@ public sealed class SeedExtractorSystem : EntitySystem
|
||||
_botanySystem.SpawnSeedPacket(seed, coords, args.User);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnRefreshParts(EntityUid uid, SeedExtractorComponent seedExtractor, RefreshPartsEvent args)
|
||||
{
|
||||
var manipulatorQuality = args.PartRatings[seedExtractor.MachinePartSeedAmount];
|
||||
seedExtractor.SeedAmountMultiplier = MathF.Pow(seedExtractor.PartRatingSeedAmountMultiplier, manipulatorQuality - 1);
|
||||
}
|
||||
|
||||
private void OnUpgradeExamine(EntityUid uid, SeedExtractorComponent seedExtractor, UpgradeExamineEvent args)
|
||||
{
|
||||
args.AddPercentageUpgrade("seed-extractor-component-upgrade-seed-yield", seedExtractor.SeedAmountMultiplier);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user