mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Fix PDA access to use regular tgui inventory rules
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
set name = "Use PDA"
|
||||
set src in usr
|
||||
|
||||
if(!can_use())
|
||||
if(!can_use(usr))
|
||||
return
|
||||
tgui_interact(usr)
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
|
||||
// Specifically here for the chat message.
|
||||
/datum/data/pda/app/messenger/Topic(href, href_list)
|
||||
if(!pda.can_use())
|
||||
if(!pda.can_use(usr))
|
||||
return
|
||||
unnotify()
|
||||
|
||||
@@ -140,7 +140,7 @@
|
||||
if(last_text && world.time < last_text + 5)
|
||||
return
|
||||
|
||||
if(!pda.can_use())
|
||||
if(!pda.can_use(usr))
|
||||
return
|
||||
|
||||
last_text = world.time
|
||||
|
||||
@@ -147,16 +147,8 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
log_debug("Invalid switch for PDA, defaulting to old PDA icons. [pdachoice] chosen.")
|
||||
start_program(find_program(/datum/data/pda/app/main_menu))
|
||||
|
||||
/obj/item/device/pda/proc/can_use()
|
||||
if(!ismob(loc))
|
||||
return FALSE
|
||||
|
||||
var/mob/M = loc
|
||||
if(M.incapacitated(INCAPACITATION_ALL))
|
||||
return FALSE
|
||||
if(src in M.contents)
|
||||
return TRUE
|
||||
return FALSE
|
||||
/obj/item/device/pda/proc/can_use(mob/user)
|
||||
return (tgui_status(user, GLOB.tgui_inventory_state) == STATUS_INTERACTIVE)
|
||||
|
||||
/obj/item/device/pda/GetAccess()
|
||||
if(id)
|
||||
@@ -169,7 +161,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
|
||||
/obj/item/device/pda/MouseDrop(obj/over_object as obj, src_location, over_location)
|
||||
var/mob/M = usr
|
||||
if((!istype(over_object, /obj/screen)) && can_use())
|
||||
if((!istype(over_object, /obj/screen)) && can_use(usr))
|
||||
return attack_self(M)
|
||||
return
|
||||
|
||||
|
||||
@@ -2,11 +2,6 @@
|
||||
/obj/item/device/pda/tgui_state(mob/user)
|
||||
return GLOB.tgui_inventory_state
|
||||
|
||||
/obj/item/device/pda/tgui_status(mob/user, datum/tgui_state/state)
|
||||
. = ..()
|
||||
if(!can_use())
|
||||
. = min(., STATUS_UPDATE)
|
||||
|
||||
/obj/item/device/pda/tgui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
@@ -68,12 +63,6 @@
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
if(!can_use())
|
||||
usr.unset_machine()
|
||||
if(ui)
|
||||
ui.close()
|
||||
return FALSE
|
||||
|
||||
add_fingerprint(usr)
|
||||
usr.set_machine(src)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user