From dfbb5da926c947cffabb3a45131c46b60ccc1863 Mon Sep 17 00:00:00 2001
From: Contrabang <91113370+Contrabang@users.noreply.github.com>
Date: Wed, 22 Mar 2023 11:07:53 -0400
Subject: [PATCH] fixes mice (#20414)
---
code/modules/mob/mob.dm | 34 ++++++++++++++++++++--------------
1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index 164692e5c92..bad40d7dbaf 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -1172,8 +1172,8 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
var/picked = input("Please select an NPC to respawn as", "Respawn as NPC") as null|anything in creatures
switch(picked)
if("Mouse")
- remove_from_respawnable_list()
- become_mouse()
+ if(become_mouse()) // Only remove respawnability if the player successfully becomes a mouse
+ remove_from_respawnable_list()
else
var/mob/living/NPC = picked
if(istype(NPC) && !NPC.key)
@@ -1183,24 +1183,30 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
to_chat(usr, "You are not dead or you have given up your right to be respawned!")
return
-
+/**
+ * Returns true if the player successfully becomes a mouse
+ */
/mob/proc/become_mouse()
var/timedifference = world.time - client.time_died_as_mouse
if(client.time_died_as_mouse && timedifference <= GLOB.mouse_respawn_time * 600)
- var/timedifference_text
- timedifference_text = time2text(GLOB.mouse_respawn_time * 600 - timedifference,"mm:ss")
+ var/timedifference_text = time2text(GLOB.mouse_respawn_time * 600 - timedifference,"mm:ss")
to_chat(src, "You may only spawn again as a mouse more than [GLOB.mouse_respawn_time] minutes after your death. You have [timedifference_text] left.")
- return
+ return FALSE
//find a viable mouse candidate
- var/list/found_vents = get_valid_vent_spawns(min_network_size = 0)
- if(length(found_vents))
- var/obj/vent_found = pick(found_vents)
- var/mob/living/simple_animal/mouse/host = new(vent_found.loc)
- host.ckey = src.ckey
- 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.")
+ var/list/found_vents = get_valid_vent_spawns()
+ if(!length(found_vents))
+ found_vents = get_valid_vent_spawns(min_network_size = 0)
+ if(!length(found_vents))
+ to_chat(src, "Unable to find any unwelded vents to spawn mice at.")
+ return FALSE
+ var/obj/vent_found = pick(found_vents)
+ var/mob/living/simple_animal/mouse/host = new(vent_found.loc)
+ host.ckey = src.ckey
+ 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.")
+ host.forceMove(vent_found)
+ host.add_ventcrawl(vent_found)
+ return TRUE
/mob/proc/assess_threat() //For sec bot threat assessment
return 5