Componentize vore panel

This commit is contained in:
Aronai Sieyes
2021-07-31 22:56:23 -04:00
parent f55f260d0b
commit 870e2728a7
4 changed files with 73 additions and 12 deletions
+13 -1
View File
@@ -1,4 +1,3 @@
/mob/living/Login()
..()
//Mind updates
@@ -13,4 +12,17 @@
ai_holder.go_sleep()
to_chat(src,"<span class='notice'>Mob AI disabled while you are controlling the mob.</span>")
// 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 .
+4
View File
@@ -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)
+54 -10
View File
@@ -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, "<span class='notice'><b>[EL]:</b></span>")
for(var/msg in B.emote_lists[EL])
to_chat(src, "<span class='notice'>[msg]</span>")
/**
* 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
+2 -1
View File
@@ -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