fixes mice (#20414)

This commit is contained in:
Contrabang
2023-03-22 11:07:53 -04:00
committed by GitHub
parent de357e657d
commit dfbb5da926
+20 -14
View File
@@ -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, "<span class='warning'>You may only spawn again as a mouse more than [GLOB.mouse_respawn_time] minutes after your death. You have [timedifference_text] left.</span>")
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, "<span class='info'>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.</span>")
else
to_chat(src, "<span class='warning'>Unable to find any unwelded vents to spawn mice at.</span>")
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, "<span class='warning'>Unable to find any unwelded vents to spawn mice at.</span>")
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, "<span class='info'>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.</span>")
host.forceMove(vent_found)
host.add_ventcrawl(vent_found)
return TRUE
/mob/proc/assess_threat() //For sec bot threat assessment
return 5