add fuel costs back to finishing welding (#27030)

* add fuel costs back to welding

* ack

* meh

* eek!
This commit is contained in:
Nemanja
2024-04-19 19:20:30 -04:00
committed by GitHub
parent 299da35c87
commit a47c5561a9
26 changed files with 403 additions and 466 deletions

View File

@@ -1,21 +0,0 @@
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared.Tools.Components
{
[NetworkedComponent]
public abstract partial class SharedWelderComponent : Component { }
[NetSerializable, Serializable]
public sealed class WelderComponentState : ComponentState
{
public float FuelCapacity { get; }
public float Fuel { get; }
public WelderComponentState(float fuelCapacity, float fuel)
{
FuelCapacity = fuelCapacity;
Fuel = fuel;
}
}
}

View File

@@ -1,6 +1,6 @@
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.Tools.Components;
@@ -10,29 +10,31 @@ public sealed partial class WeldableComponent : Component
/// <summary>
/// Tool quality for welding.
/// </summary>
[DataField("weldingQuality", customTypeSerializer: typeof(PrototypeIdSerializer<ToolQualityPrototype>))]
[ViewVariables(VVAccess.ReadWrite)]
public string WeldingQuality = "Welding";
[DataField]
public ProtoId<ToolQualityPrototype> WeldingQuality = "Welding";
/// <summary>
/// How much time does it take to weld/unweld entity.
/// </summary>
[DataField("time")]
[ViewVariables(VVAccess.ReadWrite)]
[AutoNetworkedField]
public TimeSpan WeldingTime = TimeSpan.FromSeconds(1f);
[DataField, AutoNetworkedField]
public TimeSpan Time = TimeSpan.FromSeconds(1f);
/// <summary>
/// How much fuel does it take to weld/unweld entity.
/// </summary>
[DataField]
public float Fuel = 3f;
/// <summary>
/// Shown when welded entity is examined.
/// </summary>
[DataField("weldedExamineMessage")]
[ViewVariables(VVAccess.ReadWrite)]
public string? WeldedExamineMessage = "weldable-component-examine-is-welded";
[DataField]
public LocId? WeldedExamineMessage = "weldable-component-examine-is-welded";
/// <summary>
/// Is this entity currently welded shut?
/// </summary>
[DataField("isWelded"), AutoNetworkedField]
[DataField, AutoNetworkedField]
public bool IsWelded;
}

View File

@@ -0,0 +1,64 @@
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using Content.Shared.Tools.Systems;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
namespace Content.Shared.Tools.Components;
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true), Access(typeof(SharedToolSystem))]
public sealed partial class WelderComponent : Component
{
[DataField, AutoNetworkedField]
public bool Enabled;
[DataField]
public float WelderTimer;
/// <summary>
/// Name of <see cref="FuelSolution"/>.
/// </summary>
[DataField]
public string FuelSolutionName = "Welder";
/// <summary>
/// Solution on the entity that contains the fuel.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public Entity<SolutionComponent>? FuelSolution;
/// <summary>
/// Reagent that will be used as fuel for welding.
/// </summary>
[DataField]
public ProtoId<ReagentPrototype> FuelReagent = "WeldingFuel";
/// <summary>
/// Fuel consumption per second while the welder is active.
/// </summary>
[DataField, AutoNetworkedField]
public FixedPoint2 FuelConsumption = FixedPoint2.New(1.0f);
/// <summary>
/// A fuel amount to be consumed when the welder goes from being unlit to being lit.
/// </summary>
[DataField, AutoNetworkedField]
public FixedPoint2 FuelLitCost = FixedPoint2.New(0.5f);
/// <summary>
/// Sound played when refilling the welder.
/// </summary>
[DataField]
public SoundSpecifier WelderRefill = new SoundPathSpecifier("/Audio/Effects/refill.ogg");
/// <summary>
/// Whether the item is safe to refill while lit without exploding the tank.
/// </summary>
[DataField]
public bool TankSafe;
[DataField]
public float WelderUpdateTimer = 1f;
}