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

@@ -1,24 +0,0 @@
using Content.Shared.Tools;
using Robust.Shared.Audio;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.Ame.Components;
/// <summary>
/// Packaged AME machinery that can be deployed to construct an AME.
/// </summary>
[RegisterComponent]
public sealed partial class AmePartComponent : Component
{
/// <summary>
/// The sound played when the AME shielding is unpacked.
/// </summary>
[DataField("unwrapSound")]
public SoundSpecifier UnwrapSound = new SoundPathSpecifier("/Audio/Effects/unwrap.ogg");
/// <summary>
/// The tool quality required to deploy the packaged AME shielding.
/// </summary>
[DataField("qualityNeeded", customTypeSerializer: typeof(PrototypeIdSerializer<ToolQualityPrototype>))]
public string QualityNeeded = "Pulsing";
}

View File

@@ -1,53 +0,0 @@
using System.Linq;
using Content.Server.Administration.Logs;
using Content.Server.Ame.Components;
using Content.Server.Popups;
using Content.Server.Tools;
using Content.Shared.Database;
using Content.Shared.Hands.Components;
using Content.Shared.Interaction;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Map;
namespace Content.Server.Ame.EntitySystems;
public sealed class AmePartSystem : EntitySystem
{
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly ToolSystem _toolSystem = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<AmePartComponent, InteractUsingEvent>(OnPartInteractUsing);
}
private void OnPartInteractUsing(EntityUid uid, AmePartComponent component, InteractUsingEvent args)
{
if (!_toolSystem.HasQuality(args.Used, component.QualityNeeded))
return;
if (!_mapManager.TryGetGrid(args.ClickLocation.GetGridUid(EntityManager), out var mapGrid))
return; // No AME in space.
var snapPos = mapGrid.TileIndicesFor(args.ClickLocation);
if (mapGrid.GetAnchoredEntities(snapPos).Any(sc => HasComp<AmeShieldComponent>(sc)))
{
_popupSystem.PopupEntity(Loc.GetString("ame-part-component-shielding-already-present"), uid, args.User);
return;
}
var ent = Spawn("AmeShielding", mapGrid.GridTileToLocal(snapPos));
_adminLogger.Add(LogType.Construction, LogImpact.Low, $"{ToPrettyString(args.User):player} unpacked {ToPrettyString(ent)} at {Transform(ent).Coordinates} from {ToPrettyString(uid)}");
_audioSystem.PlayPvs(component.UnwrapSound, uid);
QueueDel(uid);
}
}