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

Smuggling Revamp: The Syndicate Broker #1655

Closed
wants to merge 16 commits into from
Closed
4 changes: 2 additions & 2 deletions Content.Server/_NF/Smuggling/Components/DeadDropComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ public sealed partial class DeadDropComponent : Component
/// Minimum wait time in seconds to wait for the next dead drop.
/// </summary>
[DataField("minimumCoolDown")]
public int MinimumCoolDown = 900; // 900 / 60 = 15 minutes
public int MinimumCoolDown = 600; // 600 / 60 = 10 minutes

/// <summary>
/// Max wait time in seconds to wait for the next dead drop.
/// </summary>
[DataField("maximumCoolDown")]
public int MaximumCoolDown = 5400; // 5400 / 60 = 90 minutes
public int MaximumCoolDown = 1200; // 1200 / 60 = 20 minutes

/// <summary>
/// Minimum distance to spawn the drop.
Expand Down
52 changes: 38 additions & 14 deletions Content.Server/_NF/Smuggling/DeadDropSystem.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
using System.Text;
using Content.Server._NF.Smuggling.Components;
using Content.Server.Administration.Logs;
using Content.Server.Fax;
using Content.Server.Paper;
using Content.Server.Power.EntitySystems;
using Content.Server.Radio.EntitySystems;
using Content.Server.Shipyard.Systems;
using Content.Server.Shuttles.Components;
using Content.Server.Shuttles.Systems;
using Content.Shared.Coordinates;
using Content.Shared.Database;
using Content.Shared.Hands.Components;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Fax.Components;
using Content.Shared.Database;
using Content.Shared.Radio;
using Content.Shared.Shuttles.Components;
using Content.Shared.Verbs;
Expand All @@ -26,16 +28,18 @@ public sealed class DeadDropSystem : EntitySystem
{
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly SharedHandsSystem _hands = default!;
[Dependency] private readonly FaxSystem _faxSystem = default!;
[Dependency] private readonly MapLoaderSystem _map = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly MetaDataSystem _meta = default!;
[Dependency] private readonly PaperSystem _paper = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly RadioSystem _radio = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ShipyardSystem _shipyard = default!;
[Dependency] private readonly ShuttleSystem _shuttle = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly PowerReceiverSystem _power = default!;

public override void Initialize()
{
Expand All @@ -44,23 +48,34 @@ public override void Initialize()
SubscribeLocalEvent<DeadDropComponent, GetVerbsEvent<InteractionVerb>>(AddSearchVerb);
}

private void OnStartup(EntityUid paintingUid, DeadDropComponent component, ComponentStartup _)
private void OnStartup(EntityUid uid, DeadDropComponent component, ComponentStartup _)
{
//set up the timing of the first activation
component.NextDrop = _timing.CurTime + TimeSpan.FromSeconds(_random.Next(component.MinimumCoolDown, component.MaximumCoolDown));
if (!HasComp<FaxMachineComponent>(uid))
component.NextDrop = component.NextDrop * 3;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You aren't multiplying the relative time difference by three, you're multiplying the absolute time by three, I don't think this is what you want. Also, just apply this logic to the fax machine's component

//Poster drops take longer
}

private void AddSearchVerb(EntityUid uid, DeadDropComponent component, GetVerbsEvent<InteractionVerb> args)
{
if (!args.CanInteract || !args.CanAccess || args.Hands == null || _timing.CurTime < component.NextDrop)
return;
var isFax = HasComp<FaxMachineComponent>(uid);
if (isFax == true && _power.IsPowered(uid, EntityManager)== false)
return;

//here we build our dynamic verb. Using the object's sprite for now to make it more dynamic for the moment.
var usedVerb = "";
if (isFax == true)
usedVerb = Loc.GetString("deaddrop-print-text");
else
usedVerb = Loc.GetString("deaddrop-search-text");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Push this into the component.

InteractionVerb searchVerb = new()
{
IconEntity = GetNetEntity(uid),
Act = () => SendDeadDrop(uid, component, args.User, args.Hands),
Text = Loc.GetString("deaddrop-search-text"),
Text = usedVerb,
Priority = 3
};

Expand Down Expand Up @@ -94,7 +109,7 @@ private void SendDeadDrop(EntityUid uid, DeadDropComponent component, EntityUid
//this is where we set up all the information that FTL is going to need, including a new null entitiy as a destination target because FTL needs it for reasons?
//dont ask me im just fulfilling FTL requirements.
var dropLocation = _random.NextVector2(component.MinimumDistance, component.MaximumDistance);
var mapId = Transform(user).MapID;
var mapId = Transform(uid).MapID;
var mapUid = _mapManager.GetMapEntityId(mapId);

if (TryComp<ShuttleComponent>(gridUids[0], out var shuttle))
Expand All @@ -104,10 +119,9 @@ private void SendDeadDrop(EntityUid uid, DeadDropComponent component, EntityUid

//tattle on the smuggler here, but obfuscate it a bit if possible to just the grid it was summoned from.
var channel = _prototypeManager.Index<RadioChannelPrototype>("Nfsd");
var sender = Transform(user).GridUid ?? uid;
var sender = Transform(uid).GridUid ?? uid;

_radio.SendRadioMessage(sender, Loc.GetString("deaddrop-security-report"), channel, uid);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth thinking about handling NFSD radio info from a fax machine differently from a regular poster dead drop. Should they know your base of operations as soon as your print one?

_adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(user)} sent a dead drop to {dropLocation.ToString()} from {ToPrettyString(uid)} at {Transform(uid).Coordinates.ToString()}");

// here we are just building a string for the hint paper so that it looks pretty and RP-like on the paper itself.
var dropHint = new StringBuilder();
Expand All @@ -116,14 +130,24 @@ private void SendDeadDrop(EntityUid uid, DeadDropComponent component, EntityUid
dropHint.AppendLine(dropLocation.ToString());
dropHint.AppendLine();
dropHint.AppendLine(Loc.GetString("deaddrop-hint-posttext"));
var printout = new FaxPrintout(dropHint.ToString(),Loc.GetString("deaddrop-hint-name"),null,null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Push printout into the if block, only used on one branch.

var isFax = HasComp<FaxMachineComponent>(uid);
if (isFax == true)
{
_faxSystem.Receive(uid,printout,null,null);
_adminLogger.Add(LogType.Action, LogImpact.Medium, $"sent a dead drop to {dropLocation.ToString()} from {ToPrettyString(uid)} at {Transform(uid).Coordinates.ToString()}");
}
else
{
var paper = EntityManager.SpawnEntity(component.HintPaper, Transform(uid).Coordinates);

var paper = EntityManager.SpawnEntity(component.HintPaper, Transform(uid).Coordinates);

_paper.SetContent(paper, dropHint.ToString());
_meta.SetEntityName(paper, Loc.GetString("deaddrop-hint-name"));
_meta.SetEntityDescription(paper, Loc.GetString("deaddrop-hint-desc"));
_hands.PickupOrDrop(user, paper, handsComp: hands);
_paper.SetContent(paper, dropHint.ToString());
_meta.SetEntityName(paper, Loc.GetString("deaddrop-hint-name"));
_meta.SetEntityDescription(paper, Loc.GetString("deaddrop-hint-desc"));
_hands.PickupOrDrop(user, paper, handsComp: hands);
_adminLogger.Add(LogType.Action, LogImpact.Medium, $"{ToPrettyString(user)} sent a dead drop to {dropLocation.ToString()} from {ToPrettyString(uid)} at {Transform(uid).Coordinates.ToString()}");

}
//reset the timer
component.NextDrop = _timing.CurTime + TimeSpan.FromSeconds(_random.Next(component.MinimumCoolDown, component.MaximumCoolDown));
}
Expand Down
4 changes: 3 additions & 1 deletion Resources/Locale/en-US/_NF/job/job-description.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ job-description-security-guard = Patrol the empty halls, whistle simple tunes yo
job-description-senior-officer = Teach new deputies the basics of searches, preforming arrests, prison times and how to properly shoot a firearm.
job-description-sheriff = Manage your department and keep them efficient, quell dissent, and keep the sector safe.
job-description-stc = Expertly de-conflict the space around the station and help the NFSD issue fines for overdocked ships.
job-description-sr = Handle access reassignment fairly using your ID console, manage Frontier outpost, and keep Clippy safe.
job-description-sr = Handle access reassignment fairly using your ID console, manage Frontier outpost, and keep Clippy safe.
job-desctiption-syndicate-bodyguard = Listen to your boss, keep your boss alive, intimidate visitors.
job-description-syndicate-broker = The head of smuggling logistics in the sector, control a POI, distribute dead drops, and deal contraband.
4 changes: 4 additions & 0 deletions Resources/Locale/en-US/_NF/job/job-names.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ job-name-security-guard = Security Guard
job-name-sheriff = Sheriff
job-name-stc = Station Traffic Controller
job-name-sr = Station Representative
job-name-syndicate-broker = Syndicate Broker
job-name-syndicate-bodyguard = Syndiacte Bodyguard

# Role timers - Make these alphabetical or I cut you
JobERTMailCarrier = ERT Mail Carrier
Expand All @@ -25,6 +27,8 @@ JobPirateCaptain = Pirate Captain
JobPirateFirstMate = Pirate First Mate
JobSecurityGuard = Security Guard
JobSTC = Station Traffic Controller
JobSyndicateBroker = Syndicate Broker
JobSyndicateBodyguard = Syndicate Bodyguard

# Upstream Removed
job-name-senior-engineer = Senior Engineer
Expand Down
2 changes: 2 additions & 0 deletions Resources/Locale/en-US/_NF/job/job-supervisors.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ job-supervisors-sergeant = the sergeant
job-supervisors-cadet = all higher ranking nfsd personnel
job-supervisors-prisoner = all nfsd personnel
job-supervisors-nfsd = deputies, the bailiff, and the sheriff
job-supervisors-syndicate-broker = the syndicate broker
job-supervisors-syndicate-bodyguard = the syndicate broker
3 changes: 2 additions & 1 deletion Resources/Locale/en-US/_NF/smuggling/deaddrop.ftl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
deaddrop-print-text = Print Drop
deaddrop-search-text = Search closer
deaddrop-security-report = Syndicate smuggling activities detected in your sector
deaddrop-hint-pretext = A Syndicate drop pod will be dispatched to the following coordinates:
deaddrop-hint-posttext = Our agents on the inside will pay anyone willing to smuggle these goods into NT territory.
deaddrop-hint-name = neatly folded paper
deaddrop-hint-desc = A piece of paper, cleanly folded to fit into a small hiding space
deaddrop-hint-desc = A piece of paper, cleanly folded to fit into a small hiding space
2 changes: 1 addition & 1 deletion Resources/Locale/en-US/job/job-supervisors.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ job-supervisors-medicine = medical doctors, chemists, and the chief medical offi
job-supervisors-security = security officers, the warden, and the head of security
job-supervisors-science = scientists, and the research director
job-supervisors-hire = whoever hires you
job-supervisors-everyone = absolutely everyone
job-supervisors-everyone = absolutely everyone
Loading
Loading