From 16500f0f27910eaeb112a41f892c8e6969a66731 Mon Sep 17 00:00:00 2001 From: Krausus Date: Mon, 25 Jul 2016 23:16:21 -0400 Subject: [PATCH 1/4] Adds admin ghost click shortcuts Also refactors extra mob info code into its own proc. --- code/__HELPERS/mobs.dm | 51 ++++++++++++++++++++++++++++++++++++- code/_onclick/observer.dm | 19 ++++++++++++++ code/modules/admin/topic.dm | 48 +--------------------------------- interface/interface.dm | 5 ++++ 4 files changed, 75 insertions(+), 48 deletions(-) diff --git a/code/__HELPERS/mobs.dm b/code/__HELPERS/mobs.dm index e1965cf701e..fc58bd0e81d 100644 --- a/code/__HELPERS/mobs.dm +++ b/code/__HELPERS/mobs.dm @@ -270,4 +270,53 @@ proc/add_logs(mob/target, mob/user, what_done, var/object=null, var/addition=nul . = 0 break if(progress) - qdel(progbar) \ No newline at end of file + qdel(progbar) + +/proc/admin_mob_info(mob/M, mob/user = usr) + if(!ismob(M)) + to_chat(user, "This can only be used on instances of type /mob") + return + + var/location_description = "" + var/special_role_description = "" + var/health_description = "" + var/gender_description = "" + var/turf/T = get_turf(M) + + //Location + if(isturf(T)) + if(isarea(T.loc)) + location_description = "([M.loc == T ? "at coordinates " : "in [M.loc] at coordinates "] [T.x], [T.y], [T.z] in area [T.loc])" + else + location_description = "([M.loc == T ? "at coordinates " : "in [M.loc] at coordinates "] [T.x], [T.y], [T.z])" + + //Job + antagonist + if(M.mind) + special_role_description = "Role: [M.mind.assigned_role]; Antagonist: [M.mind.special_role]; Has been rev: [(M.mind.has_been_rev)?"Yes":"No"]" + else + special_role_description = "Role: Mind datum missing Antagonist: Mind datum missing; Has been rev: Mind datum missing;" + + //Health + if(isliving(M)) + var/mob/living/L = M + var/status + switch(M.stat) + if(0) status = "Alive" + if(1) status = "Unconscious" + if(2) status = "Dead" + health_description = "Status = [status]" + health_description += "
Oxy: [L.getOxyLoss()] - Tox: [L.getToxLoss()] - Fire: [L.getFireLoss()] - Brute: [L.getBruteLoss()] - Clone: [L.getCloneLoss()] - Brain: [L.getBrainLoss()]" + else + health_description = "This mob type has no health to speak of." + + //Gener + switch(M.gender) + if(MALE,FEMALE) gender_description = "[M.gender]" + else gender_description = "[M.gender]" + + to_chat(user, "Info about [M.name]: ") + to_chat(user, "Mob type = [M.type]; Gender = [gender_description] Damage = [health_description]") + to_chat(user, "Name = [M.name]; Real_name = [M.real_name]; Mind_name = [M.mind?"[M.mind.name]":""]; Key = [M.key];") + to_chat(user, "Location = [location_description];") + to_chat(user, "[special_role_description]") + to_chat(user, "(PM) (PP) (VV) (SM) (FLW) (CA)") diff --git a/code/_onclick/observer.dm b/code/_onclick/observer.dm index 869ee83ff9c..8927af5f7be 100644 --- a/code/_onclick/observer.dm +++ b/code/_onclick/observer.dm @@ -25,6 +25,25 @@ return var/list/modifiers = params2list(params) + if(check_rights(R_ADMIN, 0)) // Admin click shortcuts + var/mob/M = A + if(!istype(M)) + M = locate() in A + if(modifiers["shift"] && modifiers["ctrl"]) + client.debug_variables(A) + return + if(modifiers["ctrl"]) + if(M) + client.holder.show_player_panel(M) + else + to_chat(src, "No mob was found in the atom you clicked on.") + return + if(modifiers["shift"] && modifiers["middle"]) + if(M) + admin_mob_info(M) + else + to_chat(src, "No mob was found in the atom you clicked on.") + return if(modifiers["shift"]) ShiftClickOn(A) return diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index a7fc809aa88..6dacca13d12 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1565,53 +1565,7 @@ else if(href_list["adminmoreinfo"]) var/mob/M = locate(href_list["adminmoreinfo"]) - if(!ismob(M)) - to_chat(usr, "This can only be used on instances of type /mob") - return - - var/location_description = "" - var/special_role_description = "" - var/health_description = "" - var/gender_description = "" - var/turf/T = get_turf(M) - - //Location - if(isturf(T)) - if(isarea(T.loc)) - location_description = "([M.loc == T ? "at coordinates " : "in [M.loc] at coordinates "] [T.x], [T.y], [T.z] in area [T.loc])" - else - location_description = "([M.loc == T ? "at coordinates " : "in [M.loc] at coordinates "] [T.x], [T.y], [T.z])" - - //Job + antagonist - if(M.mind) - special_role_description = "Role: [M.mind.assigned_role]; Antagonist: [M.mind.special_role]; Has been rev: [(M.mind.has_been_rev)?"Yes":"No"]" - else - special_role_description = "Role: Mind datum missing Antagonist: Mind datum missing; Has been rev: Mind datum missing;" - - //Health - if(isliving(M)) - var/mob/living/L = M - var/status - switch(M.stat) - if(0) status = "Alive" - if(1) status = "Unconscious" - if(2) status = "Dead" - health_description = "Status = [status]" - health_description += "
Oxy: [L.getOxyLoss()] - Tox: [L.getToxLoss()] - Fire: [L.getFireLoss()] - Brute: [L.getBruteLoss()] - Clone: [L.getCloneLoss()] - Brain: [L.getBrainLoss()]" - else - health_description = "This mob type has no health to speak of." - - //Gener - switch(M.gender) - if(MALE,FEMALE) gender_description = "[M.gender]" - else gender_description = "[M.gender]" - - to_chat(src.owner, "Info about [M.name]: ") - to_chat(src.owner, "Mob type = [M.type]; Gender = [gender_description] Damage = [health_description]") - to_chat(src.owner, "Name = [M.name]; Real_name = [M.real_name]; Mind_name = [M.mind?"[M.mind.name]":""]; Key = [M.key];") - to_chat(src.owner, "Location = [location_description];") - to_chat(src.owner, "[special_role_description]") - to_chat(src.owner, "(PM) (PP) (VV) (SM) (FLW) (CA)") + admin_mob_info(M) else if(href_list["adminspawncookie"]) if(!check_rights(R_ADMIN|R_EVENT)) return diff --git a/interface/interface.dm b/interface/interface.dm index f144b225160..cf3419cc1a7 100644 --- a/interface/interface.dm +++ b/interface/interface.dm @@ -89,6 +89,11 @@ Admin: \tF7 = Player Panel \tF8 = Admin PM \tF9 = Invisimin + +Admin ghost: +\tCtrl+Click = Player Panel +\tCtrl+Shift+Click = View Variables +\tShift+Middle Click = Mob Info "} mob.hotkey_help() From da8f1f3c4c1c8a0e2b9373f6e0c341d5e01b3bb9 Mon Sep 17 00:00:00 2001 From: TheDZD Date: Thu, 28 Jul 2016 16:58:02 -0400 Subject: [PATCH 2/4] Fixes error in SQL schema --- SQL/paradise_schema.sql | 1 - SQL/paradise_schema_prefixed.sql | 1 - 2 files changed, 2 deletions(-) diff --git a/SQL/paradise_schema.sql b/SQL/paradise_schema.sql index 1f5f4c87421..b1ddd70368d 100644 --- a/SQL/paradise_schema.sql +++ b/SQL/paradise_schema.sql @@ -250,7 +250,6 @@ CREATE TABLE `player` ( `nanoui_fancy` smallint(4) DEFAULT '1', `show_ghostitem_attack` smallint(4) DEFAULT '1', `lastchangelog` varchar(32) NOT NULL DEFAULT '0', - `lastchangelog` varchar(32) NOT NULL, `space_parallax` smallint(4) DEFAULT '1', `space_dust` smallint(4) DEFAULT '1', `parallax_speed` float(24) DEFAULT '2', diff --git a/SQL/paradise_schema_prefixed.sql b/SQL/paradise_schema_prefixed.sql index 1349ca6f349..c919036be13 100644 --- a/SQL/paradise_schema_prefixed.sql +++ b/SQL/paradise_schema_prefixed.sql @@ -250,7 +250,6 @@ CREATE TABLE `SS13_player` ( `nanoui_fancy` smallint(4) DEFAULT '1', `show_ghostitem_attack` smallint(4) DEFAULT '1', `lastchangelog` varchar(32) NOT NULL DEFAULT '0', - `lastchangelog` varchar(32) NOT NULL, `space_parallax` smallint(4) DEFAULT '1', `space_dust` smallint(4) DEFAULT '1', `parallax_speed` float(24) DEFAULT '2', From 56f6b3a14ecdb1950544065519dbfb6a8f6fc0ba Mon Sep 17 00:00:00 2001 From: Krausus Date: Thu, 28 Jul 2016 17:02:46 -0400 Subject: [PATCH 3/4] Adds multi-mob warning to admin click shortcuts Also, cleans up admin_mob_info code a bit --- code/__HELPERS/mobs.dm | 32 +++++++++++++++++++++++++++----- code/_onclick/observer.dm | 10 +++------- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/code/__HELPERS/mobs.dm b/code/__HELPERS/mobs.dm index fc58bd0e81d..889a0824f35 100644 --- a/code/__HELPERS/mobs.dm +++ b/code/__HELPERS/mobs.dm @@ -301,9 +301,12 @@ proc/add_logs(mob/target, mob/user, what_done, var/object=null, var/addition=nul var/mob/living/L = M var/status switch(M.stat) - if(0) status = "Alive" - if(1) status = "Unconscious" - if(2) status = "Dead" + if(CONSCIOUS) + status = "Alive" + if(UNCONSCIOUS) + status = "Unconscious" + if(DEAD) + status = "Dead" health_description = "Status = [status]" health_description += "
Oxy: [L.getOxyLoss()] - Tox: [L.getToxLoss()] - Fire: [L.getFireLoss()] - Brute: [L.getBruteLoss()] - Clone: [L.getCloneLoss()] - Brain: [L.getBrainLoss()]" else @@ -311,8 +314,10 @@ proc/add_logs(mob/target, mob/user, what_done, var/object=null, var/addition=nul //Gener switch(M.gender) - if(MALE,FEMALE) gender_description = "[M.gender]" - else gender_description = "[M.gender]" + if(MALE, FEMALE) + gender_description = "[M.gender]" + else + gender_description = "[M.gender]" to_chat(user, "Info about [M.name]: ") to_chat(user, "Mob type = [M.type]; Gender = [gender_description] Damage = [health_description]") @@ -320,3 +325,20 @@ proc/add_logs(mob/target, mob/user, what_done, var/object=null, var/addition=nul to_chat(user, "Location = [location_description];") to_chat(user, "[special_role_description]") to_chat(user, "(PM) (PP) (VV) (SM) (FLW) (CA)") + +// Gets the first mob contained in an atom, and warns the user if there's not exactly one +/proc/get_mob_in_atom_with_warning(atom/A, mob/user = usr) + if(!istype(A)) + return null + if(ismob(A)) + return A + + . = null + for(var/mob/M in A) + if(!.) + . = M + else + to_chat(user, "Multiple mobs in [A], using first mob found...") + break + if(!.) + to_chat(user, "No mob located in [A].") diff --git a/code/_onclick/observer.dm b/code/_onclick/observer.dm index 8927af5f7be..d04abfe5a87 100644 --- a/code/_onclick/observer.dm +++ b/code/_onclick/observer.dm @@ -26,23 +26,19 @@ var/list/modifiers = params2list(params) if(check_rights(R_ADMIN, 0)) // Admin click shortcuts - var/mob/M = A - if(!istype(M)) - M = locate() in A + var/mob/M if(modifiers["shift"] && modifiers["ctrl"]) client.debug_variables(A) return if(modifiers["ctrl"]) + M = get_mob_in_atom_with_warning(A) if(M) client.holder.show_player_panel(M) - else - to_chat(src, "No mob was found in the atom you clicked on.") return if(modifiers["shift"] && modifiers["middle"]) + M = get_mob_in_atom_with_warning(A) if(M) admin_mob_info(M) - else - to_chat(src, "No mob was found in the atom you clicked on.") return if(modifiers["shift"]) ShiftClickOn(A) From e5794561d6c1611d8a45ab3cbffc51c442243598 Mon Sep 17 00:00:00 2001 From: ParadiseSS13-Bot Date: Thu, 28 Jul 2016 17:09:22 -0400 Subject: [PATCH 4/4] Automatic changelog generation for PR #5203 --- html/changelogs/AutoChangeLog-pr-5203.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 html/changelogs/AutoChangeLog-pr-5203.yml diff --git a/html/changelogs/AutoChangeLog-pr-5203.yml b/html/changelogs/AutoChangeLog-pr-5203.yml new file mode 100644 index 00000000000..6ddee474950 --- /dev/null +++ b/html/changelogs/AutoChangeLog-pr-5203.yml @@ -0,0 +1,4 @@ +author: Krausus +delete-after: True +changes: + - rscadd: "Admins now have click shortcuts for opening a player panel, showing mob info, and viewing variables. Specifics are in Hotkey Help."