- add: interaction part 2

This commit is contained in:
2024-02-23 18:52:03 +03:00
parent 28c8b45eec
commit 2ec981e9e6
22 changed files with 608 additions and 79 deletions

View File

@@ -0,0 +1,18 @@
using Content.Shared.Interaction;
namespace Content.Shared._Amour.InteractionPanel.Checks;
public sealed class HasSmallDistance : IInteractionCheck
{
[DataField] private readonly float _range = SharedInteractionSystem.InteractionRange;
public bool IsAvailable(Entity<InteractionPanelComponent> user, Entity<InteractionPanelComponent> target, IEntityManager entityManager)
{
var transformSystem = entityManager.System<SharedTransformSystem>();
if (_range <= 0)
return true;
var distance = (transformSystem.GetWorldPosition(user) - transformSystem.GetWorldPosition(target)).Length();
return distance <= _range;
}
}

View File

@@ -0,0 +1,83 @@
using Content.Shared._Amour.Hole;
namespace Content.Shared._Amour.InteractionPanel.Checks;
public sealed class UserHasButt : IInteractionCheck
{
public bool IsAvailable(Entity<InteractionPanelComponent> user, Entity<InteractionPanelComponent> target, IEntityManager entityManager)
{
return entityManager.System<SharedHoleSystem>().TryFind(user.Owner, "Anus", out _);
}
}
public sealed class TargetHasButt : IInteractionCheck
{
public bool IsAvailable(Entity<InteractionPanelComponent> user, Entity<InteractionPanelComponent> target, IEntityManager entityManager)
{
return entityManager.System<SharedHoleSystem>().TryFind(target.Owner, "Anus", out _);
}
}
public sealed class UserHasPenis : IInteractionCheck
{
public bool IsAvailable(Entity<InteractionPanelComponent> user, Entity<InteractionPanelComponent> target, IEntityManager entityManager)
{
return entityManager.System<SharedHoleSystem>().TryFind(user.Owner, "Dick", out _);
}
}
public sealed class TargetHasPenis : IInteractionCheck
{
public bool IsAvailable(Entity<InteractionPanelComponent> user, Entity<InteractionPanelComponent> target, IEntityManager entityManager)
{
return entityManager.System<SharedHoleSystem>().TryFind(target.Owner, "Dick", out _);
}
}
public sealed class UserHasVagina : IInteractionCheck
{
public bool IsAvailable(Entity<InteractionPanelComponent> user, Entity<InteractionPanelComponent> target, IEntityManager entityManager)
{
return entityManager.System<SharedHoleSystem>().TryFind(user.Owner, "Vagina", out _);
}
}
public sealed class TargetHasVagina : IInteractionCheck
{
public bool IsAvailable(Entity<InteractionPanelComponent> user, Entity<InteractionPanelComponent> target, IEntityManager entityManager)
{
return entityManager.System<SharedHoleSystem>().TryFind(target.Owner, "Vagina", out _);
}
}
public sealed class UserHasTesticles : IInteractionCheck
{
public bool IsAvailable(Entity<InteractionPanelComponent> user, Entity<InteractionPanelComponent> target, IEntityManager entityManager)
{
return entityManager.System<SharedHoleSystem>().TryFind(user.Owner, "Testicles", out _);
}
}
public sealed class TargetHasTesticles : IInteractionCheck
{
public bool IsAvailable(Entity<InteractionPanelComponent> user, Entity<InteractionPanelComponent> target, IEntityManager entityManager)
{
return entityManager.System<SharedHoleSystem>().TryFind(target.Owner, "Testicles", out _);
}
}
public sealed class UserHasBreast : IInteractionCheck
{
public bool IsAvailable(Entity<InteractionPanelComponent> user, Entity<InteractionPanelComponent> target, IEntityManager entityManager)
{
return entityManager.System<SharedHoleSystem>().TryFind(user.Owner, "Breast", out _);
}
}
public sealed class TargetHasBreast : IInteractionCheck
{
public bool IsAvailable(Entity<InteractionPanelComponent> user, Entity<InteractionPanelComponent> target, IEntityManager entityManager)
{
return entityManager.System<SharedHoleSystem>().TryFind(target.Owner, "Breast", out _);
}
}

View File

@@ -0,0 +1,17 @@
namespace Content.Shared._Amour.InteractionPanel.Checks;
public sealed class InteractSelf : IInteractionCheck
{
public bool IsAvailable(Entity<InteractionPanelComponent> user, Entity<InteractionPanelComponent> target, IEntityManager entityManager)
{
return user == target;
}
}
public sealed class CantInteractSelf: IInteractionCheck
{
public bool IsAvailable(Entity<InteractionPanelComponent> user, Entity<InteractionPanelComponent> target, IEntityManager entityManager)
{
return user != target;
}
}

View File

@@ -0,0 +1,18 @@
using Content.Shared._Amour.Hole;
namespace Content.Shared._Amour.InteractionPanel;
public interface IInteractionCheck
{
public bool IsAvailable(Entity<InteractionPanelComponent> user,
Entity<InteractionPanelComponent> target,IEntityManager entityManager);
}
public sealed class BasicCheck : IInteractionCheck
{
public bool IsAvailable(Entity<InteractionPanelComponent> user, Entity<InteractionPanelComponent> target, IEntityManager entityManager)
{
Logger.Debug("MEWO!!");
return true;
}
}

View File

@@ -0,0 +1,18 @@
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
namespace Content.Shared._Amour.InteractionPanel;
[RegisterComponent]
public sealed partial class InteractionPanelComponent : Component
{
[ViewVariables] public bool IsActive = false;
[ViewVariables] public bool IsBlocked = false;
[ViewVariables] public ProtoId<InteractionPrototype> CurrentAction;
[ViewVariables] public TimeSpan Timeout;
[ViewVariables] public Entity<InteractionPanelComponent>? CurrentPartner;
[DataField] public List<ProtoId<InteractionPrototype>> ActionPrototypes = new();
}

View File

@@ -0,0 +1,33 @@
using Content.Shared.Actions;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
namespace Content.Shared._Amour.InteractionPanel;
public abstract class InteractionBaseEvent : HandledEntityEventArgs
{
public ProtoId<InteractionPrototype> Id;
public Entity<InteractionPanelComponent> Performer;
public Entity<InteractionPanelComponent> Target;
protected InteractionBaseEvent(ProtoId<InteractionPrototype> id, Entity<InteractionPanelComponent> performer, Entity<InteractionPanelComponent> target)
{
Id = id;
Performer = performer;
Target = target;
}
}
public sealed class InteractionBeginningEvent : InteractionBaseEvent
{
public InteractionBeginningEvent(ProtoId<InteractionPrototype> id, Entity<InteractionPanelComponent> performer, Entity<InteractionPanelComponent> target) : base(id, performer, target)
{
}
}
public sealed class InteractionEndingEvent : InteractionBaseEvent
{
public InteractionEndingEvent(ProtoId<InteractionPrototype> id, Entity<InteractionPanelComponent> performer, Entity<InteractionPanelComponent> target) : base(id, performer, target)
{
}
}

View File

@@ -0,0 +1,35 @@
using Content.Shared.Eui;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
namespace Content.Shared._Amour.InteractionPanel;
[Serializable,NetSerializable]
public sealed class InteractionSelectedMessage : EuiMessageBase
{
public string Id;
public InteractionSelectedMessage(string id)
{
Id = id;
}
}
[Serializable,NetSerializable]
public sealed class InteractionState: EuiStateBase
{
public NetEntity Performer { get; }
public NetEntity Target { get; }
public HashSet<string> AvailableInteractions;
public byte? Arousal;
public InteractionState(NetEntity performer, NetEntity target, HashSet<string> availableInteractions, byte? arousal)
{
Performer = performer;
Target = target;
AvailableInteractions = availableInteractions;
Arousal = arousal;
}
}

View File

@@ -0,0 +1,11 @@
using Content.Shared.Actions;
namespace Content.Shared._Amour.InteractionPanel;
public sealed class InteractionPanelSystem : EntitySystem
{
public override void Initialize()
{
}
}

View File

@@ -0,0 +1,23 @@
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
namespace Content.Shared._Amour.InteractionPanel;
[Prototype("interaction")]
public sealed partial class InteractionPrototype : IPrototype
{
[IdDataField] public string ID { get; private set; } = default!;
[ViewVariables] public PrototypeLayerData? Icon;
[ViewVariables] public SoundSpecifier? BeginningSound;
[ViewVariables] public SoundSpecifier? EndingSound;
[DataField] public List<string> BeginningMessages = new();
[DataField] public List<string> EndingMessages = new();
[DataField] public List<IInteractionCheck> Checks = new();
[DataField] public TimeSpan Timeout = TimeSpan.Zero;
}