diff --git a/code/modules/mob/living/login.dm b/code/modules/mob/living/login.dm index 96d59dc330f..3b445ca3b46 100644 --- a/code/modules/mob/living/login.dm +++ b/code/modules/mob/living/login.dm @@ -1,4 +1,3 @@ - /mob/living/Login() ..() //Mind updates @@ -13,4 +12,17 @@ ai_holder.go_sleep() to_chat(src,"Mob AI disabled while you are controlling the mob.") + + + // Vore stuff + verbs |= /mob/living/proc/escapeOOC + verbs |= /mob/living/proc/lick + verbs |= /mob/living/proc/smell + verbs |= /mob/living/proc/switch_scaling + + if(!no_vore) + verbs |= /mob/living/proc/vorebelly_printout + if(!vorePanel) + AddComponent(/datum/component/vore_panel) + return . diff --git a/code/modules/mob/living/logout.dm b/code/modules/mob/living/logout.dm index fa04b0b317d..eb75f9fced3 100644 --- a/code/modules/mob/living/logout.dm +++ b/code/modules/mob/living/logout.dm @@ -4,6 +4,10 @@ //Per BYOND docs key remains set if the player DCs, becomes null if switching bodies. if(!key) //key and mind have become seperated. mind.active = 0 //This is to stop say, a mind.transfer_to call on a corpse causing a ghost to re-enter its body. + + var/datum/component/vore_panel/vp = GetComponent(/datum/component/vore_panel) + if(vp) + qdel(vp) spawn(15 SECONDS) //15 seconds to get back into the mob before it goes wild if(src && !src.client) diff --git a/code/modules/vore/eating/living_vr.dm b/code/modules/vore/eating/living_vr.dm index 96ed09cd013..80ce37c5d59 100644 --- a/code/modules/vore/eating/living_vr.dm +++ b/code/modules/vore/eating/living_vr.dm @@ -39,16 +39,6 @@ // Hook for generic creation of stuff on new creatures // /hook/living_new/proc/vore_setup(mob/living/M) - M.verbs += /mob/living/proc/escapeOOC - M.verbs += /mob/living/proc/lick - M.verbs += /mob/living/proc/smell - M.verbs += /mob/living/proc/switch_scaling - M.verbs += /mob/living/proc/vorebelly_printout - if(M.no_vore) //If the mob isn't supposed to have a stomach, let's not give it an insidepanel so it can make one for itself, or a stomach. - return TRUE - M.vorePanel = new(M) - M.verbs += /mob/living/proc/insidePanel - //Tries to load prefs if a client is present otherwise gives freebie stomach spawn(2 SECONDS) if(M) @@ -908,3 +898,57 @@ to_chat(src, "[EL]:") for(var/msg in B.emote_lists[EL]) to_chat(src, "[msg]") + +/** + * Small helper component to manage the vore panel HUD icon + */ +/datum/component/vore_panel + var/obj/screen/vore_panel/screen_icon + +/datum/component/vore_panel/Initialize() + if(!isliving(parent)) + return COMPONENT_INCOMPATIBLE + . = ..() + +/datum/component/vore_panel/RegisterWithParent() + . = ..() + RegisterSignal(parent, COMSIG_MOB_CLIENT_LOGIN, .proc/create_mob_button) + var/mob/living/owner = parent + if(owner.client) + create_mob_button(parent) + owner.verbs |= /mob/living/proc/insidePanel + owner.vorePanel = new(owner) + +/datum/component/vore_panel/UnregisterFromParent() + . = ..() + UnregisterSignal(parent, COMSIG_MOB_CLIENT_LOGIN) + var/mob/living/owner = parent + if(screen_icon) + owner?.client?.screen -= screen_icon + UnregisterSignal(screen_icon, COMSIG_CLICK) + qdel_null(screen_icon) + owner.verbs -= /mob/living/proc/insidePanel + qdel_null(owner.vorePanel) + +/datum/component/vore_panel/proc/create_mob_button(mob/user) + var/datum/hud/HUD = user.hud_used + if(!screen_icon) + screen_icon = new() + RegisterSignal(screen_icon, COMSIG_CLICK, .proc/vore_panel_click) + screen_icon.icon = HUD.ui_style + LAZYADD(HUD.other_important, screen_icon) + user.client?.screen += screen_icon + +/datum/component/vore_panel/proc/vore_panel_click(source, location, control, params, user) + var/mob/living/owner = user + if(istype(owner) && owner.vorePanel) + INVOKE_ASYNC(owner.vorePanel, .proc/tgui_interact, user) + +/** + * Screen object for vore panel + */ +/obj/screen/vore_panel + name = "vore panel" + icon = 'icons/mob/screen/midnight.dmi' + icon_state = "vore" + screen_loc = ui_smallquad diff --git a/code/modules/vore/eating/vorepanel_vr.dm b/code/modules/vore/eating/vorepanel_vr.dm index a3e5e0f3568..12248bbee78 100644 --- a/code/modules/vore/eating/vorepanel_vr.dm +++ b/code/modules/vore/eating/vorepanel_vr.dm @@ -22,7 +22,8 @@ vorePanel.tgui_interact(src) /mob/living/proc/updateVRPanel() //Panel popup update call from belly events. - SStgui.update_uis(vorePanel) + if(vorePanel) + SStgui.update_uis(vorePanel) // // Callback Handler for the Inside form