-
Notifications
You must be signed in to change notification settings - Fork 608
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
Changes from 7 commits
ef3b99c
ebdc472
a5cf3ed
25d41b5
1c9ff94
26894cc
3112a8b
7b80675
34a435d
87db140
1b54ee0
cd11805
a9b70cc
707bc0b
46c3384
1e0706f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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; | ||
|
@@ -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() | ||
{ | ||
|
@@ -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; | ||
//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"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
}; | ||
|
||
|
@@ -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)) | ||
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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(); | ||
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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)); | ||
} | ||
|
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 |
There was a problem hiding this comment.
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