mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
[MIRROR] usr to user up to player effects (#9552)
Co-authored-by: Heroman3003 <31296024+Heroman3003@users.noreply.github.com> Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
a7e4ef7dad
commit
0180cc74c5
@@ -173,7 +173,7 @@
|
||||
. = TRUE
|
||||
|
||||
if("calibration")
|
||||
var/input = tgui_input_number(usr, "0-9", "disperser calibration", 0, 9, 0)
|
||||
var/input = tgui_input_number(ui.user, "0-9", "disperser calibration", 0, 9, 0)
|
||||
if(!isnull(input)) //can be zero so we explicitly check for null
|
||||
var/calnum = sanitize_integer(text2num(params["calibration"]), 0, caldigit)//sanitiiiiize
|
||||
calibration[calnum + 1] = sanitize_integer(input, 0, 9, 0)//must add 1 because js indexes from 0
|
||||
@@ -185,22 +185,22 @@
|
||||
. = TRUE
|
||||
|
||||
if("strength")
|
||||
var/input = tgui_input_number(usr, "1-5", "disperser strength", 1, 5, 1)
|
||||
if(input && tgui_status(usr, state) == STATUS_INTERACTIVE)
|
||||
var/input = tgui_input_number(ui.user, "1-5", "disperser strength", 1, 5, 1)
|
||||
if(input && tgui_status(ui.user, state) == STATUS_INTERACTIVE)
|
||||
strength = sanitize_integer(input, 1, 5, 1)
|
||||
middle.update_idle_power_usage(strength * range * 100)
|
||||
. = TRUE
|
||||
|
||||
if("range")
|
||||
var/input = tgui_input_number(usr, "1-5", "disperser radius", 1, 5, 1)
|
||||
if(input && tgui_status(usr, state) == STATUS_INTERACTIVE)
|
||||
var/input = tgui_input_number(ui.user, "1-5", "disperser radius", 1, 5, 1)
|
||||
if(input && tgui_status(ui.user, state) == STATUS_INTERACTIVE)
|
||||
range = sanitize_integer(input, 1, 5, 1)
|
||||
middle.update_idle_power_usage(strength * range * 100)
|
||||
. = TRUE
|
||||
|
||||
if("fire")
|
||||
fire(usr)
|
||||
fire(ui.user)
|
||||
. = TRUE
|
||||
|
||||
if(. && !issilicon(usr))
|
||||
if(. && !issilicon(ui.user))
|
||||
playsound(src, "terminal_type", 50, 1)
|
||||
|
||||
@@ -62,8 +62,8 @@
|
||||
. = TRUE
|
||||
|
||||
if("set_global_limit")
|
||||
var/newlim = tgui_input_number(usr, "Input new thrust limit (0..100%)", "Thrust limit", linked.thrust_limit*100, 100, 0, round_value = FALSE)
|
||||
if(tgui_status(usr, state) != STATUS_INTERACTIVE)
|
||||
var/newlim = tgui_input_number(ui.user, "Input new thrust limit (0..100%)", "Thrust limit", linked.thrust_limit*100, 100, 0, round_value = FALSE)
|
||||
if(tgui_status(ui.user, state) != STATUS_INTERACTIVE)
|
||||
return FALSE
|
||||
linked.thrust_limit = clamp(newlim/100, 0, 1)
|
||||
for(var/datum/ship_engine/E in linked.engines)
|
||||
@@ -78,8 +78,8 @@
|
||||
|
||||
if("set_limit")
|
||||
var/datum/ship_engine/E = locate(params["engine"])
|
||||
var/newlim = tgui_input_number(usr, "Input new thrust limit (0..100)", "Thrust limit", E.get_thrust_limit(), 100, 0, round_value = FALSE)
|
||||
if(tgui_status(usr, state) != STATUS_INTERACTIVE)
|
||||
var/newlim = tgui_input_number(ui.user, "Input new thrust limit (0..100)", "Thrust limit", E.get_thrust_limit(), 100, 0, round_value = FALSE)
|
||||
if(tgui_status(ui.user, state) != STATUS_INTERACTIVE)
|
||||
return FALSE
|
||||
var/limit = clamp(newlim/100, 0, 1)
|
||||
if(istype(E))
|
||||
@@ -99,5 +99,5 @@
|
||||
E.toggle()
|
||||
. = TRUE
|
||||
|
||||
if(. && !issilicon(usr))
|
||||
if(. && !issilicon(ui.user))
|
||||
playsound(src, "terminal_type", 50, 1)
|
||||
|
||||
@@ -171,33 +171,33 @@ GLOBAL_LIST_EMPTY(all_waypoints)
|
||||
switch(action)
|
||||
if("update_camera_view")
|
||||
if(TIMER_COOLDOWN_RUNNING(src, COOLDOWN_SHIP_REFRESH))
|
||||
to_chat(usr, span_warning("You cannot refresh the map so often."))
|
||||
to_chat(ui.user, span_warning("You cannot refresh the map so often."))
|
||||
return
|
||||
update_map()
|
||||
TIMER_COOLDOWN_START(src, COOLDOWN_SHIP_REFRESH, 5 SECONDS)
|
||||
. = TRUE
|
||||
if("add")
|
||||
var/datum/computer_file/data/waypoint/R = new()
|
||||
var/sec_name = tgui_input_text(usr, "Input navigation entry name", "New navigation entry", "Sector #[known_sectors.len]", MAX_NAME_LEN)
|
||||
var/sec_name = tgui_input_text(ui.user, "Input navigation entry name", "New navigation entry", "Sector #[known_sectors.len]", MAX_NAME_LEN)
|
||||
sec_name = sanitize(sec_name,MAX_NAME_LEN)
|
||||
if(tgui_status(usr, state) != STATUS_INTERACTIVE)
|
||||
if(tgui_status(ui.user, state) != STATUS_INTERACTIVE)
|
||||
return FALSE
|
||||
if(!sec_name)
|
||||
sec_name = "Sector #[known_sectors.len]"
|
||||
R.fields["name"] = sec_name
|
||||
if(sec_name in known_sectors)
|
||||
to_chat(usr, span_warning("Sector with that name already exists, please input a different name."))
|
||||
to_chat(ui.user, span_warning("Sector with that name already exists, please input a different name."))
|
||||
return TRUE
|
||||
switch(params["add"])
|
||||
if("current")
|
||||
R.fields["x"] = linked.x
|
||||
R.fields["y"] = linked.y
|
||||
if("new")
|
||||
var/newx = tgui_input_number(usr, "Input new entry x coordinate", "Coordinate input", linked.x, world.maxx, 1)
|
||||
if(tgui_status(usr, state) != STATUS_INTERACTIVE)
|
||||
var/newx = tgui_input_number(ui.user, "Input new entry x coordinate", "Coordinate input", linked.x, world.maxx, 1)
|
||||
if(tgui_status(ui.user, state) != STATUS_INTERACTIVE)
|
||||
return TRUE
|
||||
var/newy = tgui_input_number(usr, "Input new entry y coordinate", "Coordinate input", linked.y, world.maxy, 1)
|
||||
if(tgui_status(usr, state) != STATUS_INTERACTIVE)
|
||||
var/newy = tgui_input_number(ui.user, "Input new entry y coordinate", "Coordinate input", linked.y, world.maxy, 1)
|
||||
if(tgui_status(ui.user, state) != STATUS_INTERACTIVE)
|
||||
return FALSE
|
||||
R.fields["x"] = CLAMP(newx, 1, world.maxx)
|
||||
R.fields["y"] = CLAMP(newy, 1, world.maxy)
|
||||
@@ -213,15 +213,15 @@ GLOBAL_LIST_EMPTY(all_waypoints)
|
||||
|
||||
if("setcoord")
|
||||
if(params["setx"])
|
||||
var/newx = tgui_input_number(usr, "Input new destiniation x coordinate", "Coordinate input", dx, world.maxx, 1)
|
||||
if(tgui_status(usr, state) != STATUS_INTERACTIVE)
|
||||
var/newx = tgui_input_number(ui.user, "Input new destiniation x coordinate", "Coordinate input", dx, world.maxx, 1)
|
||||
if(tgui_status(ui.user, state) != STATUS_INTERACTIVE)
|
||||
return
|
||||
if(newx)
|
||||
dx = CLAMP(newx, 1, world.maxx)
|
||||
|
||||
if(params["sety"])
|
||||
var/newy = tgui_input_number(usr, "Input new destiniation y coordinate", "Coordinate input", dy, world.maxy, 1)
|
||||
if(tgui_status(usr, state) != STATUS_INTERACTIVE)
|
||||
var/newy = tgui_input_number(ui.user, "Input new destiniation y coordinate", "Coordinate input", dy, world.maxy, 1)
|
||||
if(tgui_status(ui.user, state) != STATUS_INTERACTIVE)
|
||||
return
|
||||
if(newy)
|
||||
dy = CLAMP(newy, 1, world.maxy)
|
||||
@@ -238,13 +238,13 @@ GLOBAL_LIST_EMPTY(all_waypoints)
|
||||
. = TRUE
|
||||
|
||||
if("speedlimit")
|
||||
var/newlimit = tgui_input_number(usr, "Input new speed limit for autopilot (0 to brake)", "Autopilot speed limit", speedlimit*1000, 100000, round_value = FALSE)
|
||||
var/newlimit = tgui_input_number(ui.user, "Input new speed limit for autopilot (0 to brake)", "Autopilot speed limit", speedlimit*1000, 100000, round_value = FALSE)
|
||||
if(newlimit)
|
||||
speedlimit = CLAMP(newlimit/1000, 0, 100)
|
||||
. = TRUE
|
||||
|
||||
if("accellimit")
|
||||
var/newlimit = tgui_input_number(usr, "Input new acceleration limit", "Acceleration limit", accellimit*1000, round_value = FALSE)
|
||||
var/newlimit = tgui_input_number(ui.user, "Input new acceleration limit", "Acceleration limit", accellimit*1000, round_value = FALSE)
|
||||
if(newlimit)
|
||||
accellimit = max(newlimit/1000, 0)
|
||||
. = TRUE
|
||||
@@ -271,11 +271,11 @@ GLOBAL_LIST_EMPTY(all_waypoints)
|
||||
. = TRUE
|
||||
|
||||
if("manual")
|
||||
viewing_overmap(usr) ? unlook(usr) : look(usr)
|
||||
viewing_overmap(ui.user) ? unlook(ui.user) : look(ui.user)
|
||||
. = TRUE
|
||||
|
||||
add_fingerprint(usr)
|
||||
if(. && !issilicon(usr))
|
||||
add_fingerprint(ui.user)
|
||||
if(. && !issilicon(ui.user))
|
||||
playsound(src, "terminal_type", 50, 1)
|
||||
|
||||
|
||||
|
||||
@@ -88,8 +88,8 @@
|
||||
|
||||
switch(action)
|
||||
if("viewing")
|
||||
if(usr && !isAI(usr))
|
||||
viewing_overmap(usr) ? unlook(usr) : look(usr)
|
||||
if(ui.user && !isAI(ui.user))
|
||||
viewing_overmap(ui.user) ? unlook(ui.user) : look(ui.user)
|
||||
. = TRUE
|
||||
|
||||
if("link")
|
||||
@@ -99,15 +99,15 @@
|
||||
if("scan")
|
||||
var/obj/effect/overmap/O = locate(params["scan"])
|
||||
if(istype(O) && !QDELETED(O) && (O in view(7,linked)))
|
||||
new/obj/item/paper/(get_turf(src), O.get_scan_data(usr), "paper (Sensor Scan - [O])")
|
||||
new/obj/item/paper/(get_turf(src), O.get_scan_data(ui.user), "paper (Sensor Scan - [O])")
|
||||
playsound(src, "sound/machines/printer.ogg", 30, 1)
|
||||
. = TRUE
|
||||
|
||||
if(sensors)
|
||||
switch(action)
|
||||
if("range")
|
||||
var/nrange = tgui_input_number(usr, "Set new sensors range", "Sensor range", sensors.range, world.view, round_value = FALSE )
|
||||
if(tgui_status(usr, state) != STATUS_INTERACTIVE)
|
||||
var/nrange = tgui_input_number(ui.user, "Set new sensors range", "Sensor range", sensors.range, world.view, round_value = FALSE )
|
||||
if(tgui_status(ui.user, state) != STATUS_INTERACTIVE)
|
||||
return FALSE
|
||||
if(nrange)
|
||||
sensors.set_range(CLAMP(nrange, 1, world.view))
|
||||
@@ -116,7 +116,7 @@
|
||||
sensors.toggle()
|
||||
. = TRUE
|
||||
|
||||
if(. && !issilicon(usr))
|
||||
if(. && !issilicon(ui.user))
|
||||
playsound(src, "terminal_type", 50, 1)
|
||||
|
||||
/obj/machinery/computer/ship/sensors/process()
|
||||
|
||||
@@ -55,11 +55,11 @@ somewhere on that shuttle. Subtypes of these can be then used to perform ship ov
|
||||
return TRUE
|
||||
switch(action)
|
||||
if("sync")
|
||||
sync_linked(usr)
|
||||
sync_linked(ui.user)
|
||||
return TRUE
|
||||
if("close")
|
||||
unlook(usr)
|
||||
usr.unset_machine()
|
||||
unlook(ui.user)
|
||||
ui.user.unset_machine()
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
|
||||
@@ -25,13 +25,13 @@
|
||||
"fuel_span" = fuel_span
|
||||
)
|
||||
|
||||
/obj/machinery/computer/shuttle_control/explore/tgui_act(action, list/params)
|
||||
/obj/machinery/computer/shuttle_control/explore/tgui_act(action, list/params, datum/tgui/ui)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
var/datum/shuttle/autodock/overmap/shuttle = SSshuttles.shuttles[shuttle_tag]
|
||||
if(!istype(shuttle))
|
||||
to_chat(usr, span_warning("Unable to establish link with the shuttle."))
|
||||
to_chat(ui.user, span_warning("Unable to establish link with the shuttle."))
|
||||
return TRUE
|
||||
|
||||
switch(action)
|
||||
@@ -39,10 +39,10 @@
|
||||
var/list/possible_d = shuttle.get_possible_destinations()
|
||||
var/D
|
||||
if(possible_d.len)
|
||||
D = tgui_input_list(usr, "Choose shuttle destination", "Shuttle Destination", possible_d)
|
||||
D = tgui_input_list(ui.user, "Choose shuttle destination", "Shuttle Destination", possible_d)
|
||||
else
|
||||
to_chat(usr,span_warning("No valid landing sites in range."))
|
||||
to_chat(ui.user,span_warning("No valid landing sites in range."))
|
||||
possible_d = shuttle.get_possible_destinations()
|
||||
if(CanInteract(usr, GLOB.tgui_default_state) && (D in possible_d))
|
||||
if(CanInteract(ui.user, GLOB.tgui_default_state) && (D in possible_d))
|
||||
shuttle.set_destination(possible_d[D])
|
||||
return TRUE
|
||||
|
||||
Reference in New Issue
Block a user