Skip to content

Commit 66e7875

Browse files
committed
more improvements
1 parent 1fd8fd0 commit 66e7875

3 files changed

Lines changed: 25 additions & 20 deletions

File tree

code/controllers/subsystem/ticker.dm

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,7 @@ SUBSYSTEM_DEF(ticker)
392392
LAZYADD(round_end_events, cb)
393393

394394
/datum/controller/subsystem/ticker/proc/create_characters()
395-
for(var/i in GLOB.auth_new_player_list)
396-
var/mob/dead/new_player/authenticated/player = i
395+
for(var/mob/dead/new_player/authenticated/player as anything in GLOB.auth_new_player_list)
397396
if(player.ready == PLAYER_READY_TO_PLAY && player.mind)
398397
GLOB.joined_player_list += player.ckey
399398
var/atom/destination = player.mind.assigned_role.get_roundstart_spawn_point()
@@ -406,12 +405,11 @@ SUBSYSTEM_DEF(ticker)
406405
CHECK_TICK
407406

408407
/datum/controller/subsystem/ticker/proc/collect_minds()
409-
for(var/mob/dead/new_player/authenticated/P in GLOB.player_list)
408+
for(var/mob/dead/new_player/authenticated/P as anything in GLOB.auth_new_player_list)
410409
if(P.new_character?.mind)
411410
SSticker.minds += P.new_character.mind
412411
CHECK_TICK
413412

414-
415413
/datum/controller/subsystem/ticker/proc/equip_characters()
416414
GLOB.security_officer_distribution = decide_security_officer_departments(
417415
shuffle(GLOB.auth_new_player_list),

code/modules/jobs/job_types/_job.dm

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,6 @@
653653
return get_latejoin_spawn_point()
654654
return spawn_point
655655

656-
657656
/// Handles finding and picking a valid roundstart effect landmark spawn point, in case no uncommon different spawning events occur.
658657
/datum/job/proc/get_default_roundstart_spawn_point()
659658
for(var/obj/effect/landmark/start/spawn_point as anything in GLOB.start_landmarks_list)
@@ -667,7 +666,6 @@
667666
if(!.)
668667
log_mapping("Couldn't find a round start spawn point for [title]")
669668

670-
671669
/// Finds a valid latejoin spawn point, checking for events and special conditions.
672670
/datum/job/proc/get_latejoin_spawn_point()
673671
if(length(GLOB.jobspawn_overrides[title])) //We're doing something special today.
@@ -676,7 +674,6 @@
676674
return pick(SSjob.latejoin_trackers)
677675
return SSjob.get_last_resort_spawn_points()
678676

679-
680677
/// Spawns the mob to be played as, taking into account preferences and the desired spawn point.
681678
/datum/job/proc/get_spawn_mob(client/player_client, atom/spawn_point)
682679
var/mob/living/spawn_instance

code/modules/mapping/mapping_helpers.dm

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,8 +1305,15 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/foodpreserver)
13051305
var/minimum_pop = 0
13061306
/// The payload is executed if the configured job's roundstart amount is less than this
13071307
var/minimum_job_amount = 0
1308-
/// The job datum type
1309-
var/targeted_job_type = null
1308+
/// A list of job datum types to compare [minimum_job_amount] against
1309+
var/list/targeted_job_types = null
1310+
/**
1311+
* It's highly likely that there will be several lowpop mapping helpers with an identical configuration.
1312+
*
1313+
* To avoid repeated checks, we generate a unique identifier for this mapping helper's configuration and store
1314+
* whether or not it passed in a static associative list formatted as: [check identifier --> TRUE/FALSE].
1315+
*/
1316+
VAR_PROTECTED/static/list/cached_succeeded_checks = list()
13101317

13111318
/obj/effect/mapping_helpers/lowpop/Initialize(mapload)
13121319
. = ..()
@@ -1325,29 +1332,32 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/foodpreserver)
13251332
/obj/effect/mapping_helpers/lowpop/proc/on_round_start()
13261333
SIGNAL_HANDLER
13271334

1328-
var/static/list/cached_succeeded_checks = list()
1329-
var/cached_check_identifier = "[targeted_job_type];[minimum_job_amount];[minimum_pop]"
1335+
var/cached_check_identifier = "[targeted_job_types.Join(",")];[minimum_job_amount];[minimum_pop]"
13301336
if(!isnull(cached_succeeded_checks[cached_check_identifier]))
13311337
if(cached_succeeded_checks[cached_check_identifier])
13321338
payload()
1333-
qdel(src)
1334-
return
1335-
1336-
if(length(GLOB.manifest.general) < minimum_pop || (ispath(targeted_job_type) && SSjob.get_job_type(targeted_job_type)?.current_positions < minimum_job_amount))
1337-
cached_succeeded_checks[cached_check_identifier] = TRUE
1338-
payload()
13391339
else
1340-
cached_succeeded_checks[cached_check_identifier] = FALSE
1340+
var/amount_of_specified_jobs = 0
1341+
for(var/job_type in targeted_job_types)
1342+
amount_of_specified_jobs += SSjob.get_job_type(job_type)?.current_positions
1343+
1344+
if(length(GLOB.manifest.general) < minimum_pop || amount_of_specified_jobs < minimum_job_amount)
1345+
cached_succeeded_checks[cached_check_identifier] = TRUE
1346+
payload()
1347+
else
1348+
cached_succeeded_checks[cached_check_identifier] = FALSE
1349+
13411350
qdel(src)
13421351

13431352
/obj/effect/mapping_helpers/lowpop/proc/payload()
1353+
SHOULD_NOT_SLEEP(TRUE)
13441354
return
13451355

13461356
/obj/effect/mapping_helpers/lowpop/cable_spawner
13471357
name = "lowpop cable spawner"
13481358
icon_state = "lowpop_cable"
13491359
minimum_job_amount = 1
1350-
targeted_job_type = /datum/job/station_engineer
1360+
targeted_job_types = list(/datum/job/station_engineer, /datum/job/chief_engineer)
13511361

13521362
/// The type of cable to spawn
13531363
var/cable_type = /obj/structure/cable
@@ -1362,7 +1372,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/foodpreserver)
13621372
name = "lowpop solar console enabler"
13631373
icon_state = "lowpop_solar"
13641374
minimum_job_amount = 1
1365-
targeted_job_type = /datum/job/station_engineer
1375+
targeted_job_types = list(/datum/job/station_engineer, /datum/job/chief_engineer)
13661376

13671377
/obj/effect/mapping_helpers/lowpop/solar_console/register_signal()
13681378
RegisterSignal(SSdcs, COMSIG_GLOB_POST_START, PROC_REF(on_round_start))

0 commit comments

Comments
 (0)