Skip to content

Commit

Permalink
Character-Specific Consent Details
Browse files Browse the repository at this point in the history
  • Loading branch information
Memeji committed Sep 3, 2024
1 parent 9dc111b commit 54b919d
Show file tree
Hide file tree
Showing 24 changed files with 88 additions and 11 deletions.
5 changes: 0 additions & 5 deletions Content.Client/CharConsent/ConsentText.xaml

This file was deleted.

12 changes: 12 additions & 0 deletions Content.Client/Floof/CharConsent/UI/Windows/ConsentText.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<controls:FancyWindow
xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
MinSize="620 670"
Title="CConsentText"
Resizable="False">
<BoxContainer Orientation="Vertical" HorizontalExpand="True">
<TextEdit Name="CConsentTextInput" Access="Public" MinSize="220 100" Margin="10" HorizontalExpand="True" VerticalExpand="True" />
</BoxContainer>
</controls:FancyWindow>
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using Content.Client.UserInterface.Controls;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Utility;

namespace Content.Client.CharConsent
namespace Content.Client.Floof.CharConsent.UI.Windows
{
[GenerateTypedNameReferences]
public sealed partial class ConsentText : Control
public sealed partial class ConsentText : FancyWindow
{
public Action<string>? OnConsentTextChanged;

Expand All @@ -16,7 +16,7 @@ public ConsentText()
IoCManager.InjectDependencies(this);

var loc = IoCManager.Resolve<ILocalizationManager>();
CConsentTextInput.Placeholder = new Rope.Leaf(loc.GetString("flavor-text-placeholder"));
CConsentTextInput.Placeholder = new Rope.Leaf(loc.GetString("consent-text-placeholder"));
CConsentTextInput.OnKeyBindDown += _ => ConsentTextChanged();
}

Expand Down
4 changes: 2 additions & 2 deletions Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Content.Client.Message;
using Content.Client.Players.PlayTimeTracking;
using Content.Client.Roles;
using Content.Client.CharConsent; // Floof - Per-Character Consent
using Content.Client.Floof.CharConsent.UI.Windows; // Floof - Per-Character Consent
using Content.Client.UserInterface.Systems.Guidebook;
using Content.Shared.CCVar;
using Content.Shared.Clothing.Loadouts.Prototypes;
Expand Down Expand Up @@ -570,7 +570,7 @@ public HumanoidProfileEditor(IClientPreferencesManager preferencesManager, IProt

var consentText = new ConsentText();
_tabContainer.AddChild(consentText);
_tabContainer.SetTabTitle(_tabContainer.ChildCount - 1, Loc.GetString("humanoid-profile-editor-flavortext-tab"));
_tabContainer.SetTabTitle(_tabContainer.ChildCount - 1, Loc.GetString("humanoid-profile-editor-consenttext-tab"));
_consentTextEdit = consentText.CConsentTextInput;

consentText.OnConsentTextChanged += OnConsentTextChange;
Expand Down
10 changes: 10 additions & 0 deletions Content.Server/Floof/CharConsent/CharConsentComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Content.Server.Floof
{
[RegisterComponent]
public sealed partial class CharConsentComponent : Component
{
[DataField("consent", required: true)]
[ViewVariables(VVAccess.ReadWrite)]
public string Consent = "";
}
}
44 changes: 44 additions & 0 deletions Content.Server/Floof/CharConsent/CharConsentSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using Content.Shared.Examine;
using Content.Shared.IdentityManagement;
using Content.Shared.Verbs;
using Robust.Shared.Utility;

namespace Content.Server.Floof.CharConsent
{
public sealed class CharConsentSystem : EntitySystem
{
[Dependency] private readonly ExamineSystemShared _examineSystem = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<CharConsentComponent, GetVerbsEvent<ExamineVerb>>(OnGetExamineVerbs);
}

private void OnGetExamineVerbs(EntityUid uid, CharConsentComponent component, GetVerbsEvent<ExamineVerb> args)
{
if (Identity.Name(args.Target, EntityManager) != MetaData(args.Target).EntityName)
return;

var detailsRange = _examineSystem.IsInDetailsRange(args.User, uid);

var verb = new ExamineVerb()
{
Act = () =>
{
var markup = new FormattedMessage();
markup.AddMarkup(component.Consent);
_examineSystem.SendExamineTooltip(args.User, uid, markup, false, false);
},
Text = Loc.GetString("consent-examinable-verb-text"),
Category = VerbCategory.Examine,
Disabled = !detailsRange,
Message = detailsRange ? null : Loc.GetString("consent-examinable-verb-disabled"),
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/vv.svg.192dpi.png"))
};

args.Verbs.Add(verb);
}
}
}
10 changes: 10 additions & 0 deletions Content.Server/Station/Systems/StationSpawningSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Utility;
using Content.Server.Floof;

namespace Content.Server.Station.Systems;

Expand Down Expand Up @@ -187,6 +188,15 @@ public EntityUid SpawnPlayerMob(
{
AddComp<DetailExaminableComponent>(entity.Value).Content = profile.FlavorText;
}

if (profile.ConsentText != "") // Floof - Per-Character Consent Menu
{
AddComp<CharConsentComponent>(entity.Value).Consent = profile.ConsentText;
}
else
{
AddComp<CharConsentComponent>(entity.Value).Consent = Loc.GetString("consent-text-not-set");
}
}

DoJobSpecials(job, entity.Value);
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions Resources/Locale/en-US/Floof/CharConsent/consent.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
consent-text-placeholder = Set your character-specific consent information here.
consent-text-not-set = This character has no specific consent infromation. Please ask the player before engaging in anything related to ERP.
humanoid-profile-editor-consenttext-tab = Consent
consent-examinable-verb-text = Character Consent Info
consent-examinable-verb-disabled = View this character's consent information.

0 comments on commit 54b919d

Please sign in to comment.