mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-30 15:37:36 +01:00
Cleanup
This commit is contained in:
@@ -21,7 +21,6 @@ jobs:
|
||||
- name: Run Linters
|
||||
run: |
|
||||
find . -name "*.json" -not -path "*/node_modules/*" -print0 | xargs -0 python3 ./tools/ci/json_verifier.py
|
||||
tools/ci/build_nanoui.sh
|
||||
tools/ci/build_tgui.sh
|
||||
tools/ci/check_grep.sh
|
||||
python3 tools/ci/check_line_endings.py
|
||||
|
||||
@@ -2043,3 +2043,12 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
|
||||
|
||||
/// Waits at a line of code until X is true
|
||||
#define UNTIL(X) while(!(X)) stoplag()
|
||||
|
||||
// Check if the source atom contains another atom
|
||||
/atom/proc/contains(atom/location)
|
||||
if(!location)
|
||||
return FALSE
|
||||
if(location == src)
|
||||
return TRUE
|
||||
|
||||
return contains(location.loc)
|
||||
|
||||
@@ -233,9 +233,9 @@ SUBSYSTEM_DEF(tgui)
|
||||
/datum/controller/subsystem/tgui/proc/on_close(datum/tgui/ui)
|
||||
var/src_object_key = "[ui.src_object.UID()]"
|
||||
if(isnull(open_uis[src_object_key]) || !istype(open_uis[src_object_key], /list))
|
||||
return 0 // It wasn't open.
|
||||
return FALSE // It wasn't open.
|
||||
else if(isnull(open_uis[src_object_key][ui.ui_key]) || !istype(open_uis[src_object_key][ui.ui_key], /list))
|
||||
return 0 // It wasn't open.
|
||||
return FALSE // It wasn't open.
|
||||
|
||||
processing_uis.Remove(ui) // Remove it from the list of processing UIs.
|
||||
if(ui.user) // If the user exists, remove it from them too.
|
||||
@@ -249,7 +249,7 @@ SUBSYSTEM_DEF(tgui)
|
||||
if(!uiobj.len)
|
||||
open_uis.Remove(src_object_key)
|
||||
|
||||
return 1 // Let the caller know we did it.
|
||||
return TRUE // Let the caller know we did it.
|
||||
|
||||
/**
|
||||
* private
|
||||
@@ -275,7 +275,7 @@ SUBSYSTEM_DEF(tgui)
|
||||
*/
|
||||
/datum/controller/subsystem/tgui/proc/on_transfer(mob/source, mob/target)
|
||||
if(!source || isnull(source.open_uis) || !istype(source.open_uis, /list) || open_uis.len == 0)
|
||||
return 0 // The old mob had no open UIs.
|
||||
return FALSE // The old mob had no open UIs.
|
||||
|
||||
if(isnull(target.open_uis) || !istype(target.open_uis, /list))
|
||||
target.open_uis = list() // Create a list for the new mob if needed.
|
||||
@@ -285,4 +285,4 @@ SUBSYSTEM_DEF(tgui)
|
||||
target.open_uis.Add(ui) // Transfer all the UIs.
|
||||
|
||||
source.open_uis.Cut() // Clear the old list.
|
||||
return 1 // Let the caller know we did it.
|
||||
return TRUE // Let the caller know we did it.
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
/datum/proc/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
||||
// If UI is not interactive or usr calling Topic is not the UI user, bail.
|
||||
if(!ui || ui.status != STATUS_INTERACTIVE)
|
||||
return 1
|
||||
return TRUE
|
||||
|
||||
/**
|
||||
* public
|
||||
@@ -135,15 +135,15 @@
|
||||
* Called by UIs when they are closed.
|
||||
* Must be a verb so winset() can call it.
|
||||
*
|
||||
* required uiref ref The UI that was closed.
|
||||
* required uiref uid The UI that was closed.
|
||||
*/
|
||||
/client/verb/uiclose(ref as text)
|
||||
/client/verb/uiclose(uid as text)
|
||||
// Name the verb, and hide it from the user panel.
|
||||
set name = "uiclose"
|
||||
set hidden = 1
|
||||
set hidden = TRUE
|
||||
|
||||
// Get the UI based on the ref.
|
||||
var/datum/tgui/ui = locateUID(ref)
|
||||
// Get the UI based on the UID.
|
||||
var/datum/tgui/ui = locateUID(uid)
|
||||
|
||||
// If we found the UI, close it.
|
||||
if(istype(ui))
|
||||
|
||||
@@ -10,11 +10,3 @@ GLOBAL_DATUM_INIT(contained_state, /datum/ui_state/contained_state, new)
|
||||
if(!src_object.contains(user))
|
||||
return STATUS_CLOSE
|
||||
return user.shared_ui_interaction(src_object)
|
||||
|
||||
/atom/proc/contains(atom/location)
|
||||
if(!location)
|
||||
return FALSE
|
||||
if(location == src)
|
||||
return TRUE
|
||||
|
||||
return contains(location.loc)
|
||||
|
||||
@@ -45,6 +45,9 @@ GLOBAL_DATUM_INIT(default_state, /datum/ui_state/default, new)
|
||||
return STATUS_INTERACTIVE
|
||||
return STATUS_CLOSE
|
||||
|
||||
/mob/living/simple_animal/revenant/default_can_use_topic(src_object)
|
||||
return STATUS_UPDATE
|
||||
|
||||
/mob/living/simple_animal/default_can_use_topic(src_object)
|
||||
. = shared_ui_interaction(src_object)
|
||||
if(. > STATUS_CLOSE)
|
||||
@@ -56,3 +59,8 @@ GLOBAL_DATUM_INIT(default_state, /datum/ui_state/default, new)
|
||||
return STATUS_INTERACTIVE
|
||||
else
|
||||
return ..()
|
||||
|
||||
/mob/dead/observer/default_can_use_topic()
|
||||
if(can_admin_interact())
|
||||
return STATUS_INTERACTIVE // Admins are more equal
|
||||
return STATUS_UPDATE // Ghosts can view updates
|
||||
|
||||
@@ -19,6 +19,9 @@ GLOBAL_DATUM_INIT(hands_state, /datum/ui_state/hands_state, new)
|
||||
return STATUS_INTERACTIVE
|
||||
return STATUS_CLOSE
|
||||
|
||||
/mob/living/simple_animal/revenant/hands_can_use_topic(src_object)
|
||||
return STATUS_UPDATE
|
||||
|
||||
/mob/living/silicon/robot/hands_can_use_topic(src_object)
|
||||
if(activated(src_object))
|
||||
return STATUS_INTERACTIVE
|
||||
|
||||
@@ -14,6 +14,9 @@ GLOBAL_DATUM_INIT(physical_state, /datum/ui_state/physical, new)
|
||||
/mob/proc/physical_can_use_topic(src_object)
|
||||
return STATUS_CLOSE
|
||||
|
||||
/mob/living/simple_animal/revenant/physical_can_use_topic(src_object)
|
||||
return STATUS_UPDATE
|
||||
|
||||
/mob/living/physical_can_use_topic(src_object)
|
||||
return shared_living_ui_distance(src_object)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user