Flatpacks and the Flatpacker 1001 (#23338)

* Flatpacker and flatpacks

* ok that's good enough

* convert solars/AME to flatpacks

* mats, mats, we are the mats

* basic mechanics are DONE

* thing

* final UI

* sloth

* rped jumpscare

* rename
This commit is contained in:
Nemanja
2024-01-03 01:16:02 -05:00
committed by GitHub
parent 04fc06e9d4
commit 1c11332fa4
40 changed files with 1066 additions and 101 deletions

View File

@@ -0,0 +1,51 @@
using Content.Shared.Tools;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
namespace Content.Shared.Construction.Components;
/// <summary>
/// This is used for an object that can instantly create a machine upon having a tool applied to it.
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
[Access(typeof(SharedFlatpackSystem))]
public sealed partial class FlatpackComponent : Component
{
/// <summary>
/// The tool quality that, upon used to interact with this object, will create the <see cref="Entity"/>
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public ProtoId<ToolQualityPrototype> QualityNeeded = "Pulsing";
/// <summary>
/// The entity that is spawned when this object is unpacked.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public EntProtoId? Entity;
/// <summary>
/// Sound effect played upon the object being unpacked.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public SoundSpecifier UnpackSound = new SoundPathSpecifier("/Audio/Effects/unwrap.ogg");
/// <summary>
/// A dictionary relating a machine board sprite state to a color used for the overlay.
/// Kinda shitty but it gets the job done.
/// </summary>
[DataField]
public Dictionary<string, Color> BoardColors = new();
}
[Serializable, NetSerializable]
public enum FlatpackVisuals : byte
{
Machine
}
public enum FlatpackVisualLayers : byte
{
Overlay
}

View File

@@ -0,0 +1,69 @@
using Content.Shared.Materials;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.Construction.Components;
/// <summary>
/// This is used for a machine that creates flatpacks at the cost of materials
/// </summary>
[RegisterComponent, NetworkedComponent]
[Access(typeof(SharedFlatpackSystem))]
[AutoGenerateComponentState]
public sealed partial class FlatpackCreatorComponent : Component
{
/// <summary>
/// Whether or not packing is occuring
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
[AutoNetworkedField]
public bool Packing;
/// <summary>
/// The time at which packing ends
/// </summary>
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), ViewVariables(VVAccess.ReadWrite)]
[AutoNetworkedField]
public TimeSpan PackEndTime;
/// <summary>
/// How long packing lasts.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public TimeSpan PackDuration = TimeSpan.FromSeconds(3);
/// <summary>
/// The prototype used when spawning a flatpack.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public EntProtoId BaseFlatpackPrototype = "BaseFlatpack";
/// <summary>
/// A default cost applied to all flatpacks outside of the cost of constructing the machine.
/// </summary>
[DataField]
public Dictionary<ProtoId<MaterialPrototype>, int> BaseMaterialCost = new();
[DataField, ViewVariables(VVAccess.ReadWrite)]
public string SlotId = "board_slot";
}
[Serializable, NetSerializable]
public enum FlatpackCreatorUIKey : byte
{
Key
}
[Serializable, NetSerializable]
public enum FlatpackCreatorVisuals : byte
{
Packing
}
[Serializable, NetSerializable]
public sealed class FlatpackCreatorStartPackBuiMessage : BoundUserInterfaceMessage
{
}