Fixes the exosuit mounted autolathe. (#18440)

* autolathe1

* cl

* Oops

* pay the price

---------

Co-authored-by: Matt Atlas <liermattia@gmail.com>
This commit is contained in:
Matt Atlas
2024-02-20 11:58:39 +00:00
committed by GitHub
co-authored by Matt Atlas
parent 60729d5a78
commit e063223199
71 changed files with 171 additions and 102 deletions
+1 -1
View File
@@ -119,7 +119,7 @@
* This is a proc over a var for memory reasons
*/
/datum/proc/ui_state(mob/user)
return default_state
return GLOB.default_state
/**
* global
+1 -1
View File
@@ -119,7 +119,7 @@
return ..()
/// NanoUI compat, remove when done
/datum/proc/CanUseTopic(mob/user, datum/ui_state/state = default_state)
/datum/proc/CanUseTopic(mob/user, datum/ui_state/state = GLOB.default_state)
var/datum/src_object = ui_host()
return state.can_use_topic(src_object, user)
+5 -5
View File
@@ -9,11 +9,11 @@
* Checks that the user has the correlating rights.
*/
/var/global/datum/ui_state/admin_state/admin_state = new(R_ADMIN)
/var/global/datum/ui_state/admin_state/moderator_state = new(R_MOD)
/var/global/datum/ui_state/admin_state/debug_state = new(R_DEBUG)
/var/global/datum/ui_state/admin_state/fun_state = new(R_FUN)
/var/global/datum/ui_state/admin_state/staff_state = new()
GLOBAL_DATUM_INIT(admin_state, /datum/ui_state/admin_state, new(R_ADMIN))
GLOBAL_DATUM_INIT(moderator_state, /datum/ui_state/admin_state, new(R_MOD))
GLOBAL_DATUM_INIT(debug_state, /datum/ui_state/admin_state, new(R_DEBUG))
GLOBAL_DATUM_INIT(fun_state, /datum/ui_state/admin_state, new(R_FUN))
GLOBAL_DATUM_INIT(staff_state, /datum/ui_state/admin_state, new)
/datum/ui_state/admin_state
var/rights_to_check = null
+1 -1
View File
@@ -9,7 +9,7 @@
* Always grants the user UI_INTERACTIVE. Period.
*/
var/global/datum/ui_state/always_state/always_state = new()
GLOBAL_DATUM_INIT(always_state, /datum/ui_state/always_state, new)
/datum/ui_state/always_state/can_use_topic(src_object, mob/user)
return UI_INTERACTIVE
+1 -1
View File
@@ -9,7 +9,7 @@
* Only checks if the user is conscious.
*/
var/global/datum/ui_state/conscious_state/conscious_state = new
GLOBAL_DATUM_INIT(conscious_state, /datum/ui_state/conscious_state, new)
/datum/ui_state/conscious_state/can_use_topic(src_object, mob/user)
if(user.stat == CONSCIOUS)
+1 -1
View File
@@ -9,7 +9,7 @@
* Checks that the user is inside the src_object.
*/
var/global/datum/ui_state/contained_state/contained_state = new
GLOBAL_DATUM_INIT(contained_state, /datum/ui_state/contained_state, new)
/datum/ui_state/contained_state/can_use_topic(atom/src_object, mob/user)
if(!src_object.contains(user))
+1 -1
View File
@@ -10,7 +10,7 @@
* (backpack, box, toolbox, etc) inventory.
*/
var/global/datum/ui_state/deep_inventory_state/deep_inventory_state = new
GLOBAL_DATUM_INIT(deep_inventory_state, /datum/ui_state/deep_inventory_state, new)
/datum/ui_state/deep_inventory_state/can_use_topic(src_object, mob/user)
if(!user.contains(src_object))
+1 -1
View File
@@ -10,7 +10,7 @@
* and view for robots.
*/
var/global/datum/ui_state/default/default_state = new
GLOBAL_DATUM_INIT(default_state, /datum/ui_state/default, new)
/datum/ui_state/default/can_use_topic(src_object, mob/user)
return user.default_can_use_topic(src_object) // Call the individual mob-overridden procs.
+1 -1
View File
@@ -9,7 +9,7 @@
* Checks that the src_object is in the user's hands.
*/
var/global/datum/ui_state/hands_state/hands_state = new
GLOBAL_DATUM_INIT(hands_state, /datum/ui_state/hands_state, new)
/datum/ui_state/hands_state/can_use_topic(src_object, mob/user)
. = user.shared_ui_interaction(src_object)
+24
View File
@@ -0,0 +1,24 @@
/*!
* Copyright (c) 2020 Aleksej Komarov
* SPDX-License-Identifier: MIT
*/
/**
* tgui state: heavy_vehicle
*
* Checks that the user is inside a mech, that the mech is powered and is the right one.
*
*/
GLOBAL_DATUM_INIT(heavy_vehicle_state, /datum/ui_state/heavy_vehicle, new)
/datum/ui_state/heavy_vehicle/can_use_topic(src_object, mob/user)
. = user.shared_ui_interaction(src_object)
if(!istype(src_object, /obj/item/mecha_equipment))
return
var/obj/item/mecha_equipment/mecha_equip = src_object
if(ismech(user.loc))
var/mob/living/heavy_vehicle/mech = user.loc
if(mecha_equip.owner == mech && mech.power == MECH_POWER_ON)
return UI_INTERACTIVE
+1 -1
View File
@@ -10,7 +10,7 @@
* human adjacent user.
*/
var/global/datum/ui_state/human_adjacent_state/human_adjacent_state = new
GLOBAL_DATUM_INIT(human_adjacent_state, /datum/ui_state/human_adjacent_state, new)
/datum/ui_state/human_adjacent_state/can_use_topic(src_object, mob/user)
. = user.default_can_use_topic(src_object)
@@ -5,7 +5,7 @@
* human adjacent user.
*/
var/global/datum/ui_state/human_adjacent_loc_state/human_adjacent_loc_state = new
GLOBAL_DATUM_INIT(human_adjacent_loc_state, /datum/ui_state/human_adjacent_loc_state, new)
/datum/ui_state/human_adjacent_loc_state/can_use_topic(src_object, mob/user)
var/turf/src_object_turf = get_turf(src_object)
+1 -1
View File
@@ -10,7 +10,7 @@
* (hand, ear, pocket, belt, etc) inventory.
*/
var/global/datum/ui_state/inventory_state/inventory_state = new
GLOBAL_DATUM_INIT(inventory_state, /datum/ui_state/inventory_state, new)
/datum/ui_state/inventory_state/can_use_topic(src_object, mob/user)
if(!(src_object in user))
+2 -2
View File
@@ -6,10 +6,10 @@
/**
* tgui state: never_state
*
* Always closes the UI, no matter what. See the ui_state in religious_tool.dm to see an example
* Always closes the UI, no matter what.
*/
var/global/datum/ui_state/never_state/never_state = new
GLOBAL_DATUM_INIT(never_state, /datum/ui_state/never_state, new)
/datum/ui_state/never_state/can_use_topic(src_object, mob/user)
return UI_CLOSE
+1 -1
View File
@@ -4,7 +4,7 @@
* Checks that the user is a /mob/dead/new_player
*/
var/global/datum/ui_state/new_player_state/new_player_state = new
GLOBAL_DATUM_INIT(new_player_state, /datum/ui_state/new_player_state, new)
/datum/ui_state/new_player_state/can_use_topic(src_object, mob/user)
return isnewplayer(user) ? UI_INTERACTIVE : UI_CLOSE
@@ -9,7 +9,7 @@
* Checks that the user isn't incapacitated
*/
var/global/datum/ui_state/not_incapacitated_state/not_incapacitated_state = new
GLOBAL_DATUM_INIT(not_incapacitated_state, /datum/ui_state/not_incapacitated_state, new)
/**
* tgui state: not_incapacitated_turf_state
+1 -1
View File
@@ -10,7 +10,7 @@
* default checks.
*/
var/global/datum/ui_state/notcontained_state/notcontained_state = new
GLOBAL_DATUM_INIT(notcontained_state, /datum/ui_state/notcontained_state, new)
/datum/ui_state/notcontained_state/can_use_topic(atom/src_object, mob/user)
. = user.shared_ui_interaction(src_object)
+1 -1
View File
@@ -9,7 +9,7 @@
* Checks that the user is an observer/ghost.
*/
var/global/datum/ui_state/observer_state/observer_state = new
GLOBAL_DATUM_INIT(observer_state, /datum/ui_state/observer_state, new)
/datum/ui_state/observer_state/can_use_topic(src_object, mob/user)
if(isobserver(user))
+1 -1
View File
@@ -9,7 +9,7 @@
* Short-circuits the default state to only check physical distance.
*/
var/global/datum/ui_state/physical/physical_state = new
GLOBAL_DATUM_INIT(physical_state, /datum/ui_state/physical, new)
/datum/ui_state/physical/can_use_topic(src_object, mob/user)
. = user.shared_ui_interaction(src_object)
@@ -10,7 +10,7 @@
* Checks if src_object is inside of user.
*/
var/global/datum/ui_state/reverse_contained_state/reverse_contained_state = new
GLOBAL_DATUM_INIT(reverse_contained_state, /datum/ui_state/reverse_contained_state, new)
/datum/ui_state/reverse_contained_state/can_use_topic(atom/src_object, mob/user)
if(!user.contains(src_object))
+1 -1
View File
@@ -9,7 +9,7 @@
* Only checks that the user and src_object are the same.
*/
var/global/datum/ui_state/self_state/self_state = new
GLOBAL_DATUM_INIT(self_state, /datum/ui_state/self_state, new)
/datum/ui_state/self_state/can_use_topic(src_object, mob/user)
if(src_object != user)
+1 -1
View File
@@ -9,7 +9,7 @@
* Only checks that the Z-level of the user and src_object are the same.
*/
var/global/datum/ui_state/z_state/z_state = new
GLOBAL_DATUM_INIT(z_state, /datum/ui_state/z_state, new)
/datum/ui_state/z_state/can_use_topic(src_object, mob/user)
var/turf/turf_obj = get_turf(src_object)