Files
wwdpublic/Content.Client/ShortConstruction/ShortConstructionSystem.cs
Spatison bee3125947 [Tweak] Blood Cult (#859)
* commit

* commit

* commit

* commit

* fuck

* cockmit

* fix

* fix Yaml

* test fix
2025-10-12 00:53:06 +03:00

49 lines
1.5 KiB
C#

using Content.Client.Construction;
using Content.Shared.Construction.Prototypes;
using Content.Shared.RadialSelector;
using Content.Shared.ShortConstruction;
using Robust.Client.Placement;
using Robust.Shared.Enums;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
namespace Content.Client.ShortConstruction;
public sealed class ShortConstructionSystem : EntitySystem
{
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IPlacementManager _placement = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly ConstructionSystem _construction = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ShortConstructionComponent, RadialSelectorSelectedMessage>(OnItemRecieved);
}
private void OnItemRecieved(Entity<ShortConstructionComponent> ent, ref RadialSelectorSelectedMessage args)
{
if (!_proto.TryIndex(args.SelectedItem, out ConstructionPrototype? prototype) ||
!_gameTiming.IsFirstTimePredicted)
return;
if (prototype.Type == ConstructionType.Item)
{
_construction.TryStartItemConstruction(prototype.ID);
return;
}
var hijack = new ConstructionPlacementHijack(_construction, prototype);
_placement.BeginPlacing(new PlacementInformation
{
IsTile = false,
PlacementOption = prototype.PlacementMode
},
hijack);
}
}