mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-24 12:37:50 +01:00
tgui usr to ui.user
This commit is contained in:
+10
-10
@@ -565,7 +565,7 @@ GLOBAL_LIST_EMPTY(apcs)
|
||||
if(do_after(user, 20))
|
||||
if(C.get_amount() >= 10 && !terminal && opened && has_electronics != APC_HAS_ELECTRONICS_SECURED)
|
||||
var/obj/structure/cable/N = T.get_cable_node()
|
||||
if(prob(50) && electrocute_mob(usr, N, N))
|
||||
if(prob(50) && electrocute_mob(user, N, N))
|
||||
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
|
||||
s.set_up(5, 1, src)
|
||||
s.start()
|
||||
@@ -587,11 +587,11 @@ GLOBAL_LIST_EMPTY(apcs)
|
||||
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
if(do_after(user, 50 * W.toolspeed))
|
||||
if(terminal && opened && has_electronics != APC_HAS_ELECTRONICS_SECURED)
|
||||
if(prob(50) && electrocute_mob(usr, terminal.powernet, terminal))
|
||||
if(prob(50) && electrocute_mob(user, terminal.powernet, terminal))
|
||||
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
|
||||
s.set_up(5, 1, src)
|
||||
s.start()
|
||||
if(usr.stunned)
|
||||
if(user.stunned)
|
||||
return
|
||||
new /obj/item/stack/cable_coil(loc,10)
|
||||
to_chat(user, span_notice("You cut the cables and dismantle the power terminal."))
|
||||
@@ -914,18 +914,18 @@ GLOBAL_LIST_EMPTY(apcs)
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/obj/machinery/power/apc/tgui_act(action, params)
|
||||
if(..() || !can_use(usr, TRUE))
|
||||
/obj/machinery/power/apc/tgui_act(action, params, datum/tgui/ui)
|
||||
if(..() || !can_use(ui.user, TRUE))
|
||||
return TRUE
|
||||
|
||||
// There's a handful of cases where we want to allow users to bypass the `locked` variable.
|
||||
// If can_admin_interact() wasn't only defined on observers, this could just be part of a single-line
|
||||
// conditional.
|
||||
var/locked_exception = FALSE
|
||||
if(issilicon(usr) || action == "nightshift")
|
||||
if(issilicon(ui.user) || action == "nightshift")
|
||||
locked_exception = TRUE
|
||||
if(isobserver(usr))
|
||||
var/mob/observer/dead/D = usr
|
||||
if(isobserver(ui.user))
|
||||
var/mob/observer/dead/D = ui.user
|
||||
if(D.can_admin_interact())
|
||||
locked_exception = TRUE
|
||||
|
||||
@@ -937,7 +937,7 @@ GLOBAL_LIST_EMPTY(apcs)
|
||||
if("lock")
|
||||
if(locked_exception) // Yay code reuse
|
||||
if(emagged || (stat & (BROKEN|MAINT)))
|
||||
to_chat(usr, "The APC does not respond to the command.")
|
||||
to_chat(ui.user, "The APC does not respond to the command.")
|
||||
return
|
||||
locked = !locked
|
||||
update_icon()
|
||||
@@ -947,7 +947,7 @@ GLOBAL_LIST_EMPTY(apcs)
|
||||
toggle_breaker()
|
||||
if("nightshift")
|
||||
if(last_nightshift_switch > world.time - 10 SECONDS) // don't spam...
|
||||
to_chat(usr, span_warning("[src]'s night lighting circuit breaker is still cycling!"))
|
||||
to_chat(ui.user, span_warning("[src]'s night lighting circuit breaker is still cycling!"))
|
||||
return 0
|
||||
last_nightshift_switch = world.time
|
||||
nightshift_setting = params["nightshift"]
|
||||
|
||||
@@ -261,14 +261,14 @@ GLOBAL_LIST_EMPTY(gravity_generators)
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/gravity_generator/main/tgui_act(action, params)
|
||||
/obj/machinery/gravity_generator/main/tgui_act(action, params, datum/tgui/ui)
|
||||
if((..()))
|
||||
return TRUE
|
||||
|
||||
switch(action)
|
||||
if("gentoggle")
|
||||
breaker = !breaker
|
||||
investigate_log("was toggled [breaker ? "<font color='green'>ON</font>" : "<font color='red'>OFF</font>"] by [key_name(usr)].", "gravity")
|
||||
investigate_log("was toggled [breaker ? "<font color='green'>ON</font>" : "<font color='red'>OFF</font>"] by [key_name(ui.user)].", "gravity")
|
||||
set_power()
|
||||
return TOPIC_REFRESH
|
||||
|
||||
|
||||
@@ -350,11 +350,11 @@
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/power/port_gen/pacman/tgui_act(action, params)
|
||||
/obj/machinery/power/port_gen/pacman/tgui_act(action, params, datum/tgui/ui)
|
||||
if(..())
|
||||
return
|
||||
|
||||
add_fingerprint(usr)
|
||||
add_fingerprint(ui.user)
|
||||
switch(action)
|
||||
if("toggle_power")
|
||||
TogglePower()
|
||||
|
||||
@@ -82,26 +82,26 @@
|
||||
part.strength = strength
|
||||
part.update_icon()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/add_strength(var/s)
|
||||
/obj/machinery/particle_accelerator/control_box/proc/add_strength(mob/user, var/s)
|
||||
if(assembled)
|
||||
strength++
|
||||
if(strength > strength_upper_limit)
|
||||
strength = strength_upper_limit
|
||||
else
|
||||
message_admins("PA Control Computer increased to [strength] by [key_name(usr, usr.client)][ADMIN_QUE(usr)] in [ADMIN_COORDJMP(src)]",0,1)
|
||||
log_game("PACCEL([x],[y],[z]) [key_name(usr)] increased to [strength]")
|
||||
investigate_log("increased to <font color='red'>[strength]</font> by [usr.key]","singulo")
|
||||
message_admins("PA Control Computer increased to [strength] by [key_name(user, user.client)][ADMIN_QUE(user)] in [ADMIN_COORDJMP(src)]",0,1)
|
||||
log_game("PACCEL([x],[y],[z]) [key_name(user)] increased to [strength]")
|
||||
investigate_log("increased to <font color='red'>[strength]</font> by [user.key]","singulo")
|
||||
strength_change()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/remove_strength(var/s)
|
||||
/obj/machinery/particle_accelerator/control_box/proc/remove_strength(mob/user, var/s)
|
||||
if(assembled)
|
||||
strength--
|
||||
if(strength < 0)
|
||||
strength = 0
|
||||
else
|
||||
message_admins("PA Control Computer decreased to [strength] by [key_name(usr, usr.client)][ADMIN_QUE(usr)] in [ADMIN_COORDJMP(src)]",0,1)
|
||||
log_game("PACCEL([x],[y],[z]) [key_name(usr)] decreased to [strength]")
|
||||
investigate_log("decreased to <font color='green'>[strength]</font> by [usr.key]","singulo")
|
||||
message_admins("PA Control Computer decreased to [strength] by [key_name(user, user.client)][ADMIN_QUE(user)] in [ADMIN_COORDJMP(src)]",0,1)
|
||||
log_game("PACCEL([x],[y],[z]) [key_name(user)] decreased to [strength]")
|
||||
investigate_log("decreased to <font color='green'>[strength]</font> by [user.key]","singulo")
|
||||
strength_change()
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/power_change()
|
||||
@@ -118,7 +118,7 @@
|
||||
//a part is missing!
|
||||
if( length(connected_parts) < 6 )
|
||||
log_game("PACCEL([x],[y],[z]) Failed due to missing parts.")
|
||||
investigate_log("lost a connected part; It <font color='red'>powered down</font>.","singulo")
|
||||
investigate_log("lost a connected part; It " + span_red("powered down") + ".","singulo")
|
||||
toggle_power()
|
||||
return
|
||||
//emit some particles
|
||||
@@ -181,11 +181,11 @@
|
||||
return 0
|
||||
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/proc/toggle_power()
|
||||
/obj/machinery/particle_accelerator/control_box/proc/toggle_power(mob/user)
|
||||
active = !active
|
||||
investigate_log("turned [active?"<font color='red'>ON</font>":"<font color='green'>OFF</font>"] by [usr ? usr.key : "outside forces"]","singulo")
|
||||
message_admins("PA Control Computer turned [active ?"ON":"OFF"] by [usr ? key_name(usr, usr.client) : "outside forces"][ADMIN_QUE(usr)] in [ADMIN_COORDJMP(src)]",0,1)
|
||||
log_game("PACCEL([x],[y],[z]) [usr ? key_name(usr, usr.client) : "outside forces"] turned [active?"ON":"OFF"].")
|
||||
investigate_log("turned [active?"<font color='red'>ON</font>":"<font color='green'>OFF</font>"] by [user ? user.key : "outside forces"]","singulo")
|
||||
message_admins("PA Control Computer turned [active ?"ON":"OFF"] by [user ? key_name(user, user.client) : "outside forces"][ADMIN_QUE(user)] in [ADMIN_COORDJMP(src)]",0,1)
|
||||
log_game("PACCEL([x],[y],[z]) [user ? key_name(user, user.client) : "outside forces"] turned [active?"ON":"OFF"].")
|
||||
if(active)
|
||||
update_use_power(USE_POWER_ACTIVE)
|
||||
for(var/obj/structure/particle_accelerator/part in connected_parts)
|
||||
@@ -226,7 +226,7 @@
|
||||
data["strength"] = strength
|
||||
return data
|
||||
|
||||
/obj/machinery/particle_accelerator/control_box/tgui_act(action, params)
|
||||
/obj/machinery/particle_accelerator/control_box/tgui_act(action, params, datum/tgui/ui)
|
||||
if(..())
|
||||
return
|
||||
|
||||
@@ -234,7 +234,7 @@
|
||||
if("power")
|
||||
if(wires.is_cut(WIRE_POWER))
|
||||
return
|
||||
toggle_power()
|
||||
toggle_power(ui.user)
|
||||
. = TRUE
|
||||
if("scan")
|
||||
part_scan()
|
||||
@@ -242,12 +242,12 @@
|
||||
if("add_strength")
|
||||
if(wires.is_cut(WIRE_PARTICLE_STRENGTH))
|
||||
return
|
||||
add_strength()
|
||||
add_strength(ui.user)
|
||||
. = TRUE
|
||||
if("remove_strength")
|
||||
if(wires.is_cut(WIRE_PARTICLE_STRENGTH))
|
||||
return
|
||||
remove_strength()
|
||||
remove_strength(ui.user)
|
||||
. = TRUE
|
||||
|
||||
update_icon()
|
||||
|
||||
@@ -338,12 +338,12 @@ GLOBAL_LIST_EMPTY(smeses)
|
||||
to_chat(user, span_filter_notice(span_notice("You begin to cut the cables...")))
|
||||
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
|
||||
if(do_after(user, 50 * W.toolspeed))
|
||||
if (prob(50) && electrocute_mob(usr, term.powernet, term))
|
||||
if (prob(50) && electrocute_mob(user, term.powernet, term))
|
||||
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
|
||||
s.set_up(5, 1, src)
|
||||
s.start()
|
||||
building_terminal = FALSE
|
||||
if(usr.stunned)
|
||||
if(user.stunned)
|
||||
return FALSE
|
||||
new /obj/item/stack/cable_coil(loc,10)
|
||||
user.visible_message(\
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
if(default_deconstruction_crowbar(user, W))
|
||||
return
|
||||
if(istype(W, /obj/item/multitool))
|
||||
var/new_ident = tgui_input_text(usr, "Enter a new ident tag.", name, comp_id, MAX_NAME_LEN)
|
||||
var/new_ident = tgui_input_text(user, "Enter a new ident tag.", name, comp_id, MAX_NAME_LEN)
|
||||
new_ident = sanitize(new_ident,MAX_NAME_LEN)
|
||||
if(new_ident && user.Adjacent(src))
|
||||
comp_id = new_ident
|
||||
@@ -338,7 +338,7 @@
|
||||
|
||||
/obj/machinery/computer/turbine_computer/attackby(obj/item/W, mob/user)
|
||||
if(istype(W, /obj/item/multitool))
|
||||
var/new_ident = tgui_input_text(usr, "Enter a new ident tag.", name, id, MAX_NAME_LEN)
|
||||
var/new_ident = tgui_input_text(user, "Enter a new ident tag.", name, id, MAX_NAME_LEN)
|
||||
new_ident = sanitize(new_ident,MAX_NAME_LEN)
|
||||
if(new_ident && user.Adjacent(src))
|
||||
id = new_ident
|
||||
|
||||
Reference in New Issue
Block a user