mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-29 23:17:28 +01:00
Componentize vore panel
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user