mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-07-20 20:54:35 +01:00
[MIRROR] usr to user up to player effects (#9552)
Co-authored-by: Heroman3003 <31296024+Heroman3003@users.noreply.github.com> Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
a7e4ef7dad
commit
0180cc74c5
@@ -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
|
||||
|
||||
|
||||
@@ -157,7 +157,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
|
||||
@@ -308,12 +308,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
|
||||
@@ -503,7 +503,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()
|
||||
@@ -511,7 +511,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()
|
||||
@@ -544,8 +544,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"])
|
||||
|
||||
@@ -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
|
||||
@@ -138,14 +138,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
|
||||
|
||||
@@ -189,13 +189,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)
|
||||
@@ -720,7 +720,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]")
|
||||
@@ -767,22 +767,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")
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user