- add: improve system

This commit is contained in:
2024-02-14 23:27:46 +03:00
parent 40d813de44
commit c9396e7b5a
13 changed files with 322 additions and 74 deletions

View File

@@ -2,49 +2,109 @@
using Content.Shared.Humanoid;
using Robust.Client.GameObjects;
using Robust.Shared.Containers;
using Robust.Shared.Reflection;
using Robust.Shared.Serialization.Manager;
namespace Content.Client._Amour.Hole;
public sealed class HoleSystem : SharedHoleSystem
{
[Dependency] private readonly IReflectionManager _reflection = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<HoleContainerComponent,EntInsertedIntoContainerMessage>(OnInsert);
SubscribeLocalEvent<HoleContainerComponent,EntRemovedFromContainerMessage>(OnRemoved);
}
private void OnRemoved(EntityUid uid, HoleContainerComponent component, EntRemovedFromContainerMessage args)
{
Log.Debug("A VSE");
if(!HasComp<HumanoidAppearanceComponent>(uid))
return;
UpdateVisuals(uid);
if(args.Container != component.Slot)
return;
UpdateVisual(uid,args.Entity,true);
}
private void OnInsert(EntityUid uid, HoleContainerComponent component, EntInsertedIntoContainerMessage args)
{
if(!TryComp<SpriteComponent>(uid, out var sprite) || !TryComp<HoleComponent>(args.Entity,out var hole))
if(!HasComp<HumanoidAppearanceComponent>(uid))
return;
Log.Debug("DRAW PISYA");
DrawShit(uid,args.Entity);
UpdateVisuals(uid);
if(args.Container != component.Slot)
return;
//UpdateVisual(uid,args.Entity);
}
private void DrawShit(Entity<SpriteComponent?,HumanoidAppearanceComponent?> owner, Entity<HoleComponent?> entity)
private void UpdateVisuals(Entity<HoleContainerComponent?> entity)
{
if(!Resolve(owner.Owner,ref owner.Comp1, ref owner.Comp2) || !Resolve(entity.Owner,ref entity.Comp))
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));
}
}
private void UpdateVisual(Entity<SpriteComponent?,HumanoidAppearanceComponent?> owner, Entity<HoleComponent?> entity, bool clear = false)
{
if(!Resolve(owner.Owner,ref owner.Comp1) || !Resolve(entity.Owner,ref entity.Comp))
return;
var spriteComp = owner.Comp1;
var holeComp = entity.Comp;
foreach (var layer in holeComp.BehindLayer)
foreach (var layer in holeComp.Layers)
{
var l = spriteComp.AddLayer(layer, 0);
spriteComp[l].Color = layer.Color ?? owner.Comp2.SkinColor;
}
if (string.IsNullOrEmpty(layer.RsiPath))
layer.RsiPath = holeComp.RsiPath;
foreach (var layer in holeComp.FrontLayer)
{
var l = spriteComp.AddLayer(layer);
spriteComp[l].Color = layer.Color ?? owner.Comp2.SkinColor;
if(Resolve(owner.Owner,ref owner.Comp2))
layer.Color ??= owner.Comp2.SkinColor;
var state = layer.State;
if (holeComp.Prefixes.Count == 0)
{
if (clear)
spriteComp.LayerSetVisible(GenitalVisualLayers.DickFront,false);
else
{
spriteComp.LayerSetData(GenitalVisualLayers.DickFront, layer);
spriteComp.LayerSetVisible(GenitalVisualLayers.DickFront,true);
}
return;
}
foreach (var prefix in holeComp.Prefixes)
{
if (!_reflection.TryParseEnumReference(prefix.Layer, out var @enum))
{
Log.Error("FUCK! ERROR WITH " + prefix.Layer);
continue;
}
layer.State = state + prefix.Prefix;
if (clear)
{
spriteComp.LayerSetVisible(@enum,false);
}
else
{
Log.Debug(@enum.ToString());
spriteComp.LayerSetData(@enum, layer);
spriteComp.LayerSetVisible(@enum,true);
}
layer.State = state;
}
}
}
}

View File

@@ -1,24 +0,0 @@
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

@@ -7,7 +7,8 @@ namespace Content.Server._Amour.Hole;
public sealed partial class HoleSystem
{
[Dependency] private readonly ContainerSystem _container = default!;
public void InitializeInventory()
private void InitializeInventory()
{
SubscribeLocalEvent<HoleInventoryComponent,ComponentInit>(OnInventoryInit);
}

View File

@@ -12,14 +12,8 @@ public sealed partial class HoleSystem : SharedHoleSystem
public override void Initialize()
{
InitializeContainer();
base.Initialize();
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)

View File

@@ -0,0 +1,16 @@
namespace Content.Shared._Amour.Hole;
public enum GenitalVisualLayers : byte
{
ButtBehind,
BreastBehind,
VaginaBehind,
TesticlesBehind,
DickBehind,
ButtFront,
BreastFront,
VaginaFront,
TesticlesFront,
DickFront,
}

View File

@@ -11,14 +11,28 @@ namespace Content.Shared._Amour.Hole;
[RegisterComponent]
public sealed partial class HoleComponent : Component
{
[ViewVariables] public NetEntity Parent;
[ViewVariables] public NetEntity? Parent;
[DataField] public string HoleName = "";
[DataField] public List<string> HoleNotVisibleIn = new();
// Father can be in mother, its like in audiofil shit
[DataField] public HoleType HoleType = HoleType.Flat;
[DataField("sprite")] public string? RsiPath;
[DataField] public List<PrototypeLayerData> FrontLayer = new();
[DataField] public List<PrototypeLayerData> BehindLayer = new();
[DataField] public List<PrototypeLayerData> Layers = new();
// this shit just for sprite prefix like state: dildo_FRONT
[DataField] public List<HolePrefix> Prefixes = new();
}
[Serializable, NetSerializable, DataDefinition]
public sealed partial class HolePrefix
{
[DataField]
public string Layer;
[DataField]
public string Prefix;
}
public enum HoleType : byte

View File

@@ -1,4 +1,5 @@
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
namespace Content.Shared._Amour.Hole;

View File

@@ -0,0 +1,51 @@
using Content.Shared.Inventory;
namespace Content.Shared._Amour.Hole;
public partial class SharedHoleSystem
{
[Dependency] private readonly InventorySystem _inventory = default!;
public bool HasAccessTo(Entity<HoleContainerComponent?,InventoryComponent?> entity, string to)
{
if (!Resolve(entity.Owner, ref entity.Comp1) || !TryFind(entity,to,out var hole))
return false;
return HasAccessTo(entity, new Entity<HoleComponent?>(hole.Owner,hole.Comp));
}
public bool HasAccessTo(Entity<HoleContainerComponent?,InventoryComponent?> entity, Entity<HoleComponent?> hole)
{
if (!Resolve(entity, ref entity.Comp1) || !Resolve(hole,ref hole.Comp))
return false;
if (!Resolve(entity, ref entity.Comp2))
return true;
foreach (var slot in hole.Comp.HoleNotVisibleIn)
{
if (_inventory.TryGetSlotEntity(entity, slot, out _, entity))
return false;
}
return true;
}
public bool TryFind(Entity<HoleContainerComponent?> entity,string to, out Entity<HoleComponent> hole)
{
hole = new Entity<HoleComponent>();
if (!Resolve(entity.Owner, ref entity.Comp))
return false;
foreach (var holeUid in entity.Comp.Slot.ContainedEntities)
{
if (!TryComp<HoleComponent>(holeUid, out var holeComponent) || holeComponent.HoleName != to)
continue;
hole.Owner = holeUid;
hole.Comp = holeComponent;
return true;
}
return false;
}
}

View File

@@ -0,0 +1,32 @@
using Robust.Shared.Containers;
using Robust.Shared.Prototypes;
namespace Content.Shared._Amour.Hole;
public abstract partial class SharedHoleSystem
{
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
public 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 protoId in component.HolePrototypes)
{
AddHole(new Entity<HoleContainerComponent?>(uid,component),protoId);
}
}
public void AddHole(Entity<HoleContainerComponent?> entity, EntProtoId protoId)
{
if (!Resolve(entity.Owner, ref entity.Comp))
return;
//entity.Comp = EnsureComp<HoleContainerComponent>(entity.Owner);
Log.Debug("ADDED " + protoId);
_containerSystem.Insert(Spawn(protoId), entity.Comp.Slot);
}
}

View File

@@ -1,9 +1,23 @@
using Robust.Shared.Containers;
using Robust.Shared.Timing;
namespace Content.Shared._Amour.Hole;
public abstract class SharedHoleSystem : EntitySystem
public abstract partial class SharedHoleSystem : EntitySystem
{
public override void Initialize()
{
InitializeContainer();
SubscribeLocalEvent<HoleComponent,EntGotInsertedIntoContainerMessage>(OnInsert);
SubscribeLocalEvent<HoleComponent,EntGotRemovedFromContainerMessage>(OnRemoved);
}
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);
}
}

View File

@@ -9,6 +9,13 @@
components:
- type: Sprite
layers:
# START AMOUR EDIT
- map: [ "enum.GenitalVisualLayers.ButtBehind"]
- map: [ "enum.GenitalVisualLayers.BreastBehind"]
- map: [ "enum.GenitalVisualLayers.VaginaBehind"]
- map: [ "enum.GenitalVisualLayers.TesticlesBehind"]
- map: [ "enum.GenitalVisualLayers.DickBehind"]
# END AMOUR EDIT
- map: [ "enum.HumanoidVisualLayers.Chest" ]
- map: [ "enum.HumanoidVisualLayers.Head" ]
- map: [ "enum.HumanoidVisualLayers.Snout" ]
@@ -35,6 +42,13 @@
- map: ["jumpsuit"]
- map: ["enum.HumanoidVisualLayers.LHand"]
- map: ["enum.HumanoidVisualLayers.RHand"]
# START AMOUR EDIT
- map: [ "enum.GenitalVisualLayers.ButtFront" ]
- map: [ "enum.GenitalVisualLayers.BreastFront" ]
- map: [ "enum.GenitalVisualLayers.VaginaFront" ]
- map: [ "enum.GenitalVisualLayers.TesticlesFront" ]
- map: [ "enum.GenitalVisualLayers.DickFront" ]
# END AMOUR EDIT
- map: [ "gloves" ]
- map: [ "shoes" ]
- map: [ "ears" ]

View File

@@ -43,11 +43,6 @@
- type: MovementSpeedModifier
- type: Polymorphable
- type: StatusIcon
- type: HoleContainer
holePrototypes:
- BaseDick
- BaseBreast
- BaseButt
# Used for mobs that have health and can take damage.
- type: entity

View File

@@ -1,15 +1,22 @@
- type: entity
id: BaseDick
abstract: true
name: Чилен
components:
- type: Hole
holeType: Father
frontLayer:
- state: penis_thick_4_1_FRONT
sprite: _Amour/Genitals/penis.rsi
behindLayer:
- state: penis_thick_4_1_BEHIND
sprite: _Amour/Genitals/penis.rsi
holeName: Dick
holeNotVisibleIn:
- suitstorage
- outerClothing
- jumpsuit
- underwearb
sprite: _Amour/Genitals/penis.rsi
prefixes:
- layer: "enum.GenitalVisualLayers.DickBehind"
prefix: "_BEHIND"
- layer: "enum.GenitalVisualLayers.DickFront"
prefix: "_FRONT"
- type: HoleSolution
- type: HoleInventory
size: Tiny
@@ -17,35 +24,63 @@
- type: entity
id: BaseVagina
abstract: true
name: Пизда
components:
- type: Hole
holeType: Mother
holeName: Vagina
holeNotVisibleIn:
- suitstorage
- outerClothing
- jumpsuit
- underwearb
sprite: _Amour/Genitals/butt.rsi
prefixes:
- layer: "enum.GenitalVisualLayers.VaginaBehind"
prefix: "_BEHIND"
- layer: "enum.GenitalVisualLayers.VaginaFront"
prefix: "_FRONT"
- type: HoleSolution
- type: HoleInventory
- type: entity
id: BaseButt
abstract: true
name: Очко
components:
- type: Hole
holeType: Mother
frontLayer:
- state: butt_pair_3_s_0_FRONT
sprite: _Amour/Genitals/butt.rsi
holeName: Anus
holeNotVisibleIn:
- suitstorage
- outerClothing
- jumpsuit
- underwearb
sprite: _Amour/Genitals/butt.rsi
prefixes:
- layer: "enum.GenitalVisualLayers.ButtFront"
prefix: "_FRONT"
- type: HoleInventory
- type: entity
id: BaseBreast
abstract: true
name: Сиськи
components:
- type: Hole
frontLayer:
- state: breasts_pair_i_s_0_FRONT
sprite: _Amour/Genitals/breasts.rsi
behindLayer:
- state: breasts_pair_i_s_0_BEHIND
sprite: _Amour/Genitals/breasts.rsi
holeName: Breast
holeNotVisibleIn:
- suitstorage
- outerClothing
- jumpsuit
- underweart
sprite: _Amour/Genitals/breasts.rsi
prefixes:
- layer: "enum.GenitalVisualLayers.BreastBehind"
prefix: "_BEHIND"
- layer: "enum.GenitalVisualLayers.BreastFront"
prefix: "_FRONT"
- type: HoleInventory
- type: entity
@@ -53,6 +88,51 @@
name: Яички
components:
- type: Hole
frontLayer:
- state: testicles_single_5_s_1_FRONT
sprite: _Amour/Genitals/testicles.rsi
holeName: Dick
holeNotVisibleIn:
- suitstorage
- outerClothing
- jumpsuit
- underwearb
sprite: _Amour/Genitals/testicles.rsi
prefixes:
- layer: "enum.GenitalVisualLayers.TesticlesBehind"
prefix: "_BEHIND"
- layer: "enum.GenitalVisualLayers.TesticlesFront"
prefix: "_FRONT"
- type: entity
parent: BaseDick
id: Dick
components:
- type: Hole
layers:
- state: penis_thick_4_1
- type: entity
parent: BaseButt
id: Butt
components:
- type: Hole
layers:
- state: butt_pair_3_s_0
- type: entity
parent: BaseBreast
id: Breast
components:
- type: Hole
layers:
- state: breasts_pair_huge_s_0
- type: entity
parent: BaseTesticles
id: Testicles
components:
- type: Hole
prefixes:
- layer: "enum.GenitalVisualLayers.TesticlesFront"
prefix: "_FRONT"
layers:
- state: testicles_sheath_5_s_0