From 9b151ccb0fb119c5f4082053e67b5b2afa6d33b8 Mon Sep 17 00:00:00 2001 From: Rerik007 <120549107+Rerik007@users.noreply.github.com> Date: Sat, 2 Mar 2024 14:32:12 +0300 Subject: [PATCH 1/3] bugfix: fixes respawn as npc verb --- code/modules/mob/mob.dm | 2 +- code/modules/mob/transform_procs.dm | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index fb862e30c2e..381106e834b 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -876,7 +876,7 @@ var/list/allowed_creatures = list("Mouse") for(var/mob/living/alive_mob as anything in GLOB.alive_mob_list) - if(!alive_mob.key && alive_mob.stat != DEAD && safe_respawn(alive_mob.type)) + if(!alive_mob.key && alive_mob.stat != DEAD && safe_respawn(alive_mob)) allowed_creatures += alive_mob var/mob/living/picked_mob = tgui_input_list(usr, "Please select an NPC to respawn as", "Respawn as NPC", allowed_creatures) diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index 3d1da8c6bf3..641a1f7b50a 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -227,24 +227,21 @@ qdel(src) -/mob/proc/safe_respawn(passed_path) +/mob/proc/safe_respawn(mob/living/passed_mob) . = FALSE - if(!ispath(passed_path)) - return . - var/static/list/safe_respawn_typecache_nuclear = typecacheof(list( /mob/living/simple_animal/pet/cat/Syndi, /mob/living/simple_animal/pet/dog/fox/Syndifox, )) - if(is_type_in_typecache(passed_path, safe_respawn_typecache_nuclear)) + if(is_type_in_typecache(passed_mob, safe_respawn_typecache_nuclear)) return GAMEMODE_IS_NUCLEAR - if(ispath(passed_path, /mob/living/simple_animal/borer) && !jobban_isbanned(src, ROLE_BORER) && !jobban_isbanned(src, ROLE_SYNDICATE)) + if(istype(passed_mob, /mob/living/simple_animal/borer) && !jobban_isbanned(src, ROLE_BORER) && !jobban_isbanned(src, ROLE_SYNDICATE)) return TRUE - if(ispath(passed_path, /mob/living/simple_animal/diona) && !jobban_isbanned(src, ROLE_NYMPH)) + if(isnymph(passed_mob) && !jobban_isbanned(src, ROLE_NYMPH)) return TRUE // Whitelist typecache. Alphabetical order please! @@ -280,6 +277,6 @@ /mob/living/simple_animal/pet/dog/fox/alisa, )) - if(is_type_in_typecache(passed_path, safe_respawn_typecache_whitelist) && !is_type_in_typecache(passed_path, safe_respawn_typecache_blacklist)) + if(is_type_in_typecache(passed_mob, safe_respawn_typecache_whitelist) && !is_type_in_typecache(passed_mob, safe_respawn_typecache_blacklist)) return TRUE From 3cf1866e08a2b21477bfc54edfe91309c9bbdd31 Mon Sep 17 00:00:00 2001 From: Rerik007 <120549107+Rerik007@users.noreply.github.com> Date: Sat, 2 Mar 2024 16:44:51 +0300 Subject: [PATCH 2/3] make npc list better --- code/modules/mob/mob.dm | 17 +++++++++++------ code/modules/mob/transform_procs.dm | 4 +++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 381106e834b..40e5630bea3 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -874,19 +874,24 @@ to_chat(usr, span_warning("You are not dead or you have given up your right to be respawned!")) return - var/list/allowed_creatures = list("Mouse") + var/list/allowed_creatures = list() for(var/mob/living/alive_mob as anything in GLOB.alive_mob_list) - if(!alive_mob.key && alive_mob.stat != DEAD && safe_respawn(alive_mob)) - allowed_creatures += alive_mob + if(!alive_mob.key && alive_mob.stat != DEAD && safe_respawn(alive_mob, TRUE)) + allowed_creatures[++allowed_creatures.len] = "[alive_mob.name]" + " ([get_area_name(alive_mob, TRUE)])" + allowed_creatures["[alive_mob.name]" + " ([get_area_name(alive_mob, TRUE)])"] = alive_mob - var/mob/living/picked_mob = tgui_input_list(usr, "Please select an NPC to respawn as", "Respawn as NPC", allowed_creatures) - if(!picked_mob) + allowed_creatures.Insert(1, "Mouse") + + var/mob/living/picked = tgui_input_list(usr, "Please select an NPC to respawn as", "Respawn as NPC", allowed_creatures) + if(!picked) return - if(picked_mob == "Mouse") + if(picked == "Mouse") become_mouse() return + var/mob/living/picked_mob = allowed_creatures[picked] + if(QDELETED(picked_mob) || picked_mob.key || picked_mob.stat == DEAD) to_chat(usr, span_warning("[capitalize(picked_mob)] is no longer available to respawn!")) return diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index 641a1f7b50a..7e4901d797b 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -227,7 +227,7 @@ qdel(src) -/mob/proc/safe_respawn(mob/living/passed_mob) +/mob/proc/safe_respawn(mob/living/passed_mob, check_station_level = TRUE) . = FALSE var/static/list/safe_respawn_typecache_nuclear = typecacheof(list( @@ -237,6 +237,8 @@ if(is_type_in_typecache(passed_mob, safe_respawn_typecache_nuclear)) return GAMEMODE_IS_NUCLEAR + if(check_station_level && !is_admin(src) && !is_station_level(passed_mob.z)) + return FALSE if(istype(passed_mob, /mob/living/simple_animal/borer) && !jobban_isbanned(src, ROLE_BORER) && !jobban_isbanned(src, ROLE_SYNDICATE)) return TRUE From 38c4cc90030cb0d056649a885d1618feeb5c9966 Mon Sep 17 00:00:00 2001 From: Rerik007 <120549107+Rerik007@users.noreply.github.com> Date: Sun, 3 Mar 2024 13:16:14 +0300 Subject: [PATCH 3/3] i did how beep said --- code/modules/mob/mob.dm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 40e5630bea3..13b2dc4d683 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -913,7 +913,7 @@ return //find a viable mouse candidate - var/list/found_vents = get_valid_vent_spawns(min_network_size = 0, station_levels_only = FALSE, z_level = z) + var/list/found_vents = get_valid_vent_spawns(min_network_size = 0) if(length(found_vents)) GLOB.respawnable_list -= src client.time_joined_as_mouse = world.time @@ -921,8 +921,6 @@ var/choosen_type = prob(90) ? /mob/living/simple_animal/mouse : /mob/living/simple_animal/mouse/rat var/mob/living/simple_animal/mouse/host = new choosen_type(vent_found.loc) host.ckey = src.ckey - if(istype(get_area(vent_found), /area/syndicate/unpowered/syndicate_space_base)) - host.faction += "syndicate" to_chat(host, "You are now a mouse. Try to avoid interaction with players, and do not give hints away that you are more than a simple rodent.") else to_chat(src, "Unable to find any unwelded vents to spawn mice at.")