Files
Delta-v/Content.Server/_DV/Recruiter/RecruiterPenSystem.cs
T
d5f2d3404d Recruiter uplink (#3232)
* redid everything. again.

* MORE SYNDIE TRASH

* more junk!!!

* togglefun

* treatcoins

* fix

* fixed typos

* rough MVP of hiring reward

* redid job tracking, probably half finished

* attempts to implement payment, probably need to redo

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Reverted to an older version that worked.

* typo

* fixed sprite issue, actually gave them their briefcase.

* fixed box issue

* fixed old emag mention

* removed old file

* added localisation for treatcoin stacks

* camelcase issue fixed

* Requested changes

* EntityUID for now.

* that doesnt work.

* actually spawns the currency now.

* icon is NOT automatic i think?

* started migration to directory

* split into directories

* migrated into seperate files

* removed kits category

* obsolete mention of kit

* simplified names

* removed fieldname

* gave recruiter a figurine

* requested changes

* Update Content.Shared/_DV/Recruiter/RecruiterPenComponent.cs

Co-authored-by: Tobias Berger <toby@tobot.dev>
Signed-off-by: Smugman <85798843+Smugman@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Tobias Berger <toby@tobot.dev>
Signed-off-by: Smugman <85798843+Smugman@users.noreply.github.com>

* Update Resources/Prototypes/_DV/Entities/Objects/Misc/paper.yml

Co-authored-by: Tobias Berger <toby@tobot.dev>
Signed-off-by: Smugman <85798843+Smugman@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Tobias Berger <toby@tobot.dev>
Signed-off-by: Smugman <85798843+Smugman@users.noreply.github.com>

* Update recruiter.yml

Signed-off-by: Smugman <85798843+Smugman@users.noreply.github.com>

* Update recruiter.yml

Signed-off-by: Smugman <85798843+Smugman@users.noreply.github.com>

* Update currency.yml

Signed-off-by: Smugman <85798843+Smugman@users.noreply.github.com>

* Update recruiter.yml

Signed-off-by: Smugman <85798843+Smugman@users.noreply.github.com>

* Update treatcoins.yml

Signed-off-by: Smugman <85798843+Smugman@users.noreply.github.com>

* Update meta.json

Signed-off-by: Smugman <85798843+Smugman@users.noreply.github.com>

* Update meta.json

Signed-off-by: Smugman <85798843+Smugman@users.noreply.github.com>

* Update meta.json

Signed-off-by: Smugman <85798843+Smugman@users.noreply.github.com>

* untouch

* drink cans shortened

* inheritance

---------

Signed-off-by: Smugman <85798843+Smugman@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tobias Berger <toby@tobot.dev>
2025-06-29 03:39:07 +01:00

64 lines
2.3 KiB
C#

using Content.Server.Body.Components;
using Content.Server.Forensics;
using Content.Server.Objectives.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(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);
}
}