From dd3d4f4cfef182f9c8db5ea399e563a7f02f0cc5 Mon Sep 17 00:00:00 2001 From: Aronai Sieyes Date: Fri, 8 May 2020 13:34:31 -0400 Subject: [PATCH] Refactor spawn_checks_vr and when it is called --- code/controllers/subsystems/ticker.dm | 1 + code/modules/mob/new_player/new_player.dm | 3 +-- code/modules/mob/new_player/new_player_vr.dm | 21 ++++++++++++-------- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/code/controllers/subsystems/ticker.dm b/code/controllers/subsystems/ticker.dm index deaa65bcfb..f213c6bf30 100644 --- a/code/controllers/subsystems/ticker.dm +++ b/code/controllers/subsystems/ticker.dm @@ -404,6 +404,7 @@ var/global/datum/controller/subsystem/ticker/ticker continue // Ask their new_player mob to spawn them + if(!player.spawn_checks_vr(player.mind.assigned_role)) continue //VOREStation Add var/mob/living/carbon/human/new_char = player.create_character() // Created their playable character, delete their /mob/new_player diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index de3c51ae75..7fa15cc383 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -365,7 +365,7 @@ if(!IsJobAvailable(rank)) alert(src,"[rank] is not available. Please try another.") return 0 - if(!attempt_vr(src,"spawn_checks_vr",list())) return 0 // VOREStation Insert + if(!spawn_checks_vr(rank)) return 0 // VOREStation Insert if(!client) return 0 @@ -491,7 +491,6 @@ /mob/new_player/proc/create_character(var/turf/T) - if (!attempt_vr(src,"spawn_checks_vr",list())) return 0 // VOREStation Insert spawning = 1 close_spawn_windows() diff --git a/code/modules/mob/new_player/new_player_vr.dm b/code/modules/mob/new_player/new_player_vr.dm index 711332e692..1c56e278f8 100644 --- a/code/modules/mob/new_player/new_player_vr.dm +++ b/code/modules/mob/new_player/new_player_vr.dm @@ -1,36 +1,41 @@ -/mob/new_player/proc/spawn_checks_vr() +/mob/new_player/proc/spawn_checks_vr(var/rank) var/pass = TRUE + var/datum/job/J = SSjob.get_job(rank) + + if(!J) + log_debug("Couldn't find job: [rank] for spawn_checks_vr, panic-returning that it's fine to spawn.") + return TRUE //No Flavor Text - if (config.require_flavor && client && client.prefs && client.prefs.flavor_texts && !client.prefs.flavor_texts["general"]) + if (config.require_flavor && !client?.prefs?.flavor_texts["general"] && !(J.mob_type & JOB_SILICON)) to_chat(src,"Please set your general flavor text to give a basic description of your character. Set it using the 'Set Flavor text' button on the 'General' tab in character setup, and choosing 'General' category.") pass = FALSE //No OOC notes - if (config.allow_Metadata && client && client.prefs && (isnull(client.prefs.metadata) || length(client.prefs.metadata) < 15)) + if (config.allow_Metadata && !(client?.prefs?.metadata || length(client.prefs.metadata) < 15)) to_chat(src,"Please set informative OOC notes related to ERP preferences. Set them using the 'OOC Notes' button on the 'General' tab in character setup.") pass = FALSE //Are they on the VERBOTEN LIST? - if (prevent_respawns.Find(client.prefs.real_name)) + if (prevent_respawns.Find(client?.prefs?.real_name)) to_chat(src,"You've already quit the round as this character. You can't go back now that you've free'd your job slot. Play another character, or wait for the next round.") pass = FALSE //Do they have their scale properly setup? - if(!client.prefs.size_multiplier) + if(!client?.prefs?.size_multiplier) pass = FALSE to_chat(src,"You have not set your scale yet. Do this on the VORE tab in character setup.") //Can they play? - if(!is_alien_whitelisted(src,GLOB.all_species[client.prefs.species]) && !check_rights(R_ADMIN, 0)) + if(!is_alien_whitelisted(src,GLOB.all_species[client?.prefs?.species]) && !check_rights(R_ADMIN, 0)) pass = FALSE to_chat(src,"You are not allowed to spawn in as this species.") //Custom species checks - if (client && client.prefs && client.prefs.species == "Custom Species") + if (client?.prefs?.species == "Custom Species") //Didn't name it - if(!client.prefs.custom_species) + if(!client?.prefs?.custom_species) pass = FALSE to_chat(src,"You have to name your custom species. Do this on the VORE tab in character setup.")