usr to user up to player effects

This commit is contained in:
Kashargul
2024-11-12 00:10:20 +01:00
parent dcfa9c2b72
commit 49d89c0059
177 changed files with 831 additions and 835 deletions
+1 -1
View File
@@ -59,7 +59,7 @@ var/datum/admin_secrets/admin_secrets = new()
/datum/admin_secret_item/proc/can_execute(var/mob/user)
if(can_view(user))
if(!warn_before_use || tgui_alert(usr, "Execute the command '[name]'?", name, list("No","Yes")) == "Yes")
if(!warn_before_use || tgui_alert(user, "Execute the command '[name]'?", name, list("No","Yes")) == "Yes")
return 1
return 0
+7 -7
View File
@@ -152,7 +152,7 @@
/datum/eventkit/modify_robot/tgui_state(mob/user)
return GLOB.tgui_admin_state
/datum/eventkit/modify_robot/tgui_act(action, params)
/datum/eventkit/modify_robot/tgui_act(action, params, datum/tgui/ui)
. = ..()
if(.)
return
@@ -292,12 +292,12 @@
var/new_upgrade = text2path(params["upgrade"])
if(new_upgrade == /obj/item/borg/upgrade/utility/reset)
var/obj/item/borg/upgrade/utility/reset/rmodul = new_upgrade
if(tgui_alert(usr, "Are you sure that you want to install [initial(rmodul.name)] and reset the robot's module?","Confirm",list("Yes","No"))!="Yes")
if(tgui_alert(ui.user, "Are you sure that you want to install [initial(rmodul.name)] and reset the robot's module?","Confirm",list("Yes","No"))!="Yes")
return FALSE
var/obj/item/borg/upgrade/U = new new_upgrade(null)
if(new_upgrade == /obj/item/borg/upgrade/utility/rename)
var/obj/item/borg/upgrade/utility/rename/UN = U
var/new_name = sanitizeSafe(tgui_input_text(usr, "Enter new robot name", "Robot Reclassification", UN.heldname, MAX_NAME_LEN), MAX_NAME_LEN)
var/new_name = sanitizeSafe(tgui_input_text(ui.user, "Enter new robot name", "Robot Reclassification", UN.heldname, MAX_NAME_LEN), MAX_NAME_LEN)
if(new_name)
UN.heldname = new_name
U = UN
@@ -487,7 +487,7 @@
target.lawsync()
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)
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))
supplied_law_position = CLAMP(new_position, 1, MAX_SUPPLIED_LAW_NUMBER)
target.lawsync()
@@ -495,7 +495,7 @@
if("edit_law")
var/datum/ai_law/AL = locate(params["edit_law"]) in target.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))
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)
AL.law = new_law
target.lawsync()
@@ -528,8 +528,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 != target)
to_chat(usr, span_notice("Laws displayed."))
if(ui.user != target)
to_chat(ui.user, span_notice("Laws displayed."))
return TRUE
if("select_ai")
selected_ai = locate(params["new_ai"])
+15 -15
View File
@@ -39,11 +39,11 @@
/datum/eventkit/player_effects/tgui_state(mob/user)
return GLOB.tgui_admin_state
/datum/eventkit/player_effects/tgui_act(action)
/datum/eventkit/player_effects/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
log_and_message_admins("[key_name(user)] used player effect: [action] on [target.ckey] playing [target.name]")
@@ -66,7 +66,7 @@
to_chat(user,"[target] didn't have any breakable legs, sorry.")
if("bluespace_artillery")
bluespace_artillery(target,usr)
bluespace_artillery(target, ui.user)
if("spont_combustion")
var/mob/living/carbon/human/Tar = target
@@ -137,14 +137,14 @@
"Orange Eyes (Light)" = /mob/living/simple_mob/shadekin/orange/white,
"Orange Eyes (Brown)" = /mob/living/simple_mob/shadekin/orange/brown,
"Rivyr (Unique)" = /mob/living/simple_mob/shadekin/blue/rivyr)
var/kin_type = tgui_input_list(usr, "Select the type of shadekin for [target] nomf","Shadekin Type Choice", kin_types)
var/kin_type = tgui_input_list(ui.user, "Select the type of shadekin for [target] nomf","Shadekin Type Choice", kin_types)
if(!kin_type || !target)
return
kin_type = kin_types[kin_type]
var/myself = tgui_alert(usr, "Control the shadekin yourself or delete pred and prey after?","Control Shadekin?",list("Control","Cancel","Delete"))
var/myself = tgui_alert(ui.user, "Control the shadekin yourself or delete pred and prey after?","Control Shadekin?",list("Control","Cancel","Delete"))
if(!myself || myself == "Cancel" || !target)
return
@@ -187,13 +187,13 @@
if("redspace_abduct")
redspace_abduction(target, usr)
redspace_abduction(target, ui.user)
if("autosave")
fake_autosave(target, usr)
fake_autosave(target, ui.user)
if("autosave2")
fake_autosave(target, usr, TRUE)
fake_autosave(target, ui.user, TRUE)
if("adspam")
if(target.client)
@@ -718,7 +718,7 @@
if(where == "To Me")
user.client.Getmob(target)
if(where == "To Mob")
var/mob/selection = tgui_input_list(usr, "Select a mob to jump [target] to:", "Jump to mob", mob_list)
var/mob/selection = tgui_input_list(ui.user, "Select a mob to jump [target] to:", "Jump to mob", mob_list)
target.on_mob_jump()
target.forceMove(get_turf(selection))
log_admin("[key_name(user)] jumped [target] to [selection]")
@@ -765,22 +765,22 @@
if("ai")
if(!istype(target, /mob/living))
to_chat(usr, span_notice("This can only be used on instances of type /mob/living"))
to_chat(ui.user, span_notice("This can only be used on instances of type /mob/living"))
return
var/mob/living/L = target
if(L.client || L.teleop)
to_chat(usr, span_warning("This cannot be used on player mobs!"))
to_chat(ui.user, span_warning("This cannot be used on player mobs!"))
return
if(L.ai_holder) //Cleaning up the original ai
var/ai_holder_old = L.ai_holder
L.ai_holder = null
qdel(ai_holder_old) //Only way I could make #TESTING - Unable to be GC'd to stop. del() logs show it works.
L.ai_holder_type = tgui_input_list(usr, "Choose AI holder", "AI Type", typesof(/datum/ai_holder/))
L.ai_holder_type = tgui_input_list(ui.user, "Choose AI holder", "AI Type", typesof(/datum/ai_holder/))
L.initialize_ai_holder()
L.faction = sanitize(tgui_input_text(usr, "Please input AI faction", "AI faction", "neutral"))
L.a_intent = tgui_input_list(usr, "Please choose AI intent", "AI intent", list(I_HURT, I_HELP))
if(tgui_alert(usr, "Make mob wake up? This is needed for carbon mobs.", "Wake mob?", list("Yes", "No")) == "Yes")
L.faction = sanitize(tgui_input_text(ui.user, "Please input AI faction", "AI faction", "neutral"))
L.a_intent = tgui_input_list(ui.user, "Please choose AI intent", "AI intent", list(I_HURT, I_HELP))
if(tgui_alert(ui.user, "Make mob wake up? This is needed for carbon mobs.", "Wake mob?", list("Yes", "No")) == "Yes")
L.AdjustSleeping(-100)
if("cloaking")