mirror of
https://github.com/Sandstorm-Station/Sandstorm-Station-13.git
synced 2026-08-22 04:38:21 +01:00
safety i guess, people are afraid that someone is SOMEHOW gonna manage to open their menu without being admin
This commit is contained in:
+20
-12
@@ -7,9 +7,9 @@
|
||||
|
||||
if(!src)
|
||||
return
|
||||
var/datum/component/interaction/interaction = GetComponent(/datum/component/interaction)
|
||||
if(interaction)
|
||||
interaction.open_menu(usr, src)
|
||||
var/datum/component/interaction_menu_granter/menu = GetComponent(/datum/component/interaction_menu_granter)
|
||||
if(menu)
|
||||
menu.open_menu(usr, src)
|
||||
else // you bad
|
||||
remove_verb(src, /mob/proc/interact_with)
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
#define INTERACTION_EXTREME 2
|
||||
|
||||
/// The menu itself, only var is target which is the mob you are interacting with
|
||||
/datum/component/interaction
|
||||
/datum/component/interaction_menu_granter
|
||||
var/mob/living/target
|
||||
|
||||
/datum/component/interaction/Initialize(...)
|
||||
/datum/component/interaction_menu_granter/Initialize(...)
|
||||
if(!ismob(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
var/mob/parent_mob = parent
|
||||
@@ -33,14 +33,17 @@
|
||||
RegisterSignal(parent_mob, COMSIG_MOB_CLICKON, .proc/open_menu)
|
||||
. = ..()
|
||||
|
||||
/datum/component/interaction/Destroy(force, ...)
|
||||
/datum/component/interaction_menu_granter/Destroy(force, ...)
|
||||
var/mob/parent_mob = parent
|
||||
remove_verb(parent_mob, /mob/proc/interact_with)
|
||||
target = null
|
||||
UnregisterSignal(parent_mob, COMSIG_MOB_CLICKON)
|
||||
. = ..()
|
||||
|
||||
/datum/component/interaction/proc/open_menu(mob/clicker, mob/clicked, mouse_params)
|
||||
/datum/component/interaction_menu_granter/proc/open_menu(mob/clicker, mob/clicked, mouse_params)
|
||||
// Don't cancel admin quick spawn
|
||||
if(isobserver(clicked) && check_rights(R_SPAWN, FALSE))
|
||||
return FALSE
|
||||
// COMSIG_MOB_CLICKON is sent for EVERYTHING your mob character clicks, avoid non-mob
|
||||
if(!istype(clicked))
|
||||
return FALSE
|
||||
@@ -54,10 +57,15 @@
|
||||
ui_interact(clicker)
|
||||
return COMSIG_MOB_CANCEL_CLICKON
|
||||
|
||||
/datum/component/interaction/ui_state(mob/user)
|
||||
return GLOB.conscious_state
|
||||
/datum/component/interaction_menu_granter/ui_state(mob/user)
|
||||
// Funny admin, don't you dare be the extra funny now.
|
||||
if(user.client.holder)
|
||||
return GLOB.always_state
|
||||
if(user == parent)
|
||||
return GLOB.conscious_state
|
||||
return GLOB.never_state
|
||||
|
||||
/datum/component/interaction/ui_interact(mob/user, datum/tgui/ui)
|
||||
/datum/component/interaction_menu_granter/ui_interact(mob/user, datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "MobInteraction", "Interactions")
|
||||
@@ -72,7 +80,7 @@
|
||||
else
|
||||
return 0
|
||||
|
||||
/datum/component/interaction/ui_data(mob/user)
|
||||
/datum/component/interaction_menu_granter/ui_data(mob/user)
|
||||
. = ..()
|
||||
//Getting player
|
||||
var/mob/living/self = parent
|
||||
@@ -190,7 +198,7 @@
|
||||
else
|
||||
return "No"
|
||||
|
||||
/datum/component/interaction/ui_act(action, params)
|
||||
/datum/component/interaction_menu_granter/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
var/mob/living/parent_mob = parent
|
||||
Reference in New Issue
Block a user