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
@@ -43,7 +43,7 @@
/datum/ColorMate/tgui_state(mob/user)
return GLOB.tgui_conscious_state
/datum/ColorMate/tgui_data()
/datum/ColorMate/tgui_data(mob/user)
. = list()
.["activemode"] = active_mode
.["matrixcolors"] = list(
@@ -69,7 +69,7 @@
.["item"] = list()
.["item"]["name"] = inserted.name
.["item"]["sprite"] = icon2base64(get_flat_icon(inserted,dir=SOUTH,no_anim=TRUE))
.["item"]["preview"] = icon2base64(build_preview())
.["item"]["preview"] = icon2base64(build_preview(user))
else
.["item"] = null
@@ -159,7 +159,7 @@
return TRUE
/// Produces the preview image of the item, used in the UI, the way the color is not stacking is a sin.
/datum/ColorMate/proc/build_preview()
/datum/ColorMate/proc/build_preview(mob/user)
if(inserted) //sanity
var/list/cm
switch(active_mode)
@@ -178,17 +178,17 @@
text2num(color_matrix_last[11]),
text2num(color_matrix_last[12]),
)
if(!check_valid_color(cm, usr))
if(!check_valid_color(cm, user))
return get_flat_icon(inserted, dir=SOUTH, no_anim=TRUE)
if(COLORMATE_TINT)
if(!check_valid_color(activecolor, usr))
if(!check_valid_color(activecolor, user))
return get_flat_icon(inserted, dir=SOUTH, no_anim=TRUE)
if(COLORMATE_HSV)
cm = color_matrix_hsv(build_hue, build_sat, build_val)
color_matrix_last = cm
if(!check_valid_color(cm, usr))
if(!check_valid_color(cm, user))
return get_flat_icon(inserted, dir=SOUTH, no_anim=TRUE)
var/cur_color = inserted.color
+11 -12
View File
@@ -153,24 +153,23 @@
data["status"] = status
return data
/datum/wires/tgui_act(action, list/params)
/datum/wires/tgui_act(action, list/params, datum/tgui/ui)
if(..())
return TRUE
var/mob/user = usr
if(!interactable(user))
if(!interactable(ui.user))
return
var/obj/item/I = user.get_active_hand()
var/obj/item/I = ui.user.get_active_hand()
var/color = lowertext(params["wire"])
holder.add_hiddenprint(user)
holder.add_hiddenprint(ui.user)
switch(action)
// Toggles the cut/mend status.
if("cut")
// if(!I.has_tool_quality(TOOL_WIRECUTTER) && !user.can_admin_interact())
if(!istype(I) || !I.has_tool_quality(TOOL_WIRECUTTER))
to_chat(user, span_warning("You need wirecutters!"))
to_chat(ui.user, span_warning("You need wirecutters!"))
return
playsound(holder, I.usesound, 20, 1)
@@ -181,7 +180,7 @@
if("pulse")
// if(!I.has_tool_quality(TOOL_MULTITOOL) && !user.can_admin_interact())
if(!istype(I) || !I.has_tool_quality(TOOL_MULTITOOL))
to_chat(user, span_warning("You need a multitool!"))
to_chat(ui.user, span_warning("You need a multitool!"))
return
playsound(holder, 'sound/weapons/empty.ogg', 20, 1)
@@ -189,7 +188,7 @@
// If they pulse the electrify wire, call interactable() and try to shock them.
if(get_wire(color) == WIRE_ELECTRIFY)
interactable(user)
interactable(ui.user)
return TRUE
@@ -198,18 +197,18 @@
if(is_attached(color))
var/obj/item/O = detach_assembly(color)
if(O)
user.put_in_hands(O)
ui.user.put_in_hands(O)
return TRUE
if(!istype(I, /obj/item/assembly/signaler))
to_chat(user, span_warning("You need a remote signaller!"))
to_chat(ui.user, span_warning("You need a remote signaller!"))
return
if(user.unEquip(I))
if(ui.user.unEquip(I))
attach_assembly(color, I)
return TRUE
else
to_chat(user, span_warning("[I] is stuck to your hand!"))
to_chat(ui.user, span_warning("[I] is stuck to your hand!"))
/**
* Proc called to determine if the user can see wire define information, such as "Contraband", "Door Bolts", etc.
+3 -3
View File
@@ -449,17 +449,17 @@
return data
/obj/machinery/computer/scan_consolenew/tgui_act(action, params)
/obj/machinery/computer/scan_consolenew/tgui_act(action, params, datum/tgui/ui)
if(..())
return TRUE
if(!istype(usr.loc, /turf))
if(!istype(ui.user.loc, /turf))
return TRUE
if(!src || !src.connected)
return TRUE
if(irradiating) // Make sure that it isn't already irradiating someone...
return TRUE
add_fingerprint(usr)
add_fingerprint(ui.user)
if(tgui_act_modal(action, params))
return TRUE
+5 -5
View File
@@ -142,7 +142,7 @@
. = TRUE
switch(action)
if("activate")
INVOKE_ASYNC(src, PROC_REF(activate))
INVOKE_ASYNC(src, PROC_REF(activate), ui.user)
return TRUE
if("detach")
if(beaker)
@@ -263,13 +263,13 @@
return
tgui_interact(user)
/obj/machinery/biogenerator/proc/activate()
if(usr.stat)
/obj/machinery/biogenerator/proc/activate(mob/user)
if(user.stat)
return
if(stat) //NOPOWER etc
return
if(processing)
to_chat(usr, span_notice("The biogenerator is in the process of working."))
to_chat(user, span_notice("The biogenerator is in the process of working."))
return
var/S = 0
for(var/obj/item/reagent_containers/food/snacks/grown/I in contents)
@@ -289,7 +289,7 @@
playsound(src, 'sound/machines/biogenerator_end.ogg', 40, 1)
update_icon()
else
to_chat(usr, span_warning("Error: No growns inside. Please insert growns."))
to_chat(user, span_warning("Error: No growns inside. Please insert growns."))
return
/obj/machinery/biogenerator/RefreshParts()
+13 -14
View File
@@ -106,17 +106,16 @@
/obj/machinery/gear_painter/AltClick(mob/user)
. = ..()
drop_item()
drop_item(user)
/obj/machinery/gear_painter/proc/drop_item()
/obj/machinery/gear_painter/proc/drop_item(var/mob/user)
if(!oview(1,src))
return
if(!inserted)
return
to_chat(usr, span_notice("You remove [inserted] from [src]"))
to_chat(user, span_notice("You remove [inserted] from [src]"))
inserted.forceMove(drop_location())
var/mob/living/user = usr
if(istype(user))
if(isliving(user))
user.put_in_hands(inserted)
inserted = null
update_icon()
@@ -155,11 +154,11 @@
.["item"] = list()
.["item"]["name"] = inserted.name
.["item"]["sprite"] = icon2base64(get_flat_icon(inserted,dir=SOUTH,no_anim=TRUE))
.["item"]["preview"] = icon2base64(build_preview())
.["item"]["preview"] = icon2base64(build_preview(user))
else
.["item"] = null
/obj/machinery/gear_painter/tgui_act(action, params)
/obj/machinery/gear_painter/tgui_act(action, params, datum/tgui/ui)
. = ..()
if(.)
return
@@ -169,17 +168,17 @@
active_mode = text2num(params["mode"])
return TRUE
if("choose_color")
var/chosen_color = input(usr, "Choose a color: ", "ColorMate colour picking", activecolor) as color|null
var/chosen_color = input(ui.user, "Choose a color: ", "ColorMate colour picking", activecolor) as color|null
if(chosen_color)
activecolor = chosen_color
return TRUE
if("paint")
do_paint(usr)
do_paint(ui.user)
temp = "Painted Successfully!"
return TRUE
if("drop")
temp = ""
drop_item()
drop_item(ui.user)
return TRUE
if("clear")
inserted.remove_atom_colour(FIXED_COLOUR_PRIORITY)
@@ -242,7 +241,7 @@
/// Produces the preview image of the item, used in the UI, the way the color is not stacking is a sin.
/obj/machinery/gear_painter/proc/build_preview()
/obj/machinery/gear_painter/proc/build_preview(mob/user)
if(inserted) //sanity
var/list/cm
switch(active_mode)
@@ -261,17 +260,17 @@
text2num(color_matrix_last[11]),
text2num(color_matrix_last[12]),
)
if(!check_valid_color(cm, usr))
if(!check_valid_color(cm, user))
return get_flat_icon(inserted, dir=SOUTH, no_anim=TRUE)
if(COLORMATE_TINT)
if(!check_valid_color(activecolor, usr))
if(!check_valid_color(activecolor, user))
return get_flat_icon(inserted, dir=SOUTH, no_anim=TRUE)
if(COLORMATE_HSV)
cm = color_matrix_hsv(build_hue, build_sat, build_val)
color_matrix_last = cm
if(!check_valid_color(cm, usr))
if(!check_valid_color(cm, user))
return get_flat_icon(inserted, dir=SOUTH, no_anim=TRUE)
var/cur_color = inserted.color
+9 -9
View File
@@ -221,11 +221,11 @@
return data
/datum/entity_narrate/tgui_act(action, list/params)
/datum/entity_narrate/tgui_act(action, list/params, datum/tgui/ui)
. = ..()
if(.) return
if(!check_rights_for(usr.client, R_FUN)) return
if(!check_rights_for(ui.user.client, R_FUN)) return
switch(action)
if("change_mode_multi")
@@ -260,7 +260,7 @@
var/datum/weakref/wref = entity_refs[tgui_selected_id]
tgui_selected_refs = wref.resolve()
if(!tgui_selected_refs)
to_chat(usr, span_notice("[tgui_selected_id] has invalid reference, deleting"))
to_chat(ui.user, span_notice("[tgui_selected_id] has invalid reference, deleting"))
entity_names -= tgui_selected_id
entity_refs -= tgui_selected_id
tgui_selected_id = ""
@@ -281,9 +281,9 @@
tgui_selected_name = A.name
if("narrate")
if(world.time < (tgui_last_message + 0.5 SECONDS))
to_chat(usr, span_notice("You can't messages that quickly! Wait at least half a second"))
to_chat(ui.user, span_notice("You can't messages that quickly! Wait at least half a second"))
else
to_chat(usr, span_notice("Message successfully sent!"))
to_chat(ui.user, span_notice("Message successfully sent!"))
tgui_last_message = world.time
var/message = params["message"] //Sanitizing before speaking it
if(tgui_selection_mode)
@@ -291,7 +291,7 @@
var/datum/weakref/wref = entity_refs[entity]
var/ref = wref.resolve()
if(!ref)
to_chat(usr, span_notice("[entity] has invalid reference, deleting"))
to_chat(ui.user, span_notice("[entity] has invalid reference, deleting"))
entity_names -= entity
entity_refs -= entity
tgui_selected_id_multi -= entity
@@ -299,7 +299,7 @@
if(istype(ref, /mob/living))
var/mob/living/L = ref
if(L.client)
log_and_message_admins("used entity-narrate to speak through [L.ckey]'s mob", usr)
log_and_message_admins("used entity-narrate to speak through [L.ckey]'s mob", ui.user)
narrate_tgui_mob(L, message)
else if(istype(ref, /atom))
var/atom/A = ref
@@ -308,7 +308,7 @@
var/datum/weakref/wref = entity_refs[tgui_selected_id]
var/ref = wref.resolve()
if(!ref)
to_chat(usr, span_notice("[tgui_selected_id] has invalid reference, deleting"))
to_chat(ui.user, span_notice("[tgui_selected_id] has invalid reference, deleting"))
entity_names -= tgui_selected_id
entity_refs -= tgui_selected_id
tgui_selected_id = ""
@@ -319,7 +319,7 @@
if(istype(ref, /mob/living))
var/mob/living/L = ref
if(L.client)
log_and_message_admins("used entity-narrate to speak through [L.ckey]'s mob", usr)
log_and_message_admins("used entity-narrate to speak through [L.ckey]'s mob", ui.user)
narrate_tgui_mob(L, message)
else if(istype(ref, /atom))
var/atom/A = ref
+16 -16
View File
@@ -198,7 +198,7 @@
/obj/machinery/casino_prize_dispenser/attackby(obj/item/W as obj, mob/user as mob)
if(currently_vending)
if(istype(W, /obj/item/spacecasinocash))
to_chat(usr, span_warning("Please select prize on display with sufficient amount of chips."))
to_chat(user, span_warning("Please select prize on display with sufficient amount of chips."))
else
SStgui.update_uis(src)
return // don't smack that machine with your 2 chips
@@ -211,15 +211,15 @@
/obj/machinery/casino_prize_dispenser/proc/pay_with_chips(var/obj/item/spacecasinocash/cashmoney, mob/user, var/price)
//"cashmoney_:[cashmoney] user:[user] currently_vending:[currently_vending]"
if(price > cashmoney.worth)
to_chat(usr, "[icon2html(cashmoney, user.client)] " + span_warning("That is not enough chips."))
to_chat(user, "[icon2html(cashmoney, user.client)] " + span_warning("That is not enough chips."))
return 0
if(istype(cashmoney, /obj/item/spacecasinocash))
visible_message(span_info("\The [usr] inserts some chips into \the [src]."))
visible_message(span_info("\The [user] inserts some chips into \the [src]."))
cashmoney.worth -= price
if(cashmoney.worth <= 0)
usr.drop_from_inventory(cashmoney)
user.drop_from_inventory(cashmoney)
qdel(cashmoney)
else
cashmoney.update_icon()
@@ -249,10 +249,10 @@
ui = new(user, src, "CasinoPrizeDispenser", name)
ui.open()
/obj/machinery/casino_prize_dispenser/tgui_act(action, params)
/obj/machinery/casino_prize_dispenser/tgui_act(action, params, datum/tgui/ui)
if(stat & (BROKEN|NOPOWER))
return
if(usr.stat || usr.restrained())
if(ui.user.stat || ui.user.restrained())
return
if(..())
return TRUE
@@ -283,36 +283,36 @@
if("event")
restriction_check = category_event
else
to_chat(usr, span_warning("Prize checkout error has occurred, purchase cancelled."))
to_chat(ui.user, span_warning("Prize checkout error has occurred, purchase cancelled."))
return FALSE
if(restriction_check < 1)
to_chat(usr, span_warning("[name] is restricted, this prize can't be bought."))
to_chat(ui.user, span_warning("[name] is restricted, this prize can't be bought."))
return FALSE
if(restriction_check > 1)
item_given = TRUE
if(price <= 0 && item_given == TRUE)
vend(bi, usr)
vend(bi, ui.user)
return TRUE
currently_vending = bi
if(istype(usr.get_active_hand(), /obj/item/spacecasinocash))
var/obj/item/spacecasinocash/cash = usr.get_active_hand()
paid = pay_with_chips(cash, usr, price)
if(istype(ui.user.get_active_hand(), /obj/item/spacecasinocash))
var/obj/item/spacecasinocash/cash = ui.user.get_active_hand()
paid = pay_with_chips(cash, ui.user, price)
else
to_chat(usr, span_warning("Payment failure: Improper payment method, please provide chips."))
to_chat(ui.user, span_warning("Payment failure: Improper payment method, please provide chips."))
return TRUE // we set this because they shouldn't even be able to get this far, and we want the UI to update.
if(paid)
if(item_given == TRUE)
vend(bi, usr)
vend(bi, ui.user)
speak("Thank you for your purchase, your [bi] has been logged.")
do_logging(currently_vending, usr, bi)
do_logging(currently_vending, ui.user, bi)
. = TRUE
else
to_chat(usr, span_warning("Payment failure: unable to process payment."))
to_chat(ui.user, span_warning("Payment failure: unable to process payment."))
/obj/machinery/casino_prize_dispenser/proc/vend(datum/data/casino_prize/bi, mob/user)
SStgui.update_uis(src)
@@ -40,7 +40,7 @@
var/channel = href_list["change_volume"]
if(!(channel in pref.volume_channels))
pref.volume_channels["[channel]"] = 1
var/value = tgui_input_number(usr, "Choose your volume for [channel] (0-200%)", "[channel] volume", (pref.volume_channels[channel] * 100), 200, 0)
var/value = tgui_input_number(user, "Choose your volume for [channel] (0-200%)", "[channel] volume", (pref.volume_channels[channel] * 100), 200, 0)
if(isnum(value))
value = CLAMP(value, 0, 200)
pref.volume_channels["[channel]"] = (value / 100)
@@ -79,14 +79,14 @@
data["volume_channels"] = user.client.prefs.volume_channels
return data
/datum/volume_panel/tgui_act(action, params)
/datum/volume_panel/tgui_act(action, params, datum/tgui/ui)
if(..())
return TRUE
if(!usr?.client?.prefs)
if(!ui.user?.client?.prefs)
return TRUE
var/datum/preferences/P = usr.client.prefs
var/datum/preferences/P = ui.user.client.prefs
switch(action)
if("adjust_volume")
var/channel = params["channel"]
+2 -2
View File
@@ -63,7 +63,7 @@
var/value = params["value"]
for(var/datum/preference_middleware/preference_middleware as anything in middleware)
if(preference_middleware.pre_set_preference(usr, requested_preference_key, value))
if(preference_middleware.pre_set_preference(ui.user, requested_preference_key, value))
return TRUE
var/datum/preference/requested_preference = GLOB.preference_entries_by_key[requested_preference_key]
@@ -82,7 +82,7 @@
for(var/datum/preference_middleware/preference_middleware as anything in middleware)
var/delegation = preference_middleware.action_delegations[action]
if(!isnull(delegation))
return call(preference_middleware, delegation)(params, usr)
return call(preference_middleware, delegation)(params, ui.user)
return FALSE
@@ -136,14 +136,14 @@ GLOBAL_DATUM(character_directory, /datum/character_directory)
if(action == "refresh")
// This is primarily to stop malicious users from trying to lag the server by spamming this verb
if(!usr.checkMoveCooldown())
to_chat(usr, span_warning("Don't spam character directory refresh."))
if(!ui.user.checkMoveCooldown())
to_chat(ui.user, span_warning("Don't spam character directory refresh."))
return
usr.setMoveCooldown(10)
update_tgui_static_data(usr, ui)
ui.user.setMoveCooldown(10)
update_tgui_static_data(ui.user, ui)
return TRUE
else
return check_for_mind_or_prefs(usr, action, params["overwrite_prefs"])
return check_for_mind_or_prefs(ui.user, action, params["overwrite_prefs"])
/datum/character_directory/proc/check_for_mind_or_prefs(mob/user, action, overwrite_prefs)
if (!user.client)
@@ -156,12 +156,12 @@ GLOBAL_DATUM(character_directory, /datum/character_directory)
return
switch(action)
if ("setTag")
var/list/new_tag = tgui_input_list(usr, "Pick a new Vore tag for the character directory", "Character Tag", GLOB.char_directory_tags)
var/list/new_tag = tgui_input_list(user, "Pick a new Vore tag for the character directory", "Character Tag", GLOB.char_directory_tags)
if(!new_tag)
return
return set_for_mind_or_prefs(user, action, new_tag, can_set_prefs, can_set_mind)
if ("setErpTag")
var/list/new_erptag = tgui_input_list(usr, "Pick a new ERP tag for the character directory", "Character ERP Tag", GLOB.char_directory_erptags)
var/list/new_erptag = tgui_input_list(user, "Pick a new ERP tag for the character directory", "Character ERP Tag", GLOB.char_directory_erptags)
if(!new_erptag)
return
return set_for_mind_or_prefs(user, action, new_erptag, can_set_prefs, can_set_mind)
@@ -171,11 +171,11 @@ GLOBAL_DATUM(character_directory, /datum/character_directory)
visible = user.mind.show_in_directory
else if (can_set_prefs)
visible = user.client.prefs.show_in_directory
to_chat(usr, span_notice("You are now [!visible ? "shown" : "not shown"] in the directory."))
to_chat(user, span_notice("You are now [!visible ? "shown" : "not shown"] in the directory."))
return set_for_mind_or_prefs(user, action, !visible, can_set_prefs, can_set_mind)
if ("editAd")
var/current_ad = (can_set_mind ? usr.mind.directory_ad : null) || (can_set_prefs ? usr.client.prefs.directory_ad : null)
var/new_ad = sanitize(tgui_input_text(usr, "Change your character ad", "Character Ad", current_ad, multiline = TRUE, prevent_enter = TRUE), extra = 0)
var/current_ad = (can_set_mind ? user.mind.directory_ad : null) || (can_set_prefs ? user.client.prefs.directory_ad : null)
var/new_ad = sanitize(tgui_input_text(user, "Change your character ad", "Character Ad", current_ad, multiline = TRUE, prevent_enter = TRUE), extra = 0)
if(isnull(new_ad))
return
return set_for_mind_or_prefs(user, action, new_ad, can_set_prefs, can_set_mind)
@@ -11,7 +11,7 @@
/obj/item/rig/tgui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui, datum/tgui_state/custom_state)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, (loc != usr ? ai_interface_path : interface_path), interface_title)
ui = new(user, src, (loc != user ? ai_interface_path : interface_path), interface_title)
ui.open()
if(custom_state)
ui.set_state(custom_state)
@@ -120,19 +120,19 @@
/*
* tgui_act() is the TGUI equivelent of Topic(). It's responsible for all of the "actions" you can take in the UI.
*/
/obj/item/rig/tgui_act(action, params)
/obj/item/rig/tgui_act(action, params, datum/tgui/ui)
// This parent call is very important, as it's responsible for invoking tgui_status and checking our state's rules.
if(..())
return TRUE
add_fingerprint(usr)
add_fingerprint(ui.user)
switch(action)
if("toggle_seals")
toggle_seals(usr)
toggle_seals(ui.user)
. = TRUE
if("toggle_cooling")
toggle_cooling(usr) // cooling toggles have its own to_chats, tbf
toggle_cooling(ui.user) // cooling toggles have its own to_chats, tbf
. = TRUE
if("toggle_ai_control")
ai_override_enabled = !ai_override_enabled
@@ -142,9 +142,9 @@
locked = !locked
. = TRUE
if("toggle_piece")
if(ishuman(usr) && (usr.stat || usr.stunned || usr.lying))
if(ishuman(ui.user) && (ui.user.stat || ui.user.stunned || ui.user.lying))
return FALSE
toggle_piece(params["piece"], usr)
toggle_piece(params["piece"], ui.user)
. = TRUE
if("interact_module")
var/module_index = text2num(params["module"])
@@ -168,5 +168,5 @@
module.charge_selected = params["charge_type"]
. = TRUE
if("tank_settings")
air_supply?.attack_self(usr)
air_supply?.attack_self(ui.user)
. = TRUE
@@ -195,16 +195,16 @@
icon_state = "collar_shk[on]"
. = TRUE
if("tag")
var/sanitized = tgui_input_text(usr, "Tag text?", "Set Tag", "", MAX_NAME_LEN, encode = TRUE)
var/sanitized = tgui_input_text(ui.user, "Tag text?", "Set Tag", "", MAX_NAME_LEN, encode = TRUE)
if(isnull(sanitized))
return
if(!length(sanitized))
to_chat(usr, span_notice("[src]'s tag set to blank."))
to_chat(ui.user, span_notice("[src]'s tag set to blank."))
name = initial(name)
desc = initial(desc)
else
to_chat(usr, span_notice("[src]'s tag set to '[sanitized]'."))
to_chat(ui.user, span_notice("[src]'s tag set to '[sanitized]'."))
name = initial(name) + " ([sanitized])"
desc = initial(desc) + " The tag says \"[sanitized]\"."
. = TRUE
@@ -366,9 +366,9 @@
switch(action)
if("size")
target_size = clamp((params["size"]/100), RESIZE_MINIMUM_DORMS, RESIZE_MAXIMUM_DORMS)
to_chat(usr, span_notice("You set the size to [target_size * 100]%"))
to_chat(ui.user, span_notice("You set the size to [target_size * 100]%"))
if(target_size < RESIZE_MINIMUM || target_size > RESIZE_MAXIMUM)
to_chat(usr, span_notice("Note: Resizing limited to 25-200% automatically while outside dormatory areas.")) //hint that we clamp it in resize
to_chat(ui.user, span_notice("Note: Resizing limited to 25-200% automatically while outside dormatory areas.")) //hint that we clamp it in resize
. = TRUE
/obj/item/clothing/accessory/collar/shock/bluespace/receive_signal(datum/signal/signal)
@@ -60,7 +60,7 @@
data["bloodsamp_desc"] = (bloodsamp ? (bloodsamp.desc ? bloodsamp.desc : "No information on record.") : "")
return data
/obj/machinery/dnaforensics/tgui_act(action, list/params)
/obj/machinery/dnaforensics/tgui_act(action, list/params, datum/tgui/ui)
if(..())
return TRUE
@@ -77,10 +77,10 @@
if(bloodsamp)
scanner_progress = 0
scanning = TRUE
to_chat(usr, span_notice("Scan initiated."))
to_chat(ui.user, span_notice("Scan initiated."))
update_icon()
else
to_chat(usr, span_warning("Insert an item to scan."))
to_chat(ui.user, span_warning("Insert an item to scan."))
. = TRUE
if("ejectItem")
+20 -20
View File
@@ -93,7 +93,7 @@ log transactions
var/obj/item/card/id/idcard = I
if(!held_card)
usr.drop_item()
user.drop_item()
idcard.loc = src
held_card = idcard
if(authenticated_account && held_card.associated_account_number != authenticated_account.account_number)
@@ -187,20 +187,20 @@ log transactions
// This is also a logout
if("insert_card")
if(held_card)
release_held_id(usr)
release_held_id(ui.user)
else
if(emagged > 0)
to_chat(usr, span_boldwarning("[icon2html(src, usr.client)] The ATM card reader rejected your ID because this machine has been sabotaged!"))
to_chat(ui.user, span_boldwarning("[icon2html(src, ui.user.client)] The ATM card reader rejected your ID because this machine has been sabotaged!"))
else
var/obj/item/I = usr.get_active_hand()
var/obj/item/I = ui.user.get_active_hand()
if(istype(I, /obj/item/card/id))
usr.drop_item(src)
ui.user.drop_item(src)
held_card = I
. = TRUE
if("logout")
if(held_card)
release_held_id(usr)
release_held_id(ui.user)
authenticated_account = null
. = TRUE
@@ -294,7 +294,7 @@ log transactions
// check if they have low security enabled
if(!tried_account_num)
scan_user(usr)
scan_user(ui.user)
else
authenticated_account = attempt_account_access(tried_account_num, tried_pin, held_card && held_card.associated_account_number == tried_account_num ? 2 : 1)
@@ -317,11 +317,11 @@ log transactions
T.time = stationtime2text()
failed_account.transaction_log.Add(T)
else
to_chat(usr, span_warning("[icon2html(src, usr.client)] Incorrect pin/account combination entered, [max_pin_attempts - number_incorrect_tries] attempts remaining."))
to_chat(ui.user, span_warning("[icon2html(src, ui.user.client)] Incorrect pin/account combination entered, [max_pin_attempts - number_incorrect_tries] attempts remaining."))
previous_account_number = tried_account_num
playsound(src, 'sound/machines/buzz-sigh.ogg', 50, 1)
else
to_chat(usr, span_warning("[icon2html(src, usr.client)] incorrect pin/account combination entered."))
to_chat(ui.user, span_warning("[icon2html(src, ui.user.client)] incorrect pin/account combination entered."))
number_incorrect_tries = 0
else
playsound(src, 'sound/machines/twobeep.ogg', 50, 1)
@@ -337,7 +337,7 @@ log transactions
T.time = stationtime2text()
authenticated_account.transaction_log.Add(T)
to_chat(usr, span_notice("[icon2html(src, usr.client)] Access granted. Welcome user '[authenticated_account.owner_name].'"))
to_chat(ui.user, span_notice("[icon2html(src, ui.user.client)] Access granted. Welcome user '[authenticated_account.owner_name].'"))
previous_account_number = tried_account_num
. = TRUE
@@ -348,12 +348,12 @@ log transactions
var/transfer_amount = text2num(params["funds_amount"])
transfer_amount = round(transfer_amount, 0.01)
if(transfer_amount <= 0)
tgui_alert_async(usr, "That is not a valid amount.")
tgui_alert_async(ui.user, "That is not a valid amount.")
else if(transfer_amount <= authenticated_account.money)
var/target_account_number = text2num(params["target_acc_number"])
var/transfer_purpose = params["purpose"]
if(charge_to_account(target_account_number, authenticated_account.owner_name, transfer_purpose, machine_id, transfer_amount))
to_chat(usr, "[icon2html(src, usr.client)]" + span_info("Funds transfer successful."))
to_chat(ui.user, "[icon2html(src, ui.user.client)]" + span_info("Funds transfer successful."))
authenticated_account.money -= transfer_amount
//create an entry in the account transaction log
@@ -366,17 +366,17 @@ log transactions
T.amount = "([transfer_amount])"
authenticated_account.transaction_log.Add(T)
else
to_chat(usr, "[icon2html(src, usr.client)]" + span_warning("Funds transfer failed."))
to_chat(ui.user, "[icon2html(src, ui.user.client)]" + span_warning("Funds transfer failed."))
else
to_chat(usr, "[icon2html(src, usr.client)]" + span_warning("You don't have enough funds to do that!"))
to_chat(ui.user, "[icon2html(src, ui.user.client)]" + span_warning("You don't have enough funds to do that!"))
. = TRUE
if("e_withdrawal")
var/amount = max(text2num(params["funds_amount"]),0)
amount = round(amount, 0.01)
if(amount <= 0)
tgui_alert_async(usr, "That is not a valid amount.")
tgui_alert_async(ui.user, "That is not a valid amount.")
return
if(!authenticated_account)
@@ -389,7 +389,7 @@ log transactions
authenticated_account.money -= amount
// spawn_money(amount,src.loc)
spawn_ewallet(amount,src.loc,usr)
spawn_ewallet(amount,src.loc,ui.user)
//create an entry in the account transaction log
var/datum/transaction/T = new()
@@ -401,14 +401,14 @@ log transactions
T.time = stationtime2text()
authenticated_account.transaction_log.Add(T)
else
to_chat(usr, "[icon2html(src, usr.client)]" + span_warning("You don't have enough funds to do that!"))
to_chat(ui.user, "[icon2html(src, ui.user.client)]" + span_warning("You don't have enough funds to do that!"))
. = TRUE
if("withdrawal")
var/amount = max(text2num(params["funds_amount"]),0)
amount = round(amount, 0.01)
if(amount <= 0)
tgui_alert_async(usr, "That is not a valid amount.")
tgui_alert_async(ui.user, "That is not a valid amount.")
return
if(!authenticated_account)
@@ -420,7 +420,7 @@ log transactions
//remove the money
authenticated_account.money -= amount
spawn_money(amount,src.loc,usr)
spawn_money(amount,src.loc,ui.user)
//create an entry in the account transaction log
var/datum/transaction/T = new()
@@ -432,7 +432,7 @@ log transactions
T.time = stationtime2text()
authenticated_account.transaction_log.Add(T)
else
to_chat(usr, "[icon2html(src, usr.client)]" + span_warning("You don't have enough funds to do that!"))
to_chat(ui.user, "[icon2html(src, ui.user.client)]" + span_warning("You don't have enough funds to do that!"))
. = TRUE
if(.)
+7 -7
View File
@@ -127,12 +127,12 @@
creating_new_account = 1
if("add_funds")
var/amount = tgui_input_number(usr, "Enter the amount you wish to add", "Silently add funds")
var/amount = tgui_input_number(ui.user, "Enter the amount you wish to add", "Silently add funds")
if(detailed_account_view)
detailed_account_view.money = min(detailed_account_view.money + amount, fund_cap)
if("remove_funds")
var/amount = tgui_input_number(usr, "Enter the amount you wish to remove", "Silently remove funds")
var/amount = tgui_input_number(ui.user, "Enter the amount you wish to remove", "Silently remove funds")
if(detailed_account_view)
detailed_account_view.money = max(detailed_account_view.money - amount, -fund_cap)
@@ -164,15 +164,15 @@
if(held_card)
held_card.loc = src.loc
if(ishuman(usr) && !usr.get_active_hand())
usr.put_in_hands(held_card)
if(ishuman(ui.user) && !ui.user.get_active_hand())
ui.user.put_in_hands(held_card)
held_card = null
else
var/obj/item/I = usr.get_active_hand()
var/obj/item/I = ui.user.get_active_hand()
if(istype(I, /obj/item/card/id))
var/obj/item/card/id/C = I
usr.drop_item()
ui.user.drop_item()
C.loc = src
held_card = C
@@ -278,4 +278,4 @@
"}
P.info = text
state("The terminal prints out a report.")
state("The terminal prints out a report.")
+34 -34
View File
@@ -294,8 +294,8 @@ GLOBAL_LIST_EMPTY(vending_products)
* Takes payment for whatever is the currently_vending item. Returns 1 if
* successful, 0 if failed.
*/
/obj/machinery/vending/proc/pay_with_ewallet(var/obj/item/spacecash/ewallet/wallet)
visible_message(span_info("\The [usr] swipes \the [wallet] through \the [src]."))
/obj/machinery/vending/proc/pay_with_ewallet(var/obj/item/spacecash/ewallet/wallet, mob/user)
visible_message(span_info("\The [user] swipes \the [wallet] through \the [src]."))
playsound(src, 'sound/machines/id_swipe.ogg', 50, 1)
if(currently_vending.price > wallet.worth)
to_chat(usr, span_warning("Insufficient funds on chargecard."))
@@ -327,7 +327,7 @@ GLOBAL_LIST_EMPTY(vending_products)
// Have the customer punch in the PIN before checking if there's enough money. Prevents people from figuring out acct is
// empty at high security levels
if(customer_account.security_level != 0) //If card requires pin authentication (ie seclevel 1 or 2)
var/attempt_pin = tgui_input_number(usr, "Enter pin code", "Vendor transaction")
var/attempt_pin = tgui_input_number(M, "Enter pin code", "Vendor transaction")
customer_account = attempt_account_access(I.associated_account_number, attempt_pin, 2)
if(!customer_account)
@@ -472,10 +472,10 @@ GLOBAL_LIST_EMPTY(vending_products)
return data
/obj/machinery/vending/tgui_act(action, params)
/obj/machinery/vending/tgui_act(action, params, datum/tgui/ui)
if(stat & (BROKEN|NOPOWER))
return
if(usr.stat || usr.restrained())
if(ui.user.stat || ui.user.restrained())
return
if(..())
return TRUE
@@ -483,32 +483,32 @@ GLOBAL_LIST_EMPTY(vending_products)
. = TRUE
switch(action)
if("remove_coin")
if(issilicon(usr))
if(issilicon(ui.user))
return FALSE
if(!coin)
to_chat(usr, span_filter_notice("There is no coin in this machine."))
to_chat(ui.user, span_filter_notice("There is no coin in this machine."))
return
coin.forceMove(src.loc)
if(!usr.get_active_hand())
usr.put_in_hands(coin)
if(!ui.user.get_active_hand())
ui.user.put_in_hands(coin)
to_chat(usr, span_notice("You remove \the [coin] from \the [src]."))
to_chat(ui.user, span_notice("You remove \the [coin] from \the [src]."))
coin = null
categories &= ~CAT_COIN
return TRUE
if("vend")
if(!vend_ready)
to_chat(usr, span_warning("[src] is busy!"))
to_chat(ui.user, span_warning("[src] is busy!"))
return
if(!allowed(usr) && !emagged && scan_id)
to_chat(usr, span_warning("Access denied.")) //Unless emagged of course
if(!allowed(ui.user) && !emagged && scan_id)
to_chat(ui.user, span_warning("Access denied.")) //Unless emagged of course
flick("[icon_state]-deny",src)
playsound(src, 'sound/machines/deniedbeep.ogg', 50, 0)
return
if(panel_open)
to_chat(usr, span_warning("[src] cannot dispense products while its service panel is open!"))
to_chat(ui.user, span_warning("[src] cannot dispense products while its service panel is open!"))
return
var/key = text2num(params["vend"])
@@ -518,27 +518,27 @@ GLOBAL_LIST_EMPTY(vending_products)
if(!(R.category & categories))
return
if(!can_buy(R, usr))
if(!can_buy(R, ui.user))
return
if(R.price <= 0)
vend(R, usr)
add_fingerprint(usr)
vend(R, ui.user)
add_fingerprint(ui.user)
return TRUE
if(issilicon(usr)) //If the item is not free, provide feedback if a synth is trying to buy something.
to_chat(usr, span_danger("Lawed unit recognized. Lawed units cannot complete this transaction. Purchase canceled."))
if(issilicon(ui.user)) //If the item is not free, provide feedback if a synth is trying to buy something.
to_chat(ui.user, span_danger("Lawed unit recognized. Lawed units cannot complete this transaction. Purchase canceled."))
return
if(!ishuman(usr))
if(!ishuman(ui.user))
return
vend_ready = FALSE // From this point onwards, vendor is locked to performing this transaction only, until it is resolved.
var/mob/living/carbon/human/H = usr
var/mob/living/carbon/human/H = ui.user
var/obj/item/card/id/C = H.GetIdCard()
if(!vendor_account || vendor_account.suspended)
to_chat(usr, span_filter_notice("Vendor account offline. Unable to process transaction."))
to_chat(ui.user, span_filter_notice("Vendor account offline. Unable to process transaction."))
flick("[icon_state]-deny",src)
vend_ready = TRUE
return
@@ -547,27 +547,27 @@ GLOBAL_LIST_EMPTY(vending_products)
var/paid = FALSE
if(istype(usr.get_active_hand(), /obj/item/spacecash))
var/obj/item/spacecash/cash = usr.get_active_hand()
paid = pay_with_cash(cash, usr)
else if(istype(usr.get_active_hand(), /obj/item/spacecash/ewallet))
var/obj/item/spacecash/ewallet/wallet = usr.get_active_hand()
paid = pay_with_ewallet(wallet)
if(istype(ui.user.get_active_hand(), /obj/item/spacecash))
var/obj/item/spacecash/cash = ui.user.get_active_hand()
paid = pay_with_cash(cash, ui.user)
else if(istype(ui.user.get_active_hand(), /obj/item/spacecash/ewallet))
var/obj/item/spacecash/ewallet/wallet = ui.user.get_active_hand()
paid = pay_with_ewallet(wallet, ui.user)
else if(istype(C, /obj/item/card))
paid = pay_with_card(C, usr)
/*else if(usr.can_advanced_admin_interact())
to_chat(usr, span_notice("Vending object due to admin interaction."))
paid = pay_with_card(C, ui.user)
/*else if(ui.user.can_advanced_admin_interact())
to_chat(ui.user, span_notice("Vending object due to admin interaction."))
paid = TRUE*/
else
to_chat(usr, span_warning("Payment failure: you have no ID or other method of payment."))
to_chat(ui.user, span_warning("Payment failure: you have no ID or other method of payment."))
vend_ready = TRUE
flick("[icon_state]-deny",src)
return TRUE // we set this because they shouldn't even be able to get this far, and we want the UI to update.
if(paid)
vend(currently_vending, usr) // vend will handle vend_ready
vend(currently_vending, ui.user) // vend will handle vend_ready
. = TRUE
else
to_chat(usr, span_warning("Payment failure: unable to process payment."))
to_chat(ui.user, span_warning("Payment failure: unable to process payment."))
vend_ready = TRUE
if("togglevoice")
@@ -31,9 +31,9 @@
/datum/eventkit/mob_spawner/tgui_static_data(mob/user)
var/list/data = list()
data["initial_x"] = usr.x;
data["initial_y"] = usr.y;
data["initial_z"] = usr.z;
data["initial_x"] = user.x;
data["initial_y"] = user.y;
data["initial_z"] = user.z;
return data
@@ -43,9 +43,9 @@
data["loc_lock"] = loc_lock
if(loc_lock)
data["loc_x"] = usr.x
data["loc_y"] = usr.y
data["loc_z"] = usr.z
data["loc_x"] = user.x
data["loc_y"] = user.y
data["loc_z"] = user.z
data["use_custom_ai"] = use_custom_ai
if(new_path)
@@ -81,16 +81,16 @@
return data
/datum/eventkit/mob_spawner/tgui_act(action, list/params)
/datum/eventkit/mob_spawner/tgui_act(action, list/params, datum/tgui/ui)
. = ..()
if(.)
return
if(!check_rights_for(usr.client, R_SPAWN))
if(!check_rights_for(ui.user.client, R_SPAWN))
return
switch(action)
if("select_path")
var/list/choices = typesof(/mob)
var/newPath = tgui_input_list(usr, "Please select the new path of the mob you want to spawn.", items = choices)
var/newPath = tgui_input_list(ui.user, "Please select the new path of the mob you want to spawn.", items = choices)
path = newPath
new_path = TRUE
@@ -99,20 +99,20 @@
use_custom_ai = !use_custom_ai
return TRUE
if("set_faction")
faction = sanitize(tgui_input_text(usr, "Please input your mobs' faction", "Faction", (faction ? faction : "neutral")))
faction = sanitize(tgui_input_text(ui.user, "Please input your mobs' faction", "Faction", (faction ? faction : "neutral")))
return TRUE
if("set_intent")
intent = tgui_input_list(usr, "Please select preferred intent", "Select Intent", list(I_HELP, I_HURT), (intent ? intent : I_HELP))
intent = tgui_input_list(ui.user, "Please select preferred intent", "Select Intent", list(I_HELP, I_HURT), (intent ? intent : I_HELP))
return TRUE
if("set_ai_path")
ai_type = tgui_input_list(usr, "Select AI path. Not all subtypes are compatible!", "AI type", \
ai_type = tgui_input_list(ui.user, "Select AI path. Not all subtypes are compatible!", "AI type", \
typesof(/datum/ai_holder/), (ai_type ? ai_type : /datum/ai_holder/simple_mob/inert))
return TRUE
if("loc_lock")
loc_lock = !loc_lock
return TRUE
if("start_spawn")
var/confirm = tgui_alert(usr, "Are you sure that you want to start spawning your custom mobs?", "Confirmation", list("Yes", "Cancel"))
var/confirm = tgui_alert(ui.user, "Are you sure that you want to start spawning your custom mobs?", "Confirmation", list("Yes", "Cancel"))
if(confirm != "Yes")
return FALSE
@@ -124,12 +124,12 @@
var/z = params["z"]
if(!name)
to_chat(usr, span_warning("Name cannot be empty."))
to_chat(ui.user, span_warning("Name cannot be empty."))
return FALSE
var/turf/T = locate(x, y, z)
if(!T)
to_chat(usr, span_warning("Those coordinates are outside the boundaries of the map."))
to_chat(ui.user, span_warning("Those coordinates are outside the boundaries of the map."))
return FALSE
for(var/i = 0, i < amount, i++)
@@ -137,7 +137,7 @@
var/turf/TU = get_turf(locate(x, y, z))
TU.ChangeTurf(path)
else
var/mob/M = new path(usr.loc)
var/mob/M = new path(ui.user.loc)
M.name = sanitize(name)
M.desc = sanitize(params["desc"])
@@ -161,7 +161,7 @@
L.initialize_ai_holder()
L.AdjustSleeping(-100)
else
to_chat(usr, span_notice("You can only set AI for subtypes of mob/living!"))
to_chat(ui.user, span_notice("You can only set AI for subtypes of mob/living!"))
@@ -180,7 +180,7 @@
M.size_multiplier = size_mul
M.update_icon()
else
to_chat(usr, span_warning("Size Multiplier not applied: ([size_mul]) is not a valid input."))
to_chat(ui.user, span_warning("Size Multiplier not applied: ([size_mul]) is not a valid input."))
M.forceMove(T)
@@ -58,17 +58,17 @@
switch(action)
if("slot")
var/slot = params["slot"]
var/obj/item/I = usr.get_active_hand()
var/obj/item/I = ui.user.get_active_hand()
if(slot <= LAZYLEN(cooking_objs)) // Inserting
var/datum/cooking_item/CI = cooking_objs[slot]
if(istype(I) && can_insert(I)) // Why do hard work when we can just make them smack us?
attackby(I, usr)
attackby(I, ui.user)
else if(istype(CI))
eject(CI, usr)
eject(CI, ui.user)
return TRUE
if(istype(I)) // Why do hard work when we can just make them smack us?
attackby(I, usr)
attackby(I, ui.user)
return TRUE
/obj/machinery/appliance/cooker/examine(var/mob/user)
@@ -212,20 +212,20 @@
.["locked"] = locked
.["secure"] = is_secure
/obj/machinery/smartfridge/tgui_act(action, params)
/obj/machinery/smartfridge/tgui_act(action, params, datum/tgui/ui)
if(..())
return TRUE
add_fingerprint(usr)
add_fingerprint(ui.user)
switch(action)
if("Release")
var/amount = 0
if(params["amount"])
amount = params["amount"]
else
amount = tgui_input_number(usr, "How many items?", "How many items would you like to take out?", 1)
amount = tgui_input_number(ui.user, "How many items?", "How many items would you like to take out?", 1)
if(QDELETED(src) || QDELETED(usr) || !usr.Adjacent(src))
if(QDELETED(src) || QDELETED(ui.user) || !ui.user.Adjacent(src))
return FALSE
var/index = text2num(params["index"])
@@ -261,11 +261,11 @@
/*
* Secure Smartfridges
*/
/obj/machinery/smartfridge/secure/tgui_act(action, params)
/obj/machinery/smartfridge/secure/tgui_act(action, params, datum/tgui/ui)
if(stat & (NOPOWER|BROKEN))
return TRUE
if(usr.contents.Find(src) || (in_range(src, usr) && istype(loc, /turf)))
if((!allowed(usr) && scan_id) && !emagged && locked != -1 && action == "Release")
to_chat(usr, span_warning("Access denied."))
if(ui.user.contents.Find(src) || (in_range(src, ui.user) && istype(loc, /turf)))
if((!allowed(ui.user) && scan_id) && !emagged && locked != -1 && action == "Release")
to_chat(ui.user, span_warning("Access denied."))
return TRUE
return ..()
+7 -7
View File
@@ -137,7 +137,7 @@
return TRUE
if("AIoverride")
if(!issilicon(usr))
if(!issilicon(ui.user))
return
if(safety_disabled && emagged)
@@ -146,18 +146,18 @@
safety_disabled = !safety_disabled
update_projections()
if(safety_disabled)
message_admins("[key_name_admin(usr)] overrode the holodeck's safeties")
log_game("[key_name(usr)] overrided the holodeck's safeties")
message_admins("[key_name_admin(ui.user)] overrode the holodeck's safeties")
log_game("[key_name(ui.user)] overrided the holodeck's safeties")
else
message_admins("[key_name_admin(usr)] restored the holodeck's safeties")
log_game("[key_name(usr)] restored the holodeck's safeties")
message_admins("[key_name_admin(ui.user)] restored the holodeck's safeties")
log_game("[key_name(ui.user)] restored the holodeck's safeties")
return TRUE
if("gravity")
toggleGravity(linkedholodeck)
return TRUE
add_fingerprint(usr)
add_fingerprint(ui.user)
/obj/machinery/computer/HolodeckControl/emag_act(var/remaining_charges, var/mob/user as mob)
playsound(src, 'sound/effects/sparks4.ogg', 75, 1)
@@ -168,7 +168,7 @@
update_projections()
to_chat(user, span_notice("You vastly increase projector power and override the safety and security protocols."))
to_chat(user, "Warning. Automatic shutoff and derezing protocols have been corrupted. Please call [using_map.company_name] maintenance and do not use the simulator.")
log_game("[key_name(usr)] emagged the Holodeck Control Computer")
log_game("[key_name(user)] emagged the Holodeck Control Computer")
return 1
return
+2 -2
View File
@@ -175,8 +175,8 @@
if(..())
return TRUE
usr.set_machine(src)
add_fingerprint(usr)
ui.user.set_machine(src)
add_fingerprint(ui.user)
switch(action)
if("eject_packet")
+1 -1
View File
@@ -66,7 +66,7 @@
switch(action)
if("print")
print_report(usr)
print_report(ui.user)
return TRUE
if("close")
last_seed = null
@@ -97,17 +97,17 @@
switch(action)
// Actual assembly actions
if("rename")
rename(usr)
rename(ui.user)
return TRUE
if("remove_cell")
if(!battery)
to_chat(usr, span_warning("There's no power cell to remove from \the [src]."))
to_chat(ui.user, span_warning("There's no power cell to remove from \the [src]."))
return FALSE
var/turf/T = get_turf(src)
battery.forceMove(T)
playsound(T, 'sound/items/Crowbar.ogg', 50, 1)
to_chat(usr, span_notice("You pull \the [battery] out of \the [src]'s power supplier."))
to_chat(ui.user, span_notice("You pull \the [battery] out of \the [src]'s power supplier."))
battery = null
return TRUE
@@ -158,14 +158,14 @@
var/obj/item/integrated_circuit/C = locate(params["ref"]) in contents
if(!istype(C))
return
C.tgui_interact(usr, null, ui)
C.tgui_interact(ui.user, null, ui)
return TRUE
if("remove_circuit")
var/obj/item/integrated_circuit/C = locate(params["ref"]) in contents
if(!istype(C))
return
C.remove(usr)
C.remove(ui.user)
return TRUE
return FALSE
@@ -149,12 +149,12 @@ a creative player the means to solve many problems. Circuits are held inside an
if(params["link"])
linked = locate(params["link"]) in pin.linked
var/obj/held_item = usr.get_active_hand()
var/obj/held_item = ui.user.get_active_hand()
. = TRUE
switch(action)
if("rename")
rename_component(usr)
rename_component(ui.user)
return
if("wire", "pin_name", "pin_data", "pin_unwire")
@@ -162,37 +162,37 @@ a creative player the means to solve many problems. Circuits are held inside an
var/obj/item/multitool/M = held_item
switch(action)
if("pin_name")
M.wire(pin, usr)
M.wire(pin, ui.user)
if("pin_data")
var/datum/integrated_io/io = pin
io.ask_for_pin_data(usr, held_item) // The pins themselves will determine how to ask for data, and will validate the data.
io.ask_for_pin_data(ui.user, held_item) // The pins themselves will determine how to ask for data, and will validate the data.
if("pin_unwire")
M.unwire(pin, linked, usr)
M.unwire(pin, linked, ui.user)
else if(istype(held_item, /obj/item/integrated_electronics/wirer))
var/obj/item/integrated_electronics/wirer/wirer = held_item
if(linked)
wirer.wire(linked, usr)
wirer.wire(linked, ui.user)
else if(pin)
wirer.wire(pin, usr)
wirer.wire(pin, ui.user)
else if(istype(held_item, /obj/item/integrated_electronics/debugger))
var/obj/item/integrated_electronics/debugger/debugger = held_item
if(pin)
debugger.write_data(pin, usr)
debugger.write_data(pin, ui.user)
else
to_chat(usr, span_warning("You can't do a whole lot without the proper tools."))
to_chat(ui.user, span_warning("You can't do a whole lot without the proper tools."))
return
if("scan")
if(istype(held_item, /obj/item/integrated_electronics/debugger))
var/obj/item/integrated_electronics/debugger/D = held_item
if(D.accepting_refs)
D.afterattack(src, usr, TRUE)
D.afterattack(src, ui.user, TRUE)
else
to_chat(usr, span_warning("The Debugger's 'ref scanner' needs to be on."))
to_chat(ui.user, span_warning("The Debugger's 'ref scanner' needs to be on."))
else
to_chat(usr, span_warning("You need a multitool/debugger set to 'ref' mode to do that."))
to_chat(ui.user, span_warning("You need a multitool/debugger set to 'ref' mode to do that."))
return
@@ -200,12 +200,12 @@ a creative player the means to solve many problems. Circuits are held inside an
var/obj/item/integrated_circuit/examined = locate(params["ref"])
if(istype(examined) && (examined.loc == loc))
if(ui.parent_ui)
examined.tgui_interact(usr, null, ui.parent_ui)
examined.tgui_interact(ui.user, null, ui.parent_ui)
else
examined.tgui_interact(usr)
examined.tgui_interact(ui.user)
if("remove")
remove(usr)
remove(ui.user)
return
return FALSE
@@ -183,7 +183,7 @@
if(..())
return TRUE
add_fingerprint(usr)
add_fingerprint(ui.user)
switch(action)
if("build")
@@ -209,15 +209,15 @@
return
if(!debug)
if(!Adjacent(usr))
to_chat(usr, span_notice("You are too far away from \the [src]."))
if(!Adjacent(ui.user))
to_chat(ui.user, span_notice("You are too far away from \the [src]."))
if(metal - cost < 0)
to_chat(usr, span_warning("You need [cost] metal to build that!."))
to_chat(ui.user, span_warning("You need [cost] metal to build that!."))
return 1
metal -= cost
var/obj/item/built = new build_type(get_turf(loc))
usr.put_in_hands(built)
to_chat(usr, span_notice("[capitalize(built.name)] printed."))
ui.user.put_in_hands(built)
to_chat(ui.user, span_notice("[capitalize(built.name)] printed."))
playsound(src, 'sound/items/jaws_pry.ogg', 50, TRUE)
return TRUE
+2 -2
View File
@@ -112,14 +112,14 @@
my_area.toggle_optional(immersion)
return TRUE
add_fingerprint(usr)
add_fingerprint(ui.user)
/obj/machinery/computer/looking_glass/emag_act(var/remaining_charges, var/mob/user as mob)
if (!emagged)
playsound(src, 'sound/effects/sparks4.ogg', 75, 1)
emagged = 1
to_chat(user, span_notice("You unlock several programs that were hidden somewhere in memory."))
log_game("[key_name(usr)] emagged the [name]")
log_game("[key_name(user)] emagged the [name]")
return 1
return
+1 -1
View File
@@ -216,7 +216,7 @@
return TRUE
if("play")
if(current_track == null)
to_chat(usr, "No track selected.")
to_chat(ui.user, "No track selected.")
else
StartPlaying()
return TRUE
@@ -90,17 +90,17 @@
return data
/obj/machinery/mineral/processing_unit_console/tgui_act(action, list/params)
/obj/machinery/mineral/processing_unit_console/tgui_act(action, list/params, datum/tgui/ui)
if(..())
return TRUE
add_fingerprint(usr)
add_fingerprint(ui.user)
switch(action)
if("toggleSmelting")
var/ore = params["ore"]
var/new_setting = params["set"]
if(new_setting == null)
new_setting = tgui_input_list(usr, "What setting do you wish to use for processing [ore]]?", "Process Setting", list("Smelting","Compressing","Alloying","Nothing"))
new_setting = tgui_input_list(ui.user, "What setting do you wish to use for processing [ore]]?", "Process Setting", list("Smelting","Compressing","Alloying","Nothing"))
if(!new_setting)
return
switch(new_setting)
@@ -119,7 +119,7 @@
if("logoff")
if(!inserted_id)
return
usr.put_in_hands(inserted_id)
ui.user.put_in_hands(inserted_id)
inserted_id = null
. = TRUE
if("claim")
@@ -128,16 +128,16 @@
inserted_id.mining_points += machine.points
machine.points = 0
else
to_chat(usr, span_warning("Required access not found."))
to_chat(ui.user, span_warning("Required access not found."))
. = TRUE
if("insert")
var/obj/item/card/id/I = usr.get_active_hand()
var/obj/item/card/id/I = ui.user.get_active_hand()
if(istype(I))
usr.drop_item()
ui.user.drop_item()
I.forceMove(src)
inserted_id = I
else
to_chat(usr, span_warning("No valid ID."))
to_chat(ui.user, span_warning("No valid ID."))
. = TRUE
if("speed_toggle")
machine.toggle_speed()
@@ -49,7 +49,7 @@
data["stackingAmt"] = machine.stack_amt
return data
/obj/machinery/mineral/stacking_unit_console/tgui_act(action, list/params)
/obj/machinery/mineral/stacking_unit_console/tgui_act(action, list/params, datum/tgui/ui)
if(..())
return TRUE
@@ -66,7 +66,7 @@
machine.stack_storage[stack] = 0
. = TRUE
add_fingerprint(usr)
add_fingerprint(ui.user)
/**********************Mineral stacking unit**************************/
@@ -257,7 +257,7 @@
ui.set_autoupdate(FALSE)
/obj/machinery/mineral/equipment_vendor/tgui_act(action, params)
/obj/machinery/mineral/equipment_vendor/tgui_act(action, params, datum/tgui/ui)
if(..())
return
@@ -266,7 +266,7 @@
if("logoff")
if(!inserted_id)
return
usr.put_in_hands(inserted_id)
ui.user.put_in_hands(inserted_id)
inserted_id = null
if("purchase")
if(!inserted_id)
@@ -279,7 +279,7 @@
return
var/datum/data/mining_equipment/prize = prize_list[category][name]
if(prize.cost > get_points(inserted_id)) // shouldn't be able to access this since the button is greyed out, but..
to_chat(usr, span_danger("You have insufficient points."))
to_chat(ui.user, span_danger("You have insufficient points."))
flick(icon_deny, src) //VOREStation Add
return
+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)
+1 -1
View File
@@ -294,7 +294,7 @@
switch(action)
if("targetSlot")
H.handle_strip(params["slot"], usr)
H.handle_strip(params["slot"], ui.user)
return TRUE
@@ -50,7 +50,7 @@
return data
/datum/pai_software/directives/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
var/mob/living/silicon/pai/P = usr
var/mob/living/silicon/pai/P = ui.user
if(!istype(P))
return TRUE
if(..())
@@ -160,7 +160,7 @@
/datum/pai_software/med_records/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
. = ..()
var/mob/living/silicon/pai/P = usr
var/mob/living/silicon/pai/P = ui.user
if(!istype(P))
return
@@ -216,7 +216,7 @@
/datum/pai_software/sec_records/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
. = ..()
var/mob/living/silicon/pai/P = usr
var/mob/living/silicon/pai/P = ui.user
if(!istype(P))
return
@@ -267,7 +267,7 @@
return data
/datum/pai_software/door_jack/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
var/mob/living/silicon/pai/P = usr
var/mob/living/silicon/pai/P = ui.user
if(!istype(P) || ..())
return TRUE
@@ -482,7 +482,7 @@
if(..())
return TRUE
var/mob/living/silicon/pai/user = usr
var/mob/living/silicon/pai/user = ui.user
if(istype(user))
var/obj/item/radio/integrated/signal/R = user.sradio
@@ -64,7 +64,7 @@
return data
/obj/machinery/computer/drone_control/tgui_act(action, params)
/obj/machinery/computer/drone_control/tgui_act(action, params, datum/tgui/ui)
if(..())
return TRUE
@@ -75,10 +75,10 @@
return
drone_call_area = t_area
to_chat(usr, span_notice("You set the area selector to [drone_call_area]."))
to_chat(ui.user, span_notice("You set the area selector to [drone_call_area]."))
if("ping")
to_chat(usr, span_notice("You issue a maintenance request for all active drones, highlighting [drone_call_area]."))
to_chat(ui.user, span_notice("You issue a maintenance request for all active drones, highlighting [drone_call_area]."))
for(var/mob/living/silicon/robot/drone/D in player_list)
if(D.stat == 0)
to_chat(D, "-- Maintenance drone presence requested in: [drone_call_area].")
@@ -87,16 +87,16 @@
var/mob/living/silicon/robot/drone/D = locate(params["ref"])
if(D.stat != 2)
to_chat(usr, span_danger("You issue a law synchronization directive for the drone."))
to_chat(ui.user, span_danger("You issue a law synchronization directive for the drone."))
D.law_resync()
if("shutdown")
var/mob/living/silicon/robot/drone/D = locate(params["ref"])
if(D.stat != 2)
to_chat(usr, span_danger("You issue a kill command for the unfortunate drone."))
message_admins("[key_name_admin(usr)] issued kill order for drone [key_name_admin(D)] from control console.")
log_game("[key_name(usr)] issued kill order for [key_name(src)] from control console.")
to_chat(ui.user, span_danger("You issue a kill command for the unfortunate drone."))
message_admins("[key_name_admin(ui.user)] issued kill order for drone [key_name_admin(D)] from control console.")
log_game("[key_name(ui.user)] issued kill order for [key_name(src)] from control console.")
D.shut_down()
if("search_fab")
@@ -108,10 +108,10 @@
continue
dronefab = fab
to_chat(usr, span_notice("Drone fabricator located."))
to_chat(ui.user, span_notice("Drone fabricator located."))
return
to_chat(usr, span_danger("Unable to locate drone fabricator."))
to_chat(ui.user, span_danger("Unable to locate drone fabricator."))
if("toggle_fab")
if(!dronefab)
@@ -119,8 +119,8 @@
if(get_dist(src,dronefab) > 3)
dronefab = null
to_chat(usr, span_danger("Unable to locate drone fabricator."))
to_chat(ui.user, span_danger("Unable to locate drone fabricator."))
return
dronefab.produce_drones = !dronefab.produce_drones
to_chat(usr, span_notice("You [dronefab.produce_drones ? "enable" : "disable"] drone production in the nearby fabricator."))
to_chat(ui.user, span_notice("You [dronefab.produce_drones ? "enable" : "disable"] drone production in the nearby fabricator."))
@@ -104,7 +104,7 @@
return data
/datum/tgui_module/robot_ui/tgui_act(action, params)
/datum/tgui_module/robot_ui/tgui_act(action, params, datum/tgui/ui)
. = ..()
if(.)
return
@@ -126,13 +126,13 @@
if(istype(C))
C.toggled = !C.toggled
if(C.toggled)
to_chat(usr, span_notice("You enable [C]."))
to_chat(ui.user, span_notice("You enable [C]."))
else
to_chat(usr, span_warning("You disable [C]."))
to_chat(ui.user, span_warning("You disable [C]."))
. = TRUE
if("toggle_module")
if(R.weapon_lock)
to_chat(usr, span_danger("Error: Modules locked."))
to_chat(ui.user, span_danger("Error: Modules locked."))
return
var/obj/item/module = locate(params["ref"])
if(istype(module))
@@ -89,12 +89,10 @@
shutdown_computer()
return TRUE
if("PC_minimize")
var/mob/user = usr
minimize_program(user)
minimize_program(ui.user)
if("PC_killprogram")
var/prog = params["name"]
var/datum/computer_file/program/P = null
var/mob/user = usr
if(hard_drive)
P = hard_drive.find_file_by_name(prog)
@@ -102,7 +100,7 @@
return
P.kill_program(1)
to_chat(user, span_notice("Program [P.filename].[P.filetype] with PID [rand(100,999)] has been killed."))
to_chat(ui.user, span_notice("Program [P.filename].[P.filetype] with PID [rand(100,999)] has been killed."))
return TRUE
if("PC_runprogram")
return run_program(params["name"])
@@ -115,7 +113,7 @@
var/param = params["name"]
switch(param)
if("ID")
proc_eject_id(usr)
proc_eject_id(ui.user)
return TRUE
else
return
@@ -206,7 +206,6 @@
ui.close()
return 1
if("PC_minimize")
var/mob/user = usr
if(!computer.active_program)
return
@@ -217,8 +216,8 @@
computer.update_icon()
ui.close()
if(user && istype(user))
computer.tgui_interact(user) // Re-open the UI on this computer. It should show the main screen now.
if(ui.user && istype(ui.user))
computer.tgui_interact(ui.user) // Re-open the UI on this computer. It should show the main screen now.
@@ -30,7 +30,7 @@
if("PRG_newtextfile")
if(!HDD)
return
var/newname = sanitize(tgui_input_text(usr, "Enter file name or leave blank to cancel:", "File rename"))
var/newname = sanitize(tgui_input_text(ui.user, "Enter file name or leave blank to cancel:", "File rename"))
if(!newname)
return
if(HDD.find_file_by_name(newname))
@@ -60,13 +60,13 @@
var/datum/computer_file/data/F = computer.find_file_by_uid(open_file)
if(!F || !istype(F))
return
if(F.do_not_edit && (tgui_alert(usr, "WARNING: This file is not compatible with editor. Editing it may result in permanently corrupted formatting or damaged data consistency. Edit anyway?", "Incompatible File", list("No", "Yes")) != "Yes"))
if(F.do_not_edit && (tgui_alert(ui.user, "WARNING: This file is not compatible with editor. Editing it may result in permanently corrupted formatting or damaged data consistency. Edit anyway?", "Incompatible File", list("No", "Yes")) != "Yes"))
return
var/oldtext = html_decode(F.stored_data)
oldtext = replacetext(oldtext, "\[br\]", "\n")
var/newtext = sanitize(replacetext(tgui_input_text(usr, "Editing file [F.filename].[F.filetype]. You may use most tags used in paper formatting:", "Text Editor", oldtext, MAX_TEXTFILE_LENGTH, TRUE, prevent_enter = TRUE), "\n", "\[br\]"), MAX_TEXTFILE_LENGTH)
var/newtext = sanitize(replacetext(tgui_input_text(ui.user, "Editing file [F.filename].[F.filetype]. You may use most tags used in paper formatting:", "Text Editor", oldtext, MAX_TEXTFILE_LENGTH, TRUE, prevent_enter = TRUE), "\n", "\[br\]"), MAX_TEXTFILE_LENGTH)
if(!newtext)
return
@@ -107,7 +107,7 @@
/**
* This is tgui's replacement for Topic(). It handles any user input from the UI.
*/
/datum/computer_file/program/game/tgui_act(action, list/params)
/datum/computer_file/program/game/tgui_act(action, list/params, datum/tgui/ui)
if(..()) // Always call parent in tgui_act, it handles making sure the user is allowed to interact with the UI.
return TRUE
@@ -115,8 +115,8 @@
if(computer)
printer = computer.nano_printer
// var/gamerSkillLevel = usr.mind?.get_skill_level(/datum/skill/gaming)
// var/gamerSkill = usr.mind?.get_skill_modifier(/datum/skill/gaming, SKILL_RANDS_MODIFIER)
// var/gamerSkillLevel = ui.user.mind?.get_skill_level(/datum/skill/gaming)
// var/gamerSkill = ui.user.mind?.get_skill_modifier(/datum/skill/gaming, SKILL_RANDS_MODIFIER)
switch(action)
if("Attack")
var/attackamt = 0 //Spam prevention.
@@ -162,20 +162,20 @@
return TRUE
if("Dispense_Tickets")
if(!printer)
to_chat(usr, span_notice("Hardware error: A printer is required to redeem tickets."))
to_chat(ui.user, span_notice("Hardware error: A printer is required to redeem tickets."))
return
if(printer.stored_paper <= 0)
to_chat(usr, span_notice("Hardware error: Printer is out of paper."))
to_chat(ui.user, span_notice("Hardware error: Printer is out of paper."))
return
else
computer.visible_message(span_infoplain(span_bold("\The [computer]") + " prints out paper."))
if(ticket_count >= 1)
new /obj/item/stack/arcadeticket((get_turf(computer)), 1)
to_chat(usr, span_notice("[src] dispenses a ticket!"))
to_chat(ui.user, span_notice("[src] dispenses a ticket!"))
ticket_count -= 1
printer.stored_paper -= 1
else
to_chat(usr, span_notice("You don't have any stored tickets!"))
to_chat(ui.user, span_notice("You don't have any stored tickets!"))
return TRUE
if("Start_Game")
game_active = TRUE
@@ -106,7 +106,7 @@
if(downloading || !loaded_article)
return
var/savename = sanitize(tgui_input_text(usr, "Enter file name or leave blank to cancel:", "Save article", loaded_article.filename))
var/savename = sanitize(tgui_input_text(ui.user, "Enter file name or leave blank to cancel:", "Save article", loaded_article.filename))
if(!savename)
return TRUE
var/obj/item/computer_hardware/hard_drive/HDD = computer.hard_drive
@@ -26,7 +26,7 @@
/datum/computer_file/program/chatclient/New()
username = "DefaultUser[rand(100, 999)]"
/datum/computer_file/program/chatclient/tgui_act(action, params)
/datum/computer_file/program/chatclient/tgui_act(action, params, datum/tgui/ui)
if(..())
return
@@ -47,8 +47,7 @@
return TRUE
channel.add_message(message, username)
// var/mob/living/user = usr
// user.log_talk(message, LOG_CHAT, tag="as [username] to channel [channel.title]")
// ui.user.log_talk(message, LOG_CHAT, tag="as [username] to channel [channel.title]")
return TRUE
if("PRG_joinchannel")
var/new_target = text2num(params["id"])
@@ -85,8 +84,7 @@
if(channel)
channel.remove_client(src) // We shouldn't be in channel's user list, but just in case...
return TRUE
var/mob/living/user = usr
if(can_run(user, TRUE, access_network))
if(isliving(ui.user) && can_run(ui.user, TRUE, access_network))
for(var/datum/ntnet_conversation/chan as anything in ntnet_global.chat_channels)
chan.remove_client(src)
netadmin_mode = TRUE
@@ -134,7 +134,7 @@ var/global/nttransfer_uid = 0
if(!remote || !remote.provided_file)
return
if(remote.server_password)
var/pass = sanitize(tgui_input_text(usr, "Code 401 Unauthorized. Please enter password:", "Password required"))
var/pass = sanitize(tgui_input_text(ui.user, "Code 401 Unauthorized. Please enter password:", "Password required"))
if(pass != remote.server_password)
error = "Incorrect Password"
return
@@ -152,7 +152,7 @@ var/global/nttransfer_uid = 0
provided_file = null
return TRUE
if("PRG_setpassword")
var/pass = sanitize(tgui_input_text(usr, "Enter new server password. Leave blank to cancel, input 'none' to disable password.", "Server security", "none"))
var/pass = sanitize(tgui_input_text(ui.user, "Enter new server password. Leave blank to cancel, input 'none' to disable password.", "Server security", "none"))
if(!pass)
return
if(pass == "none")
@@ -74,11 +74,11 @@
switch(action)
if("PRG_txtrpeview")
show_browser(usr,"<HTML><HEAD><TITLE>[open_file]</TITLE></HEAD>[pencode2html(loaded_data)]</BODY></HTML>", "window=[open_file]")
show_browser(ui.user,"<HTML><HEAD><TITLE>[open_file]</TITLE></HEAD>[pencode2html(loaded_data)]</BODY></HTML>", "window=[open_file]")
return TRUE
if("PRG_taghelp")
to_chat(usr, span_notice("The hologram of a googly-eyed paper clip helpfully tells you:"))
to_chat(ui.user, span_notice("The hologram of a googly-eyed paper clip helpfully tells you:"))
var/help = {"
\[br\] : Creates a linebreak.
\[center\] - \[/center\] : Centers the text.
@@ -104,7 +104,7 @@
\[redlogo\] - Inserts red NT logo image.
\[sglogo\] - Inserts Solgov insignia image."}
to_chat(usr, help)
to_chat(ui.user, help)
return TRUE
if("PRG_closebrowser")
@@ -121,7 +121,7 @@
if("PRG_openfile")
if(is_edited)
if(tgui_alert(usr, "Would you like to save your changes first?","Save Changes",list("Yes","No")) == "Yes")
if(tgui_alert(ui.user, "Would you like to save your changes first?","Save Changes",list("Yes","No")) == "Yes")
save_file(open_file)
browsing = 0
if(!open_file(params["PRG_openfile"]))
@@ -130,10 +130,10 @@
if("PRG_newfile")
if(is_edited)
if(tgui_alert(usr, "Would you like to save your changes first?","Save Changes",list("Yes","No")) == "Yes")
if(tgui_alert(ui.user, "Would you like to save your changes first?","Save Changes",list("Yes","No")) == "Yes")
save_file(open_file)
var/newname = sanitize(tgui_input_text(usr, "Enter file name:", "New File"))
var/newname = sanitize(tgui_input_text(ui.user, "Enter file name:", "New File"))
if(!newname)
return TRUE
var/datum/computer_file/data/F = create_file(newname)
@@ -146,7 +146,7 @@
return TRUE
if("PRG_saveasfile")
var/newname = sanitize(tgui_input_text(usr, "Enter file name:", "Save As"))
var/newname = sanitize(tgui_input_text(ui.user, "Enter file name:", "Save As"))
if(!newname)
return TRUE
var/datum/computer_file/data/F = create_file(newname, loaded_data)
@@ -158,7 +158,7 @@
if("PRG_savefile")
if(!open_file)
open_file = sanitize(tgui_input_text(usr, "Enter file name:", "Save As"))
open_file = sanitize(tgui_input_text(ui.user, "Enter file name:", "Save As"))
if(!open_file)
return 0
if(!save_file(open_file))
@@ -169,7 +169,7 @@
var/oldtext = html_decode(loaded_data)
oldtext = replacetext(oldtext, "\[br\]", "\n")
var/newtext = sanitize(replacetext(tgui_input_text(usr, "Editing file '[open_file]'. You may use most tags used in paper formatting:", "Text Editor", oldtext, MAX_TEXTFILE_LENGTH, TRUE, prevent_enter = TRUE), "\n", "\[br\]"), MAX_TEXTFILE_LENGTH)
var/newtext = sanitize(replacetext(tgui_input_text(ui.user, "Editing file '[open_file]'. You may use most tags used in paper formatting:", "Text Editor", oldtext, MAX_TEXTFILE_LENGTH, TRUE, prevent_enter = TRUE), "\n", "\[br\]"), MAX_TEXTFILE_LENGTH)
if(!newtext)
return
loaded_data = newtext
@@ -66,7 +66,7 @@
return TRUE
// High security - can only be operated when the user has an ID with access on them.
var/obj/item/card/id/I = usr.GetIdCard()
var/obj/item/card/id/I = ui.user.GetIdCard()
if(!istype(I) || !(access_network in I.GetAccess()))
return TRUE
@@ -93,7 +93,7 @@
if(!current_account)
return TRUE
var/newpass = sanitize(tgui_input_text(usr,"Enter new password for account [current_account.login]", "Password", null, 100), 100)
var/newpass = sanitize(tgui_input_text(ui.user,"Enter new password for account [current_account.login]", "Password", null, 100), 100)
if(!newpass)
return TRUE
current_account.password = newpass
@@ -118,10 +118,10 @@
return TRUE
if("newaccount")
var/newdomain = sanitize(tgui_input_list(usr,"Pick domain:", "Domain name", using_map.usable_email_tlds))
var/newdomain = sanitize(tgui_input_list(ui.user,"Pick domain:", "Domain name", using_map.usable_email_tlds))
if(!newdomain)
return TRUE
var/newlogin = sanitize(tgui_input_text(usr,"Pick account name (@[newdomain]):", "Account name", null, 100), 100)
var/newlogin = sanitize(tgui_input_text(ui.user,"Pick account name (@[newdomain]):", "Account name", null, 100), 100)
if(!newlogin)
return TRUE
@@ -60,8 +60,8 @@
ntnet_global.setting_disabled = FALSE
return TRUE
var/response = tgui_alert(usr, "Really disable NTNet wireless? If your computer is connected wirelessly you won't be able to turn it back on! This will affect all connected wireless devices.", "NTNet shutdown", list("Yes", "No"))
if(response == "Yes" && tgui_status(usr, state) == STATUS_INTERACTIVE)
var/response = tgui_alert(ui.user, "Really disable NTNet wireless? If your computer is connected wirelessly you won't be able to turn it back on! This will affect all connected wireless devices.", "NTNet shutdown", list("Yes", "No"))
if(response == "Yes" && tgui_status(ui.user, state) == STATUS_INTERACTIVE)
ntnet_global.setting_disabled = TRUE
return TRUE
if("purgelogs")
@@ -81,14 +81,14 @@
if("ban_nid")
if(!ntnet_global)
return
var/nid = tgui_input_number(usr,"Enter NID of device which you want to block from the network:", "Enter NID")
if(nid && tgui_status(usr, state) == STATUS_INTERACTIVE)
var/nid = tgui_input_number(ui.user,"Enter NID of device which you want to block from the network:", "Enter NID")
if(nid && tgui_status(ui.user, state) == STATUS_INTERACTIVE)
ntnet_global.banned_nids |= nid
return TRUE
if("unban_nid")
if(!ntnet_global)
return
var/nid = tgui_input_number(usr,"Enter NID of device which you want to unblock from the network:", "Enter NID")
if(nid && tgui_status(usr, state) == STATUS_INTERACTIVE)
var/nid = tgui_input_number(ui.user,"Enter NID of device which you want to unblock from the network:", "Enter NID")
if(nid && tgui_status(ui.user, state) == STATUS_INTERACTIVE)
ntnet_global.banned_nids -= nid
return TRUE
@@ -72,19 +72,19 @@ var/warrant_uid = 0
// The following actions will only be possible if the user has an ID with security access equipped. This is in line with modular computer framework's authentication methods,
// which also use RFID scanning to allow or disallow access to some functions. Anyone can view warrants, editing requires ID. This also prevents situations where you show a tablet
// to someone who is to be arrested, which allows them to change the stuff there.
var/obj/item/card/id/I = usr.GetIdCard()
var/obj/item/card/id/I = ui.user.GetIdCard()
if(!istype(I) || !I.registered_name || !(access_security in I.GetAccess()))
to_chat(usr, "Authentication error: Unable to locate ID with appropriate access to allow this operation.")
to_chat(ui.user, "Authentication error: Unable to locate ID with appropriate access to allow this operation.")
return
switch(action)
if("addwarrant")
. = TRUE
var/datum/data/record/warrant/W = new()
var/temp = tgui_alert(usr, "Do you want to create a search-, or an arrest warrant?", "Warrant Type", list("Search","Arrest","Cancel"))
var/temp = tgui_alert(ui.user, "Do you want to create a search-, or an arrest warrant?", "Warrant Type", list("Search","Arrest","Cancel"))
if(!temp)
return
if(tgui_status(usr, state) == STATUS_INTERACTIVE)
if(tgui_status(ui.user, state) == STATUS_INTERACTIVE)
if(temp == "Arrest")
W.fields["namewarrant"] = "Unknown"
W.fields["charges"] = "No charges present"
@@ -112,24 +112,24 @@ var/warrant_uid = 0
var/namelist = list()
for(var/datum/data/record/t in data_core.general)
namelist += t.fields["name"]
var/new_name = sanitize(tgui_input_list(usr, "Please input name:", "Name Choice", namelist))
if(tgui_status(usr, state) == STATUS_INTERACTIVE)
var/new_name = sanitize(tgui_input_list(ui.user, "Please input name:", "Name Choice", namelist))
if(tgui_status(ui.user, state) == STATUS_INTERACTIVE)
if (!new_name)
return
activewarrant.fields["namewarrant"] = new_name
if("editwarrantnamecustom")
. = TRUE
var/new_name = sanitize(tgui_input_text(usr, "Please input name"))
if(tgui_status(usr, state) == STATUS_INTERACTIVE)
var/new_name = sanitize(tgui_input_text(ui.user, "Please input name"))
if(tgui_status(ui.user, state) == STATUS_INTERACTIVE)
if (!new_name)
return
activewarrant.fields["namewarrant"] = new_name
if("editwarrantcharges")
. = TRUE
var/new_charges = sanitize(tgui_input_text(usr, "Please input charges", "Charges", activewarrant.fields["charges"]))
if(tgui_status(usr, state) == STATUS_INTERACTIVE)
var/new_charges = sanitize(tgui_input_text(ui.user, "Please input charges", "Charges", activewarrant.fields["charges"]))
if(tgui_status(ui.user, state) == STATUS_INTERACTIVE)
if (!new_charges)
return
activewarrant.fields["charges"] = new_charges
@@ -137,6 +137,6 @@ var/warrant_uid = 0
if("editwarrantauth")
. = TRUE
if(!(access_hos in I.GetAccess())) // VOREStation edit begin
to_chat(usr, span_warning("You don't have the access to do this!"))
to_chat(ui.user, span_warning("You don't have the access to do this!"))
return // VOREStation edit end
activewarrant.fields["auth"] = "[I.registered_name] - [I.assignment ? I.assignment : "(Unknown)"]"
@@ -250,7 +250,7 @@
var/obj/item/card/id/I = W.GetID()
// Awaiting payment state
if(state == 2)
if(process_payment(I,W))
if(process_payment(user, I,W))
fabricate_and_recalc_price(1)
if((devtype == 1) && fabricated_laptop)
if(fabricated_laptop.battery_module)
@@ -274,18 +274,18 @@
return ..()
// Simplified payment processing, returns 1 on success.
/obj/machinery/lapvend/proc/process_payment(var/obj/item/card/id/I, var/obj/item/ID_container)
/obj/machinery/lapvend/proc/process_payment(mob/user, var/obj/item/card/id/I, var/obj/item/ID_container)
if(I==ID_container || ID_container == null)
visible_message(span_info("\The [usr] swipes \the [I] through \the [src]."))
visible_message(span_info("\The [user] swipes \the [I] through \the [src]."))
else
visible_message(span_info("\The [usr] swipes \the [ID_container] through \the [src]."))
visible_message(span_info("\The [user] swipes \the [ID_container] through \the [src]."))
var/datum/money_account/customer_account = get_account(I.associated_account_number)
if (!customer_account || customer_account.suspended)
ping("Connection error. Unable to connect to account.")
return 0
if(customer_account.security_level != 0) //If card requires pin authentication (ie seclevel 1 or 2)
var/attempt_pin = tgui_input_number(usr, "Enter pin code", "Vendor transaction")
var/attempt_pin = tgui_input_number(user, "Enter pin code", "Vendor transaction")
customer_account = attempt_account_access(I.associated_account_number, attempt_pin, 2)
if(!customer_account)
@@ -177,34 +177,34 @@
. = 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
. = TRUE
if("skill_calibration")
for(var/i = 1 to min(caldigit, usr.get_skill_value(core_skill) - skill_offset))
for(var/i = 1 to min(caldigit, ui.user.get_skill_value(core_skill) - skill_offset))
calibration[i] = calexpected[i]
. = 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)
+19 -19
View File
@@ -173,33 +173,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)
@@ -215,15 +215,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)
@@ -240,22 +240,22 @@ 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
if("move")
var/ndir = text2num(params["dir"])
if(prob(usr.skill_fail_chance(/datum/skill/pilot, 50, linked.skill_needed, factor = 1)))
if(prob(ui.user.skill_fail_chance(/datum/skill/pilot, 50, linked.skill_needed, factor = 1)))
ndir = turn(ndir,pick(90,-90))
linked.relaymove(usr, ndir, accellimit)
linked.relaymove(ui.user, ndir, accellimit)
. = TRUE
if("brake")
@@ -275,11 +275,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()
+3 -3
View File
@@ -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,28 +25,27 @@
"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
if(ismob(usr))
var/mob/user = usr
shuttle.operator_skill = user.get_skill_value(/datum/skill/pilot)
if(ismob(ui.user))
shuttle.operator_skill = ui.user.get_skill_value(/datum/skill/pilot)
switch(action)
if("pick")
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
+24 -24
View File
@@ -179,13 +179,13 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins
if("scan")
if(scan)
scan.forceMove(loc)
if(ishuman(usr) && !usr.get_active_hand())
usr.put_in_hands(scan)
if(ishuman(ui.user) && !ui.user.get_active_hand())
ui.user.put_in_hands(scan)
scan = null
else
var/obj/item/I = usr.get_active_hand()
var/obj/item/I = ui.user.get_active_hand()
if(istype(I, /obj/item/card/id))
usr.drop_item()
ui.user.drop_item()
I.forceMove(src)
scan = I
return TRUE
@@ -195,30 +195,30 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins
if(check_access(scan))
authenticated = scan.registered_name
rank = scan.assignment
else if(login_type == LOGIN_TYPE_AI && isAI(usr))
authenticated = usr.name
else if(login_type == LOGIN_TYPE_AI && isAI(ui.user))
authenticated = ui.user.name
rank = JOB_AI
else if(login_type == LOGIN_TYPE_ROBOT && isrobot(usr))
authenticated = usr.name
var/mob/living/silicon/robot/R = usr
else if(login_type == LOGIN_TYPE_ROBOT && isrobot(ui.user))
authenticated = ui.user.name
var/mob/living/silicon/robot/R = ui.user
rank = "[R.modtype] [R.braintype]"
return TRUE
if("logout")
if(scan)
scan.forceMove(loc)
if(ishuman(usr) && !usr.get_active_hand())
usr.put_in_hands(scan)
if(ishuman(ui.user) && !ui.user.get_active_hand())
ui.user.put_in_hands(scan)
scan = null
authenticated = null
return TRUE
if("remove")
if(copyitem)
if(get_dist(usr, src) >= 2)
to_chat(usr, "\The [copyitem] is too far away for you to remove it.")
if(get_dist(ui.user, src) >= 2)
to_chat(ui.user, "\The [copyitem] is too far away for you to remove it.")
return
copyitem.forceMove(loc)
usr.put_in_hands(copyitem)
to_chat(usr, span_notice("You take \the [copyitem] out of \the [src]."))
ui.user.put_in_hands(copyitem)
to_chat(ui.user, span_notice("You take \the [copyitem] out of \the [src]."))
copyitem = null
if("send_automated_staff_request")
request_roles()
@@ -229,7 +229,7 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins
switch(action)
if("rename")
if(copyitem)
var/new_name = tgui_input_text(usr, "Enter new paper title", "This will show up in the preview for staff chat on discord when sending \
var/new_name = tgui_input_text(ui.user, "Enter new paper title", "This will show up in the preview for staff chat on discord when sending \
to central.", copyitem.name, MAX_NAME_LEN)
if(!new_name)
return
@@ -237,9 +237,9 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins
if("send")
if(copyitem)
if (destination in admin_departments)
if(check_if_default_title_and_rename())
if(check_if_default_title_and_rename(ui.user))
return
send_admin_fax(usr, destination)
send_admin_fax(ui.user, destination)
else
sendfax(destination)
@@ -249,14 +249,14 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins
if("dept")
var/lastdestination = destination
destination = tgui_input_list(usr, "Which department?", "Choose a department", (alldepartments + admin_departments))
destination = tgui_input_list(ui.user, "Which department?", "Choose a department", (alldepartments + admin_departments))
if(!destination)
destination = lastdestination
return TRUE
/obj/machinery/photocopier/faxmachine/proc/check_if_default_title_and_rename()
/obj/machinery/photocopier/faxmachine/proc/check_if_default_title_and_rename(mob/user)
/*
Returns TRUE only on "Cancel" or invalid newname, else returns null/false
Extracted to its own procedure for easier logic handling with paper bundles.
@@ -276,13 +276,13 @@ Extracted to its own procedure for easier logic handling with paper bundles.
else if(copyitem.name != initial(copyitem.name))
return FALSE
var/choice = tgui_alert(usr, "[question_text] improve response time from staff when sending to discord. \
var/choice = tgui_alert(user, "[question_text] improve response time from staff when sending to discord. \
Renaming it changes its preview in staff chat.", \
"Default name detected", list("Change Title","Continue", "Cancel"))
if(!choice || choice == "Cancel")
return TRUE
else if(choice == "Change Title")
var/new_name = tgui_input_text(usr, "Enter new fax title", "This will show up in the preview for staff chat on discord when sending \
var/new_name = tgui_input_text(user, "Enter new fax title", "This will show up in the preview for staff chat on discord when sending \
to central.", copyitem.name, MAX_NAME_LEN)
if(!new_name)
return TRUE
@@ -295,9 +295,9 @@ Extracted to its own procedure for easier logic handling with paper bundles.
O.forceMove(src)
scan = O
else if(O.has_tool_quality(TOOL_MULTITOOL) && panel_open)
var/input = sanitize(tgui_input_text(usr, "What Department ID would you like to give this fax machine?", "Multitool-Fax Machine Interface", department))
var/input = sanitize(tgui_input_text(user, "What Department ID would you like to give this fax machine?", "Multitool-Fax Machine Interface", department))
if(!input)
to_chat(usr, "No input found. Please hang up and try your call again.")
to_chat(user, "No input found. Please hang up and try your call again.")
return
department = input
if( !(("[department]" in alldepartments) || ("[department]" in admin_departments)) && !(department == "Unknown"))
+3 -3
View File
@@ -99,15 +99,15 @@
return list("contents" = files)
/obj/structure/filingcabinet/tgui_act(action, params)
/obj/structure/filingcabinet/tgui_act(action, params, datum/tgui/ui)
if(..())
return TRUE
switch(action)
if("retrieve")
var/obj/item/P = locate(params["ref"])
if(istype(P) && (P.loc == src) && usr.Adjacent(src))
usr.put_in_hands(P)
if(istype(P) && (P.loc == src) && ui.user.Adjacent(src))
ui.user.put_in_hands(P)
open_animation()
SStgui.update_uis(src)
+7 -7
View File
@@ -61,13 +61,13 @@
switch(action)
if("make_copy")
addtimer(CALLBACK(src, PROC_REF(copy_operation), usr), 0)
addtimer(CALLBACK(src, PROC_REF(copy_operation), ui.user), 0)
. = TRUE
if("remove")
if(copyitem)
copyitem.loc = usr.loc
usr.put_in_hands(copyitem)
to_chat(usr, span_notice("You take \the [copyitem] out of \the [src]."))
copyitem.loc = ui.user.loc
ui.user.put_in_hands(copyitem)
to_chat(ui.user, span_notice("You take \the [copyitem] out of \the [src]."))
copyitem = null
else if(has_buckled_mobs())
to_chat(buckled_mobs[1], span_notice("You feel a slight pressure on your ass.")) // It can't eject your asscheeks, but it'll try.
@@ -76,13 +76,13 @@
copies = clamp(text2num(params["num_copies"]), 1, maxcopies)
. = TRUE
if("ai_photo")
if(!issilicon(usr))
if(!issilicon(ui.user))
return
if(stat & (BROKEN|NOPOWER))
return
if(toner >= 5)
var/mob/living/silicon/tempAI = usr
var/mob/living/silicon/tempAI = ui.user
var/obj/item/camera/siliconcam/camera = tempAI.aiCamera
if(!camera)
@@ -376,7 +376,7 @@
if(M.item_is_in_hands(C))
continue
if((C.body_parts_covered & LOWER_TORSO) && !istype(C,/obj/item/clothing/under/permit))
to_chat(usr, span_warning("One needs to not be wearing pants to photocopy one's ass..."))
to_chat(M, span_warning("One needs to not be wearing pants to photocopy one's ass..."))
return FALSE
return TRUE
+40 -40
View File
@@ -33,7 +33,7 @@
else
switch(text2num(params["option"]))
if(1) // Configure pAI device
pda.pai.attack_self(usr)
pda.pai.attack_self(ui.user)
if(2) // Eject pAI device
var/turf/T = get_turf_or_move(pda.loc)
if(T)
@@ -72,105 +72,105 @@
return TRUE
switch(action)
if("Edit")
var/n = tgui_input_text(usr, "Please enter message", name, notehtml, multiline = TRUE, prevent_enter = TRUE)
if(pda.loc == usr)
var/n = tgui_input_text(ui.user, "Please enter message", name, notehtml, multiline = TRUE, prevent_enter = TRUE)
if(pda.loc == ui.user)
note = adminscrub(n)
notehtml = html_decode(note)
note = replacetext(note, "\n", "<br>")
else
pda.close(usr)
pda.close(ui.user)
return TRUE
if("Titleset")
var/n = tgui_input_text(usr, "Please enter title", name, notetitle, multiline = FALSE)
if(pda.loc == usr)
var/n = tgui_input_text(ui.user, "Please enter title", name, notetitle, multiline = FALSE)
if(pda.loc == ui.user)
notetitle = adminscrub(n)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
if("Print")
if(pda.loc == usr)
printnote()
if(pda.loc == ui.user)
printnote(ui.user)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
// dumb way to do this, but i don't know how to easily parse this without a lot of silly code outside the switch!
if("Note1")
if(pda.loc == usr)
if(pda.loc == ui.user)
changetonote(1)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
if("Note2")
if(pda.loc == usr)
if(pda.loc == ui.user)
changetonote(2)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
if("Note3")
if(pda.loc == usr)
if(pda.loc == ui.user)
changetonote(3)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
if("Note4")
if(pda.loc == usr)
if(pda.loc == ui.user)
changetonote(4)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
if("Note5")
if(pda.loc == usr)
if(pda.loc == ui.user)
changetonote(5)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
if("Note6")
if(pda.loc == usr)
if(pda.loc == ui.user)
changetonote(6)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
if("Note7")
if(pda.loc == usr)
if(pda.loc == ui.user)
changetonote(7)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
if("Note8")
if(pda.loc == usr)
if(pda.loc == ui.user)
changetonote(8)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
if("Note9")
if(pda.loc == usr)
if(pda.loc == ui.user)
changetonote(9)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
if("Note10")
if(pda.loc == usr)
if(pda.loc == ui.user)
changetonote(10)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
if("Note11")
if(pda.loc == usr)
if(pda.loc == ui.user)
changetonote(11)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
if("Note12")
if(pda.loc == usr)
if(pda.loc == ui.user)
changetonote(12)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
/datum/data/pda/app/notekeeper/proc/printnote()
/datum/data/pda/app/notekeeper/proc/printnote(mob/user)
// get active hand of person holding PDA, and print the page to the paper in it
if(istype( usr, /mob/living/carbon/human ))
var/mob/living/carbon/human/H = usr
if(istype( user, /mob/living/carbon/human ))
var/mob/living/carbon/human/H = user
var/obj/item/I = H.get_active_hand()
if(istype(I,/obj/item/paper))
var/obj/item/paper/P = I
@@ -178,12 +178,12 @@
var/titlenote = "Note [alphabet_uppercase[currentnote]]"
if(!isnull(notetitle) && notetitle != "")
titlenote = notetitle
to_chat(usr, span_notice("Successfully printed [titlenote]!"))
to_chat(user, span_notice("Successfully printed [titlenote]!"))
P.set_content( pencode2html(note), titlenote)
else
to_chat(usr, span_notice("You can only print to empty paper!"))
to_chat(user, span_notice("You can only print to empty paper!"))
else
to_chat(usr, span_notice("You must be holding paper for the pda to print to!"))
to_chat(user, span_notice("You must be holding paper for the pda to print to!"))
/datum/data/pda/app/notekeeper/proc/changetonote(var/noteindex)
+5 -5
View File
@@ -86,7 +86,7 @@
active_conversation = null
if("Message")
var/obj/item/pda/P = locate(params["target"])
create_message(usr, P)
create_message(ui.user, P)
if(params["target"] in conversations) // Need to make sure the message went through, if not welp.
active_conversation = params["target"]
if("Select Conversation")
@@ -100,12 +100,12 @@
var/obj/item/pda/P = locate(params["target"])
if(!P)
to_chat(usr, "PDA not found.")
to_chat(ui.user, "PDA not found.")
var/datum/data/pda/messenger_plugin/plugin = locate(params["plugin"])
if(plugin && (plugin in pda.cartridge.messenger_plugins))
plugin.messenger = src
plugin.user_act(usr, P)
plugin.user_act(ui.user, P)
if("Back")
active_conversation = null
@@ -142,7 +142,7 @@
if(last_text && world.time < last_text + 5)
return
if(!pda.can_use(usr))
if(!pda.can_use(U))
return
last_text = world.time
@@ -181,7 +181,7 @@
PM.receive_message(list("sent" = 0, "owner" = "[pda.owner]", "job" = "[pda.ownjob]", "message" = "[t]", "target" = "\ref[pda]"), "\ref[pda]")
SStgui.update_user_uis(U, P) // Update the sending user's PDA UI so that they can see the new message
log_pda("(PDA: [src.name]) sent \"[t]\" to [P.name]", usr)
log_pda("(PDA: [src.name]) sent \"[t]\" to [P.name]", U)
to_chat(U, "[icon2html(pda,U.client)] <b>Sent message to [P.owner] ([P.ownjob]), </b>\"[t]\"")
else
to_chat(U, span_notice("ERROR: Messaging server is not responding."))
+3 -3
View File
@@ -63,8 +63,8 @@
if(..())
return TRUE
add_fingerprint(usr)
usr.set_machine(src)
add_fingerprint(ui.user)
ui.user.set_machine(src)
if(!touch_silent)
playsound(src, 'sound/machines/pda_click.ogg', 20)
@@ -99,7 +99,7 @@
cartridge = null
update_shortcuts()
if("Authenticate")//Checks for ID
id_check(usr, 1)
id_check(ui.user, 1)
if("Retro")
retro_mode = !retro_mode
if("TouchSounds")
+10 -10
View File
@@ -56,7 +56,7 @@
/obj/structure/noticeboard/attackby(obj/item/I, mob/user)
if(I.has_tool_quality(TOOL_SCREWDRIVER))
var/choice = tgui_input_list(usr, "Which direction do you wish to place the noticeboard?", "Noticeboard Offset", list("North", "South", "East", "West", "No Offset"))
var/choice = tgui_input_list(user, "Which direction do you wish to place the noticeboard?", "Noticeboard Offset", list("North", "South", "East", "West", "No Offset"))
if(choice && Adjacent(user) && I.loc == user && !user.incapacitated())
playsound(loc, 'sound/items/Screwdriver.ogg', 50, 1)
switch(choice)
@@ -127,7 +127,7 @@
data["notices"] = tgui_notices
return data
/obj/structure/noticeboard/tgui_act(action, params)
/obj/structure/noticeboard/tgui_act(action, params, datum/tgui/ui)
if(..())
return TRUE
@@ -135,36 +135,36 @@
if("read")
var/obj/item/paper/P = locate(params["ref"])
if(P && P.loc == src)
P.show_content(usr)
P.show_content(ui.user)
. = TRUE
if("look")
var/obj/item/photo/P = locate(params["ref"])
if(P && P.loc == src)
P.show(usr)
P.show(ui.user)
. = TRUE
if("remove")
if(!in_range(src, usr))
if(!in_range(src, ui.user))
return FALSE
var/obj/item/I = locate(params["ref"])
remove_paper(I)
if(istype(I))
usr.put_in_hands(I)
add_fingerprint(usr)
ui.user.put_in_hands(I)
add_fingerprint(ui.user)
. = TRUE
if("write")
if(!in_range(src, usr))
if(!in_range(src, ui.user))
return FALSE
var/obj/item/P = locate(params["ref"])
if((P && P.loc == src)) //if the paper's on the board
var/mob/living/M = usr
var/mob/living/M = ui.user
if(istype(M))
var/obj/item/pen/E = M.get_type_in_hands(/obj/item/pen)
if(E)
add_fingerprint(M)
P.attackby(E, usr)
P.attackby(E, ui.user)
else
to_chat(M, span_notice("You'll need something to write with!"))
. = TRUE
+10 -10
View File
@@ -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"]
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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()
+2 -2
View File
@@ -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(\
+2 -2
View File
@@ -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
@@ -300,7 +300,7 @@
var/amount_per_pill = CLAMP(reagents.total_volume / count, 0, MAX_UNITS_PER_PILL)
while(count--)
if(reagents.total_volume <= 0)
to_chat(usr, span_notice("Not enough reagents to create these pills!"))
to_chat(ui.user, span_notice("Not enough reagents to create these pills!"))
return
var/obj/item/reagent_containers/pill/P = new(loc)
@@ -336,7 +336,7 @@
// var/is_medical_patch = chemical_safety_check(reagents)
while(count--)
if(reagents.total_volume <= 0)
to_chat(usr, span_notice("Not enough reagents to create these patches!"))
to_chat(ui.user, span_notice("Not enough reagents to create these patches!"))
return
var/obj/item/reagent_containers/pill/patch/P = new(loc)
@@ -363,7 +363,7 @@
var/amount_per_bottle = CLAMP(reagents.total_volume / count, 0, MAX_UNITS_PER_BOTTLE)
while(count--)
if(reagents.total_volume <= 0)
to_chat(usr, span_notice("Not enough reagents to create these bottles!"))
to_chat(ui.user, span_notice("Not enough reagents to create these bottles!"))
return
var/obj/item/reagent_containers/glass/bottle/P = new(loc)
P.name = "[answer] bottle"
@@ -393,8 +393,8 @@
if(tgui_act_modal(action, params, ui, state))
return TRUE
add_fingerprint(usr)
usr.set_machine(src)
add_fingerprint(ui.user)
ui.user.set_machine(src)
. = TRUE
switch(action)
@@ -403,8 +403,8 @@
if("ejectp")
if(loaded_pill_bottle)
loaded_pill_bottle.forceMove(get_turf(src))
if(Adjacent(usr) && !issilicon(usr))
usr.put_in_hands(loaded_pill_bottle)
if(Adjacent(ui.user) && !issilicon(ui.user))
ui.user.put_in_hands(loaded_pill_bottle)
loaded_pill_bottle = null
if("print")
if(printing || condi)
@@ -463,8 +463,8 @@
if(!beaker)
return
beaker.forceMove(get_turf(src))
if(Adjacent(usr) && !issilicon(usr))
usr.put_in_hands(beaker)
if(Adjacent(ui.user) && !issilicon(ui.user))
ui.user.put_in_hands(beaker)
beaker = null
reagents.clear_reagents()
update_icon()
+11 -11
View File
@@ -121,9 +121,9 @@
if(istype(G)) // handle grabbed mob
if(ismob(G.affecting))
var/mob/GM = G.affecting
for (var/mob/V in viewers(usr))
V.show_message("[usr] starts putting [GM.name] into the disposal.", 3)
if(do_after(usr, 20))
for (var/mob/V in viewers(user))
V.show_message("[user] starts putting [GM.name] into the disposal.", 3)
if(do_after(user, 20))
if (GM.client)
GM.client.perspective = EYE_PERSPECTIVE
GM.client.eye = src
@@ -169,13 +169,13 @@
src.add_fingerprint(user)
var/target_loc = target.loc
var/msg
for (var/mob/V in viewers(usr))
for (var/mob/V in viewers(user))
if(target == user && !user.stat && !user.weakened && !user.stunned && !user.paralysis)
V.show_message("[usr] starts climbing into the disposal.", 3)
V.show_message("[user] starts climbing into the disposal.", 3)
if(target != user && !user.restrained() && !user.stat && !user.weakened && !user.stunned && !user.paralysis)
if(target.anchored) return
V.show_message("[usr] starts stuffing [target.name] into the disposal.", 3)
if(!do_after(usr, 20))
V.show_message("[user] starts stuffing [target.name] into the disposal.", 3)
if(!do_after(user, 20))
return
if(target_loc != target.loc)
return
@@ -265,18 +265,18 @@
if(..())
return
if(usr.loc == src)
to_chat(usr, span_warning("You cannot reach the controls from inside."))
if(ui.user.loc == src)
to_chat(ui.user, span_warning("You cannot reach the controls from inside."))
return TRUE
if(mode==-1 && action != "eject") // If the mode is -1, only allow ejection
to_chat(usr, span_warning("The disposal units power is disabled."))
to_chat(ui.user, span_warning("The disposal units power is disabled."))
return
if(stat & BROKEN)
return
add_fingerprint(usr)
add_fingerprint(ui.user)
if(flushing)
return
+11 -11
View File
@@ -40,9 +40,9 @@
to_chat(user, span_warning("You need to set a destination first!"))
else if(istype(W, /obj/item/pen))
switch(tgui_alert(usr, "What would you like to alter?","Select Alteration",list("Title","Description","Cancel")))
switch(tgui_alert(user, "What would you like to alter?","Select Alteration",list("Title","Description","Cancel")))
if("Title")
var/str = sanitizeSafe(tgui_input_text(usr,"Label text?","Set label","", MAX_NAME_LEN), MAX_NAME_LEN)
var/str = sanitizeSafe(tgui_input_text(user,"Label text?","Set label","", MAX_NAME_LEN), MAX_NAME_LEN)
if(!str || !length(str))
to_chat(user, span_warning(" Invalid text."))
return
@@ -57,7 +57,7 @@
else
nameset = 1
if("Description")
var/str = sanitize(tgui_input_text(usr,"Label text?","Set label",""))
var/str = sanitize(tgui_input_text(user,"Label text?","Set label",""))
if(!str || !length(str))
to_chat(user, span_red("Invalid text."))
return
@@ -151,9 +151,9 @@
to_chat(user, span_warning("You need to set a destination first!"))
else if(istype(W, /obj/item/pen))
switch(tgui_alert(usr, "What would you like to alter?","Select Alteration",list("Title","Description","Cancel")))
switch(tgui_alert(user, "What would you like to alter?","Select Alteration",list("Title","Description","Cancel")))
if("Title")
var/str = sanitizeSafe(tgui_input_text(usr,"Label text?","Set label","", MAX_NAME_LEN), MAX_NAME_LEN)
var/str = sanitizeSafe(tgui_input_text(user,"Label text?","Set label","", MAX_NAME_LEN), MAX_NAME_LEN)
if(!str || !length(str))
to_chat(user, span_warning(" Invalid text."))
return
@@ -169,7 +169,7 @@
nameset = 1
if("Description")
var/str = sanitize(tgui_input_text(usr,"Label text?","Set label",""))
var/str = sanitize(tgui_input_text(user,"Label text?","Set label",""))
if(!str || !length(str))
to_chat(user, span_red("Invalid text."))
return
@@ -268,9 +268,9 @@
if(i > 5)
P.icon_state = "deliverycrate5"
P.name = "huge parcel"
P.add_fingerprint(usr)
O.add_fingerprint(usr)
src.add_fingerprint(usr)
P.add_fingerprint(user)
O.add_fingerprint(user)
src.add_fingerprint(user)
src.amount -= 1
user.visible_message("\The [user] wraps \a [target] with \a [src].",\
span_notice("You wrap \the [target], leaving [amount] units of paper on \the [src]."),\
@@ -374,10 +374,10 @@
/obj/item/destTagger/attack_self(mob/user as mob)
tgui_interact(user)
/obj/item/destTagger/tgui_act(action, params)
/obj/item/destTagger/tgui_act(action, params, datum/tgui/ui)
if(..())
return TRUE
add_fingerprint(usr)
add_fingerprint(ui.user)
switch(action)
if("set_tag")
var/new_tag = params["tag"]
+18 -18
View File
@@ -297,26 +297,26 @@
if(..())
return TRUE
add_fingerprint(usr)
add_fingerprint(ui.user)
switch(action)
if("search")
search = params["search"]
update_tgui_static_data(usr, ui)
update_tgui_static_data(ui.user, ui)
return TRUE
if("design_page")
if(params["reset"])
design_page = 0
else
design_page = max(design_page + (1 * params["reverse"]), 0)
update_tgui_static_data(usr, ui)
update_tgui_static_data(ui.user, ui)
return TRUE
if("builder_page")
if(params["reset"])
builder_page = 0
else
builder_page = max(builder_page + (1 * params["reverse"]), 0)
update_tgui_static_data(usr, ui)
update_tgui_static_data(ui.user, ui)
return TRUE
if("updt_tech") //Update the research holder with information from the technology disk.
@@ -326,7 +326,7 @@
files.AddTech2Known(t_disk.stored)
files.RefreshResearch()
griefProtection() //Update CentCom too
update_tgui_static_data(usr, ui)
update_tgui_static_data(ui.user, ui)
return TRUE
if("clear_tech") //Erase data on the technology disk.
@@ -351,7 +351,7 @@
busy_msg = null
files.AddDesign2Known(d_disk.blueprint)
griefProtection() //Update CentCom too
update_tgui_static_data(usr, ui)
update_tgui_static_data(ui.user, ui)
return TRUE
if("clear_design") //Erases data on the design disk.
@@ -373,7 +373,7 @@
if("eject_item") //Eject the item inside the destructive analyzer.
if(linked_destroy)
if(linked_destroy.busy)
to_chat(usr, span_notice("The destructive analyzer is busy at the moment."))
to_chat(ui.user, span_notice("The destructive analyzer is busy at the moment."))
return FALSE
if(linked_destroy.loaded_item)
@@ -387,7 +387,7 @@
return FALSE
if(linked_destroy.busy)
to_chat(usr, span_notice("The destructive analyzer is busy at the moment."))
to_chat(ui.user, span_notice("The destructive analyzer is busy at the moment."))
return
linked_destroy.busy = 1
@@ -398,7 +398,7 @@
linked_destroy.busy = 0
busy_msg = null
if(!linked_destroy.loaded_item)
to_chat(usr, span_notice("The destructive analyzer appears to be empty."))
to_chat(ui.user, span_notice("The destructive analyzer appears to be empty."))
return
if(istype(linked_destroy.loaded_item,/obj/item/stack))//Only deconsturcts one sheet at a time instead of the entire stack
@@ -440,19 +440,19 @@
use_power(linked_destroy.active_power_usage)
files.RefreshResearch()
update_tgui_static_data(usr, ui)
update_tgui_static_data(ui.user, ui)
return TRUE
if("lock") //Lock the console from use by anyone without tox access.
if(!allowed(usr))
to_chat(usr, "Unauthorized Access.")
if(!allowed(ui.user))
to_chat(ui.user, "Unauthorized Access.")
return
locked = !locked
return TRUE
if("sync") //Sync the research holder with all the R&D consoles in the game that aren't sync protected.
if(!sync)
to_chat(usr, span_notice("You must connect to the network first."))
to_chat(ui.user, span_notice("You must connect to the network first."))
return
busy_msg = "Updating Database..."
@@ -478,7 +478,7 @@
S.produce_heat()
busy_msg = null
files.RefreshResearch()
update_tgui_static_data(usr, ui)
update_tgui_static_data(ui.user, ui)
return TRUE
if("togglesync") //Prevents the console from being synced by other consoles. Can still send data.
@@ -573,7 +573,7 @@
spawn(10)
busy_msg = null
SyncRDevices()
update_tgui_static_data(usr, ui)
update_tgui_static_data(ui.user, ui)
return TRUE
if("disconnect") //The R&D console disconnects with a specific device.
@@ -587,18 +587,18 @@
if("imprinter")
linked_imprinter.linked_console = null
linked_imprinter = null
update_tgui_static_data(usr, ui)
update_tgui_static_data(ui.user, ui)
if("reset") //Reset the R&D console's database.
griefProtection()
var/choice = tgui_alert(usr, "R&D Console Database Reset", "Are you sure you want to reset the R&D console's database? Data lost cannot be recovered.", list("Continue", "Cancel"))
var/choice = tgui_alert(ui.user, "R&D Console Database Reset", "Are you sure you want to reset the R&D console's database? Data lost cannot be recovered.", list("Continue", "Cancel"))
if(choice == "Continue")
busy_msg = "Updating Database..."
qdel(files)
files = new /datum/research(src)
spawn(20)
busy_msg = null
update_tgui_static_data(usr, ui)
update_tgui_static_data(ui.user, ui)
if("print") //Print research information
busy_msg = "Printing Research Information. Please Wait..."
+5 -5
View File
@@ -219,7 +219,7 @@
if(..())
return TRUE
add_fingerprint(usr)
add_fingerprint(ui.user)
switch(action)
if("toggle_upload", "toggle_download")
var/obj/machinery/r_n_d/server/S = locate(params["server"])
@@ -248,7 +248,7 @@
var/obj/machinery/r_n_d/server/target = locate(params["server"])
if(!istype(target))
return FALSE
var/choice = tgui_alert(usr, "Technology Data Rest", "Are you sure you want to reset this technology to its default data? Data lost cannot be recovered.", list("Continue", "Cancel"))
var/choice = tgui_alert(ui.user, "Technology Data Rest", "Are you sure you want to reset this technology to its default data? Data lost cannot be recovered.", list("Continue", "Cancel"))
if(choice == "Continue")
for(var/datum/tech/T in target.files.known_tech)
if(T.id == params["tech"])
@@ -261,7 +261,7 @@
var/obj/machinery/r_n_d/server/target = locate(params["server"])
if(!istype(target))
return FALSE
var/choice = tgui_alert(usr, "Design Data Deletion", "Are you sure you want to delete this design? If you still have the prerequisites for the design, it'll reset to its base reliability. Data lost cannot be recovered.", list("Continue", "Cancel"))
var/choice = tgui_alert(ui.user, "Design Data Deletion", "Are you sure you want to delete this design? If you still have the prerequisites for the design, it'll reset to its base reliability. Data lost cannot be recovered.", list("Continue", "Cancel"))
if(choice == "Continue")
for(var/datum/design/D in target.files.known_designs)
if(D.id == params["design"])
@@ -273,8 +273,8 @@
if("transfer_data")
if(!badmin)
// no href exploits, you've been r e p o r t e d
log_admin("Warning: [key_name(usr)] attempted to transfer R&D data from [params["server"]] to [params["target"]] via href exploit with [src] [COORD(src)]")
message_admins("Warning: [ADMIN_FULLMONTY(usr)] attempted to transfer R&D data from [params["server"]] to [params["target"]] via href exploit with [src] [ADMIN_COORDJMP(src)]")
log_admin("Warning: [key_name(ui.user)] attempted to transfer R&D data from [params["server"]] to [params["target"]] via href exploit with [src] [COORD(src)]")
message_admins("Warning: [ADMIN_FULLMONTY(ui.user)] attempted to transfer R&D data from [params["server"]] to [params["target"]] via href exploit with [src] [ADMIN_COORDJMP(src)]")
return FALSE
var/obj/machinery/r_n_d/server/from = locate(params["server"])
if(!istype(from))
+2 -2
View File
@@ -230,7 +230,7 @@
return data
/obj/machinery/computer/transhuman/resleeving/tgui_act(action, params)
/obj/machinery/computer/transhuman/resleeving/tgui_act(action, params, datum/tgui/ui)
. = ..()
if(.)
return
@@ -391,7 +391,7 @@
subtargets += H
if(subtargets.len)
var/oc_sanity = sleever.occupant
override = tgui_input_list(usr,"Multiple bodies detected. Select target for resleeving of [active_mr.mindname] manually. Sleeving of primary body is unsafe with sub-contents, and is not listed.", "Resleeving Target", subtargets)
override = tgui_input_list(ui.user,"Multiple bodies detected. Select target for resleeving of [active_mr.mindname] manually. Sleeving of primary body is unsafe with sub-contents, and is not listed.", "Resleeving Target", subtargets)
if(!override || oc_sanity != sleever.occupant || !(override in sleever.occupant))
set_temp("Error: Target selection aborted.", "danger")
active_mr = null
+5 -5
View File
@@ -216,20 +216,20 @@
return data
/obj/machinery/computer/transhuman/designer/tgui_act(action, params)
/obj/machinery/computer/transhuman/designer/tgui_act(action, params, datum/tgui/ui)
if(..())
return TRUE
switch(action)
if("debug_load_my_body")
active_br = new /datum/transhuman/body_record(usr, FALSE, FALSE)
active_br = new /datum/transhuman/body_record(ui.user, FALSE, FALSE)
update_preview_icon()
menu = MENU_SPECIFICRECORD
if("view_brec")
var/datum/transhuman/body_record/BR = locate(params["view_brec"])
if(BR && istype(BR.mydna))
if(allowed(usr) || BR.ckey == usr.ckey)
if(allowed(ui.user) || BR.ckey == ui.user.ckey)
active_br = new /datum/transhuman/body_record(BR) // Load a COPY!
update_preview_icon()
menu = MENU_SPECIFICRECORD
@@ -282,9 +282,9 @@
temp = ""
if("href_conversion")
PrefHrefMiddleware(params, usr)
PrefHrefMiddleware(params, ui.user)
add_fingerprint(usr)
add_fingerprint(ui.user)
return 1 // Return 1 to refresh UI
//
+6 -6
View File
@@ -84,7 +84,7 @@
data["can_recall_shuttle"] = (shuttle_control && (shuttle_control.z in using_map.belter_belt_z) && !curZoneOccupied)
return data
/obj/machinery/computer/roguezones/tgui_act(action, list/params)
/obj/machinery/computer/roguezones/tgui_act(action, list/params, datum/tgui/ui)
if(..())
return TRUE
switch(action)
@@ -92,10 +92,10 @@
scan_for_new_zone()
. = TRUE
if("recall_shuttle")
failsafe_shuttle_recall()
failsafe_shuttle_recall(ui.user)
. = TRUE
add_fingerprint(usr)
add_fingerprint(ui.user)
/obj/machinery/computer/roguezones/proc/scan_for_new_zone()
if(scanning)
@@ -132,7 +132,7 @@
return
/obj/machinery/computer/roguezones/proc/failsafe_shuttle_recall()
/obj/machinery/computer/roguezones/proc/failsafe_shuttle_recall(mob/user)
if(!shuttle_control)
return // Shuttle computer has been destroyed
if (!(shuttle_control.z in using_map.belter_belt_z))
@@ -141,7 +141,7 @@
return // Not usable if shuttle is in occupied zone
// Okay do it
var/datum/shuttle/autodock/ferry/S = SSshuttles.shuttles["Belter"]
S.launch(usr)
S.launch(user)
/obj/item/circuitboard/roguezones
name = T_BOARD("asteroid belt scanning computer")
@@ -160,4 +160,4 @@
When a new zone has been scanned, your station's shuttle destination will be updated to direct it to the newly discovered area automatically.<br>
You can then travel to the new area to mine in that location.<br>
<br>
<font size=1>This technology produced under license from Thinktronic Systems, LTD.</font>"}
<font size=1>This technology produced under license from Thinktronic Systems, LTD.</font>"}
+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
+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
+4 -4
View File
@@ -49,7 +49,7 @@
if(..())
return TRUE
add_fingerprint(usr)
add_fingerprint(ui.user)
switch(action)
if ("logout")
@@ -58,12 +58,12 @@
if("stocks_buy")
var/datum/stock/S = locate(params["share"]) in GLOB.stockExchange.stocks
if (S)
buy_some_shares(S, usr)
buy_some_shares(S, ui.user)
if("stocks_sell")
var/datum/stock/S = locate(params["share"]) in GLOB.stockExchange.stocks
if (S)
sell_some_shares(S, usr)
sell_some_shares(S, ui.user)
if("stocks_check")
screen = "logs"
@@ -82,7 +82,7 @@
if (S)
//current_stock = S
//screen = "graph"
S.displayValues(usr)
S.displayValues(ui.user)
if("stocks_backbutton")
current_stock = null
+2 -2
View File
@@ -160,11 +160,11 @@
if("send")
sending = 1
teleport(usr)
teleport(ui.user)
if("receive")
sending = 0
teleport(usr)
teleport(ui.user)
if("recal")
recalibrate()
+1 -1
View File
@@ -90,7 +90,7 @@
*/
/datum/proc/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
SHOULD_CALL_PARENT(TRUE)
SEND_SIGNAL(src, COMSIG_UI_ACT, usr, action)
SEND_SIGNAL(src, COMSIG_UI_ACT, ui.user, action)
// If UI is not interactive or usr calling Topic is not the UI user, bail.
if(!ui || ui.status != STATUS_INTERACTIVE)
return TRUE
+2 -2
View File
@@ -68,7 +68,7 @@ Code is pretty much ripped verbatim from nano modules, but with un-needed stuff
if(istype(host))
. += host.get_header_data()
/datum/tgui_module/tgui_act(action, params)
/datum/tgui_module/tgui_act(action, params, datum/tgui/ui)
if(..())
return TRUE
@@ -81,7 +81,7 @@ Code is pretty much ripped verbatim from nano modules, but with un-needed stuff
host.shutdown_computer()
return TRUE
if(action == "PC_minimize")
host.minimize_program(usr)
host.minimize_program(ui.user)
return TRUE
// Just a nice little default interact in case the subtypes don't need any special behavior here
@@ -68,10 +68,10 @@
if("show_player_info")
var/datum/tgui_module/player_notes_info/A = new(src)
A.key = params["name"]
A.tgui_interact(usr)
A.tgui_interact(ui.user)
if("filter_player_notes")
var/input = tgui_input_text(usr, "Filter string (case-insensitive regex)", "Player notes filter")
var/input = tgui_input_text(ui.user, "Filter string (case-insensitive regex)", "Player notes filter")
current_filter = input
if("set_page")
@@ -123,10 +123,10 @@
switch(action)
if("add_player_info")
var/key = params["ckey"]
var/add = tgui_input_text(usr, "Write your comment below.", "Add Player Info", multiline = TRUE, prevent_enter = TRUE)
var/add = tgui_input_text(ui.user, "Write your comment below.", "Add Player Info", multiline = TRUE, prevent_enter = TRUE)
if(!add) return
notes_add(key,add,usr)
notes_add(key,add,ui.user)
if("remove_player_info")
var/key = params["ckey"]
@@ -39,15 +39,15 @@
if("adminobserve")
var/datum/shuttle/S = locate(params["ref"])
if(istype(S))
var/client/C = usr.client
if(!isobserver(usr))
var/client/C = ui.user.client
if(!isobserver(ui.user))
C.admin_ghost()
spawn(2)
C.jumptoturf(get_turf(S.current_location))
else if(istype(S, /obj/effect/overmap/visitable))
var/obj/effect/overmap/visitable/V = S
var/client/C = usr.client
if(!isobserver(usr))
var/client/C = ui.user.client
if(!isobserver(ui.user))
C.admin_ghost()
spawn(2)
var/atom/target
@@ -68,34 +68,34 @@
var/datum/shuttle/S = locate(params["ref"])
if(istype(S, /datum/shuttle/autodock/multi))
var/datum/shuttle/autodock/multi/shuttle = S
var/dest_key = tgui_input_list(usr, "Choose shuttle destination", "Shuttle Destination", shuttle.get_destinations())
var/dest_key = tgui_input_list(ui.user, "Choose shuttle destination", "Shuttle Destination", shuttle.get_destinations())
if(dest_key)
shuttle.set_destination(dest_key, usr)
shuttle.set_destination(dest_key, ui.user)
shuttle.launch(src)
else if(istype(S, /datum/shuttle/autodock/overmap))
var/datum/shuttle/autodock/overmap/shuttle = S
var/list/possible_d = shuttle.get_possible_destinations()
var/D
if(!LAZYLEN(possible_d))
to_chat(usr, span_warning("There are no possible destinations for [shuttle] ([shuttle.type])"))
to_chat(ui.user, span_warning("There are no possible destinations for [shuttle] ([shuttle.type])"))
return FALSE
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)
if(D)
shuttle.set_destination(possible_d[D])
shuttle.launch()
else if(istype(S, /datum/shuttle/autodock))
var/datum/shuttle/autodock/shuttle = S
if(tgui_alert(usr, "Are you sure you want to launch [shuttle]?", "Launching Shuttle", list("Yes", "No")) == "Yes")
if(tgui_alert(ui.user, "Are you sure you want to launch [shuttle]?", "Launching Shuttle", list("Yes", "No")) == "Yes")
shuttle.launch(src)
else
to_chat(usr, span_notice("The shuttle control panel isn't quite sure how to move [S] ([S?.type])."))
to_chat(ui.user, span_notice("The shuttle control panel isn't quite sure how to move [S] ([S?.type])."))
return FALSE
to_chat(usr, span_notice("Launching shuttle [S]."))
to_chat(ui.user, span_notice("Launching shuttle [S]."))
return TRUE
if("overmap_control")
var/obj/effect/overmap/visitable/ship/V = locate(params["ref"])
if(istype(V))
var/datum/tgui_module/ship/fullmonty/F = new(src, V)
F.tgui_interact(usr, null, ui)
F.tgui_interact(ui.user, null, ui)
return TRUE
+38 -38
View File
@@ -43,91 +43,91 @@
switch(action)
if("electronic_warfare")
S.electronic_warfare = !S.electronic_warfare
to_chat(usr, span_notice("Electronic warfare [S.electronic_warfare ? "enabled" : "disabled"]."))
to_chat(ui.user, span_notice("Electronic warfare [S.electronic_warfare ? "enabled" : "disabled"]."))
. = TRUE
if("age")
var/new_age = tgui_input_number(usr,"What age would you like to put on this card?","Agent Card Age", S.age)
if(!isnull(new_age) && tgui_status(usr, state) == STATUS_INTERACTIVE)
var/new_age = tgui_input_number(ui.user,"What age would you like to put on this card?","Agent Card Age", S.age)
if(!isnull(new_age) && tgui_status(ui.user, state) == STATUS_INTERACTIVE)
if(new_age < 0)
S.age = initial(S.age)
else
S.age = new_age
to_chat(usr, span_notice("Age has been set to '[S.age]'."))
to_chat(ui.user, span_notice("Age has been set to '[S.age]'."))
. = TRUE
if("appearance")
var/datum/card_state/choice = tgui_input_list(usr, "Select the appearance for this card.", "Agent Card Appearance", id_card_states())
if(choice && tgui_status(usr, state) == STATUS_INTERACTIVE)
var/datum/card_state/choice = tgui_input_list(ui.user, "Select the appearance for this card.", "Agent Card Appearance", id_card_states())
if(choice && tgui_status(ui.user, state) == STATUS_INTERACTIVE)
S.icon_state = choice.icon_state
S.item_state = choice.item_state
S.sprite_stack = choice.sprite_stack
S.update_icon()
to_chat(usr, span_notice("Appearance changed to [choice]."))
to_chat(ui.user, span_notice("Appearance changed to [choice]."))
. = TRUE
if("assignment")
var/new_job = sanitize(tgui_input_text(usr,"What assignment would you like to put on this card?\nChanging assignment will not grant or remove any access levels.","Agent Card Assignment", S.assignment))
if(!isnull(new_job) && tgui_status(usr, state) == STATUS_INTERACTIVE)
var/new_job = sanitize(tgui_input_text(ui.user,"What assignment would you like to put on this card?\nChanging assignment will not grant or remove any access levels.","Agent Card Assignment", S.assignment))
if(!isnull(new_job) && tgui_status(ui.user, state) == STATUS_INTERACTIVE)
S.assignment = new_job
to_chat(usr, span_notice("Occupation changed to '[new_job]'."))
to_chat(ui.user, span_notice("Occupation changed to '[new_job]'."))
S.update_name()
. = TRUE
if("bloodtype")
var/default = S.blood_type
if(default == initial(S.blood_type) && ishuman(usr))
var/mob/living/carbon/human/H = usr
if(default == initial(S.blood_type) && ishuman(ui.user))
var/mob/living/carbon/human/H = ui.user
if(H.dna)
default = H.dna.b_type
var/new_blood_type = sanitize(tgui_input_text(usr,"What blood type would you like to be written on this card?","Agent Card Blood Type",default))
if(!isnull(new_blood_type) && tgui_status(usr, state) == STATUS_INTERACTIVE)
var/new_blood_type = sanitize(tgui_input_text(ui.user,"What blood type would you like to be written on this card?","Agent Card Blood Type",default))
if(!isnull(new_blood_type) && tgui_status(ui.user, state) == STATUS_INTERACTIVE)
S.blood_type = new_blood_type
to_chat(usr, span_notice("Blood type changed to '[new_blood_type]'."))
to_chat(ui.user, span_notice("Blood type changed to '[new_blood_type]'."))
. = TRUE
if("dnahash")
var/default = S.dna_hash
if(default == initial(S.dna_hash) && ishuman(usr))
var/mob/living/carbon/human/H = usr
if(default == initial(S.dna_hash) && ishuman(ui.user))
var/mob/living/carbon/human/H = ui.user
if(H.dna)
default = H.dna.unique_enzymes
var/new_dna_hash = sanitize(tgui_input_text(usr,"What DNA hash would you like to be written on this card?","Agent Card DNA Hash",default))
if(!isnull(new_dna_hash) && tgui_status(usr, state) == STATUS_INTERACTIVE)
var/new_dna_hash = sanitize(tgui_input_text(ui.user,"What DNA hash would you like to be written on this card?","Agent Card DNA Hash",default))
if(!isnull(new_dna_hash) && tgui_status(ui.user, state) == STATUS_INTERACTIVE)
S.dna_hash = new_dna_hash
to_chat(usr, span_notice("DNA hash changed to '[new_dna_hash]'."))
to_chat(ui.user, span_notice("DNA hash changed to '[new_dna_hash]'."))
. = TRUE
if("fingerprinthash")
var/default = S.fingerprint_hash
if(default == initial(S.fingerprint_hash) && ishuman(usr))
var/mob/living/carbon/human/H = usr
if(default == initial(S.fingerprint_hash) && ishuman(ui.user))
var/mob/living/carbon/human/H = ui.user
if(H.dna)
default = md5(H.dna.uni_identity)
var/new_fingerprint_hash = sanitize(tgui_input_text(usr,"What fingerprint hash would you like to be written on this card?","Agent Card Fingerprint Hash",default))
if(!isnull(new_fingerprint_hash) && tgui_status(usr, state) == STATUS_INTERACTIVE)
var/new_fingerprint_hash = sanitize(tgui_input_text(ui.user,"What fingerprint hash would you like to be written on this card?","Agent Card Fingerprint Hash",default))
if(!isnull(new_fingerprint_hash) && tgui_status(ui.user, state) == STATUS_INTERACTIVE)
S.fingerprint_hash = new_fingerprint_hash
to_chat(usr, span_notice("Fingerprint hash changed to '[new_fingerprint_hash]'."))
to_chat(ui.user, span_notice("Fingerprint hash changed to '[new_fingerprint_hash]'."))
. = TRUE
if("name")
var/new_name = sanitizeName(tgui_input_text(usr,"What name would you like to put on this card?","Agent Card Name", S.registered_name))
if(!isnull(new_name) && tgui_status(usr, state) == STATUS_INTERACTIVE)
var/new_name = sanitizeName(tgui_input_text(ui.user,"What name would you like to put on this card?","Agent Card Name", S.registered_name))
if(!isnull(new_name) && tgui_status(ui.user, state) == STATUS_INTERACTIVE)
S.registered_name = new_name
S.update_name()
to_chat(usr, span_notice("Name changed to '[new_name]'."))
to_chat(ui.user, span_notice("Name changed to '[new_name]'."))
. = TRUE
if("photo")
S.set_id_photo(usr)
to_chat(usr, span_notice("Photo changed."))
S.set_id_photo(ui.user)
to_chat(ui.user, span_notice("Photo changed."))
. = TRUE
if("sex")
var/new_sex = sanitize(tgui_input_text(usr,"What sex would you like to put on this card?","Agent Card Sex", S.sex))
if(!isnull(new_sex) && tgui_status(usr, state) == STATUS_INTERACTIVE)
var/new_sex = sanitize(tgui_input_text(ui.user,"What sex would you like to put on this card?","Agent Card Sex", S.sex))
if(!isnull(new_sex) && tgui_status(ui.user, state) == STATUS_INTERACTIVE)
S.sex = new_sex
to_chat(usr, span_notice("Sex changed to '[new_sex]'."))
to_chat(ui.user, span_notice("Sex changed to '[new_sex]'."))
. = TRUE
if("species")
var/new_species = sanitize(tgui_input_text(usr,"What species would you like to put on this card?","Agent Card Species", S.species))
if(!isnull(new_species) && tgui_status(usr, state) == STATUS_INTERACTIVE)
var/new_species = sanitize(tgui_input_text(ui.user,"What species would you like to put on this card?","Agent Card Species", S.species))
if(!isnull(new_species) && tgui_status(ui.user, state) == STATUS_INTERACTIVE)
S.species = new_species
to_chat(usr, span_notice("Species changed to '[new_species]'."))
to_chat(ui.user, span_notice("Species changed to '[new_species]'."))
. = TRUE
if("factoryreset")
if(tgui_alert(usr, "This will factory reset the card, including access and owner. Continue?", "Factory Reset", list("No", "Yes")) == "Yes" && tgui_status(usr, state) == STATUS_INTERACTIVE)
if(tgui_alert(ui.user, "This will factory reset the card, including access and owner. Continue?", "Factory Reset", list("No", "Yes")) == "Yes" && tgui_status(ui.user, state) == STATUS_INTERACTIVE)
S.age = initial(S.age)
S.access = syndicate_access.Copy()
S.assignment = initial(S.assignment)
@@ -145,5 +145,5 @@
S.sex = initial(S.sex)
S.species = initial(S.species)
S.update_icon()
to_chat(usr, span_notice("All information has been deleted from \the [src]."))
to_chat(ui.user, span_notice("All information has been deleted from \the [src]."))
. = TRUE
+4 -4
View File
@@ -96,13 +96,13 @@
return all_alarms
/datum/tgui_module/alarm_monitor/tgui_act(action, params)
/datum/tgui_module/alarm_monitor/tgui_act(action, params, datum/tgui/ui)
if(..())
return TRUE
// Camera stuff is AI only.
// If you're not an AI, this is a read-only UI.
if(!isAI(usr))
if(!isAI(ui.user))
return
switch(action)
@@ -111,7 +111,7 @@
if(!C)
return
usr.switch_to_camera(C)
ui.user.switch_to_camera(C)
return 1
/datum/tgui_module/alarm_monitor/tgui_data(mob/user)
+115 -129
View File
@@ -88,99 +88,99 @@
var/mob/living/carbon/human/target = owner
if(customize_usr)
if(!ishuman(usr))
if(!ishuman(ui.user))
return TRUE
target = usr
target = ui.user
switch(action)
if("race")
if(can_change(APPEARANCE_RACE) && (params["race"] in valid_species))
if(can_change(target, APPEARANCE_RACE) && (params["race"] in valid_species))
if(target.change_species(params["race"]))
if(params["race"] == "Custom Species")
target.custom_species = sanitize(tgui_input_text(usr, "Input custom species name:",
target.custom_species = sanitize(tgui_input_text(target, "Input custom species name:",
"Custom Species Name", null, MAX_NAME_LEN), MAX_NAME_LEN)
cut_data()
generate_data(usr)
generate_data(target)
changed_hook(APPEARANCECHANGER_CHANGED_RACE)
return 1
if("gender")
if(can_change(APPEARANCE_GENDER) && (params["gender"] in get_genders()))
if(can_change(target, APPEARANCE_GENDER) && (params["gender"] in get_genders(target)))
if(target.change_gender(params["gender"]))
cut_data()
generate_data(usr)
generate_data(target)
changed_hook(APPEARANCECHANGER_CHANGED_GENDER)
return 1
if("gender_id")
if(can_change(APPEARANCE_GENDER) && (params["gender_id"] in all_genders_define_list))
if(can_change(target, APPEARANCE_GENDER) && (params["gender_id"] in all_genders_define_list))
target.identifying_gender = params["gender_id"]
changed_hook(APPEARANCECHANGER_CHANGED_GENDER_ID)
return 1
if("skin_tone")
if(can_change_skin_tone())
var/new_s_tone = tgui_input_number(usr, "Choose your character's skin-tone:\n(Light 1 - 220 Dark)", "Skin Tone", -target.s_tone + 35, 220, 1)
if(isnum(new_s_tone) && can_still_topic(usr, state))
if(can_change_skin_tone(target))
var/new_s_tone = tgui_input_number(target, "Choose your character's skin-tone:\n(Light 1 - 220 Dark)", "Skin Tone", -target.s_tone + 35, 220, 1)
if(isnum(new_s_tone) && can_still_topic(target, state))
new_s_tone = 35 - max(min( round(new_s_tone), 220),1)
changed_hook(APPEARANCECHANGER_CHANGED_SKINTONE)
return target.change_skin_tone(new_s_tone)
if("skin_color")
if(can_change_skin_color())
var/new_skin = input(usr, "Choose your character's skin colour: ", "Skin Color", rgb(target.r_skin, target.g_skin, target.b_skin)) as color|null
if(new_skin && can_still_topic(usr, state))
if(can_change_skin_color(target))
var/new_skin = input(target, "Choose your character's skin colour: ", "Skin Color", rgb(target.r_skin, target.g_skin, target.b_skin)) as color|null
if(new_skin && can_still_topic(target, state))
var/r_skin = hex2num(copytext(new_skin, 2, 4))
var/g_skin = hex2num(copytext(new_skin, 4, 6))
var/b_skin = hex2num(copytext(new_skin, 6, 8))
if(target.change_skin_color(r_skin, g_skin, b_skin))
update_dna()
update_dna(target)
changed_hook(APPEARANCECHANGER_CHANGED_SKINCOLOR)
return 1
if("hair")
if(can_change(APPEARANCE_HAIR) && (params["hair"] in valid_hairstyles))
if(can_change(target, APPEARANCE_HAIR) && (params["hair"] in valid_hairstyles))
if(target.change_hair(params["hair"]))
update_dna()
update_dna(target)
changed_hook(APPEARANCECHANGER_CHANGED_HAIRSTYLE)
return 1
if("hair_color")
if(can_change(APPEARANCE_HAIR_COLOR))
var/new_hair = input(usr, "Please select hair color.", "Hair Color", rgb(target.r_hair, target.g_hair, target.b_hair)) as color|null
if(new_hair && can_still_topic(usr, state))
if(can_change(target, APPEARANCE_HAIR_COLOR))
var/new_hair = input(target, "Please select hair color.", "Hair Color", rgb(target.r_hair, target.g_hair, target.b_hair)) as color|null
if(new_hair && can_still_topic(target, state))
var/r_hair = hex2num(copytext(new_hair, 2, 4))
var/g_hair = hex2num(copytext(new_hair, 4, 6))
var/b_hair = hex2num(copytext(new_hair, 6, 8))
if(target.change_hair_color(r_hair, g_hair, b_hair))
update_dna()
update_dna(target)
changed_hook(APPEARANCECHANGER_CHANGED_HAIRCOLOR)
return 1
if("facial_hair")
if(can_change(APPEARANCE_FACIAL_HAIR) && (params["facial_hair"] in valid_facial_hairstyles))
if(can_change(target, APPEARANCE_FACIAL_HAIR) && (params["facial_hair"] in valid_facial_hairstyles))
if(target.change_facial_hair(params["facial_hair"]))
update_dna()
update_dna(target)
changed_hook(APPEARANCECHANGER_CHANGED_F_HAIRSTYLE)
return 1
if("facial_hair_color")
if(can_change(APPEARANCE_FACIAL_HAIR_COLOR))
var/new_facial = input(usr, "Please select facial hair color.", "Facial Hair Color", rgb(target.r_facial, target.g_facial, target.b_facial)) as color|null
if(new_facial && can_still_topic(usr, state))
if(can_change(target, APPEARANCE_FACIAL_HAIR_COLOR))
var/new_facial = input(target, "Please select facial hair color.", "Facial Hair Color", rgb(target.r_facial, target.g_facial, target.b_facial)) as color|null
if(new_facial && can_still_topic(target, state))
var/r_facial = hex2num(copytext(new_facial, 2, 4))
var/g_facial = hex2num(copytext(new_facial, 4, 6))
var/b_facial = hex2num(copytext(new_facial, 6, 8))
if(target.change_facial_hair_color(r_facial, g_facial, b_facial))
update_dna()
update_dna(target)
changed_hook(APPEARANCECHANGER_CHANGED_F_HAIRCOLOR)
return 1
if("eye_color")
if(can_change(APPEARANCE_EYE_COLOR))
var/new_eyes = input(usr, "Please select eye color.", "Eye Color", rgb(target.r_eyes, target.g_eyes, target.b_eyes)) as color|null
if(new_eyes && can_still_topic(usr, state))
if(can_change(target, APPEARANCE_EYE_COLOR))
var/new_eyes = input(target, "Please select eye color.", "Eye Color", rgb(target.r_eyes, target.g_eyes, target.b_eyes)) as color|null
if(new_eyes && can_still_topic(target, state))
var/r_eyes = hex2num(copytext(new_eyes, 2, 4))
var/g_eyes = hex2num(copytext(new_eyes, 4, 6))
var/b_eyes = hex2num(copytext(new_eyes, 6, 8))
if(target.change_eye_color(r_eyes, g_eyes, b_eyes))
update_dna()
update_dna(target)
changed_hook(APPEARANCECHANGER_CHANGED_EYES)
return 1
// VOREStation Add - Ears/Tails/Wings/Markings
if("ear")
if(can_change(APPEARANCE_ALL_HAIR))
if(can_change(target, APPEARANCE_ALL_HAIR))
var/datum/sprite_accessory/ears/instance = locate(params["ref"])
if(params["clear"])
instance = null
@@ -188,11 +188,11 @@
return FALSE
target.ear_style = instance
target.update_hair()
update_dna()
update_dna(target)
changed_hook(APPEARANCECHANGER_CHANGED_HAIRSTYLE)
return TRUE
if("ear_secondary")
if(can_change(APPEARANCE_ALL_HAIR))
if(can_change(target, APPEARANCE_ALL_HAIR))
var/datum/sprite_accessory/ears/instance = locate(params["ref"])
if(params["clear"])
instance = null
@@ -204,46 +204,46 @@
if(length(target.ear_secondary_colors) < instance.get_color_channel_count())
target.ear_secondary_colors.len = instance.get_color_channel_count()
target.update_hair()
update_dna()
update_dna(target)
changed_hook(APPEARANCECHANGER_CHANGED_HAIRSTYLE)
return TRUE
if("ears_color")
if(can_change(APPEARANCE_HAIR_COLOR))
var/new_hair = input(usr, "Please select ear color.", "Ear Color", rgb(target.r_ears, target.g_ears, target.b_ears)) as color|null
if(new_hair && can_still_topic(usr, state))
if(can_change(target, APPEARANCE_HAIR_COLOR))
var/new_hair = input(target, "Please select ear color.", "Ear Color", rgb(target.r_ears, target.g_ears, target.b_ears)) as color|null
if(new_hair && can_still_topic(target, state))
target.r_ears = hex2num(copytext(new_hair, 2, 4))
target.g_ears = hex2num(copytext(new_hair, 4, 6))
target.b_ears = hex2num(copytext(new_hair, 6, 8))
update_dna()
update_dna(target)
target.update_hair()
changed_hook(APPEARANCECHANGER_CHANGED_HAIRCOLOR)
return 1
if("ears2_color")
if(can_change(APPEARANCE_HAIR_COLOR))
var/new_hair = input(usr, "Please select secondary ear color.", "2nd Ear Color", rgb(target.r_ears2, target.g_ears2, target.b_ears2)) as color|null
if(new_hair && can_still_topic(usr, state))
if(can_change(target, APPEARANCE_HAIR_COLOR))
var/new_hair = input(target, "Please select secondary ear color.", "2nd Ear Color", rgb(target.r_ears2, target.g_ears2, target.b_ears2)) as color|null
if(new_hair && can_still_topic(target, state))
target.r_ears2 = hex2num(copytext(new_hair, 2, 4))
target.g_ears2 = hex2num(copytext(new_hair, 4, 6))
target.b_ears2 = hex2num(copytext(new_hair, 6, 8))
update_dna()
update_dna(target)
target.update_hair()
changed_hook(APPEARANCECHANGER_CHANGED_HAIRCOLOR)
return 1
if("ears_secondary_color")
if(can_change(APPEARANCE_HAIR_COLOR))
if(can_change(target, APPEARANCE_HAIR_COLOR))
var/channel = params["channel"]
if(channel > length(target.ear_secondary_colors))
return TRUE
var/existing = LAZYACCESS(target.ear_secondary_colors, channel) || "#ffffff"
var/new_color = input(usr, "Please select ear color.", "2nd Ear Color", existing) as color|null
if(new_color && can_still_topic(usr, state))
var/new_color = input(target, "Please select ear color.", "2nd Ear Color", existing) as color|null
if(new_color && can_still_topic(target, state))
target.ear_secondary_colors[channel] = new_color
update_dna()
update_dna(target)
target.update_hair()
changed_hook(APPEARANCECHANGER_CHANGED_HAIRCOLOR)
return TRUE
if("tail")
if(can_change(APPEARANCE_ALL_HAIR))
if(can_change(target, APPEARANCE_ALL_HAIR))
var/datum/sprite_accessory/tail/instance = locate(params["ref"])
if(params["clear"])
instance = null
@@ -251,33 +251,33 @@
return FALSE
target.tail_style = instance
target.update_tail_showing()
update_dna()
update_dna(target)
changed_hook(APPEARANCECHANGER_CHANGED_HAIRSTYLE)
return TRUE
if("tail_color")
if(can_change(APPEARANCE_HAIR_COLOR))
var/new_hair = input(usr, "Please select tail color.", "Tail Color", rgb(target.r_tail, target.g_tail, target.b_tail)) as color|null
if(new_hair && can_still_topic(usr, state))
if(can_change(target, APPEARANCE_HAIR_COLOR))
var/new_hair = input(target, "Please select tail color.", "Tail Color", rgb(target.r_tail, target.g_tail, target.b_tail)) as color|null
if(new_hair && can_still_topic(target, state))
target.r_tail = hex2num(copytext(new_hair, 2, 4))
target.g_tail = hex2num(copytext(new_hair, 4, 6))
target.b_tail = hex2num(copytext(new_hair, 6, 8))
update_dna()
update_dna(target)
target.update_tail_showing()
changed_hook(APPEARANCECHANGER_CHANGED_HAIRCOLOR)
return 1
if("tail2_color")
if(can_change(APPEARANCE_HAIR_COLOR))
var/new_hair = input(usr, "Please select secondary tail color.", "2nd Tail Color", rgb(target.r_tail2, target.g_tail2, target.b_tail2)) as color|null
if(new_hair && can_still_topic(usr, state))
if(can_change(target, APPEARANCE_HAIR_COLOR))
var/new_hair = input(target, "Please select secondary tail color.", "2nd Tail Color", rgb(target.r_tail2, target.g_tail2, target.b_tail2)) as color|null
if(new_hair && can_still_topic(target, state))
target.r_tail2 = hex2num(copytext(new_hair, 2, 4))
target.g_tail2 = hex2num(copytext(new_hair, 4, 6))
target.b_tail2 = hex2num(copytext(new_hair, 6, 8))
update_dna()
update_dna(target)
target.update_tail_showing()
changed_hook(APPEARANCECHANGER_CHANGED_HAIRCOLOR)
return 1
if("wing")
if(can_change(APPEARANCE_ALL_HAIR))
if(can_change(target, APPEARANCE_ALL_HAIR))
var/datum/sprite_accessory/wing/instance = locate(params["ref"])
if(params["clear"])
instance = null
@@ -285,33 +285,33 @@
return FALSE
target.wing_style = instance
target.update_wing_showing()
update_dna()
update_dna(target)
changed_hook(APPEARANCECHANGER_CHANGED_HAIRSTYLE)
return TRUE
if("wing_color")
if(can_change(APPEARANCE_HAIR_COLOR))
var/new_hair = input(usr, "Please select wing color.", "Wing Color", rgb(target.r_wing, target.g_wing, target.b_wing)) as color|null
if(new_hair && can_still_topic(usr, state))
if(can_change(target, APPEARANCE_HAIR_COLOR))
var/new_hair = input(target, "Please select wing color.", "Wing Color", rgb(target.r_wing, target.g_wing, target.b_wing)) as color|null
if(new_hair && can_still_topic(target, state))
target.r_wing = hex2num(copytext(new_hair, 2, 4))
target.g_wing = hex2num(copytext(new_hair, 4, 6))
target.b_wing = hex2num(copytext(new_hair, 6, 8))
update_dna()
update_dna(target)
target.update_wing_showing()
changed_hook(APPEARANCECHANGER_CHANGED_HAIRCOLOR)
return 1
if("wing2_color")
if(can_change(APPEARANCE_HAIR_COLOR))
var/new_hair = input(usr, "Please select secondary wing color.", "2nd Wing Color", rgb(target.r_wing2, target.g_wing2, target.b_wing2)) as color|null
if(new_hair && can_still_topic(usr, state))
if(can_change(target, APPEARANCE_HAIR_COLOR))
var/new_hair = input(target, "Please select secondary wing color.", "2nd Wing Color", rgb(target.r_wing2, target.g_wing2, target.b_wing2)) as color|null
if(new_hair && can_still_topic(target, state))
target.r_wing2 = hex2num(copytext(new_hair, 2, 4))
target.g_wing2 = hex2num(copytext(new_hair, 4, 6))
target.b_wing2 = hex2num(copytext(new_hair, 6, 8))
update_dna()
update_dna(target)
target.update_wing_showing()
changed_hook(APPEARANCECHANGER_CHANGED_HAIRCOLOR)
return 1
if("marking")
if(can_change(APPEARANCE_ALL_HAIR))
if(can_change(target, APPEARANCE_ALL_HAIR))
var/todo = params["todo"]
var/name_marking = params["name"]
switch (todo)
@@ -323,8 +323,8 @@
return TRUE
if (1) //add
var/list/usable_markings = markings.Copy() ^ body_marking_styles_list.Copy()
var/new_marking = tgui_input_list(usr, "Choose a body marking:", "New Body Marking", usable_markings)
if(new_marking && can_still_topic(usr, state))
var/new_marking = tgui_input_list(target, "Choose a body marking:", "New Body Marking", usable_markings)
if(new_marking && can_still_topic(target, state))
var/datum/sprite_accessory/marking/mark_datum = body_marking_styles_list[new_marking]
if (target.add_marking(mark_datum))
changed_hook(APPEARANCECHANGER_CHANGED_HAIRSTYLE)
@@ -339,8 +339,8 @@
return TRUE
if (4) //color
var/current = markings[name_marking] ? markings[name_marking] : "#000000"
var/marking_color = input(usr, "Please select marking color", "Marking color", current) as color|null
if(marking_color && can_still_topic(usr, state))
var/marking_color = input(target, "Please select marking color", "Marking color", current) as color|null
if(marking_color && can_still_topic(target, state))
var/datum/sprite_accessory/marking/mark_datum = body_marking_styles_list[name_marking]
if (target.change_marking_color(mark_datum, marking_color))
return TRUE
@@ -374,15 +374,15 @@
/datum/tgui_module/appearance_changer/tgui_static_data(mob/user)
var/list/data = ..()
generate_data(usr)
generate_data(user)
if(can_change(APPEARANCE_RACE))
if(can_change(user, APPEARANCE_RACE))
var/species[0]
for(var/specimen in valid_species)
species[++species.len] = list("specimen" = specimen)
data["species"] = species
if(can_change(APPEARANCE_HAIR))
if(can_change(user, APPEARANCE_HAIR))
var/hair_styles[0]
for(var/hair_style in valid_hairstyles)
hair_styles[++hair_styles.len] = list("hairstyle" = hair_style)
@@ -393,7 +393,7 @@
data["wing_styles"] = valid_wingstyles
// VOREStation Add End
if(can_change(APPEARANCE_FACIAL_HAIR))
if(can_change(user, APPEARANCE_FACIAL_HAIR))
var/facial_hair_styles[0]
for(var/facial_hair_style in valid_facial_hairstyles)
facial_hair_styles[++facial_hair_styles.len] = list("facialhairstyle" = facial_hair_style)
@@ -408,20 +408,20 @@
var/mob/living/carbon/human/target = owner
if(customize_usr)
if(!ishuman(usr))
if(!ishuman(ui.user))
return TRUE
target = usr
target = ui.user
data["name"] = target.name
data["specimen"] = target.species.name
data["gender"] = target.gender
data["gender_id"] = target.identifying_gender
data["change_race"] = can_change(APPEARANCE_RACE)
data["change_race"] = can_change(target, APPEARANCE_RACE)
data["change_gender"] = can_change(APPEARANCE_GENDER)
data["change_gender"] = can_change(target, APPEARANCE_GENDER)
if(data["change_gender"])
var/genders[0]
for(var/gender in get_genders())
for(var/gender in get_genders(target))
genders[++genders.len] = list("gender_name" = gender2text(gender), "gender_key" = gender)
data["genders"] = genders
var/id_genders[0]
@@ -429,7 +429,7 @@
id_genders[++id_genders.len] = list("gender_name" = gender2text(gender), "gender_key" = gender)
data["id_genders"] = id_genders
data["change_hair"] = can_change(APPEARANCE_HAIR)
data["change_hair"] = can_change(target, APPEARANCE_HAIR)
if(data["change_hair"])
data["hair_style"] = target.h_style
@@ -445,20 +445,20 @@
data["markings"] = markings_data
// VOREStation Add End
data["change_facial_hair"] = can_change(APPEARANCE_FACIAL_HAIR)
data["change_facial_hair"] = can_change(target, APPEARANCE_FACIAL_HAIR)
if(data["change_facial_hair"])
data["facial_hair_style"] = target.f_style
data["change_skin_tone"] = can_change_skin_tone()
data["change_skin_color"] = can_change_skin_color()
data["change_skin_tone"] = can_change_skin_tone(target)
data["change_skin_color"] = can_change_skin_color(target)
if(data["change_skin_color"])
data["skin_color"] = rgb(target.r_skin, target.g_skin, target.b_skin)
data["change_eye_color"] = can_change(APPEARANCE_EYE_COLOR)
data["change_eye_color"] = can_change(target, APPEARANCE_EYE_COLOR)
if(data["change_eye_color"])
data["eye_color"] = rgb(target.r_eyes, target.g_eyes, target.b_eyes)
data["change_hair_color"] = can_change(APPEARANCE_HAIR_COLOR)
data["change_hair_color"] = can_change(target, APPEARANCE_HAIR_COLOR)
if(data["change_hair_color"])
data["hair_color"] = rgb(target.r_hair, target.g_hair, target.b_hair)
// VOREStation Add - Ears/Tails/Wings
@@ -476,7 +476,7 @@
data["wing2_color"] = rgb(target.r_wing2, target.g_wing2, target.b_wing2)
// VOREStation Add End
data["change_facial_hair_color"] = can_change(APPEARANCE_FACIAL_HAIR_COLOR)
data["change_facial_hair_color"] = can_change(target, APPEARANCE_FACIAL_HAIR_COLOR)
if(data["change_facial_hair_color"])
data["facial_hair_color"] = rgb(target.r_facial, target.g_facial, target.b_facial)
return data
@@ -512,42 +512,30 @@
local_skybox.set_position("CENTER", "CENTER", (world.maxx>>1) - newturf.x, (world.maxy>>1) - newturf.y)
*/
/datum/tgui_module/appearance_changer/proc/update_dna()
var/mob/living/carbon/human/target = owner
if(customize_usr)
if(!ishuman(usr))
return TRUE
target = usr
/datum/tgui_module/appearance_changer/proc/update_dna(mob/target)
if(customize_usr && !ishuman(target))
return TRUE
var/mob/living/carbon/human/H = target
if(H && (flags & APPEARANCE_UPDATE_DNA))
H.update_dna()
if(target && (flags & APPEARANCE_UPDATE_DNA))
target.update_dna()
/datum/tgui_module/appearance_changer/proc/can_change(mob/target, var/flag)
if(customize_usr && !ishuman(target))
return TRUE
var/mob/living/carbon/human/H = target
return H && (flags & flag)
/datum/tgui_module/appearance_changer/proc/can_change(var/flag)
var/mob/living/carbon/human/target = owner
if(customize_usr)
if(!ishuman(usr))
return TRUE
target = usr
/datum/tgui_module/appearance_changer/proc/can_change_skin_tone(mob/target)
if(customize_usr && !ishuman(target))
return TRUE
var/mob/living/carbon/human/H = target
return H && (flags & APPEARANCE_SKIN) && H.species.appearance_flags & HAS_SKIN_TONE
return target && (flags & flag)
/datum/tgui_module/appearance_changer/proc/can_change_skin_tone()
var/mob/living/carbon/human/target = owner
if(customize_usr)
if(!ishuman(usr))
return TRUE
target = usr
return target && (flags & APPEARANCE_SKIN) && target.species.appearance_flags & HAS_SKIN_TONE
/datum/tgui_module/appearance_changer/proc/can_change_skin_color()
var/mob/living/carbon/human/target = owner
if(customize_usr)
if(!ishuman(usr))
return TRUE
target = usr
return target && (flags & APPEARANCE_SKIN) && target.species.appearance_flags & HAS_SKIN_COLOR
/datum/tgui_module/appearance_changer/proc/can_change_skin_color(mob/target)
if(customize_usr && !ishuman(target))
return TRUE
var/mob/living/carbon/human/H = target
return H && (flags & APPEARANCE_SKIN) && H.species.appearance_flags & HAS_SKIN_COLOR
/datum/tgui_module/appearance_changer/proc/cut_data()
// Making the assumption that the available species remain constant
@@ -610,15 +598,13 @@
)))
// VOREStation Add End
/datum/tgui_module/appearance_changer/proc/get_genders()
var/mob/living/carbon/human/target = owner
if(customize_usr)
if(!ishuman(usr))
return TRUE
target = usr
var/datum/species/S = target.species
/datum/tgui_module/appearance_changer/proc/get_genders(mob/target)
if(customize_usr && !ishuman(target))
return TRUE
var/mob/living/carbon/human/H = target
var/datum/species/S = H.species
var/list/possible_genders = S.genders
if(!target.internal_organs_by_name["cell"])
if(!H.internal_organs_by_name["cell"])
return possible_genders
possible_genders = possible_genders.Copy()
possible_genders |= NEUTER
+1 -1
View File
@@ -28,7 +28,7 @@
var/obj/machinery/alarm/alarm = locate(params["alarm"]) in (monitored_alarms.len ? monitored_alarms : machines)
if(alarm)
var/datum/tgui_state/TS = generate_state(alarm)
alarm.tgui_interact(usr, parent_ui = ui_ref, state = TS)
alarm.tgui_interact(ui.user, parent_ui = ui_ref, state = TS)
return 1
if("setZLevel")
ui.set_map_z_level(params["mapZLevel"])
+4 -4
View File
@@ -130,16 +130,16 @@
data["allNetworks"] |= C.network
return data
/datum/tgui_module/camera/tgui_act(action, params)
/datum/tgui_module/camera/tgui_act(action, params, datum/tgui/ui)
if(..())
return TRUE
if(action && !issilicon(usr))
if(action && !issilicon(ui.user))
playsound(tgui_host(), "terminal_type", 50, 1)
if(action == "switch_camera")
var/c_tag = params["name"]
var/list/cameras = get_available_cameras(usr)
var/list/cameras = get_available_cameras(ui.user)
var/obj/machinery/camera/C = cameras["[ckey(c_tag)]"]
if(active_camera)
UnregisterSignal(active_camera, COMSIG_OBSERVER_MOVED)
@@ -159,7 +159,7 @@
var/obj/machinery/camera/target
var/best_dist = INFINITY
var/list/possible_cameras = get_available_cameras(usr)
var/list/possible_cameras = get_available_cameras(ui.user)
for(var/obj/machinery/camera/C in get_area(T))
if(!possible_cameras["[ckey(C.c_tag)]"])
continue
+73 -74
View File
@@ -63,7 +63,7 @@
to_chat(user, span_warning("Access denied."))
return COMM_AUTHENTICATION_NONE
/datum/tgui_module/communications/proc/change_security_level(new_level)
/datum/tgui_module/communications/proc/change_security_level(mob/user, new_level)
tmp_alertlevel = new_level
var/old_level = security_level
if(!tmp_alertlevel) tmp_alertlevel = SEC_LEVEL_GREEN
@@ -72,8 +72,8 @@
set_security_level(tmp_alertlevel)
if(security_level != old_level)
//Only notify the admins if an actual change happened
log_game("[key_name(usr)] has changed the security level to [get_security_level()].")
message_admins("[key_name_admin(usr)] has changed the security level to [get_security_level()].")
log_game("[key_name(user)] has changed the security level to [get_security_level()].")
message_admins("[key_name_admin(user)] has changed the security level to [get_security_level()].")
switch(security_level)
if(SEC_LEVEL_GREEN)
feedback_inc("alert_comms_green",1)
@@ -197,102 +197,101 @@
frequency.post_signal(null, status_signal)
/datum/tgui_module/communications/tgui_act(action, params)
/datum/tgui_module/communications/tgui_act(action, params, datum/tgui/ui)
if(..())
return TRUE
if(using_map && !(get_z(usr) in using_map.contact_levels))
to_chat(usr, span_danger("Unable to establish a connection: You're too far away from the station!"))
if(using_map && !(get_z(ui.user) in using_map.contact_levels))
to_chat(ui.user, span_danger("Unable to establish a connection: You're too far away from the station!"))
return FALSE
. = TRUE
if(action == "auth")
if(!ishuman(usr))
to_chat(usr, span_warning("Access denied."))
if(!ishuman(ui.user))
to_chat(ui.user, span_warning("Access denied."))
return FALSE
// Logout function.
if(authenticated != COMM_AUTHENTICATION_NONE)
authenticated = COMM_AUTHENTICATION_NONE
crew_announcement.announcer = null
setMenuState(usr, COMM_SCREEN_MAIN)
setMenuState(ui.user, COMM_SCREEN_MAIN)
return
// Login function.
if(check_access(usr, access_heads))
if(check_access(ui.user, access_heads))
authenticated = COMM_AUTHENTICATION_MIN
if(check_access(usr, access_captain))
if(check_access(ui.user, access_captain))
authenticated = COMM_AUTHENTICATION_MAX
var/mob/M = usr
var/obj/item/card/id = M.GetIdCard()
var/obj/item/card/id = ui.user.GetIdCard()
if(istype(id))
crew_announcement.announcer = GetNameAndAssignmentFromId(id)
if(authenticated == COMM_AUTHENTICATION_NONE)
to_chat(usr, span_warning("You need to wear your ID."))
to_chat(ui.user, span_warning("You need to wear your ID."))
// All functions below this point require authentication.
if(!is_authenticated(usr))
if(!is_authenticated(ui.user))
return FALSE
switch(action)
// main interface
if("main")
setMenuState(usr, COMM_SCREEN_MAIN)
setMenuState(ui.user, COMM_SCREEN_MAIN)
if("newalertlevel")
if(isAI(usr) || isrobot(usr))
to_chat(usr, span_warning("Firewalls prevent you from changing the alert level."))
if(isAI(ui.user) || isrobot(ui.user))
to_chat(ui.user, span_warning("Firewalls prevent you from changing the alert level."))
return
else if(isobserver(usr))
var/mob/observer/dead/D = usr
else if(isobserver(ui.user))
var/mob/observer/dead/D = ui.user
if(D.can_admin_interact())
change_security_level(text2num(params["level"]))
change_security_level(ui.user, text2num(params["level"]))
return TRUE
else if(!ishuman(usr))
to_chat(usr, span_warning("Security measures prevent you from changing the alert level."))
else if(!ishuman(ui.user))
to_chat(ui.user, span_warning("Security measures prevent you from changing the alert level."))
return
if(is_authenticated(usr))
change_security_level(text2num(params["level"]))
if(is_authenticated(ui.user))
change_security_level(ui.user, text2num(params["level"]))
else
to_chat(usr, span_warning("You are not authorized to do this."))
setMenuState(usr, COMM_SCREEN_MAIN)
to_chat(ui.user, span_warning("You are not authorized to do this."))
setMenuState(ui.user, COMM_SCREEN_MAIN)
if("announce")
if(is_authenticated(usr) == COMM_AUTHENTICATION_MAX)
if(is_authenticated(ui.user) == COMM_AUTHENTICATION_MAX)
if(message_cooldown > world.time)
to_chat(usr, span_warning("Please allow at least one minute to pass between announcements."))
to_chat(ui.user, span_warning("Please allow at least one minute to pass between announcements."))
return
var/input = tgui_input_text(usr, "Please write a message to announce to the station crew.", "Priority Announcement", multiline = TRUE, prevent_enter = TRUE)
if(!input || message_cooldown > world.time || ..() || !(is_authenticated(usr) == COMM_AUTHENTICATION_MAX))
var/input = tgui_input_text(ui.user, "Please write a message to announce to the station crew.", "Priority Announcement", multiline = TRUE, prevent_enter = TRUE)
if(!input || message_cooldown > world.time || ..() || !(is_authenticated(ui.user) == COMM_AUTHENTICATION_MAX))
return
if(length(input) < COMM_MSGLEN_MINIMUM)
to_chat(usr, span_warning("Message '[input]' is too short. [COMM_MSGLEN_MINIMUM] character minimum."))
to_chat(ui.user, span_warning("Message '[input]' is too short. [COMM_MSGLEN_MINIMUM] character minimum."))
return
crew_announcement.Announce(input)
message_cooldown = world.time + 600 //One minute
if("callshuttle")
if(!is_authenticated(usr))
if(!is_authenticated(ui.user))
return
call_shuttle_proc(usr)
call_shuttle_proc(ui.user)
if(emergency_shuttle.online())
post_status(src, "shuttle", user = usr)
setMenuState(usr, COMM_SCREEN_MAIN)
post_status(src, "shuttle", user = ui.user)
setMenuState(ui.user, COMM_SCREEN_MAIN)
if("cancelshuttle")
if(isAI(usr) || isrobot(usr))
to_chat(usr, span_warning("Firewalls prevent you from recalling the shuttle."))
if(isAI(ui.user) || isrobot(ui.user))
to_chat(ui.user, span_warning("Firewalls prevent you from recalling the shuttle."))
return
var/response = tgui_alert(usr, "Are you sure you wish to recall the shuttle?", "Confirm", list("Yes", "No"))
var/response = tgui_alert(ui.user, "Are you sure you wish to recall the shuttle?", "Confirm", list("Yes", "No"))
if(response == "Yes")
cancel_call_proc(usr)
setMenuState(usr, COMM_SCREEN_MAIN)
cancel_call_proc(ui.user)
setMenuState(ui.user, COMM_SCREEN_MAIN)
if("messagelist")
current_viewing_message = null
current_viewing_message_id = null
if(params["msgid"])
setCurrentMessage(usr, text2num(params["msgid"]))
setMenuState(usr, COMM_SCREEN_MESSAGES)
setCurrentMessage(ui.user, text2num(params["msgid"]))
setMenuState(ui.user, COMM_SCREEN_MESSAGES)
if("toggleatc")
ATC.squelched = !ATC.squelched
@@ -300,79 +299,79 @@
if("delmessage")
var/datum/comm_message_listener/l = obtain_message_listener()
if(params["msgid"])
setCurrentMessage(usr, text2num(params["msgid"]))
var/response = tgui_alert(usr, "Are you sure you wish to delete this message?", "Confirm", list("Yes", "No"))
setCurrentMessage(ui.user, text2num(params["msgid"]))
var/response = tgui_alert(ui.user, "Are you sure you wish to delete this message?", "Confirm", list("Yes", "No"))
if(response == "Yes")
if(current_viewing_message)
if(l != global_message_listener)
l.Remove(current_viewing_message)
current_viewing_message = null
setMenuState(usr, COMM_SCREEN_MESSAGES)
setMenuState(ui.user, COMM_SCREEN_MESSAGES)
if("status")
setMenuState(usr, COMM_SCREEN_STAT)
setMenuState(ui.user, COMM_SCREEN_STAT)
// Status display stuff
if("setstat")
display_type = params["statdisp"]
switch(display_type)
if("message")
post_status(src, "message", stat_msg1, stat_msg2, user = usr)
post_status(src, "message", stat_msg1, stat_msg2, user = ui.user)
if("alert")
post_status(src, "alert", params["alert"], user = usr)
post_status(src, "alert", params["alert"], user = ui.user)
else
post_status(src, params["statdisp"], user = usr)
post_status(src, params["statdisp"], user = ui.user)
if("setmsg1")
stat_msg1 = reject_bad_text(sanitize(tgui_input_text(usr, "Line 1", "Enter Message Text", stat_msg1, 40), 40), 40)
setMenuState(usr, COMM_SCREEN_STAT)
stat_msg1 = reject_bad_text(sanitize(tgui_input_text(ui.user, "Line 1", "Enter Message Text", stat_msg1, 40), 40), 40)
setMenuState(ui.user, COMM_SCREEN_STAT)
if("setmsg2")
stat_msg2 = reject_bad_text(sanitize(tgui_input_text(usr, "Line 2", "Enter Message Text", stat_msg2, 40), 40), 40)
setMenuState(usr, COMM_SCREEN_STAT)
stat_msg2 = reject_bad_text(sanitize(tgui_input_text(ui.user, "Line 2", "Enter Message Text", stat_msg2, 40), 40), 40)
setMenuState(ui.user, COMM_SCREEN_STAT)
// OMG CENTCOMM LETTERHEAD
if("MessageCentCom")
if(is_authenticated(usr) == COMM_AUTHENTICATION_MAX)
if(is_authenticated(ui.user) == COMM_AUTHENTICATION_MAX)
if(centcomm_message_cooldown > world.time)
to_chat(usr, span_warning("Arrays recycling. Please stand by."))
to_chat(ui.user, span_warning("Arrays recycling. Please stand by."))
return
var/input = sanitize(tgui_input_text(usr, "Please choose a message to transmit to [using_map.boss_short] via quantum entanglement. \
var/input = sanitize(tgui_input_text(ui.user, "Please choose a message to transmit to [using_map.boss_short] via quantum entanglement. \
Please be aware that this process is very expensive, and abuse will lead to... termination. \
Transmission does not guarantee a response. \
There is a 30 second delay before you may send another message, be clear, full and concise.", "Central Command Quantum Messaging", multiline = TRUE, prevent_enter = TRUE))
if(!input || ..() || !(is_authenticated(usr) == COMM_AUTHENTICATION_MAX))
if(!input || ..() || !(is_authenticated(ui.user) == COMM_AUTHENTICATION_MAX))
return
if(length(input) < COMM_CCMSGLEN_MINIMUM)
to_chat(usr, span_warning("Message '[input]' is too short. [COMM_CCMSGLEN_MINIMUM] character minimum."))
to_chat(ui.user, span_warning("Message '[input]' is too short. [COMM_CCMSGLEN_MINIMUM] character minimum."))
return
CentCom_announce(input, usr)
to_chat(usr, span_blue("Message transmitted."))
log_game("[key_name(usr)] has made an IA [using_map.boss_short] announcement: [input]")
CentCom_announce(input, ui.user)
to_chat(ui.user, span_blue("Message transmitted."))
log_game("[key_name(ui.user)] has made an IA [using_map.boss_short] announcement: [input]")
centcomm_message_cooldown = world.time + 300 // 30 seconds
setMenuState(usr, COMM_SCREEN_MAIN)
setMenuState(ui.user, COMM_SCREEN_MAIN)
// OMG SYNDICATE ...LETTERHEAD
if("MessageSyndicate")
if((is_authenticated(usr) == COMM_AUTHENTICATION_MAX) && (emagged))
if((is_authenticated(ui.user) == COMM_AUTHENTICATION_MAX) && (emagged))
if(centcomm_message_cooldown > world.time)
to_chat(usr, "Arrays recycling. Please stand by.")
to_chat(ui.user, "Arrays recycling. Please stand by.")
return
var/input = sanitize(tgui_input_text(usr, "Please choose a message to transmit to \[ABNORMAL ROUTING CORDINATES\] via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response. There is a 30 second delay before you may send another message, be clear, full and concise.", "To abort, send an empty message.", ""))
if(!input || ..() || !(is_authenticated(usr) == COMM_AUTHENTICATION_MAX))
var/input = sanitize(tgui_input_text(ui.user, "Please choose a message to transmit to \[ABNORMAL ROUTING CORDINATES\] via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response. There is a 30 second delay before you may send another message, be clear, full and concise.", "To abort, send an empty message.", ""))
if(!input || ..() || !(is_authenticated(ui.user) == COMM_AUTHENTICATION_MAX))
return
if(length(input) < COMM_CCMSGLEN_MINIMUM)
to_chat(usr, span_warning("Message '[input]' is too short. [COMM_CCMSGLEN_MINIMUM] character minimum."))
to_chat(ui.user, span_warning("Message '[input]' is too short. [COMM_CCMSGLEN_MINIMUM] character minimum."))
return
Syndicate_announce(input, usr)
to_chat(usr, span_blue("Message transmitted."))
log_game("[key_name(usr)] has made an illegal announcement: [input]")
Syndicate_announce(input, ui.user)
to_chat(ui.user, span_blue("Message transmitted."))
log_game("[key_name(ui.user)] has made an illegal announcement: [input]")
centcomm_message_cooldown = world.time + 300 // 30 seconds
if("RestoreBackup")
to_chat(usr, "Backup routing data restored!")
to_chat(ui.user, "Backup routing data restored!")
emagged = FALSE
setMenuState(usr, COMM_SCREEN_MAIN)
setMenuState(ui.user, COMM_SCREEN_MAIN)
/datum/tgui_module/communications/ntos
ntos = TRUE
@@ -386,7 +385,7 @@
if ((!( ticker ) || !emergency_shuttle.location()))
return
if(!universe.OnShuttleCall(usr))
if(!universe.OnShuttleCall(user))
to_chat(user, span_notice("Cannot establish a bluespace connection."))
return
+5 -5
View File
@@ -11,18 +11,18 @@
if(..())
return TRUE
if(action && !issilicon(usr))
if(action && !issilicon(ui.user))
playsound(tgui_host(), "terminal_type", 50, 1)
var/turf/T = get_turf(usr)
var/turf/T = get_turf(ui.user)
if(!T || !(T.z in using_map.player_levels))
to_chat(usr, span_boldwarning("Unable to establish a connection") + ": You're too far away from the station!")
to_chat(ui.user, span_boldwarning("Unable to establish a connection") + ": You're too far away from the station!")
return FALSE
switch(action)
if("track")
if(isAI(usr))
var/mob/living/silicon/ai/AI = usr
if(isAI(ui.user))
var/mob/living/silicon/ai/AI = ui.user
var/mob/living/carbon/human/H = locate(params["track"]) in mob_list
if(hassensorlevel(H, SUIT_SENSOR_TRACKING))
AI.ai_actual_track(H)
@@ -5,7 +5,7 @@
var/gyro_tag = ""
var/scan_range = 25
/datum/tgui_module/gyrotron_control/tgui_act(action, params)
/datum/tgui_module/gyrotron_control/tgui_act(action, params, datum/tgui/ui)
if(..())
return TRUE
@@ -18,13 +18,13 @@
switch(action)
if("set_tag")
var/new_ident = sanitize_text(tgui_input_text(usr, "Enter a new ident tag.", "Gyrotron Control", gyro_tag))
var/new_ident = sanitize_text(tgui_input_text(ui.user, "Enter a new ident tag.", "Gyrotron Control", gyro_tag))
if(new_ident)
gyro_tag = new_ident
return TRUE
if("toggle_active")
G.activate(usr)
G.activate(ui.user)
return TRUE
if("set_str")
@@ -65,4 +65,4 @@
return data
/datum/tgui_module/gyrotron_control/ntos
ntos = TRUE
ntos = TRUE

Some files were not shown because too many files have changed in this diff Show More