tgui usr to ui.user

This commit is contained in:
Kashargul
2024-11-13 00:49:17 +01:00
parent 49d89c0059
commit 32c9f971bc
120 changed files with 1037 additions and 1061 deletions
@@ -97,17 +97,17 @@
switch(action)
// Actual assembly actions
if("rename")
rename(usr)
rename(ui.user)
return TRUE
if("remove_cell")
if(!battery)
to_chat(usr, span_warning("There's no power cell to remove from \the [src]."))
to_chat(ui.user, span_warning("There's no power cell to remove from \the [src]."))
return FALSE
var/turf/T = get_turf(src)
battery.forceMove(T)
playsound(T, 'sound/items/Crowbar.ogg', 50, 1)
to_chat(usr, span_notice("You pull \the [battery] out of \the [src]'s power supplier."))
to_chat(ui.user, span_notice("You pull \the [battery] out of \the [src]'s power supplier."))
battery = null
return TRUE
@@ -158,14 +158,14 @@
var/obj/item/integrated_circuit/C = locate(params["ref"]) in contents
if(!istype(C))
return
C.tgui_interact(usr, null, ui)
C.tgui_interact(ui.user, null, ui)
return TRUE
if("remove_circuit")
var/obj/item/integrated_circuit/C = locate(params["ref"]) in contents
if(!istype(C))
return
C.remove(usr)
C.remove(ui.user)
return TRUE
return FALSE
@@ -149,12 +149,12 @@ a creative player the means to solve many problems. Circuits are held inside an
if(params["link"])
linked = locate(params["link"]) in pin.linked
var/obj/held_item = usr.get_active_hand()
var/obj/held_item = ui.user.get_active_hand()
. = TRUE
switch(action)
if("rename")
rename_component(usr)
rename_component(ui.user)
return
if("wire", "pin_name", "pin_data", "pin_unwire")
@@ -162,37 +162,37 @@ a creative player the means to solve many problems. Circuits are held inside an
var/obj/item/multitool/M = held_item
switch(action)
if("pin_name")
M.wire(pin, usr)
M.wire(pin, ui.user)
if("pin_data")
var/datum/integrated_io/io = pin
io.ask_for_pin_data(usr, held_item) // The pins themselves will determine how to ask for data, and will validate the data.
io.ask_for_pin_data(ui.user, held_item) // The pins themselves will determine how to ask for data, and will validate the data.
if("pin_unwire")
M.unwire(pin, linked, usr)
M.unwire(pin, linked, ui.user)
else if(istype(held_item, /obj/item/integrated_electronics/wirer))
var/obj/item/integrated_electronics/wirer/wirer = held_item
if(linked)
wirer.wire(linked, usr)
wirer.wire(linked, ui.user)
else if(pin)
wirer.wire(pin, usr)
wirer.wire(pin, ui.user)
else if(istype(held_item, /obj/item/integrated_electronics/debugger))
var/obj/item/integrated_electronics/debugger/debugger = held_item
if(pin)
debugger.write_data(pin, usr)
debugger.write_data(pin, ui.user)
else
to_chat(usr, span_warning("You can't do a whole lot without the proper tools."))
to_chat(ui.user, span_warning("You can't do a whole lot without the proper tools."))
return
if("scan")
if(istype(held_item, /obj/item/integrated_electronics/debugger))
var/obj/item/integrated_electronics/debugger/D = held_item
if(D.accepting_refs)
D.afterattack(src, usr, TRUE)
D.afterattack(src, ui.user, TRUE)
else
to_chat(usr, span_warning("The Debugger's 'ref scanner' needs to be on."))
to_chat(ui.user, span_warning("The Debugger's 'ref scanner' needs to be on."))
else
to_chat(usr, span_warning("You need a multitool/debugger set to 'ref' mode to do that."))
to_chat(ui.user, span_warning("You need a multitool/debugger set to 'ref' mode to do that."))
return
@@ -200,12 +200,12 @@ a creative player the means to solve many problems. Circuits are held inside an
var/obj/item/integrated_circuit/examined = locate(params["ref"])
if(istype(examined) && (examined.loc == loc))
if(ui.parent_ui)
examined.tgui_interact(usr, null, ui.parent_ui)
examined.tgui_interact(ui.user, null, ui.parent_ui)
else
examined.tgui_interact(usr)
examined.tgui_interact(ui.user)
if("remove")
remove(usr)
remove(ui.user)
return
return FALSE
@@ -183,7 +183,7 @@
if(..())
return TRUE
add_fingerprint(usr)
add_fingerprint(ui.user)
switch(action)
if("build")
@@ -209,15 +209,15 @@
return
if(!debug)
if(!Adjacent(usr))
to_chat(usr, span_notice("You are too far away from \the [src]."))
if(!Adjacent(ui.user))
to_chat(ui.user, span_notice("You are too far away from \the [src]."))
if(metal - cost < 0)
to_chat(usr, span_warning("You need [cost] metal to build that!."))
to_chat(ui.user, span_warning("You need [cost] metal to build that!."))
return 1
metal -= cost
var/obj/item/built = new build_type(get_turf(loc))
usr.put_in_hands(built)
to_chat(usr, span_notice("[capitalize(built.name)] printed."))
ui.user.put_in_hands(built)
to_chat(ui.user, span_notice("[capitalize(built.name)] printed."))
playsound(src, 'sound/items/jaws_pry.ogg', 50, TRUE)
return TRUE