Files
Delta-v/Content.Server/_DV/Recruiter/RecruiterPenSystem.cs
T
08dfaf0dd5 Merge Injector & Hypospray Systems & Components (#41833)
* Merge Injector & Hyposprays

* Fixes

* Requested Changes

* Preview

* Inclusion of Prototypes

* Fix

* small oversight

* Further fixes

* A few more fixes & Bluespacesyringe buff

Co-Authored-By: āda <177162775+iaada@users.noreply.github.com>

* Final Commit, hopefully

* Merge conflict no more

* YML fix

* Add required changes

Co-Authored-By: Princess Cheeseballs <66055347+Princess-Cheeseballs@users.noreply.github.com>

* cleanup warnings removal

* Bug fix & Maintainer Requests

Co-Authored-By: āda <177162775+iaada@users.noreply.github.com>

* Adhere to requested changes

Co-Authored-By: āda <177162775+iaada@users.noreply.github.com>

---------

Co-authored-by: āda <177162775+iaada@users.noreply.github.com>
Co-authored-by: Princess Cheeseballs <66055347+Princess-Cheeseballs@users.noreply.github.com>
Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
2025-12-29 11:39:30 -06:00

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);
}
}