Refactor stations to properly use entity prototypes. (stationsv3) (#16570)
* Update StationSpawningSystem.cs Web-edit to allow feeding in an existing entity. * Update StationSpawningSystem.cs value type moment * Update StationSpawningSystem.cs * Oh goddamnit this is a refactor now. * awawawa * aaaaaaaaaaa * ee * forgot records. * no records? no records. * What's in a name? * Sloth forcing me to do the refactor properly smh. * e * optional evac in test. * tests pls work * awa --------- Co-authored-by: moonheart08 <moonheart08@users.noreply.github.com>
This commit is contained in:
@@ -50,7 +50,9 @@ namespace Content.Server.GameTicking
|
||||
|
||||
foreach (var (player, _) in profiles)
|
||||
{
|
||||
if (playerNetIds.Contains(player)) continue;
|
||||
if (playerNetIds.Contains(player))
|
||||
continue;
|
||||
|
||||
toRemove.Add(player);
|
||||
}
|
||||
|
||||
@@ -60,12 +62,14 @@ namespace Content.Server.GameTicking
|
||||
}
|
||||
}
|
||||
|
||||
var assignedJobs = _stationJobs.AssignJobs(profiles, _stationSystem.Stations.ToList());
|
||||
var spawnableStations = EntityQuery<StationJobsComponent, StationSpawningComponent>().Select(x => x.Item1.Owner).ToList();
|
||||
|
||||
_stationJobs.AssignOverflowJobs(ref assignedJobs, playerNetIds, profiles, _stationSystem.Stations.ToList());
|
||||
var assignedJobs = _stationJobs.AssignJobs(profiles, spawnableStations);
|
||||
|
||||
_stationJobs.AssignOverflowJobs(ref assignedJobs, playerNetIds, profiles, spawnableStations);
|
||||
|
||||
// Calculate extended access for stations.
|
||||
var stationJobCounts = _stationSystem.Stations.ToDictionary(e => e, _ => 0);
|
||||
var stationJobCounts = spawnableStations.ToDictionary(e => e, _ => 0);
|
||||
foreach (var (netUser, (job, station)) in assignedJobs)
|
||||
{
|
||||
if (job == null)
|
||||
@@ -117,7 +121,7 @@ namespace Content.Server.GameTicking
|
||||
|
||||
if (station == EntityUid.Invalid)
|
||||
{
|
||||
var stations = _stationSystem.Stations.ToList();
|
||||
var stations = EntityQuery<StationJobsComponent, StationSpawningComponent>().Select(x => x.Item1.Owner).ToList();
|
||||
_robustRandom.Shuffle(stations);
|
||||
if (stations.Count == 0)
|
||||
station = EntityUid.Invalid;
|
||||
|
||||
Reference in New Issue
Block a user