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
+6 -6
View File
@@ -82,27 +82,27 @@
return FALSE
return TRUE
/obj/machinery/computer/shuttle_control/tgui_act(action, list/params)
/obj/machinery/computer/shuttle_control/tgui_act(action, list/params, datum/tgui/ui)
if(..())
return TRUE
if(skip_act)
return
add_fingerprint(usr)
add_fingerprint(ui.user)
var/datum/shuttle/autodock/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)
if("move")
if(can_move(shuttle, usr))
if(can_move(shuttle, ui.user))
shuttle.launch(src)
return TRUE
if("force")
if(can_move(shuttle, usr))
if(can_move(shuttle, ui.user))
shuttle.force_launch(src)
return TRUE
@@ -111,7 +111,7 @@
return TRUE
if("set_codes")
var/newcode = tgui_input_text(usr, "Input new docking codes", "Docking codes", shuttle.docking_codes, MAX_NAME_LEN)
var/newcode = tgui_input_text(ui.user, "Input new docking codes", "Docking codes", shuttle.docking_codes, MAX_NAME_LEN)
newcode = sanitize(newcode,MAX_NAME_LEN)
if(newcode && !..())
shuttle.set_docking_codes(uppertext(newcode))
@@ -14,20 +14,20 @@
// "engines_charging" = ((shuttle.last_move + (shuttle.cooldown SECONDS)) > world.time), // Replaced by longer warmup_time
)
/obj/machinery/computer/shuttle_control/multi/tgui_act(action, list/params)
/obj/machinery/computer/shuttle_control/multi/tgui_act(action, list/params, datum/tgui/ui)
if(..())
return TRUE
var/datum/shuttle/autodock/multi/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)
if("pick")
var/dest_key = tgui_input_list(usr, "Choose shuttle destination", "Shuttle Destination", shuttle.get_destinations())
if(dest_key && CanInteract(usr, GLOB.tgui_default_state))
shuttle.set_destination(dest_key, usr)
var/dest_key = tgui_input_list(ui.user, "Choose shuttle destination", "Shuttle Destination", shuttle.get_destinations())
if(dest_key && CanInteract(ui.user, GLOB.tgui_default_state))
shuttle.set_destination(dest_key, ui.user)
return TRUE
if("toggle_cloaked")
@@ -35,7 +35,7 @@
return TRUE
shuttle.cloaked = !shuttle.cloaked
if(shuttle.legit)
to_chat(usr, span_notice("Ship ATC inhibitor systems have been [(shuttle.cloaked ? "activated. The station will not" : "deactivated. The station will")] be notified of our arrival."))
to_chat(ui.user, span_notice("Ship ATC inhibitor systems have been [(shuttle.cloaked ? "activated. The station will not" : "deactivated. The station will")] be notified of our arrival."))
else
to_chat(usr, span_warning("Ship stealth systems have been [(shuttle.cloaked ? "activated. The station will not" : "deactivated. The station will")] be warned of our arrival."))
to_chat(ui.user, span_warning("Ship stealth systems have been [(shuttle.cloaked ? "activated. The station will not" : "deactivated. The station will")] be warned of our arrival."))
return TRUE
+15 -15
View File
@@ -290,7 +290,7 @@
return data
/obj/machinery/computer/shuttle_control/web/tgui_act(action, list/params)
/obj/machinery/computer/shuttle_control/web/tgui_act(action, list/params, datum/tgui/ui)
if(..())
return TRUE
@@ -300,22 +300,22 @@
return
if(WS.moving_status != SHUTTLE_IDLE)
to_chat(usr, span_blue("[WS.visible_name] is busy moving."))
to_chat(ui.user, span_blue("[WS.visible_name] is busy moving."))
return
switch(action)
if("rename_command")
WS.rename_shuttle(usr)
WS.rename_shuttle(ui.user)
if("dock_command")
if(WS.autopilot)
to_chat(usr, span_warning("The autopilot must be disabled before you can control the vessel manually."))
to_chat(ui.user, span_warning("The autopilot must be disabled before you can control the vessel manually."))
return
WS.dock()
if("undock_command")
if(WS.autopilot)
to_chat(usr, span_warning("The autopilot must be disabled before you can control the vessel manually."))
to_chat(ui.user, span_warning("The autopilot must be disabled before you can control the vessel manually."))
return
WS.undock()
@@ -324,20 +324,20 @@
return
WS.cloaked = !WS.cloaked
if(WS.cloaked)
to_chat(usr, span_danger("Ship stealth systems have been activated. The station will not be warned of our arrival."))
to_chat(ui.user, span_danger("Ship stealth systems have been activated. The station will not be warned of our arrival."))
else
to_chat(usr, span_danger("Ship stealth systems have been deactivated. The station will be warned of our arrival."))
to_chat(ui.user, span_danger("Ship stealth systems have been deactivated. The station will be warned of our arrival."))
if("toggle_autopilot")
WS.adjust_autopilot(!WS.autopilot)
if("traverse")
if(WS.autopilot)
to_chat(usr, span_warning("The autopilot must be disabled before you can control the vessel manually."))
to_chat(ui.user, span_warning("The autopilot must be disabled before you can control the vessel manually."))
return
if((WS.last_move + WS.cooldown) > world.time)
to_chat(usr, span_red("The ship's drive is inoperable while the engines are charging."))
to_chat(ui.user, span_red("The ship's drive is inoperable while the engines are charging."))
return
var/index = text2num(params["traverse"])
@@ -346,7 +346,7 @@
message_admins("ERROR: Shuttle computer was asked to traverse a nonexistant route.")
return
if(!check_docking(WS))
if(!check_docking(, ui.user, WS))
return TRUE
var/datum/shuttle_destination/target_destination = new_route.get_other_side(WS.web_master.current_destination)
@@ -355,11 +355,11 @@
return
WS.next_location = target_destination.my_landmark
if(!can_move(WS, usr))
if(!can_move(WS, ui.user))
return
WS.web_master.future_destination = target_destination
to_chat(usr, span_notice("[WS.visible_name] flight computer received command."))
to_chat(ui.user, span_notice("[WS.visible_name] flight computer received command."))
WS.web_master.reset_autopath() // Deviating from the path will almost certainly confuse the autopilot, so lets just reset its memory.
var/travel_time = new_route.travel_time * WS.flight_time_modifier
@@ -370,15 +370,15 @@
WS.short_jump(target_destination.my_landmark)
//check if we're undocked, give option to force launch
/obj/machinery/computer/shuttle_control/web/proc/check_docking(datum/shuttle/autodock/MS)
/obj/machinery/computer/shuttle_control/web/proc/check_docking(mob/user, datum/shuttle/autodock/MS)
if(MS.skip_docking_checks() || MS.check_undocked())
return 1
var/choice = tgui_alert(usr, "The shuttle is currently docked! Please undock before continuing.","Error",list("Cancel","Force Launch"))
var/choice = tgui_alert(user, "The shuttle is currently docked! Please undock before continuing.","Error",list("Cancel","Force Launch"))
if(!choice || choice == "Cancel")
return 0
choice = tgui_alert(usr, "Forcing a shuttle launch while docked may result in severe injury, death and/or damage to property. Are you sure you wish to continue?", "Force Launch", list("Force Launch", "Cancel"))
choice = tgui_alert(user, "Forcing a shuttle launch while docked may result in severe injury, death and/or damage to property. Are you sure you wish to continue?", "Force Launch", list("Force Launch", "Cancel"))
if(choice || choice == "Cancel")
return 0