- add: genitals
This commit is contained in:
24
Content.Server/_Amour/Hole/HoleSystem.Container.cs
Normal file
24
Content.Server/_Amour/Hole/HoleSystem.Container.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Content.Shared._Amour.Hole;
|
||||
using Robust.Server.Containers;
|
||||
using Robust.Shared.Containers;
|
||||
|
||||
namespace Content.Server._Amour.Hole;
|
||||
|
||||
public sealed partial class HoleSystem
|
||||
{
|
||||
[Dependency] private readonly ContainerSystem _containerSystem = default!;
|
||||
private void InitializeContainer()
|
||||
{
|
||||
SubscribeLocalEvent<HoleContainerComponent,ComponentInit>(OnContainerInit);
|
||||
}
|
||||
|
||||
private void OnContainerInit(EntityUid uid, HoleContainerComponent component, ComponentInit args)
|
||||
{
|
||||
component.Slot = _containerSystem.EnsureContainer<Container>(uid, HoleContainerComponent.SlotName);
|
||||
foreach (var holePrototype in component.HolePrototypes)
|
||||
{
|
||||
Log.Debug("ADDED " + holePrototype);
|
||||
_containerSystem.Insert(Spawn(holePrototype), component.Slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Content.Server/_Amour/Hole/HoleSystem.Inventory.cs
Normal file
19
Content.Server/_Amour/Hole/HoleSystem.Inventory.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Content.Shared._Amour.Hole;
|
||||
using Robust.Server.Containers;
|
||||
using Robust.Shared.Containers;
|
||||
|
||||
namespace Content.Server._Amour.Hole;
|
||||
|
||||
public sealed partial class HoleSystem
|
||||
{
|
||||
[Dependency] private readonly ContainerSystem _container = default!;
|
||||
public void InitializeInventory()
|
||||
{
|
||||
SubscribeLocalEvent<HoleInventoryComponent,ComponentInit>(OnInventoryInit);
|
||||
}
|
||||
|
||||
private void OnInventoryInit(EntityUid uid, HoleInventoryComponent component, ComponentInit args)
|
||||
{
|
||||
component.Slot = _container.EnsureContainer<ContainerSlot>(uid,HoleInventoryComponent.SlotName);
|
||||
}
|
||||
}
|
||||
45
Content.Server/_Amour/Hole/HoleSystem.Solution.cs
Normal file
45
Content.Server/_Amour/Hole/HoleSystem.Solution.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using Content.Server.Chemistry.Containers.EntitySystems;
|
||||
using Content.Shared._Amour.Hole;
|
||||
|
||||
namespace Content.Server._Amour.Hole;
|
||||
|
||||
public sealed partial class HoleSystem
|
||||
{
|
||||
[Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
|
||||
|
||||
public void InitializeSolution()
|
||||
{
|
||||
SubscribeLocalEvent<HoleSolutionComponent,ComponentInit>(OnSolutionInit);
|
||||
SubscribeLocalEvent<HoleSolutionComponent,EntityUnpausedEvent>(OnUnpaused);
|
||||
}
|
||||
|
||||
private void OnSolutionInit(EntityUid uid, HoleSolutionComponent component, ComponentInit args)
|
||||
{
|
||||
component.NextGenerationTime = _gameTiming.CurTime;
|
||||
component.Solution = _solutionContainer.EnsureSolution(uid, HoleSolutionComponent.SlotName);
|
||||
component.Solution.MaxVolume = component.SubstanceHoldCount;
|
||||
}
|
||||
|
||||
private void OnUnpaused(EntityUid uid, HoleSolutionComponent component, EntityUnpausedEvent args)
|
||||
{
|
||||
component.NextGenerationTime += args.PausedTime;
|
||||
}
|
||||
|
||||
private void UpdateSolution(float frameTime)
|
||||
{
|
||||
return;
|
||||
var query = EntityQueryEnumerator<HoleSolutionComponent>();
|
||||
while (query.MoveNext(out var uid, out var component))
|
||||
{
|
||||
if(_gameTiming.CurTime < component.NextGenerationTime)
|
||||
continue;
|
||||
|
||||
component.NextGenerationTime = _gameTiming.CurTime;
|
||||
|
||||
if(component.Solution.Volume >= component.SubstanceHoldCount)
|
||||
continue;
|
||||
|
||||
component.Solution.AddReagent(component.SubstanceName,component.SubstanceGenerationCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
29
Content.Server/_Amour/Hole/HoleSystem.cs
Normal file
29
Content.Server/_Amour/Hole/HoleSystem.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Content.Server.Chemistry.Containers.EntitySystems;
|
||||
using Content.Shared._Amour.Hole;
|
||||
using Robust.Server.Containers;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Server._Amour.Hole;
|
||||
|
||||
public sealed partial class HoleSystem : SharedHoleSystem
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
InitializeContainer();
|
||||
InitializeInventory();
|
||||
SubscribeLocalEvent<HoleComponent,EntGotInsertedIntoContainerMessage>(OnInsert);
|
||||
}
|
||||
|
||||
private void OnInsert(EntityUid uid, HoleComponent component, EntGotInsertedIntoContainerMessage args)
|
||||
{
|
||||
component.Parent = GetNetEntity(args.Container.Owner);
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
UpdateSolution(frameTime);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user