Files

43 lines
1.3 KiB
C#
Raw Permalink Normal View History

2024-02-20 14:28:01 +03:00
using Content.Shared._Amour.Arousal;
using Robust.Shared.Containers;
2024-02-18 13:23:05 +03:00
using Robust.Shared.GameStates;
2024-02-14 12:49:00 +03:00
namespace Content.Shared._Amour.Hole;
2024-02-14 23:27:46 +03:00
public abstract partial class SharedHoleSystem : EntitySystem
2024-02-14 12:49:00 +03:00
{
2024-02-14 23:27:46 +03:00
public override void Initialize()
{
InitializeContainer();
SubscribeLocalEvent<HoleComponent,EntGotInsertedIntoContainerMessage>(OnInsert);
SubscribeLocalEvent<HoleComponent,EntGotRemovedFromContainerMessage>(OnRemoved);
}
2024-02-14 12:49:00 +03:00
2024-02-14 23:27:46 +03:00
private void OnRemoved(EntityUid uid, HoleComponent component, EntGotRemovedFromContainerMessage args)
{
component.Parent = null;
}
private void OnInsert(EntityUid uid, HoleComponent component, EntGotInsertedIntoContainerMessage args)
{
component.Parent = GetNetEntity(args.Container.Owner);
}
2024-02-17 19:03:07 +03:00
public virtual void Exide(Entity<HoleComponent?> entity, bool value = true)
{
2024-02-20 14:28:01 +03:00
if(!Resolve(entity.Owner,ref entity.Comp))
return;
2024-02-17 19:03:07 +03:00
entity.Comp.IsExcited = value;
2024-02-18 13:23:05 +03:00
Dirty(entity);
}
public void ExideEntity(Entity<HoleContainerComponent?> entity, bool value = true)
{
if (Resolve(entity,ref entity.Comp) && entity.Comp.MainHole != null)
{
Exide(GetEntity(entity.Comp.MainHole.Value), value);
}
2024-02-17 19:03:07 +03:00
}
2024-02-14 12:49:00 +03:00
}