Ghost spawning as mice from trash piles

Added the ability for observers to click on trash piles to trigger the mouse spawn prompt. Doing so spawns them on the pile with the same "crawls out of the trash" message a normal mouse would trigger.
This commit is contained in:
Eli Atonis
2022-07-26 07:13:07 +10:00
parent ce3b2a0728
commit e8e05d96ef
@@ -84,6 +84,49 @@
else
return ..()
/obj/structure/trash_pile/attack_ghost(mob/observer/user as mob)
if(config.disable_player_mice)
to_chat(user, "<span class='warning'>Spawning as a mouse is currently disabled.</span>")
return
//VOREStation Add Start
if(jobban_isbanned(user, "GhostRoles"))
to_chat(user, "<span class='warning'>You cannot become a mouse because you are banned from playing ghost roles.</span>")
return
//VOREStation Add End
if(!user.MayRespawn(1))
return
var/turf/T = get_turf(src)
if(!T || (T.z in using_map.admin_levels))
to_chat(user, "<span class='warning'>You may not spawn as a mouse on this Z-level.</span>")
return
var/timedifference = world.time - user.client.time_died_as_mouse
if(user.client.time_died_as_mouse && timedifference <= mouse_respawn_time * 600)
var/timedifference_text
timedifference_text = time2text(mouse_respawn_time * 600 - timedifference,"mm:ss")
to_chat(user, "<span class='warning'>You may only spawn again as a mouse more than [mouse_respawn_time] minutes after your death. You have [timedifference_text] left.</span>")
return
var/response = tgui_alert(user, "Are you -sure- you want to become a mouse?","Are you sure you want to squeek?",list("Squeek!","Nope!"))
if(response != "Squeek!") return //Hit the wrong key...again.
var/mob/living/simple_mob/animal/passive/mouse/host
host = new /mob/living/simple_mob/animal/passive/mouse(get_turf(src))
if(host)
if(config.uneducated_mice)
host.universal_understand = 0
announce_ghost_joinleave(src, 0, "They are now a mouse.")
host.ckey = user.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>")
var/atom/A = get_holder_at_turf_level(src)
A.visible_message("[host] crawls out of \the [src].")
return
/obj/structure/trash_pile/attack_hand(mob/user)
//Human mob
if(ishuman(user))