mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
* Scope creep my ass * why was this shit not pushed???? * gone... * fix that * review plus buildd * asfsafsafsafsafas * grug * burber * I'll fix this later * shrimply die * also this * it's snerf or snuthin * assaads * round snend * aaaa * fix this shit for real * actually, don't start GameRules until MapInit now that I think aboot it. * forgot u * don't actually need this part nullable * Deffer comp removal * one liner * do that too * chungus * Honestly makes more sense here, plus WHY are we doing all that shit on "GameRuleAdded" rather than GameRuleStarted(?) * deferred removal :V * aaaaaaaaaaaaaaa * whhop * Whoop * better * landmine that I placed for myself then forgot about lmao * cleanup * FUCKING `!` * gotovo * amogus * please don't check by metadata I beg * waawsasfdfsasfa * sfafsasfafsas * fdsaasffsasfa * code * fix * fasasffasfasfsad * chungaas * I may be stupid * gra * graaaaaaaaaaaaaaaaa * comment * gra * clearing is not predicted and would require major refactors, so don't cache on client. * lame shit :P * last holes * nukeopsfsafsasafsfafsa * why was that shit public bruh * bubrbgwahrghfaka * dynamic * revert change that did nothing lmao
61 lines
2.3 KiB
C#
61 lines
2.3 KiB
C#
using Content.Server.Chat.Systems;
|
|
using Content.Server.Station.Systems;
|
|
using Content.Shared.CriminalRecords;
|
|
using Content.Shared.CriminalRecords.Components;
|
|
using Content.Shared.CriminalRecords.Systems;
|
|
using Content.Shared.Random.Helpers;
|
|
using Content.Shared.Security;
|
|
using Content.Shared.StationRecords;
|
|
using Content.Shared.StationRecords.Systems;
|
|
using Robust.Shared.Random;
|
|
|
|
namespace Content.Server.CriminalRecords.Systems;
|
|
|
|
public sealed partial class CriminalRecordsHackerSystem : SharedCriminalRecordsHackerSystem
|
|
{
|
|
[Dependency] private ChatSystem _chat = default!;
|
|
[Dependency] private CriminalRecordsSystem _criminalRecords = default!;
|
|
[Dependency] private IRobustRandom _random = default!;
|
|
[Dependency] private ServerStationSystem _station = default!;
|
|
[Dependency] private StationRecordsSystem _records = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<CriminalRecordsHackerComponent, CriminalRecordsHackDoAfterEvent>(OnDoAfter);
|
|
}
|
|
|
|
private void OnDoAfter(Entity<CriminalRecordsHackerComponent> ent, ref CriminalRecordsHackDoAfterEvent args)
|
|
{
|
|
if (args.Cancelled || args.Handled || args.Target == null)
|
|
return;
|
|
|
|
if (_station.GetOwningStation(ent) is not {} station)
|
|
return;
|
|
|
|
var reasons = ProtoMan.Index(ent.Comp.Reasons);
|
|
foreach (var (key, record) in _records.GetRecordsOfType<CriminalRecord>(station))
|
|
{
|
|
var reason = _random.Pick(reasons);
|
|
_criminalRecords.OverwriteStatus(new StationRecordKey(key, station), record, SecurityStatus.Wanted, reason);
|
|
// no radio message since spam
|
|
// no history since lazy and its easy to remove anyway
|
|
// main damage with this is existing arrest warrants are lost and to anger beepsky
|
|
}
|
|
|
|
_chat.DispatchGlobalAnnouncement(Loc.GetString(ent.Comp.Announcement), playSound: true, colorOverride: Color.Red);
|
|
|
|
// once is enough
|
|
RemComp<CriminalRecordsHackerComponent>(ent);
|
|
|
|
var ev = new CriminalRecordsHackedEvent(ent, args.Target.Value);
|
|
RaiseLocalEvent(args.User, ref ev);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Raised on the user after hacking a criminal records console.
|
|
/// </summary>
|
|
[ByRefEvent]
|
|
public record struct CriminalRecordsHackedEvent(EntityUid User, EntityUid Target);
|