Machine var shim (#18644)

* removal of machine var

* shimsham

* deprecation warnings

* COMSIG_LIVING_HANDLE_VISION signal

* improved

* more cleanup

* more fixes

* this is fine

* fixed radios

* notices for now, tgui fix

* cleaned up hud and vision parent calls, adds COMSIG_LIVING_HANDLE_HUD

* radios use tgui now

* guestpass does not need machine anymore

* cloning machine doesn't use it

* this arcade machine is tgui too

* autolathe does not need machine

* remaining cleanup

* doc fix

* fix

* logout handling

---------

Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
Will
2025-10-27 02:06:29 -04:00
committed by GitHub
co-authored by Cameron Lennox
parent cccd2280a7
commit 1dfae07494
63 changed files with 304 additions and 221 deletions
+2 -2
View File
@@ -987,8 +987,8 @@
wearer_move_delay = world.time
return wearer.buckled.relaymove(wearer, direction)
if(istype(wearer.machine, /obj/machinery))
if(wearer.machine.relaymove(wearer, direction))
if(istype(wearer.get_current_machine(), /obj/machinery))
if(wearer.get_current_machine().relaymove(wearer, direction))
return
if(wearer.pulledby || wearer.buckled) // Wheelchair driving!
-1
View File
@@ -235,7 +235,6 @@
if(paicard)
ejectpai(user)
return
user.set_machine(src)
tgui_interact(user)
/*******************
-2
View File
@@ -82,8 +82,6 @@
/obj/machinery/computer/HolodeckControl/attack_hand(var/mob/user as mob)
if(..())
return
user.set_machine(src)
tgui_interact(user)
/**
@@ -175,7 +175,6 @@
if(..())
return TRUE
ui.user.set_machine(src)
add_fingerprint(ui.user)
switch(action)
-1
View File
@@ -216,7 +216,6 @@
wires.Interact(user)
if(lockdown)
return
user.set_machine(src)
tgui_interact(user)
/obj/machinery/seed_storage/tgui_interact(mob/user, datum/tgui/ui)
-1
View File
@@ -201,7 +201,6 @@
/mob/living/bot/cleanbot/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
if(..())
return TRUE
ui.user.set_machine(src)
add_fingerprint(ui.user)
switch(action)
if("start")
-1
View File
@@ -269,7 +269,6 @@
if(..())
return TRUE
ui.user.set_machine(src)
add_fingerprint(ui.user)
. = TRUE
+10 -8
View File
@@ -89,8 +89,7 @@
return 1
/mob/living/carbon/alien/handle_regular_hud_updates()
/mob/living/carbon/alien/handle_vision()
if (stat == 2 || (XRAY in src.mutations))
sight |= SEE_TURFS
sight |= SEE_MOBS
@@ -104,6 +103,14 @@
see_in_dark = 2
see_invisible = SEE_INVISIBLE_LIVING
// Call parent to handle signals
..()
/mob/living/carbon/alien/handle_regular_hud_updates()
. = ..()
if(!.)
return
if (healths)
if (stat != 2)
switch(health)
@@ -124,8 +131,7 @@
else
healths.icon_state = "health7"
if (client)
client.screen.Remove(GLOB.global_hud.blurry,GLOB.global_hud.druggy,GLOB.global_hud.vimpaired)
client.screen.Remove(GLOB.global_hud.blurry,GLOB.global_hud.druggy,GLOB.global_hud.vimpaired)
if ( stat != 2)
if ((blinded))
@@ -135,10 +141,6 @@
set_fullscreen(disabilities & NEARSIGHTED, "impaired", /atom/movable/screen/fullscreen/impaired, 1)
set_fullscreen(eye_blurry, "blurry", /atom/movable/screen/fullscreen/blurry)
set_fullscreen(druggy, "high", /atom/movable/screen/fullscreen/high)
if(machine && machine.check_eye(src) < 0)
reset_perspective()
return 1
/mob/living/carbon/alien/handle_environment(var/datum/gas_mixture/environment)
// Both alien subtypes survive in vaccum and suffer in high temperatures,
+14 -24
View File
@@ -152,22 +152,30 @@
return 1
/mob/living/carbon/brain/handle_regular_hud_updates()
if (stat == 2 || (XRAY in src.mutations))
/mob/living/carbon/brain/handle_vision()
if (stat == DEAD || (XRAY in src.mutations))
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
else if (stat != 2)
else if (stat != DEAD)
sight &= ~SEE_TURFS
sight &= ~SEE_MOBS
sight &= ~SEE_OBJS
see_in_dark = 2
see_invisible = SEE_INVISIBLE_LIVING
// Call parent to handle signals
..()
/mob/living/carbon/brain/handle_regular_hud_updates()
. = ..()
if(!.)
return
if (healths)
if (stat != 2)
if (stat != DEAD)
switch(health)
if(100 to INFINITY)
healths.icon_state = "health0"
@@ -186,22 +194,9 @@
else
healths.icon_state = "health7"
if (stat == 2 || (XRAY in src.mutations))
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
else if (stat != 2)
sight &= ~SEE_TURFS
sight &= ~SEE_MOBS
sight &= ~SEE_OBJS
see_in_dark = 2
see_invisible = SEE_INVISIBLE_LIVING
if (client)
client.screen.Remove(GLOB.global_hud.blurry,GLOB.global_hud.druggy,GLOB.global_hud.vimpaired)
client.screen.Remove(GLOB.global_hud.blurry,GLOB.global_hud.druggy,GLOB.global_hud.vimpaired)
if (stat != 2)
if (stat != DEAD)
if ((blinded))
overlay_fullscreen("blind", /atom/movable/screen/fullscreen/blind)
else
@@ -209,8 +204,3 @@
set_fullscreen(disabilities & NEARSIGHTED, "impaired", /atom/movable/screen/fullscreen/impaired, 1)
set_fullscreen(eye_blurry, "blurry", /atom/movable/screen/fullscreen/blurry)
set_fullscreen(druggy, "high", /atom/movable/screen/fullscreen/high)
if (machine && machine.check_eye(src) < 0)
reset_perspective()
return 1
+7 -15
View File
@@ -1431,11 +1431,9 @@
handle_hud_list()
// now handle what we see on our screen
if(!client)
return 0
..()
. = ..()
if(!.)
return
client.screen.Remove(GLOB.global_hud.blurry, GLOB.global_hud.druggy, GLOB.global_hud.vimpaired, GLOB.global_hud.darkMask, GLOB.global_hud.nvg, GLOB.global_hud.thermal, GLOB.global_hud.meson, GLOB.global_hud.science, GLOB.global_hud.material, GLOB.global_hud.whitense)
@@ -1730,17 +1728,11 @@
if(!seer && !glasses_processed && seedarkness)
see_invisible = see_invisible_default
if(machine)
var/viewflags = machine.check_eye(src)
if(viewflags < 0)
reset_perspective()
else if(viewflags && !is_remote_viewing())
sight |= viewflags
else
machine.apply_visual(src)
else if(eyeobj && eyeobj.owner != src)
if(!get_current_machine() && eyeobj && eyeobj.owner != src)
reset_perspective()
return 1
// Call parent to handle signals
..()
/mob/living/carbon/human/proc/process_glasses(var/obj/item/clothing/glasses/G)
. = FALSE
+3 -6
View File
@@ -232,15 +232,12 @@
adjustEarDamage(-0.05,-1)
/mob/living/handle_regular_hud_updates()
if(!client)
return 0
..()
. = ..()
if(!.)
return
handle_darksight()
handle_hud_icons()
return 1
/mob/living/proc/update_sight()
if(!seedarkness)
see_invisible = SEE_INVISIBLE_NOLIGHTING
+1 -1
View File
@@ -34,7 +34,7 @@ var/list/ai_verbs_default = list(
var/is_in_use = 0
if (subject!=null)
for(var/mob/living/silicon/ai/M as anything in GLOB.ai_list)
if ((M.client && M.machine == subject))
if ((M.client && M.check_current_machine(subject)))
is_in_use = 1
subject.attack_ai(M)
return is_in_use
@@ -390,6 +390,9 @@
/mob/living/silicon/pai/handle_regular_hud_updates()
. = ..()
if(!.)
return
if(healths)
if(stat != DEAD)
var/heal_per = (health / getMaxHealth()) * 100
+10 -8
View File
@@ -149,9 +149,10 @@
else
blinded = 1
return 1
// Call parent to handle signals
. = ..()
/mob/living/silicon/robot/handle_regular_hud_updates()
/mob/living/silicon/robot/handle_vision()
var/fullbright = FALSE
var/seemeson = FALSE
var/seejanhud = sight_mode & BORGJAN
@@ -211,8 +212,14 @@
plane_holder.set_vis(VIS_MESONS,seemeson)
plane_holder.set_vis(VIS_JANHUD,seejanhud)
// Call parent to handle signals
..()
/mob/living/silicon/robot/handle_regular_hud_updates()
. = ..()
if(!.)
return
if (healths)
if (stat != 2)
if(istype(src,/mob/living/silicon/robot/drone))
@@ -249,7 +256,7 @@
else
healths.icon_state = "health7"
if (syndicate && client)
if (syndicate)
for(var/datum/mind/tra in traitors.current_antagonists)
if(tra.current)
// TODO: Update to new antagonist system.
@@ -292,16 +299,11 @@
set_fullscreen(eye_blurry, "blurry", /atom/movable/screen/fullscreen/blurry)
set_fullscreen(druggy, "high", /atom/movable/screen/fullscreen/high)
if (machine && machine.check_eye(src) < 0)
reset_perspective()
if(emagged)
throw_alert("hacked", /atom/movable/screen/alert/hacked)
else
clear_alert("hacked")
return 1
/mob/living/silicon/robot/proc/update_cell()
if(cell)
var/cellcharge = cell.charge/cell.maxcharge
@@ -171,7 +171,7 @@
forceMove(get_turf(host))
machine = null
unset_machine()
if(ishuman(host))
var/mob/living/carbon/human/H = host
@@ -179,7 +179,7 @@
if(head)
head.implants -= src
host.machine = null
host.unset_machine()
host = null
/mob/living/simple_mob/animal/borer/proc/request_player()
-1
View File
@@ -69,7 +69,6 @@
var/list/logging = list()
var/already_placed = 0.0
var/obj/machinery/machine = null
var/other_mobs = null
var/memory = ""
var/poll_answer = 0.0
+10 -5
View File
@@ -555,7 +555,7 @@ var/list/intents = list(I_HELP,I_DISARM,I_GRAB,I_HURT)
say_dead_direct(span_name("[name]") + " no longer [pick("skulks","lurks","prowls","creeps","stalks")] in the realm of the dead. [message]")
/mob/proc/switch_to_camera(var/obj/machinery/camera/C)
if (!C.can_use() || stat || (get_dist(C, src) > 1 || machine != src || blinded || !canmove))
if (!C.can_use() || stat || (get_dist(C, src) > 1 || !check_current_machine(src) || blinded || !canmove))
return 0
check_eye(src)
return 1
@@ -712,13 +712,18 @@ var/list/global/organ_rel_size = list(
/mob/proc/recalculate_vis()
return
//General HUD updates done regularly (health puppet things, etc)
/// General HUD updates done regularly (health puppet things, etc). Returns true if the mob has a client.
/mob/proc/handle_regular_hud_updates()
return
SHOULD_CALL_PARENT(TRUE)
if(!client)
return FALSE
SEND_SIGNAL(src,COMSIG_LIVING_HANDLE_HUD)
return TRUE
//Handle eye things like the Byond SEE_TURFS, SEE_OBJS, etc.
/// Handle eye things like the Byond SEE_TURFS, SEE_OBJS, etc.
/mob/proc/handle_vision()
return
SHOULD_CALL_PARENT(TRUE)
SEND_SIGNAL(src,COMSIG_LIVING_HANDLE_VISION)
//Icon is used to occlude things like huds from the faulty byond context menu.
// http://www.byond.com/forum/?post=2336679
+3 -2
View File
@@ -214,8 +214,9 @@
return
// Relaymove could handle it
if(my_mob.machine)
var/result = my_mob.machine.relaymove(my_mob, direct)
var/obj/machine = my_mob.get_current_machine()
if(machine)
var/result = machine.relaymove(my_mob, direct)
if(result)
return result
+1 -1
View File
@@ -93,7 +93,7 @@ somewhere on that shuttle. Subtypes of these can be then used to perform ship ov
user.reset_perspective()
/obj/machinery/computer/ship/check_eye(var/mob/user)
if(!get_dist(user, src) > 1 || user.blinded || !linked)
if(user.blinded || !linked)
user.reset_perspective()
return -1
else
-2
View File
@@ -36,8 +36,6 @@ GLOBAL_LIST_EMPTY(adminfaxes) //cache for faxes that have been sent to admins
GLOB.alldepartments |= department
/obj/machinery/photocopier/faxmachine/attack_hand(mob/user as mob)
user.set_machine(src)
tgui_interact(user)
/obj/machinery/photocopier/faxmachine/verb/remove_card()
-2
View File
@@ -31,8 +31,6 @@
return attack_hand(user)
/obj/machinery/photocopier/attack_hand(mob/user as mob)
user.set_machine(src)
tgui_interact(user)
/obj/machinery/photocopier/tgui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui)
-2
View File
@@ -432,9 +432,7 @@
if(id_check(user, 2))
to_chat(user, span_notice("You put the ID into \the [src]'s slot."))
add_overlay("pda-id")
updateSelfDialog()//Update self dialog on success.
return //Return in case of failed check or when successful.
updateSelfDialog()//For the non-input related code.
else if(istype(C, /obj/item/paicard) && !src.pai)
user.drop_item(src)
pai = C
+1 -1
View File
@@ -991,7 +991,7 @@ GLOBAL_LIST_INIT(possible_cable_coil_colours, list(
src.add_fingerprint(user)
CC.add_fingerprint(user)
spawn(0)
if (src && user.machine==src)
if (src && user.check_current_machine(src))
src.interact(user)
else
return
@@ -79,7 +79,6 @@
/obj/machinery/chem_master/attack_hand(mob/user as mob)
if(stat & BROKEN)
return
user.set_machine(src)
tgui_interact(user)
/obj/machinery/chem_master/ui_assets(mob/user)
@@ -396,7 +395,6 @@
return TRUE
add_fingerprint(ui.user)
ui.user.set_machine(src)
. = TRUE
switch(action)
@@ -16,7 +16,7 @@
default_apply_parts()
/obj/machinery/smart_centrifuge/attackby(var/obj/item/O as obj, var/mob/user as mob)
if(in_use)
if(working)
to_chat(user, "<span class='notice'>\The [src] is still spinning.</span>")
return
if(default_deconstruction_screwdriver(user, O))
-1
View File
@@ -117,7 +117,6 @@
return attack_hand(user)
/obj/machinery/computer/transhuman/resleeving/attack_hand(mob/user as mob)
user.set_machine(src)
add_fingerprint(user)
if(stat & (BROKEN|NOPOWER))
+24 -18
View File
@@ -1,8 +1,9 @@
/client/verb/tcssave()
set hidden = 1
if(mob.machine || issilicon(mob))
if((istype(mob.machine, /obj/machinery/computer/telecomms/traffic) && (mob.machine in view(1, mob))) || issilicon(mob))
var/obj/machinery/computer/telecomms/traffic/Machine = mob.machine
var/obj/machine = mob.get_current_machine()
if(machine || issilicon(mob))
if((istype(machine, /obj/machinery/computer/telecomms/traffic) && (machine in view(1, mob))) || issilicon(mob))
var/obj/machinery/computer/telecomms/traffic/Machine = machine
if(Machine.editingcode != mob)
return
@@ -27,9 +28,10 @@
/client/verb/tcscompile()
set hidden = 1
if(mob.machine || issilicon(mob))
if((istype(mob.machine, /obj/machinery/computer/telecomms/traffic) && (mob.machine in view(1, mob))) || (issilicon(mob) && istype(mob.machine, /obj/machinery/computer/telecomms/traffic) ))
var/obj/machinery/computer/telecomms/traffic/Machine = mob.machine
var/obj/machine = mob.get_current_machine()
if(machine || issilicon(mob))
if((istype(machine, /obj/machinery/computer/telecomms/traffic) && (machine in view(1, mob))) || (issilicon(mob) && istype(machine, /obj/machinery/computer/telecomms/traffic) ))
var/obj/machinery/computer/telecomms/traffic/Machine = machine
if(Machine.editingcode != mob)
return
@@ -78,9 +80,10 @@
/client/verb/tcsrun()
set hidden = 1
if(mob.machine || issilicon(mob))
if((istype(mob.machine, /obj/machinery/computer/telecomms/traffic) && (mob.machine in view(1, mob))) || (issilicon(mob) && istype(mob.machine, /obj/machinery/computer/telecomms/traffic) ))
var/obj/machinery/computer/telecomms/traffic/Machine = mob.machine
var/obj/machine = mob.get_current_machine()
if(machine || issilicon(mob))
if((istype(machine, /obj/machinery/computer/telecomms/traffic) && (machine in view(1, mob))) || (issilicon(mob) && istype(machine, /obj/machinery/computer/telecomms/traffic) ))
var/obj/machinery/computer/telecomms/traffic/Machine = machine
if(Machine.editingcode != mob)
return
@@ -144,9 +147,10 @@
/client/verb/exittcs()
set hidden = 1
if(mob.machine || issilicon(mob))
if((istype(mob.machine, /obj/machinery/computer/telecomms/traffic) && (mob.machine in view(1, mob))) || (issilicon(mob) && istype(mob.machine, /obj/machinery/computer/telecomms/traffic) ))
var/obj/machinery/computer/telecomms/traffic/Machine = mob.machine
var/obj/machine = mob.get_current_machine()
if(machine || issilicon(mob))
if((istype(machine, /obj/machinery/computer/telecomms/traffic) && (machine in view(1, mob))) || (issilicon(mob) && istype(machine, /obj/machinery/computer/telecomms/traffic) ))
var/obj/machinery/computer/telecomms/traffic/Machine = machine
if(Machine.editingcode == mob)
Machine.storedcode = "[winget(mob, "tcscode", "text")]"
Machine.editingcode = null
@@ -156,9 +160,10 @@
/client/verb/tcsrevert()
set hidden = 1
if(mob.machine || issilicon(mob))
if((istype(mob.machine, /obj/machinery/computer/telecomms/traffic) && (mob.machine in view(1, mob))) || (issilicon(mob) && istype(mob.machine, /obj/machinery/computer/telecomms/traffic) ))
var/obj/machinery/computer/telecomms/traffic/Machine = mob.machine
var/obj/machine = mob.get_current_machine()
if(machine || issilicon(mob))
if((istype(machine, /obj/machinery/computer/telecomms/traffic) && (machine in view(1, mob))) || (issilicon(mob) && istype(machine, /obj/machinery/computer/telecomms/traffic) ))
var/obj/machinery/computer/telecomms/traffic/Machine = machine
if(Machine.editingcode != mob)
return
@@ -185,9 +190,10 @@
/client/verb/tcsclearmem()
set hidden = 1
if(mob.machine || issilicon(mob))
if((istype(mob.machine, /obj/machinery/computer/telecomms/traffic) && (mob.machine in view(1, mob))) || (issilicon(mob) && istype(mob.machine, /obj/machinery/computer/telecomms/traffic) ))
var/obj/machinery/computer/telecomms/traffic/Machine = mob.machine
var/obj/machine = mob.get_current_machine()
if(machine || issilicon(mob))
if((istype(machine, /obj/machinery/computer/telecomms/traffic) && (machine in view(1, mob))) || (issilicon(mob) && istype(machine, /obj/machinery/computer/telecomms/traffic) ))
var/obj/machinery/computer/telecomms/traffic/Machine = machine
if(Machine.editingcode != mob)
return
+1 -1
View File
@@ -342,7 +342,7 @@
return 1
if (!usr || (!(usr in range(1, src)) && iscarbon(usr)))
usr.machine = src
usr.set_machine(src)
src.add_fingerprint(usr)
src.updateUsrDialog(usr)
+1 -1
View File
@@ -177,7 +177,7 @@
if(!current_uav)
return
if(user.machine != tgui_host())
if(!user.check_current_machine(tgui_host()))
user.set_machine(tgui_host())
current_uav.add_master(user)
LAZYDISTINCTADD(viewers, WEAKREF(user))
+1 -1
View File
@@ -31,7 +31,7 @@
/datum/tgui_module/ship/tgui_status(mob/user)
. = ..()
if(viewing_overmap(user) && (user.machine != src))
if(viewing_overmap(user) && (!user.check_current_machine(src)))
user.reset_perspective()
/datum/tgui_module/ship/tgui_close(mob/user)
+3
View File
@@ -175,6 +175,9 @@
if(user.client)
terminate_byondui_elements()
// Unset machine just to be sure.
user.unset_machine()
state = null
if(parent_ui)
parent_ui.children -= src
@@ -285,7 +285,7 @@
if(inserted_battery.battery_effect.effect == EFFECT_TOUCH)
var/list/nearby = viewers(1, src)
for(var/mob/M in nearby)
if(M.machine == src)
if(M.check_current_machine(src))
inserted_battery.battery_effect.DoEffectTouch(M)
//if there's no charge left, finish