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
+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
+11 -9
View File
@@ -105,31 +105,33 @@
return data
/datum/tgui_module/late_choices/tgui_act(action, params)
/datum/tgui_module/late_choices/tgui_act(action, params, datum/tgui/ui)
. = ..()
if(.)
return
var/mob/new_player/user = usr
if(!isnewplayer(ui.user))
return
var/mob/new_player/new_user = ui.user
switch(action)
if("join")
var/job = params["job"]
if(!CONFIG_GET(flag/enter_allowed))
to_chat(user, span_notice("There is an administrative lock on entering the game!"))
to_chat(new_user, span_notice("There is an administrative lock on entering the game!"))
return
else if(ticker && ticker.mode && ticker.mode.explosion_in_progress)
to_chat(user, span_danger("The station is currently exploding. Joining would go poorly."))
to_chat(new_user, span_danger("The station is currently exploding. Joining would go poorly."))
return
var/datum/species/S = GLOB.all_species[user.client.prefs.species]
if(!is_alien_whitelisted(user, S))
tgui_alert(user, "You are currently not whitelisted to play [user.client.prefs.species].")
var/datum/species/S = GLOB.all_species[new_user.client.prefs.species]
if(!is_alien_whitelisted(new_user, S))
tgui_alert(new_user, "You are currently not whitelisted to play [new_user.client.prefs.species].")
return 0
if(!(S.spawn_flags & SPECIES_CAN_JOIN))
tgui_alert_async(user,"Your current species, [user.client.prefs.species], is not available for play on the station.")
tgui_alert_async(new_user,"Your current species, [new_user.client.prefs.species], is not available for play on the station.")
return 0
user.AttemptLateSpawn(job, user.client.prefs.spawnpoint)
new_user.AttemptLateSpawn(job, new_user.client.prefs.spawnpoint)
+20 -20
View File
@@ -45,69 +45,69 @@
return TRUE
if("add_zeroth_law")
if(zeroth_law && is_admin(usr) && !owner.laws.zeroth_law)
if(zeroth_law && is_admin(ui.user) && !owner.laws.zeroth_law)
owner.set_zeroth_law(zeroth_law)
return TRUE
if("add_ion_law")
if(ion_law && is_malf(usr))
if(ion_law && is_malf(ui.user))
owner.add_ion_law(ion_law)
return TRUE
if("add_inherent_law")
if(inherent_law && is_malf(usr))
if(inherent_law && is_malf(ui.user))
owner.add_inherent_law(inherent_law)
return TRUE
if("add_supplied_law")
if(supplied_law && supplied_law_position >= 1 && MIN_SUPPLIED_LAW_NUMBER <= MAX_SUPPLIED_LAW_NUMBER && is_malf(usr))
if(supplied_law && supplied_law_position >= 1 && MIN_SUPPLIED_LAW_NUMBER <= MAX_SUPPLIED_LAW_NUMBER && is_malf(ui.user))
owner.add_supplied_law(supplied_law_position, supplied_law)
return TRUE
if("change_zeroth_law")
var/new_law = sanitize(params["val"])
if(new_law && new_law != zeroth_law && can_still_topic(usr, state))
if(new_law && new_law != zeroth_law && can_still_topic(ui.user, state))
zeroth_law = new_law
return TRUE
if("change_ion_law")
var/new_law = sanitize(params["val"])
if(new_law && new_law != ion_law && can_still_topic(usr, state))
if(new_law && new_law != ion_law && can_still_topic(ui.user, state))
ion_law = new_law
return TRUE
if("change_inherent_law")
var/new_law = sanitize(params["val"])
if(new_law && new_law != inherent_law && can_still_topic(usr, state))
if(new_law && new_law != inherent_law && can_still_topic(ui.user, state))
inherent_law = new_law
return TRUE
if("change_supplied_law")
var/new_law = sanitize(params["val"])
if(new_law && new_law != supplied_law && can_still_topic(usr, state))
if(new_law && new_law != supplied_law && can_still_topic(ui.user, state))
supplied_law = new_law
return TRUE
if("change_supplied_law_position")
var/new_position = tgui_input_number(usr, "Enter new supplied law position between 1 and [MAX_SUPPLIED_LAW_NUMBER], inclusive. Inherent laws at the same index as a supplied law will not be stated.", "Law Position", supplied_law_position, MAX_SUPPLIED_LAW_NUMBER, 1)
if(isnum(new_position) && can_still_topic(usr, state))
var/new_position = tgui_input_number(ui.user, "Enter new supplied law position between 1 and [MAX_SUPPLIED_LAW_NUMBER], inclusive. Inherent laws at the same index as a supplied law will not be stated.", "Law Position", supplied_law_position, MAX_SUPPLIED_LAW_NUMBER, 1)
if(isnum(new_position) && can_still_topic(ui.user, state))
supplied_law_position = CLAMP(new_position, 1, MAX_SUPPLIED_LAW_NUMBER)
return TRUE
if("edit_law")
if(is_malf(usr))
if(is_malf(ui.user))
var/datum/ai_law/AL = locate(params["edit_law"]) in owner.laws.all_laws()
if(AL)
var/new_law = sanitize(tgui_input_text(usr, "Enter new law. Leaving the field blank will cancel the edit.", "Edit Law", AL.law))
if(new_law && new_law != AL.law && is_malf(usr) && can_still_topic(usr, state))
var/new_law = sanitize(tgui_input_text(ui.user, "Enter new law. Leaving the field blank will cancel the edit.", "Edit Law", AL.law))
if(new_law && new_law != AL.law && is_malf(ui.user) && can_still_topic(ui.user, state))
log_and_message_admins("has changed a law of [owner] from '[AL.law]' to '[new_law]'")
AL.law = new_law
return TRUE
if("delete_law")
if(is_malf(usr))
if(is_malf(ui.user))
var/datum/ai_law/AL = locate(params["delete_law"]) in owner.laws.all_laws()
if(AL && is_malf(usr))
if(AL && is_malf(ui.user))
owner.delete_law(AL)
return TRUE
@@ -116,14 +116,14 @@
return TRUE
if("state_law_set")
var/datum/ai_laws/ALs = locate(params["state_law_set"]) in (is_admin(usr) ? admin_laws : player_laws)
var/datum/ai_laws/ALs = locate(params["state_law_set"]) in (is_admin(ui.user) ? admin_laws : player_laws)
if(ALs)
owner.statelaws(ALs)
return TRUE
if("transfer_laws")
if(is_malf(usr))
var/datum/ai_laws/ALs = locate(params["transfer_laws"]) in (is_admin(usr) ? admin_laws : player_laws)
if(is_malf(ui.user))
var/datum/ai_laws/ALs = locate(params["transfer_laws"]) in (is_admin(ui.user) ? admin_laws : player_laws)
if(ALs)
log_and_message_admins("has transfered the [ALs.name] laws to [owner].")
ALs.sync(owner, 0)
@@ -137,8 +137,8 @@
for(var/mob/living/silicon/robot/R in AI.connected_robots)
to_chat(R, span_danger("Law Notice"))
R.laws.show_laws(R)
if(usr != owner)
to_chat(usr, span_notice("Laws displayed."))
if(ui.user != owner)
to_chat(ui.user, span_notice("Laws displayed."))
return TRUE
/datum/tgui_module/law_manager/tgui_interact(mob/user, datum/tgui/ui)
+12 -12
View File
@@ -119,7 +119,7 @@
if(!istype(computer))
return TRUE
var/obj/item/card/id/user_id_card = usr.GetIdCard()
var/obj/item/card/id/user_id_card = ui.user.GetIdCard()
var/obj/item/card/id/id_card
if(computer.card_slot)
id_card = computer.card_slot.stored_card
@@ -131,7 +131,7 @@
if("print")
if(computer && computer.nano_printer) //This option should never be called if there is no printer
if(!mod_mode)
if(program.can_run(usr, 1))
if(program.can_run(ui.user, 1))
var/contents = {"<h4>Access Report</h4>
<u>Prepared By:</u> [user_id_card.registered_name ? user_id_card.registered_name : "Unknown"]<br>
<u>For:</u> [id_card.registered_name ? id_card.registered_name : "Unregistered"]<br>
@@ -148,7 +148,7 @@
contents += " [get_access_desc(A)]"
if(!computer.nano_printer.print_text(contents,"access report"))
to_chat(usr, span_notice("Hardware error: Printer was unable to print the file. It may be out of paper."))
to_chat(ui.user, span_notice("Hardware error: Printer was unable to print the file. It may be out of paper."))
return
else
computer.visible_message(span_bold("\The [computer]") + " prints out paper.")
@@ -158,7 +158,7 @@
[data_core ? data_core.get_manifest(0) : ""]
"}
if(!computer.nano_printer.print_text(contents,text("crew manifest ([])", stationtime2text())))
to_chat(usr, span_notice("Hardware error: Printer was unable to print the file. It may be out of paper."))
to_chat(ui.user, span_notice("Hardware error: Printer was unable to print the file. It may be out of paper."))
return
else
computer.visible_message(span_bold("\The [computer]") + " prints out paper.")
@@ -167,16 +167,16 @@
if(computer && computer.card_slot)
if(id_card)
data_core.manifest_modify(id_card.registered_name, id_card.assignment, id_card.rank)
computer.proc_eject_id(usr)
computer.proc_eject_id(ui.user)
. = TRUE
if("terminate")
if(computer && program.can_run(usr, 1))
if(computer && program.can_run(ui.user, 1))
id_card.assignment = "Dismissed" //VOREStation Edit: setting adjustment
id_card.access = list()
callHook("terminate_employee", list(id_card))
. = TRUE
if("reg")
if(computer && program.can_run(usr, 1))
if(computer && program.can_run(ui.user, 1))
var/temp_name = sanitizeName(params["reg"], allow_numbers = TRUE)
if(temp_name)
id_card.registered_name = temp_name
@@ -184,15 +184,15 @@
computer.visible_message(span_notice("[computer] buzzes rudely."))
. = TRUE
if("account")
if(computer && program.can_run(usr, 1))
if(computer && program.can_run(ui.user, 1))
var/account_num = text2num(params["account"])
id_card.associated_account_number = account_num
. = TRUE
if("assign")
if(computer && program.can_run(usr, 1) && id_card)
if(computer && program.can_run(ui.user, 1) && id_card)
var/t1 = params["assign_target"]
if(t1 == "Custom")
var/temp_t = sanitize(tgui_input_text(usr, "Enter a custom job assignment.","Assignment", id_card.assignment, 45), 45)
var/temp_t = sanitize(tgui_input_text(ui.user, "Enter a custom job assignment.","Assignment", id_card.assignment, 45), 45)
//let custom jobs function as an impromptu alt title, mainly for sechuds
if(temp_t)
id_card.assignment = temp_t
@@ -208,7 +208,7 @@
jobdatum = J
break
if(!jobdatum)
to_chat(usr, span_warning("No log exists for this job: [t1]"))
to_chat(ui.user, span_warning("No log exists for this job: [t1]"))
return
access = jobdatum.get_access()
@@ -220,7 +220,7 @@
callHook("reassign_employee", list(id_card))
. = TRUE
if("access")
if(computer && program.can_run(usr, 1))
if(computer && program.can_run(ui.user, 1))
var/access_type = text2num(params["access_target"])
var/access_allowed = text2num(params["allowed"])
if(access_type in get_access_ids(ACCESS_TYPE_STATION|ACCESS_TYPE_CENTCOM))
+7 -8
View File
@@ -228,11 +228,10 @@
return 1
/datum/tgui_module/email_client/tgui_act(action, params)
/datum/tgui_module/email_client/tgui_act(action, params, datum/tgui/ui)
if(..())
return TRUE
var/mob/living/user = usr
check_for_new_messages(1) // Any actual interaction (button pressing) is considered as acknowledging received message, for the purpose of notification icons.
switch(action)
@@ -279,7 +278,7 @@
var/oldtext = html_decode(msg_body)
oldtext = replacetext(oldtext, "\[editorbr\]", "\n")
var/newtext = sanitize(replacetext(tgui_input_text(usr, "Enter your message. You may use most tags from paper formatting", "Message Editor", oldtext, 20000, TRUE, prevent_enter = TRUE), "\n", "\[editorbr\]"), 20000)
var/newtext = sanitize(replacetext(tgui_input_text(ui.user, "Enter your message. You may use most tags from paper formatting", "Message Editor", oldtext, 20000, TRUE, prevent_enter = TRUE), "\n", "\[editorbr\]"), 20000)
if(newtext)
msg_body = newtext
return 1
@@ -362,13 +361,13 @@
return 1
if("changepassword")
var/oldpassword = sanitize(tgui_input_text(user,"Please enter your old password:", "Password Change", null, 100), 100)
var/oldpassword = sanitize(tgui_input_text(ui.user,"Please enter your old password:", "Password Change", null, 100), 100)
if(!oldpassword)
return 1
var/newpassword1 = sanitize(tgui_input_text(user,"Please enter your new password:", "Password Change", null, 100), 100)
var/newpassword1 = sanitize(tgui_input_text(ui.user,"Please enter your new password:", "Password Change", null, 100), 100)
if(!newpassword1)
return 1
var/newpassword2 = sanitize(tgui_input_text(user,"Please re-enter your new password:", "Password Change", null, 100), 100)
var/newpassword2 = sanitize(tgui_input_text(ui.user,"Please re-enter your new password:", "Password Change", null, 100), 100)
if(!newpassword2)
return 1
@@ -399,7 +398,7 @@
error = "Error exporting file. Are you using a functional and NTOS-compliant device?"
return 1
var/filename = sanitize(tgui_input_text(user,"Please specify file name:", "Message export", null, 100), 100)
var/filename = sanitize(tgui_input_text(ui.user,"Please specify file name:", "Message export", null, 100), 100)
if(!filename)
return 1
@@ -427,7 +426,7 @@
if(CF.unsendable)
continue
filenames.Add(CF.filename)
var/picked_file = tgui_input_list(user, "Please pick a file to send as attachment (max 32GQ)", "Select Attachment", filenames)
var/picked_file = tgui_input_list(ui.user, "Please pick a file to send as attachment (max 32GQ)", "Select Attachment", filenames)
if(!picked_file)
return 1
+5 -5
View File
@@ -45,11 +45,11 @@
if("switch_uav")
var/obj/item/uav/U = locate(params["switch_uav"]) //This is a \ref to the UAV itself
if(!istype(U))
to_chat(usr,span_warning("Something is blocking the connection to that UAV. In-person investigation is required."))
to_chat(ui.user,span_warning("Something is blocking the connection to that UAV. In-person investigation is required."))
return FALSE
if(!get_signal_to(U))
to_chat(usr,span_warning("The screen freezes for a moment, before returning to the UAV selection menu. It's not able to connect to that UAV."))
to_chat(ui.user,span_warning("The screen freezes for a moment, before returning to the UAV selection menu. It's not able to connect to that UAV."))
return FALSE
set_current(U)
@@ -70,10 +70,10 @@
if(!current_uav)
return FALSE
if(current_uav.check_eye(usr) < 0)
to_chat(usr,span_warning("The screen freezes for a moment, before returning to the UAV selection menu. It's not able to connect to that UAV."))
if(current_uav.check_eye(ui.user) < 0)
to_chat(ui.user,span_warning("The screen freezes for a moment, before returning to the UAV selection menu. It's not able to connect to that UAV."))
else
viewing_uav(usr) ? unlook(usr) : look(usr)
viewing_uav(ui.user) ? unlook(ui.user) : look(ui.user)
return TRUE
if("power_uav")
+18 -18
View File
@@ -149,7 +149,7 @@
return data
/datum/tgui_module/ship/nav/tgui_act(action, params)
/datum/tgui_module/ship/nav/tgui_act(action, params, datum/tgui/ui)
if(..())
return TRUE
@@ -157,7 +157,7 @@
return FALSE
if(action == "viewing")
viewing_overmap(usr) ? unlook(usr) : look(usr)
viewing_overmap(ui.user) ? unlook(ui.user) : look(ui.user)
return TRUE
/datum/tgui_module/ship/nav/ntos
@@ -326,7 +326,7 @@
return data
// Beware ye eyes. This holds all of the ACTIONS from helm, engine, and sensor control all at once.
/datum/tgui_module/ship/fullmonty/tgui_act(action, params)
/datum/tgui_module/ship/fullmonty/tgui_act(action, params, datum/tgui/ui)
if(..())
return TRUE
@@ -334,21 +334,21 @@
/* HELM */
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(!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)
var/newy = tgui_input_number(usr, "Input new entry y coordinate", "Coordinate input", linked.y, world.maxy, 1)
var/newx = tgui_input_number(ui.user, "Input new entry x coordinate", "Coordinate input", linked.x, world.maxx, 1)
var/newy = tgui_input_number(ui.user, "Input new entry y coordinate", "Coordinate input", linked.y, world.maxy, 1)
R.fields["x"] = CLAMP(newx, 1, world.maxx)
R.fields["y"] = CLAMP(newy, 1, world.maxy)
known_sectors[sec_name] = R
@@ -363,12 +363,12 @@
if("setcoord")
if(params["setx"])
var/newx = tgui_input_number(usr, "Input new destiniation x coordinate", "Coordinate input", dx, world.maxx, 1)
var/newx = tgui_input_number(ui.user, "Input new destiniation x coordinate", "Coordinate input", dx, world.maxx, 1)
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)
var/newy = tgui_input_number(ui.user, "Input new destiniation y coordinate", "Coordinate input", dy, world.maxy, 1)
if(newy)
dy = CLAMP(newy, 1, world.maxy)
. = TRUE
@@ -384,13 +384,13 @@
. = TRUE
if("speedlimit")
var/newlimit = tgui_input_number(usr, "Input new speed limit for autopilot (0 to brake)", "Autopilot speed limit", speedlimit*1000, 100000)
var/newlimit = tgui_input_number(ui.user, "Input new speed limit for autopilot (0 to brake)", "Autopilot speed limit", speedlimit*1000, 100000)
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)
var/newlimit = tgui_input_number(ui.user, "Input new acceleration limit", "Acceleration limit", accellimit*1000)
if(newlimit)
accellimit = max(newlimit/1000, 0)
. = TRUE
@@ -398,7 +398,7 @@
if("move")
var/ndir = text2num(params["dir"])
ndir = turn(ndir,pick(90,-90))
linked.relaymove(usr, ndir, accellimit)
linked.relaymove(ui.user, ndir, accellimit)
. = TRUE
if("brake")
@@ -418,7 +418,7 @@
. = TRUE
if("manual")
viewing_overmap(usr) ? unlook(usr) : look(usr)
viewing_overmap(ui.user) ? unlook(ui.user) : look(ui.user)
. = TRUE
/* END HELM */
/* ENGINES */
@@ -430,7 +430,7 @@
. = 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)
var/newlim = tgui_input_number(ui.user, "Input new thrust limit (0..100%)", "Thrust limit", linked.thrust_limit*100, 100, 0)
linked.thrust_limit = clamp(newlim/100, 0, 1)
for(var/datum/ship_engine/E in linked.engines)
E.set_thrust_limit(linked.thrust_limit)
@@ -444,7 +444,7 @@
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)
var/newlim = tgui_input_number(ui.user, "Input new thrust limit (0..100)", "Thrust limit", E.get_thrust_limit(), 100, 0)
var/limit = clamp(newlim/100, 0, 1)
if(istype(E))
E.set_thrust_limit(limit)
@@ -465,7 +465,7 @@
/* END ENGINES */
/* SENSORS */
if("range")
var/nrange = tgui_input_number(usr, "Set new sensors range", "Sensor range", sensors.range, world.view, round_value = FALSE)
var/nrange = tgui_input_number(ui.user, "Set new sensors range", "Sensor range", sensors.range, world.view, round_value = FALSE)
if(nrange)
sensors.set_range(CLAMP(nrange, 1, world.view))
. = TRUE
@@ -473,8 +473,8 @@
sensors.toggle()
. = TRUE
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
/* END SENSORS */
+4 -4
View File
@@ -55,7 +55,7 @@
return data
/datum/tgui_module/rcon/tgui_act(action, params)
/datum/tgui_module/rcon/tgui_act(action, params, datum/tgui/ui)
if(..())
return TRUE
@@ -78,14 +78,14 @@
var/obj/machinery/power/smes/buildable/SMES = GetSMESByTag(params["smes"])
if(SMES)
SMES.tgui_set_io(SMES_TGUI_INPUT, params["target"], text2num(params["adjust"]))
// var/inputset = (input(usr, "Enter new input level (0-[SMES.input_level_max/1000] kW)", "SMES Input Power Control", SMES.input_level/1000) as num) * 1000
// var/inputset = (input(ui.user, "Enter new input level (0-[SMES.input_level_max/1000] kW)", "SMES Input Power Control", SMES.input_level/1000) as num) * 1000
// SMES.set_input(inputset)
. = TRUE
if("smes_out_set")
var/obj/machinery/power/smes/buildable/SMES = GetSMESByTag(params["smes"])
if(SMES)
SMES.tgui_set_io(SMES_TGUI_OUTPUT, params["target"], text2num(params["adjust"]))
// var/outputset = (input(usr, "Enter new output level (0-[SMES.output_level_max/1000] kW)", "SMES Output Power Control", SMES.output_level/1000) as num) * 1000
// var/outputset = (input(ui.user, "Enter new output level (0-[SMES.output_level_max/1000] kW)", "SMES Output Power Control", SMES.output_level/1000) as num) * 1000
// SMES.set_output(outputset)
. = TRUE
if("toggle_breaker")
@@ -95,7 +95,7 @@
toggle = breaker
if(toggle)
if(toggle.update_locked)
to_chat(usr, "The breaker box was recently toggled. Please wait before toggling it again.")
to_chat(ui.user, "The breaker box was recently toggled. Please wait before toggling it again.")
else
toggle.auto_toggle()
. = TRUE
@@ -4,7 +4,7 @@
var/core_tag = ""
/datum/tgui_module/rustcore_monitor/tgui_act(action, params)
/datum/tgui_module/rustcore_monitor/tgui_act(action, params, datum/tgui/ui)
if(..())
return TRUE
@@ -25,7 +25,7 @@
return TRUE
if("set_tag")
var/new_ident = sanitize_text(tgui_input_text(usr, "Enter a new ident tag.", "Core Control", core_tag))
var/new_ident = sanitize_text(tgui_input_text(ui.user, "Enter a new ident tag.", "Core Control", core_tag))
if(new_ident)
core_tag = new_ident
return TRUE
@@ -4,7 +4,7 @@
var/fuel_tag = ""
/datum/tgui_module/rustfuel_control/tgui_act(action, params)
/datum/tgui_module/rustfuel_control/tgui_act(action, params, datum/tgui/ui)
if(..())
return TRUE
@@ -22,7 +22,7 @@
return TRUE
if("set_tag")
var/new_ident = sanitize_text(tgui_input_text(usr, "Enter a new ident tag.", "Gyrotron Control", fuel_tag))
var/new_ident = sanitize_text(tgui_input_text(ui.user, "Enter a new ident tag.", "Gyrotron Control", fuel_tag))
if(new_ident)
fuel_tag = new_ident
@@ -48,4 +48,4 @@
return data
/datum/tgui_module/rustfuel_control/ntos
ntos = TRUE
ntos = TRUE
+5 -5
View File
@@ -20,7 +20,7 @@
/datum/tgui_module/teleport_control/tgui_act(action, params, datum/tgui/ui, datum/tgui_state/state)
if(..())
return TRUE
switch(action)
if("select_target")
var/list/L = list()
@@ -59,10 +59,10 @@
areaindex[tmpname] = 1
L[tmpname] = I
var/desc = tgui_input_list(usr, "Please select a location to lock in.", "Locking Menu", L)
var/desc = tgui_input_list(ui.user, "Please select a location to lock in.", "Locking Menu", L)
if(!desc)
return FALSE
if(tgui_status(usr, state) != STATUS_INTERACTIVE)
if(tgui_status(ui.user, state) != STATUS_INTERACTIVE)
return FALSE
locked = L[desc]
@@ -76,10 +76,10 @@
if("toggle_on")
if(!station)
return FALSE
if(station.engaged)
station.disengage()
else
station.engage()
return TRUE