Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lemirda memes code #131

Merged
merged 3 commits into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions Content.Server/Andromeda/Signature/SignatureSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
using Content.Server.Access.Systems;
using Content.Server.Paper;
using Content.Server.Popups;
using Content.Shared.Paper;
using Content.Shared.Popups;
using Content.Shared.Tag;
using Content.Shared.Verbs;
using Robust.Server.Audio;
using Robust.Shared.Player;

namespace Content.Server.DeltaV.Paper;

public sealed class SignatureSystem : EntitySystem
{
[Dependency] private readonly AudioSystem _audio = default!;
[Dependency] private readonly IdCardSystem _idCard = default!;
[Dependency] private readonly PaperSystem _paper = default!;
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly TagSystem _tagSystem = default!;
private const string SignatureStampState = "paper_stamp-signature";

public override void Initialize()
{
SubscribeLocalEvent<PaperComponent, GetVerbsEvent<AlternativeVerb>>(OnGetAltVerbs);
}

private void OnGetAltVerbs(EntityUid uid, PaperComponent component, GetVerbsEvent<AlternativeVerb> args)
{
if (!args.CanAccess || !args.CanInteract)
return;

var pen = args.Using;
if (pen == null || !_tagSystem.HasTag(pen.Value, "Write"))
return;

AlternativeVerb verb = new()
{
Act = () =>
{
TrySignPaper((uid, component), args.User);
},
Text = Loc.GetString("paper-sign-verb"),
DoContactInteraction = true,
Priority = 10
};
args.Verbs.Add(verb);
}

public bool TrySignPaper(Entity<PaperComponent?> paper, EntityUid signer)
{
var paperComp = paper.Comp;
if (!Resolve(paper, ref paperComp))
return false;

var signatureName = DetermineEntitySignature(signer);

var stampInfo = new StampDisplayInfo()
{
StampedName = signatureName,
StampedColor = Color.DarkSlateGray,
};

if (!paperComp.StampedBy.Contains(stampInfo) && _paper.TryStamp(paper, stampInfo, SignatureStampState, paperComp))
{
var signedSelfMessage = Loc.GetString("paper-signed-self", ("target", paper));
_popup.PopupEntity(signedSelfMessage, signer, signer);

_audio.PlayPvs(paperComp.Sound, signer);

_paper.UpdateUserInterface(paper, paperComp);

return true;
}
else
{
_popup.PopupEntity(Loc.GetString("paper-signed-failure", ("target", paper)), signer, signer, PopupType.SmallCaution);
return false;
}
}

private string DetermineEntitySignature(EntityUid uid)
{
if (_idCard.TryFindIdCard(uid, out var id) && !string.IsNullOrWhiteSpace(id.Comp.FullName))
{
return id.Comp.FullName;
}

return Name(uid);
}
}
11 changes: 4 additions & 7 deletions Content.Server/GameTicking/GameTicker.Spawning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Utility;
using Content.Server.Database; //A-13 Eblan system update start
using Robust.Shared.Audio; //A-13 Eblan system update start
using Robust.Shared.Audio.Systems; //A-13 Eblan system update start
using Content.Shared.CombatMode.Pacification; //A-13 Eblan system update start
using Content.Shared.Players.PlayTimeTracking; //A-13 Eblan system update start
using System.Threading.Tasks; //A-13 Eblan system update start
using Content.Shared.CombatMode.Pacification; //A-13 Eblan system update
using Content.Shared.Players.PlayTimeTracking; //A-13 Eblan system update
using System.Threading.Tasks; //A-13 Eblan system update

namespace Content.Server.GameTicking
{
Expand Down Expand Up @@ -68,7 +65,7 @@ private async Task CheckPlayTimeAndAddEblanComponent(ICommonSession session, Ent
var playTime = await _db.GetPlayTimes(session.UserId);
var overallTime = playTime.Find(p => p.Tracker == PlayTimeTrackingShared.TrackerOverall)?.TimeSpent;

if (overallTime.HasValue && overallTime.Value.TotalHours < minPlayTimeHours)
if (!overallTime.HasValue || overallTime.Value.TotalHours < minPlayTimeHours)
{
if (!EntityManager.HasComponent<EblanComponent>(mob))
{
Expand Down
3 changes: 3 additions & 0 deletions Resources/Locale/ru-RU/Andromeda/papers/signature.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
paper-sign-verb = Расписаться
paper-signed-self = Вы расписались.
paper-signed-failure = Вы не можете расписаться.
1 change: 0 additions & 1 deletion Resources/Prototypes/Entities/Mobs/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
- type: MovementSpeedModifier
- type: Polymorphable
- type: StatusIcon
- type: Fatigue #A-13 Fatigue
- type: TTS # Corvax-TTS

# Used for mobs that have health and can take damage.
Expand Down
3 changes: 3 additions & 0 deletions Resources/Textures/Objects/Misc/bureaucracy.rsi/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@
},
{
"name": "paper_stamp-psychologist"
},
{
"name": "paper_stamp-signature"
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading