Skip to content

Commit

Permalink
Fixes for RoundstartFugitiveRuleSystem
Browse files Browse the repository at this point in the history
  • Loading branch information
Kr8art committed Nov 26, 2024
1 parent a1f7665 commit 93982f2
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Content.Server/GameTicking/Rules/RoundstartFugitiveRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ public sealed class RoundstartFugitiveRuleSystem : GameRuleSystem<RoundstartFugi
[Dependency] private readonly SharedHandsSystem _hands = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly SharedStorageSystem _storage = default!;

[Dependency] private readonly ChatSystem _chat = default!;
[Dependency] private readonly StationSystem _station = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;

public override void Initialize()
{
Expand Down Expand Up @@ -85,14 +87,14 @@ protected override void ActiveTick(EntityUid uid, RoundstartFugitiveRuleComponen

var announcement = Loc.GetString(comp.Announcement);
var sender = Loc.GetString(comp.Sender);
ChatSystem.DispatchGlobalAnnouncement(announcement, sender: sender, colorOverride: comp.Color);
_chat.DispatchGlobalAnnouncement(announcement, sender: sender, colorOverride: comp.Color);

// send the report to every comms console on the station
var query = EntityQueryEnumerator<TransformComponent, CommunicationsConsoleComponent>();
var consoles = new List<TransformComponent>();
while (query.MoveNext(out var console, out var xform, out _))
{
if (StationSystem.GetOwningStation(console, xform) != comp.Station || HasComp<GhostComponent>(console))
if (_station.GetOwningStation(console, xform) != comp.Station || HasComp<GhostComponent>(console))
continue;

consoles.Add(xform);
Expand Down Expand Up @@ -120,7 +122,7 @@ private void OnEntitySelected(Entity<RoundstartFugitiveRuleComponent> ent, ref A

var fugi = args.EntityUid;
comp.Report = GenerateReport(fugi, comp).ToMarkup();
comp.Station = StationSystem.GetOwningStation(fugi);
comp.Station = _station.GetOwningStation(fugi);
comp.NextAnnounce = Timing.CurTime + comp.AnnounceDelay;

_popup.PopupEntity(Loc.GetString("fugitive-spawn"), fugi, fugi);
Expand Down Expand Up @@ -163,7 +165,7 @@ private FormattedMessage GenerateReport(EntityUid uid, RoundstartFugitiveRuleCom
return report;
}

var species = PrototypeManager.Index(humanoid.Species);
var species = _proto.Index(humanoid.Species); //IPrototype or protoype

report.PushMarkup(Loc.GetString("fugitive-report-morphotype", ("species", Loc.GetString(species.Name))));
report.PushMarkup(Loc.GetString("fugitive-report-age", ("age", humanoid.Age)));
Expand Down Expand Up @@ -205,7 +207,7 @@ private string GetPrints(EntityUid uid)

private void AddCharges(FormattedMessage report, RoundstartFugitiveRuleComponent rule)
{
var crimeTypes = PrototypeManager.Index(rule.CrimesDataset);
var crimeTypes = _proto.Index(rule.CrimesDataset);
var crimes = new HashSet<LocId>();
var total = RobustRandom.Next(rule.MinCrimes, rule.MaxCrimes + 1);
while (crimes.Count < total)
Expand Down

0 comments on commit 93982f2

Please sign in to comment.