Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Machine parts tiers #328

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
878e550
Revert "Revert "kill machine parts + migrate machine part spawners to…
Ratyyy Feb 11, 2024
6a080a7
Revert "Rip out remaining machine upgrades (#24413)"
Ratyyy Feb 11, 2024
f266431
Revert "machine parts + power cell resprite (#23913)"
Ratyyy Feb 11, 2024
b263ef1
Revert "kill machine parts + migrate machine part spawners to salvage…
Ratyyy Feb 11, 2024
1344105
Revert "Hyper convection lathes and industrial ore processor (#23202)"
Ratyyy Feb 11, 2024
96b8df4
blah-blah
Ratyyy Feb 11, 2024
9e8944e
Revert "Experimental Anomaly Vessel (#22233)"
Ratyyy Feb 11, 2024
874fc9c
Revert "Revert "Hyper convection lathes and industrial ore processor …
Ratyyy Feb 11, 2024
157dc56
Revert "Revert "Experimental Anomaly Vessel (#22233)""
Ratyyy Feb 11, 2024
188eb5c
Revert "Revert "Revert "Hyper convection lathes and industrial ore pr…
Ratyyy Feb 11, 2024
af59b7e
some things
Ratyyy Feb 11, 2024
d7f56be
mo more turbo recharger
Ratyyy Feb 11, 2024
94246e5
bamm
Ratyyy Feb 12, 2024
ad21cda
no
Ratyyy Feb 12, 2024
6894559
turbo recharger
Ratyyy Feb 16, 2024
7ebc652
Merge branch 'arumoon-server' into machine-parts-tiers
Ratyyy Feb 18, 2024
ca62364
Merge branch 'arumoon-server' of gitlab.workbench.network:Workbench-T…
MilenVolf Feb 19, 2024
c37dbee
Merge branch 'arumoon-server' of gitlab.workbench.network:Workbench-T…
MilenVolf Feb 19, 2024
67b8736
turbo crharger 2
Ratyyy Feb 19, 2024
d60d3e1
Merge branch 'machine-parts-tiers' of https://github.com/Ratyyy/space…
Ratyyy Feb 19, 2024
6017206
fix
Ratyyy Feb 19, 2024
287d239
Merge branch 'arumoon-server' into machine-parts-tiers
Ratyyy Feb 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,34 @@ public async Task ChangeMachine()
await Interact(Bin1, Bin1, Bin1, Manipulator1, Glass, Screw);
AssertPrototype("Autolathe");
}

[Test]
public async Task UpgradeLathe()
{
// Partially deconstruct a protolathe.
await SpawnTarget(Protolathe);
var serverTarget = SEntMan.GetEntity(Target!.Value);

// Initially has all quality-1 parts.
foreach (var part in SConstruction.GetAllParts(serverTarget))
{
Assert.That(part.Rating, Is.EqualTo(1));
}

// Partially deconstruct lathe
await Interact(Screw, Pry, Pry);
AssertPrototype(MachineFrame);

// Reconstruct with better parts.
await Interact(ProtolatheBoard, Bin4, Bin4, Manipulator4, Manipulator4, Beaker, Beaker);
await Interact(Screw);
AssertPrototype(Protolathe);

// Query now returns higher quality parts.
foreach (var part in SConstruction.GetAllParts(SEntMan.GetEntity(Target!.Value)))
{
Assert.That(part.Rating, Is.EqualTo(4));
}
}
}

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

namespace Content.IntegrationTests.Tests.Interaction;

// This partial class contains various constant prototype IDs common to interaction tests.
Expand Down Expand Up @@ -27,8 +28,12 @@ public abstract partial class InteractionTest

// Parts
protected const string Bin1 = "MatterBinStockPart";
protected const string Bin4 = "BluespaceMatterBinStockPart";
protected const string Cap1 = "CapacitorStockPart";
protected const string Cap4 = "QuadraticCapacitorStockPart";
protected const string Manipulator1 = "MicroManipulatorStockPart";
protected const string Manipulator4 = "FemtoManipulatorStockPart";
protected const string Battery1 = "PowerCellSmall";
protected const string Battery4 = "PowerCellHyper";
}

7 changes: 7 additions & 0 deletions Content.Server/Anomaly/AnomalySystem.Vessel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Server.Anomaly.Components;
using Content.Server.Construction;
using Content.Server.Power.EntitySystems;
using Content.Shared.Anomaly;
using Content.Shared.Anomaly.Components;
Expand All @@ -19,6 +20,7 @@ private void InitializeVessel()
{
SubscribeLocalEvent<AnomalyVesselComponent, ComponentShutdown>(OnVesselShutdown);
SubscribeLocalEvent<AnomalyVesselComponent, MapInitEvent>(OnVesselMapInit);
SubscribeLocalEvent<AnomalyVesselComponent, UpgradeExamineEvent>(OnUpgradeExamine);
SubscribeLocalEvent<AnomalyVesselComponent, InteractUsingEvent>(OnVesselInteractUsing);
SubscribeLocalEvent<AnomalyVesselComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<AnomalyVesselComponent, ResearchServerGetPointsPerSecondEvent>(OnVesselGetPointsPerSecond);
Expand Down Expand Up @@ -64,6 +66,11 @@ private void OnVesselMapInit(EntityUid uid, AnomalyVesselComponent component, Ma
UpdateVesselAppearance(uid, component);
}

private void OnUpgradeExamine(EntityUid uid, AnomalyVesselComponent component, UpgradeExamineEvent args)
{
args.AddPercentageUpgrade("anomaly-vessel-component-upgrade-output", component.PointMultiplier);
}

private void OnVesselInteractUsing(EntityUid uid, AnomalyVesselComponent component, InteractUsingEvent args)
{
if (component.Anomaly != null ||
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using Content.Shared.Atmos;
using Content.Shared.Construction.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;

namespace Content.Server.Atmos.Piping.Binary.Components
{
Expand All @@ -17,10 +19,28 @@ public sealed partial class GasRecyclerComponent : Component
[DataField("outlet")]
public string OutletName { get; set; } = "outlet";

[DataField, ViewVariables(VVAccess.ReadWrite)]
[ViewVariables(VVAccess.ReadWrite)]
public float MinTemp = 300 + Atmospherics.T0C;

[DataField, ViewVariables(VVAccess.ReadWrite)]
[DataField("BaseMinTemp")]
public float BaseMinTemp = 300 + Atmospherics.T0C;

[DataField("machinePartMinTemp", customTypeSerializer: typeof(PrototypeIdSerializer<MachinePartPrototype>))]
public string MachinePartMinTemp = "Capacitor";

[DataField("partRatingMinTempMultiplier")]
public float PartRatingMinTempMultiplier = 0.95f;

[ViewVariables(VVAccess.ReadWrite)]
public float MinPressure = 30 * Atmospherics.OneAtmosphere;

[DataField("BaseMinPressure")]
public float BaseMinPressure = 30 * Atmospherics.OneAtmosphere;

[DataField("machinePartMinPressure", customTypeSerializer: typeof(PrototypeIdSerializer<MachinePartPrototype>))]
public string MachinePartMinPressure = "Manipulator";

[DataField("partRatingMinPressureMultiplier")]
public float PartRatingMinPressureMultiplier = 0.8f;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.Piping.Binary.Components;
using Content.Server.Atmos.Piping.Components;
using Content.Server.Construction;
using Content.Server.NodeContainer;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
Expand Down Expand Up @@ -28,6 +29,8 @@ public override void Initialize()
SubscribeLocalEvent<GasRecyclerComponent, AtmosDeviceUpdateEvent>(OnUpdate);
SubscribeLocalEvent<GasRecyclerComponent, AtmosDeviceDisabledEvent>(OnDisabled);
SubscribeLocalEvent<GasRecyclerComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<GasRecyclerComponent, RefreshPartsEvent>(OnRefreshParts);
SubscribeLocalEvent<GasRecyclerComponent, UpgradeExamineEvent>(OnUpgradeExamine);
}

private void OnEnabled(EntityUid uid, GasRecyclerComponent comp, ref AtmosDeviceEnabledEvent args)
Expand Down Expand Up @@ -122,5 +125,20 @@ private void UpdateAppearance(EntityUid uid, GasRecyclerComponent? comp = null)

_appearance.SetData(uid, PumpVisuals.Enabled, comp.Reacting);
}

private void OnRefreshParts(EntityUid uid, GasRecyclerComponent component, RefreshPartsEvent args)
{
var ratingTemp = args.PartRatings[component.MachinePartMinTemp];
var ratingPressure = args.PartRatings[component.MachinePartMinPressure];

component.MinTemp = component.BaseMinTemp * MathF.Pow(component.PartRatingMinTempMultiplier, ratingTemp - 1);
component.MinPressure = component.BaseMinPressure * MathF.Pow(component.PartRatingMinPressureMultiplier, ratingPressure - 1);
}

private void OnUpgradeExamine(EntityUid uid, GasRecyclerComponent component, UpgradeExamineEvent args)
{
args.AddPercentageUpgrade("gas-recycler-upgrade-min-temp", component.MinTemp / component.BaseMinTemp);
args.AddPercentageUpgrade("gas-recycler-upgrade-min-pressure", component.MinPressure / component.BaseMinPressure);
}
}
}
44 changes: 42 additions & 2 deletions Content.Server/Atmos/Portable/PortableScrubberComponent.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using Content.Shared.Atmos;
using Content.Shared.Construction.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;

namespace Content.Server.Atmos.Portable
{
Expand Down Expand Up @@ -48,13 +50,51 @@ public sealed partial class PortableScrubberComponent : Component
/// <summary>
/// Maximum internal pressure before it refuses to take more.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
[ViewVariables(VVAccess.ReadWrite)]
public float MaxPressure = 2500;

/// <summary>
/// The base amount of maximum internal pressure
/// </summary>
[DataField("baseMaxPressure")]
public float BaseMaxPressure = 2500;

/// <summary>
/// The machine part that modifies the maximum internal pressure
/// </summary>
[DataField("machinePartMaxPressure", customTypeSerializer: typeof(PrototypeIdSerializer<MachinePartPrototype>))]
public string MachinePartMaxPressure = "MatterBin";

/// <summary>
/// How much the <see cref="MachinePartMaxPressure"/> will affect the pressure.
/// The value will be multiplied by this amount for each increasing part tier.
/// </summary>
[DataField("partRatingMaxPressureModifier")]
public float PartRatingMaxPressureModifier = 1.5f;

/// <summary>
/// The speed at which gas is scrubbed from the environment.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
[ViewVariables(VVAccess.ReadWrite)]
public float TransferRate = 800;

/// <summary>
/// The base speed at which gas is scrubbed from the environment.
/// </summary>
[DataField("baseTransferRate")]
public float BaseTransferRate = 800;

/// <summary>
/// The machine part which modifies the speed of <see cref="TransferRate"/>
/// </summary>
[DataField("machinePartTransferRate", customTypeSerializer: typeof(PrototypeIdSerializer<MachinePartPrototype>))]
public string MachinePartTransferRate = "Manipulator";

/// <summary>
/// How much the <see cref="MachinePartTransferRate"/> will modify the rate.
/// The value will be multiplied by this amount for each increasing part tier.
/// </summary>
[DataField("partRatingTransferRateModifier")]
public float PartRatingTransferRateModifier = 1.4f;
}
}
18 changes: 18 additions & 0 deletions Content.Server/Atmos/Portable/PortableScrubberSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Content.Server.NodeContainer.NodeGroups;
using Content.Server.Audio;
using Content.Server.Administration.Logs;
using Content.Server.Construction;
using Content.Server.NodeContainer.EntitySystems;
using Content.Shared.Database;

Expand All @@ -38,6 +39,8 @@ public override void Initialize()
SubscribeLocalEvent<PortableScrubberComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<PortableScrubberComponent, DestructionEventArgs>(OnDestroyed);
SubscribeLocalEvent<PortableScrubberComponent, GasAnalyzerScanEvent>(OnScrubberAnalyzed);
SubscribeLocalEvent<PortableScrubberComponent, RefreshPartsEvent>(OnRefreshParts);
SubscribeLocalEvent<PortableScrubberComponent, UpgradeExamineEvent>(OnUpgradeExamine);
}

private bool IsFull(PortableScrubberComponent component)
Expand Down Expand Up @@ -167,5 +170,20 @@ private void OnScrubberAnalyzed(EntityUid uid, PortableScrubberComponent compone
}
args.GasMixtures = gasMixDict;
}

private void OnRefreshParts(EntityUid uid, PortableScrubberComponent component, RefreshPartsEvent args)
{
var pressureRating = args.PartRatings[component.MachinePartMaxPressure];
var transferRating = args.PartRatings[component.MachinePartTransferRate];

component.MaxPressure = component.BaseMaxPressure * MathF.Pow(component.PartRatingMaxPressureModifier, pressureRating - 1);
component.TransferRate = component.BaseTransferRate * MathF.Pow(component.PartRatingTransferRateModifier, transferRating - 1);
}

private void OnUpgradeExamine(EntityUid uid, PortableScrubberComponent component, UpgradeExamineEvent args)
{
args.AddPercentageUpgrade("portable-scrubber-component-upgrade-max-pressure", component.MaxPressure / component.BaseMaxPressure);
args.AddPercentageUpgrade("portable-scrubber-component-upgrade-transfer-rate", component.TransferRate / component.BaseTransferRate);
}
}
}
17 changes: 17 additions & 0 deletions Content.Server/Bed/BedSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
using Content.Server.Bed.Components;
using Content.Server.Bed.Sleep;
using Content.Server.Body.Systems;
using Content.Server.Construction;
using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;
using Content.Shared.Bed;
using Content.Shared.Bed.Sleep;
using Content.Shared.Body.Components;
using Content.Shared.Buckle.Components;
using Content.Shared.Damage;
using Content.Shared.Emag.Components;
using Content.Shared.Emag.Systems;
using Content.Shared.Mobs.Systems;
using Robust.Shared.Timing;
Expand All @@ -31,6 +33,8 @@ public override void Initialize()
SubscribeLocalEvent<StasisBedComponent, BuckleChangeEvent>(OnBuckleChange);
SubscribeLocalEvent<StasisBedComponent, PowerChangedEvent>(OnPowerChanged);
SubscribeLocalEvent<StasisBedComponent, GotEmaggedEvent>(OnEmagged);
SubscribeLocalEvent<StasisBedComponent, RefreshPartsEvent>(OnRefreshParts);
SubscribeLocalEvent<StasisBedComponent, UpgradeExamineEvent>(OnUpgradeExamine);
}

private void ManageUpdateList(EntityUid uid, HealOnBuckleComponent component, ref BuckleChangeEvent args)
Expand Down Expand Up @@ -126,5 +130,18 @@ private void UpdateMetabolisms(EntityUid uid, StasisBedComponent component, bool
RaiseLocalEvent(buckledEntity, metabolicEvent);
}
}

private void OnRefreshParts(EntityUid uid, StasisBedComponent component, RefreshPartsEvent args)
{
var metabolismRating = args.PartRatings[component.MachinePartMetabolismModifier];
component.Multiplier = component.BaseMultiplier * metabolismRating; //linear scaling so it's not OP
if (HasComp<EmaggedComponent>(uid))
component.Multiplier = 1f / component.Multiplier;
}

private void OnUpgradeExamine(EntityUid uid, StasisBedComponent component, UpgradeExamineEvent args)
{
args.AddPercentageUpgrade("stasis-bed-component-upgrade-stasis", component.Multiplier / component.BaseMultiplier);
}
}
}
9 changes: 9 additions & 0 deletions Content.Server/Bed/Components/StasisBedComponent.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
using Content.Shared.Construction.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;

namespace Content.Server.Bed.Components
{
[RegisterComponent]
public sealed partial class StasisBedComponent : Component
{
[DataField("baseMultiplier", required: true), ViewVariables(VVAccess.ReadWrite)]
public float BaseMultiplier = 10f;

/// <summary>
/// What the metabolic update rate will be multiplied by (higher = slower metabolism)
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public float Multiplier = 10f;

[DataField("machinePartMetabolismModifier", customTypeSerializer: typeof(PrototypeIdSerializer<MachinePartPrototype>))]
public string MachinePartMetabolismModifier = "Capacitor";
}
}
26 changes: 24 additions & 2 deletions Content.Server/Botany/Components/SeedExtractorComponent.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -7,14 +10,33 @@ namespace Content.Server.Botany.Components;
public sealed partial class SeedExtractorComponent : Component
{
/// <summary>
/// The minimum amount of seed packets dropped.
/// The minimum amount of seed packets dropped with no machine upgrades.
/// </summary>
[DataField("baseMinSeeds"), ViewVariables(VVAccess.ReadWrite)]
public int BaseMinSeeds = 1;

/// <summary>
/// The maximum amount of seed packets dropped.
/// The maximum amount of seed packets dropped with no machine upgrades.
/// </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;
}
Loading
Loading