Files
crystall-punk-14/Content.Server/_CP14/RandomJobs/CP14StationRandomJobsSystem.cs
Red 422a0c5e10 Gods and religions (#1405)
* basic religion vision

* block god interactions

* skill tree mob specify

* silvania setup??

* clustering shader optimization

* gods department & job

* random gods jobs

* Luxian god

* Update Nature.png

* Update sphere_of_light.yml

* god chat

* Update ChatSystem.cs

* OBSERVATION

* public observation and basic follower api

* shader tweaks

* improve shaders

* spawning and praying on altars

* altars ppvs override

* move pvs overridiation from altars to observers

* shader coloration

* spectral z mover

* god magic radius restricted

* guide how to believe in god

* sends messages to god when smoeone wanna become follower

* follower doAfter

* goodbye luxian, welcome lumera

* goodbye silvania, welcome merkas

* som polish and renamings

* gods fast travel

* Update altar.ftl

* some lumera sfx

* renouncing patrons!

* renounce followers

* followewr percentage calculation

* remove from player-facing

* fix

* Update sphere_of_light.yml

* Update base.yml
2025-06-13 14:15:48 +03:00

53 lines
1.5 KiB
C#

using Content.Server.Station.Events;
using Content.Server.Station.Systems;
using Content.Shared.Roles;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
namespace Content.Server._CP14.RandomJobs;
public sealed partial class CP14StationRandomJobsSystem : EntitySystem
{
[Dependency] private readonly StationJobsSystem _jobs = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<StationInitializedEvent>(OnInit, after: new[] { typeof(StationJobsSystem) });
}
private void OnInit(StationInitializedEvent args)
{
if (!TryComp<CP14StationRandomJobsComponent>(args.Station, out var randomJobs))
return;
foreach (var entry in randomJobs.Entries)
{
if (!_random.Prob(entry.Prob))
continue;
var count = entry.Count.Next(_random);
var tempList = new List<ProtoId<JobPrototype>>(entry.Jobs);
for (var i = 0; i < count; i++)
{
if (tempList.Count == 0)
break;
var job = _random.Pick(tempList);
tempList.Remove(job);
if (!_proto.TryIndex(job, out var jobProto))
continue;
_jobs.TryAdjustJobSlot(args.Station, jobProto, 1, createSlot: true);
}
}
}
}