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
+5 -5
View File
@@ -201,8 +201,8 @@
/mob/living/bot/cleanbot/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
if(..())
return TRUE
usr.set_machine(src)
add_fingerprint(usr)
ui.user.set_machine(src)
add_fingerprint(ui.user)
switch(action)
if("start")
if(on)
@@ -222,11 +222,11 @@
. = TRUE
if("wet_floors")
wet_floors = !wet_floors
to_chat(usr, span_notice("You twiddle the screw."))
to_chat(ui.user, span_notice("You twiddle the screw."))
. = TRUE
if("spray_blood")
spray_blood = !spray_blood
to_chat(usr, span_notice("You press the weird button."))
to_chat(ui.user, span_notice("You press the weird button."))
. = TRUE
/mob/living/bot/cleanbot/emag_act(var/remaining_uses, var/mob/user)
@@ -272,6 +272,6 @@
var/t = sanitizeSafe(tgui_input_text(user, "Enter new robot name", name, created_name, MAX_NAME_LEN), MAX_NAME_LEN)
if(!t)
return
if(!in_range(src, usr) && src.loc != usr)
if(!in_range(src, user) && src.loc != user)
return
created_name = t
+4 -4
View File
@@ -87,15 +87,15 @@
switch(action)
if("red_switch")
red_switch = !red_switch
to_chat(usr, span_notice("You flip the red switch [red_switch ? "on" : "off"]."))
to_chat(ui.user, span_notice("You flip the red switch [red_switch ? "on" : "off"]."))
. = TRUE
if("green_switch")
green_switch = !green_switch
to_chat(usr, span_notice("You flip the green switch [green_switch ? "on" : "off"]."))
to_chat(ui.user, span_notice("You flip the green switch [green_switch ? "on" : "off"]."))
. = TRUE
if("blue_switch")
blue_switch = !blue_switch
to_chat(usr, span_notice("You flip the blue switch [blue_switch ? "on" : "off"]."))
to_chat(ui.user, span_notice("You flip the blue switch [blue_switch ? "on" : "off"]."))
. = TRUE
/mob/living/bot/cleanbot/edCLN/emag_act(var/remaining_uses, var/mob/user)
@@ -124,7 +124,7 @@
var/t = sanitizeSafe(tgui_input_text(user, "Enter new robot name", name, created_name, MAX_NAME_LEN), MAX_NAME_LEN)
if(!t)
return
if(!in_range(src, usr) && src.loc != usr)
if(!in_range(src, user) && src.loc != user)
return
created_name = t
return
+3 -3
View File
@@ -84,11 +84,11 @@
if(..())
return TRUE
add_fingerprint(usr)
add_fingerprint(ui.user)
switch(action)
if("power")
if(!access_scanner.allowed(usr))
if(!access_scanner.allowed(ui.user))
return FALSE
if(on)
turn_off()
@@ -413,7 +413,7 @@
t = sanitize(t, MAX_NAME_LEN)
if(!t)
return
if(!in_range(src, usr) && loc != usr)
if(!in_range(src, user) && loc != user)
return
created_name = t
+1 -1
View File
@@ -86,7 +86,7 @@
turn_on()
. = TRUE
if(locked && !issilicon(usr))
if(locked && !issilicon(ui.user))
return
switch(action)
+5 -5
View File
@@ -269,20 +269,20 @@
if(..())
return TRUE
usr.set_machine(src)
add_fingerprint(usr)
ui.user.set_machine(src)
add_fingerprint(ui.user)
. = TRUE
switch(action)
if("power")
if(!access_scanner.allowed(usr))
if(!access_scanner.allowed(ui.user))
return FALSE
if(on)
turn_off()
else
turn_on()
if(locked && !issilicon(usr))
if(locked && !issilicon(ui.user))
return TRUE
switch(action)
@@ -538,7 +538,7 @@
var/t = sanitizeSafe(tgui_input_text(user, "Enter new robot name", name, created_name, MAX_NAME_LEN), MAX_NAME_LEN)
if(!t)
return
if(!in_range(src, usr) && loc != usr)
if(!in_range(src, user) && loc != user)
return
created_name = t
else
+12 -12
View File
@@ -82,43 +82,43 @@
data["safety"] = safety
return data
/mob/living/bot/mulebot/tgui_act(action, params)
/mob/living/bot/mulebot/tgui_act(action, params, datum/tgui/ui)
if(..())
return TRUE
add_fingerprint(usr)
add_fingerprint(ui.user)
switch(action)
if("power")
if(on)
turn_off()
else
turn_on()
visible_message("[usr] switches [on ? "on" : "off"] [src].")
visible_message("[ui.user] switches [on ? "on" : "off"] [src].")
. = TRUE
if("stop")
obeyCommand("Stop")
obeyCommand(ui.user, "Stop")
. = TRUE
if("go")
obeyCommand("GoTD")
obeyCommand(ui.user, "GoTD")
. = TRUE
if("home")
obeyCommand("Home")
obeyCommand(ui.user, "Home")
. = TRUE
if("destination")
obeyCommand("SetD")
obeyCommand(ui.user, "SetD")
. = TRUE
if("sethome")
var/new_dest
var/list/beaconlist = GetBeaconList()
if(beaconlist.len)
new_dest = tgui_input_list(usr, "Select new home tag", "Mulebot [suffix ? "([suffix])" : ""]", beaconlist)
new_dest = tgui_input_list(ui.user, "Select new home tag", "Mulebot [suffix ? "([suffix])" : ""]", beaconlist)
else
tgui_alert_async(usr, "No destination beacons available.")
tgui_alert_async(ui.user, "No destination beacons available.")
if(new_dest)
home = get_turf(beaconlist[new_dest])
homeName = new_dest
@@ -144,7 +144,7 @@
..()
update_icons()
/mob/living/bot/mulebot/proc/obeyCommand(var/command)
/mob/living/bot/mulebot/proc/obeyCommand(mob/user, var/command)
switch(command)
if("Home")
resetTarget()
@@ -154,9 +154,9 @@
var/new_dest
var/list/beaconlist = GetBeaconList()
if(beaconlist.len)
new_dest = tgui_input_list(usr, "Select new destination tag", "Mulebot [suffix ? "([suffix])" : ""]", beaconlist)
new_dest = tgui_input_list(user, "Select new destination tag", "Mulebot [suffix ? "([suffix])" : ""]", beaconlist)
else
tgui_alert_async(usr, "No destination beacons available.")
tgui_alert_async(user, "No destination beacons available.")
if(new_dest)
resetTarget()
target = get_turf(beaconlist[new_dest])
+3 -3
View File
@@ -129,11 +129,11 @@
if(..())
return
add_fingerprint(usr)
add_fingerprint(ui.user)
switch(action)
if("power")
if(!access_scanner.allowed(usr))
if(!access_scanner.allowed(ui.user))
return FALSE
if(on)
turn_off()
@@ -141,7 +141,7 @@
turn_on()
. = TRUE
if(locked && !issilicon(usr))
if(locked && !issilicon(ui.user))
return TRUE
switch(action)