- add: genitals

This commit is contained in:
2024-02-14 12:49:00 +03:00
parent 7f54d0ddea
commit 40d813de44
678 changed files with 3782 additions and 0 deletions

View 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);
}
}
}

View 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);
}
}

View 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);
}
}
}

View 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);
}
}