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
+2 -2
View File
@@ -114,14 +114,14 @@
time_since_fail = 0 //losing charge faster than we can draw from PN
last_stored_charge = stored_charge
/obj/machinery/shield_capacitor/tgui_act(action, params)
/obj/machinery/shield_capacitor/tgui_act(action, params, datum/tgui/ui)
if(..())
return TRUE
switch(action)
if("toggle")
if(!active && !anchored)
to_chat(usr, span_red("The [src] needs to be firmly secured to the floor first."))
to_chat(ui.user, span_red("The [src] needs to be firmly secured to the floor first."))
return
active = !active
. = TRUE
+2 -2
View File
@@ -197,14 +197,14 @@
else
average_field_strength = 0
/obj/machinery/shield_gen/tgui_act(action, params)
/obj/machinery/shield_gen/tgui_act(action, params, datum/tgui/ui)
if(..())
return TRUE
switch(action)
if("toggle")
if (!active && !anchored)
to_chat(usr, span_red("The [src] needs to be firmly secured to the floor first."))
to_chat(ui.user, span_red("The [src] needs to be firmly secured to the floor first."))
return
toggle()
. = TRUE
+6 -6
View File
@@ -458,8 +458,8 @@
if("begin_shutdown")
if(running < SHIELD_RUNNING) // Discharging or off
return
var/alert = tgui_alert(usr, "Are you sure you wish to do this? It will drain the power inside the internal storage rapidly.", "Are you sure?", list("Yes", "No"))
if(tgui_status(usr, state) != STATUS_INTERACTIVE)
var/alert = tgui_alert(ui.user, "Are you sure you wish to do this? It will drain the power inside the internal storage rapidly.", "Are you sure?", list("Yes", "No"))
if(tgui_status(ui.user, state) != STATUS_INTERACTIVE)
return
if(running < SHIELD_RUNNING)
return
@@ -485,7 +485,7 @@
if(!running)
return TRUE
var/choice = tgui_alert(usr, "Are you sure that you want to initiate an emergency shield shutdown? This will instantly drop the shield, and may result in unstable release of stored electromagnetic energy. Proceed at your own risk.", "Confirmation", list("No", "Yes"))
var/choice = tgui_alert(ui.user, "Are you sure that you want to initiate an emergency shield shutdown? This will instantly drop the shield, and may result in unstable release of stored electromagnetic energy. Proceed at your own risk.", "Confirmation", list("No", "Yes"))
if((choice != "Yes") || !running)
return TRUE
@@ -493,7 +493,7 @@
offline_for = round(current_energy / (SHIELD_SHUTDOWN_DISPERSION_RATE / 1.5))
var/old_energy = current_energy
shutdown_field()
log_and_message_admins("has triggered \the [src]'s emergency shutdown!", usr)
log_and_message_admins("has triggered \the [src]'s emergency shutdown!", ui.user)
spawn()
empulse(src, old_energy / 60000000, old_energy / 32000000, 1) // If shields are charged at 450 MJ, the EMP will be 7.5, 14.0625. 90 MJ, 1.5, 2.8125
old_energy = 0
@@ -505,14 +505,14 @@
switch(action)
if("set_range")
var/new_range = tgui_input_number(usr, "Enter new field range (1-[world.maxx]). Leave blank to cancel.", "Field Radius Control", field_radius, world.maxx, 1)
var/new_range = tgui_input_number(ui.user, "Enter new field range (1-[world.maxx]). Leave blank to cancel.", "Field Radius Control", field_radius, world.maxx, 1)
if(!new_range)
return TRUE
target_radius = between(1, new_range, world.maxx)
return TRUE
if("set_input_cap")
var/new_cap = round(tgui_input_number(usr, "Enter new input cap (in kW). Enter 0 or nothing to disable input cap.", "Generator Power Control", round(input_cap / 1000)))
var/new_cap = round(tgui_input_number(ui.user, "Enter new input cap (in kW). Enter 0 or nothing to disable input cap.", "Generator Power Control", round(input_cap / 1000)))
if(!new_cap)
input_cap = 0
return