64 lines
2.4 KiB
C#
64 lines
2.4 KiB
C#
using Content.Server.Forensics;
|
|
using Content.Server.Objectives.Components;
|
|
using Content.Shared.Body.Components;
|
|
using Content.Shared.Chemistry.Components;
|
|
using Content.Shared.Chemistry.EntitySystems;
|
|
using Content.Shared._DV.Recruiter;
|
|
using Content.Shared.Popups;
|
|
using Content.Shared.Hands.EntitySystems;
|
|
|
|
namespace Content.Server._DV.Recruiter;
|
|
|
|
/// <summary>
|
|
/// Handles bloodstream related code since that isn't in shared.
|
|
/// </summary>
|
|
public sealed class RecruiterPenSystem : SharedRecruiterPenSystem
|
|
{
|
|
[Dependency] private readonly ForensicsSystem _forensics = default!;
|
|
[Dependency] private readonly SolutionTransferSystem _transfer = default!;
|
|
[Dependency] private readonly SharedHandsSystem _hands = default!;
|
|
|
|
protected override void DrawBlood(EntityUid uid, Entity<SolutionComponent> dest, EntityUid user)
|
|
{
|
|
// how did you even use this mr plushie...
|
|
if (CompOrNull<BloodstreamComponent>(user)?.BloodSolution is not { } blood)
|
|
return;
|
|
|
|
var desired = dest.Comp.Solution.AvailableVolume;
|
|
// TODO: when bloodstream is shared put the transfer in shared so PopupClient is actually used, and this popup isnt needed
|
|
if (desired == 0)
|
|
{
|
|
Popup.PopupEntity(Loc.GetString("recruiter-pen-prick-full", ("pen", uid)), user, user);
|
|
return;
|
|
}
|
|
|
|
if (_transfer.Transfer(new SolutionTransferData(user, user, blood, uid, dest, desired)) != desired)
|
|
return;
|
|
|
|
// this is why you have to keep the pen safe, it has the dna of everyone you recruited!
|
|
_forensics.TransferDna(uid, user, canDnaBeCleaned: false);
|
|
|
|
Popup.PopupEntity(Loc.GetString("recruiter-pen-pricked", ("pen", uid)), user, user, PopupType.LargeCaution);
|
|
}
|
|
|
|
protected override void Recruit(Entity<RecruiterPenComponent> ent, EntityUid user)
|
|
{
|
|
// only increment count once if 1 person signs multiple papers
|
|
if (!ent.Comp.Recruited.Add(user))
|
|
return;
|
|
|
|
if (ent.Comp.RecruiterMind is { } mindId &&
|
|
Mind.TryGetObjectiveComp<RecruitingConditionComponent>(mindId, out var obj, null))
|
|
{
|
|
obj.Recruited++;
|
|
Reward(ent, user);
|
|
}
|
|
}
|
|
|
|
public void Reward(Entity<RecruiterPenComponent> ent, EntityUid user)
|
|
{
|
|
var pay = Spawn(ent.Comp.Currency);
|
|
_hands.PickupOrDrop(user, pay);
|
|
}
|
|
}
|