mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +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 name = "Use PDA"
|
||||||
set src in usr
|
set src in usr
|
||||||
|
|
||||||
if(!can_use())
|
if(!can_use(usr))
|
||||||
return
|
return
|
||||||
tgui_interact(usr)
|
tgui_interact(usr)
|
||||||
|
|
||||||
|
|||||||
@@ -109,7 +109,7 @@
|
|||||||
|
|
||||||
// Specifically here for the chat message.
|
// Specifically here for the chat message.
|
||||||
/datum/data/pda/app/messenger/Topic(href, href_list)
|
/datum/data/pda/app/messenger/Topic(href, href_list)
|
||||||
if(!pda.can_use())
|
if(!pda.can_use(usr))
|
||||||
return
|
return
|
||||||
unnotify()
|
unnotify()
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@
|
|||||||
if(last_text && world.time < last_text + 5)
|
if(last_text && world.time < last_text + 5)
|
||||||
return
|
return
|
||||||
|
|
||||||
if(!pda.can_use())
|
if(!pda.can_use(usr))
|
||||||
return
|
return
|
||||||
|
|
||||||
last_text = world.time
|
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.")
|
log_debug("Invalid switch for PDA, defaulting to old PDA icons. [pdachoice] chosen.")
|
||||||
start_program(find_program(/datum/data/pda/app/main_menu))
|
start_program(find_program(/datum/data/pda/app/main_menu))
|
||||||
|
|
||||||
/obj/item/device/pda/proc/can_use()
|
/obj/item/device/pda/proc/can_use(mob/user)
|
||||||
if(!ismob(loc))
|
return (tgui_status(user, GLOB.tgui_inventory_state) == STATUS_INTERACTIVE)
|
||||||
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/GetAccess()
|
/obj/item/device/pda/GetAccess()
|
||||||
if(id)
|
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)
|
/obj/item/device/pda/MouseDrop(obj/over_object as obj, src_location, over_location)
|
||||||
var/mob/M = usr
|
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 attack_self(M)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,6 @@
|
|||||||
/obj/item/device/pda/tgui_state(mob/user)
|
/obj/item/device/pda/tgui_state(mob/user)
|
||||||
return GLOB.tgui_inventory_state
|
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)
|
/obj/item/device/pda/tgui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui)
|
||||||
ui = SStgui.try_update_ui(user, src, ui)
|
ui = SStgui.try_update_ui(user, src, ui)
|
||||||
if(!ui)
|
if(!ui)
|
||||||
@@ -68,12 +63,6 @@
|
|||||||
if(..())
|
if(..())
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|
||||||
if(!can_use())
|
|
||||||
usr.unset_machine()
|
|
||||||
if(ui)
|
|
||||||
ui.close()
|
|
||||||
return FALSE
|
|
||||||
|
|
||||||
add_fingerprint(usr)
|
add_fingerprint(usr)
|
||||||
usr.set_machine(src)
|
usr.set_machine(src)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user