Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dvir001 committed Sep 28, 2023
1 parent 68da93b commit 9b7c3f5
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions Content.Server/Paper/PaperSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,24 +110,31 @@ private void OnExamined(EntityUid uid, PaperComponent paperComp, ExaminedEvent a
private void OnInteractUsing(EntityUid uid, PaperComponent paperComp, InteractUsingEvent args)
{
// If a pen, attempt to use on paper
if (TryComp<PenComponent>(args.Used, out var penComp))
if (_tagSystem.HasTag(args.Used, "Write") && paperComp.StampedBy.Count == 0)
{
// If a pen in sign mod, dont try to write.
if (penComp.Pen != PenMode.PenSign)
bool write = true;

if (TryComp<PenComponent>(args.Used, out var penComp))
{
if (_tagSystem.HasTag(args.Used, "Write") && paperComp.StampedBy.Count == 0)
// If a pen in sign mod, dont try to write.
if (penComp.Pen == PenMode.PenSign)
{
var writeEvent = new PaperWriteEvent(uid, args.User);
RaiseLocalEvent(args.Used, ref writeEvent);
if (!TryComp<ActorComponent>(args.User, out var actor))
return;

paperComp.Mode = PaperAction.Write;
_uiSystem.TryOpen(uid, PaperUiKey.Key, actor.PlayerSession);
UpdateUserInterface(uid, paperComp, actor.PlayerSession);
return;
write = false;
}
}

if (write)
{
var writeEvent = new PaperWriteEvent(uid, args.User);
RaiseLocalEvent(args.Used, ref writeEvent);
if (!TryComp<ActorComponent>(args.User, out var actor))
return;

paperComp.Mode = PaperAction.Write;
_uiSystem.TryOpen(uid, PaperUiKey.Key, actor.PlayerSession);
UpdateUserInterface(uid, paperComp, actor.PlayerSession);
return;
}
}

// If a stamp, attempt to stamp paper
Expand Down

0 comments on commit 9b7c3f5

Please sign in to comment.