Очень важный момент для курток

This commit is contained in:
BIGZi0348
2024-11-24 18:58:00 +03:00
parent 30180b2e2a
commit 8339fd5672
8 changed files with 91 additions and 36 deletions

View File

@@ -4,6 +4,7 @@ using Robust.Client.GameObjects;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
using Robust.Shared.Reflection;
using Content.Shared.Foldable;
namespace Content.Client._Amour.Hole;
@@ -13,15 +14,27 @@ public sealed class HoleSystem : SharedHoleSystem
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<HoleContainerComponent,EntInsertedIntoContainerMessage>(OnInsert);
SubscribeLocalEvent<HoleContainerComponent,EntRemovedFromContainerMessage>(OnRemoved);
SubscribeLocalEvent<HoleContainerComponent, EntInsertedIntoContainerMessage>(OnInsert);
SubscribeLocalEvent<HoleContainerComponent, EntRemovedFromContainerMessage>(OnRemoved);
SubscribeLocalEvent<HoleComponent,ComponentHandleState>(OnHandleState);
SubscribeLocalEvent<HoleComponent, ComponentHandleState>(OnHandleState);
SubscribeLocalEvent<HoleBlockerComponent, FoldedEvent>(OnFolded);
}
private void OnHandleState(EntityUid uid, HoleComponent component,ref ComponentHandleState args)
private void OnFolded(Entity<HoleBlockerComponent> ent, ref FoldedEvent args)
{
if(args.Current is not HoleComponentState componentState)
if (ent.Comp.Equipee == NetEntity.Invalid)
return;
var equipee = GetEntity(ent.Comp.Equipee);
if (!HasComp<HoleContainerComponent>(equipee))
return;
UpdateVisuals(equipee);
}
private void OnHandleState(EntityUid uid, HoleComponent component, ref ComponentHandleState args)
{
if (args.Current is not HoleComponentState componentState)
return;
component.IsExcited = componentState.IsExcited;
@@ -29,25 +42,25 @@ public sealed class HoleSystem : SharedHoleSystem
if (component.Parent is not null)
{
UpdateVisual(GetEntity(component.Parent.Value),uid,!HasAccessTo(GetEntity(component.Parent.Value),uid));
UpdateVisual(GetEntity(component.Parent.Value), uid, !HasAccessTo(GetEntity(component.Parent.Value), uid));
}
}
private void OnRemoved(EntityUid uid, HoleContainerComponent component, EntRemovedFromContainerMessage args)
{
if(!HasComp<HumanoidAppearanceComponent>(uid))
if (!HasComp<HumanoidAppearanceComponent>(uid))
return;
UpdateVisuals(uid);
if(args.Container != component.Slot)
if (args.Container != component.Slot)
return;
UpdateVisual(uid,args.Entity,true);
UpdateVisual(uid, args.Entity, true);
}
private void OnInsert(EntityUid uid, HoleContainerComponent component, EntInsertedIntoContainerMessage args)
{
if(!HasComp<HumanoidAppearanceComponent>(uid))
if (!HasComp<HumanoidAppearanceComponent>(uid))
return;
UpdateVisuals(uid);
@@ -55,18 +68,18 @@ public sealed class HoleSystem : SharedHoleSystem
private void UpdateVisuals(Entity<HoleContainerComponent?> entity)
{
if(!Resolve(entity,ref entity.Comp) || entity.Comp.Slot == null)
if (!Resolve(entity, ref entity.Comp) || entity.Comp.Slot == null)
return;
foreach (var hole in entity.Comp.Slot.ContainedEntities)
{
UpdateVisual(entity.Owner,hole,!HasAccessTo(entity,hole));
UpdateVisual(entity.Owner, hole, !HasAccessTo(entity, hole));
}
}
private void UpdateVisual(Entity<SpriteComponent?,HumanoidAppearanceComponent?,HoleContainerComponent?> owner, Entity<HoleComponent?> entity, bool clear = false)
private void UpdateVisual(Entity<SpriteComponent?, HumanoidAppearanceComponent?, HoleContainerComponent?> owner, Entity<HoleComponent?> entity, bool clear = false)
{
if(!Resolve(owner.Owner,ref owner.Comp1, ref owner.Comp3) || !Resolve(entity.Owner,ref entity.Comp))
if (!Resolve(owner.Owner, ref owner.Comp1, ref owner.Comp3) || !Resolve(entity.Owner, ref entity.Comp))
return;
var spriteComp = owner.Comp1;
@@ -87,11 +100,11 @@ public sealed class HoleSystem : SharedHoleSystem
if (holeComp.Prefixes.Count == 0)
{
if (clear)
spriteComp.LayerSetVisible(GenitalVisualLayers.DickFront,false);
spriteComp.LayerSetVisible(GenitalVisualLayers.DickFront, false);
else
{
spriteComp.LayerSetData(GenitalVisualLayers.DickFront, layer);
spriteComp.LayerSetVisible(GenitalVisualLayers.DickFront,true);
spriteComp.LayerSetVisible(GenitalVisualLayers.DickFront, true);
}
return;
}
@@ -106,7 +119,7 @@ public sealed class HoleSystem : SharedHoleSystem
if (clear)
{
spriteComp.LayerSetVisible(@enum,false);
spriteComp.LayerSetVisible(@enum, false);
}
else
{
@@ -120,7 +133,7 @@ public sealed class HoleSystem : SharedHoleSystem
layer.State = state + s + mainPrefix;
spriteComp.LayerSetData(@enum, layer);
spriteComp.LayerSetVisible(@enum,true);
spriteComp.LayerSetVisible(@enum, true);
layer.State = state;
}
@@ -130,7 +143,7 @@ public sealed class HoleSystem : SharedHoleSystem
public override void Exide(Entity<HoleComponent?> entity, bool value = true)
{
if(!Resolve(entity.Owner,ref entity.Comp)) return;
if (!Resolve(entity.Owner, ref entity.Comp)) return;
base.Exide(entity, value);
var netEntity = entity.Comp.Parent;
if (netEntity != null)