[MIRROR] Machine var shim (#11878)

Co-authored-by: Will <7099514+Willburd@users.noreply.github.com>
Co-authored-by: C.L. <killer65311@gmail.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-10-26 23:35:27 -07:00
committed by GitHub
parent 61146ef685
commit 4099a9435b
63 changed files with 307 additions and 224 deletions

View File

@@ -123,7 +123,6 @@
/obj/effect/mine/interact(mob/living/user as mob)
if(!panel_open || isAI(user))
return
user.set_machine(src)
wires.Interact(user)
/obj/effect/mine/camo

View File

@@ -91,7 +91,6 @@
/obj/item/radio/headset/attackby(obj/item/W as obj, mob/user as mob)
// ..()
user.set_machine(src)
if(!(W.has_tool_quality(TOOL_SCREWDRIVER) || istype(W, /obj/item/encryptionkey)))
return

View File

@@ -116,7 +116,6 @@
return
/obj/item/radio/attack_self(mob/user as mob)
user.set_machine(src)
interact(user)
/obj/item/radio/interact(mob/user)
@@ -588,7 +587,6 @@ GLOBAL_DATUM(autospeaker, /mob/living/silicon/ai/announcer)
/obj/item/radio/attackby(obj/item/W as obj, mob/user as mob)
..()
user.set_machine(src)
if (!W.has_tool_quality(TOOL_SCREWDRIVER))
return
b_stat = !( b_stat )
@@ -643,7 +641,6 @@ GLOBAL_DATUM(autospeaker, /mob/living/silicon/ai/announcer)
/obj/item/radio/borg/attackby(obj/item/W as obj, mob/user as mob)
// ..()
user.set_machine(src)
if (!(W.has_tool_quality(TOOL_SCREWDRIVER) || istype(W, /obj/item/encryptionkey)))
return

View File

@@ -126,7 +126,7 @@
if(camera.status && !isturf(target))
show_tvs(target)
user.visible_message(span_infoplain(span_bold("[user]") + " aims [src] at [target]."), span_info("You aim [src] at [target]."))
if(user.machine == src)
if(user.check_current_machine(src))
show_ui(user) // refresh the UI
/obj/item/tvcamera/process()

View File

@@ -48,7 +48,7 @@
AddElement(/datum/element/sellable/material_stack)
/obj/item/stack/Destroy()
if (src && usr && usr.machine == src)
if (src && usr && usr.check_current_machine(src))
usr << browse(null, "window=stack")
if(islist(synths))
synths.Cut()
@@ -423,7 +423,7 @@
src.add_fingerprint(user)
F.add_fingerprint(user)
spawn(0)
if (src && user.machine==src)
if (src && user.check_current_machine(src))
src.interact(user)
else
..()
@@ -439,9 +439,9 @@
src.transfer_to(S)
spawn(0) //give the stacks a chance to delete themselves if necessary
if (S && user.machine==S)
if (S && user.check_current_machine(S))
S.interact(user)
if (src && user.machine==src)
if (src && user.check_current_machine(src))
src.interact(user)
else
return ..()

View File

@@ -8,6 +8,7 @@
density = TRUE
opacity = 0
anchored = TRUE
flags = REMOTEVIEW_ON_ENTER
var/ready = 1
var/malfunction = 0
@@ -41,7 +42,6 @@
dat += span_bold("Implants:") + " [src.implant_list.len ? "[implant_list.len]" : "<A href='byond://?src=\ref[src];replenish=1'>Replenish</A>"]<BR>"
if(src.occupant)
dat += "[src.ready ? "<A href='byond://?src=\ref[src];implant=1'>Implant</A>" : "Recharging"]<BR>"
user.set_machine(src)
var/datum/browser/popup = new(user, "implant", "Implant")
popup.set_content(dat)

View File

@@ -99,65 +99,10 @@
else
return null
/obj/proc/updateUsrDialog(mob/user)
if(in_use)
var/is_in_use = 0
var/list/nearby = viewers(1, src)
for(var/mob/M in nearby)
if ((M.client && M.machine == src))
is_in_use = 1
src.attack_hand(M)
if (isAI(user) || isrobot(user))
if (!(user in nearby))
if (user.client && user.machine==src) // && M.machine == src is omitted because if we triggered this by using the dialog, it doesn't matter if our machine changed in between triggering it and this - the dialog is probably still supposed to refresh.
is_in_use = 1
src.attack_ai(user)
// check for TK users
if (ishuman(user))
var/mob/living/carbon/human/H = user
if(H.get_type_in_hands(/obj/item/tk_grab))
if(!(H in nearby))
if(H.client && H.machine==src)
is_in_use = 1
src.attack_hand(H)
in_use = is_in_use
/obj/proc/updateDialog()
// Check that people are actually using the machine. If not, don't update anymore.
if(in_use)
var/list/nearby = viewers(1, src)
var/is_in_use = 0
for(var/mob/M in nearby)
if ((M.client && M.machine == src))
is_in_use = 1
src.interact(M)
var/ai_in_use = AutoUpdateAI(src)
if(!ai_in_use && !is_in_use)
in_use = 0
/obj/attack_ghost(mob/user)
tgui_interact(user)
..()
/mob/proc/unset_machine()
machine?.remove_visual(src)
src.machine = null
/mob/proc/set_machine(var/obj/O)
if(src.machine)
unset_machine()
src.machine = O
if(istype(O))
O.in_use = 1
/obj/item/proc/updateSelfDialog()
var/mob/M = src.loc
if(istype(M) && M.client && M.machine == src)
src.attack_self(M)
/obj/proc/hide(h)
return