Skip to content

Commit

Permalink
Little changes and standardisation of some admin commands (tgstation#…
Browse files Browse the repository at this point in the history
…36091)

* Adds a cancel button to the timing section of turning the nuke on.

* Adds a custom input for managing job slots. No longer must it be infinite or many add button clicks.

* Adds |null on all input (I believe they need that to have the cancel button)
and updates from !holder to new admin check
  • Loading branch information
Jalleo authored and duncathan committed Mar 4, 2018
1 parent dab977d commit 5bcf8b2
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 53 deletions.
5 changes: 3 additions & 2 deletions code/modules/admin/admin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -769,13 +769,14 @@
dat += "<tr><td>[J_title]:</td> <td>[J_opPos]/[job.total_positions < 0 ? " (unlimited)" : J_totPos]"

if(job.title == "AI" || job.title == "Cyborg")
dat += " (Cannot Late Join)</td>"
dat += " </td><td>(Cannot Late Join)</td>"
continue
else
dat += "</td>"
dat += "<td>"
if(job.total_positions >= 0)
dat += "<A href='?src=[REF(src)];[HrefToken()];addjobslot=[job.title]'>Add</A> | "
dat += "<A href='?src=[REF(src)];[HrefToken()];customjobslot=[job.title]'>Custom</A> | "
dat += "<A href='?src=[REF(src)];[HrefToken()];addjobslot=[job.title]'>Add 1</A> | "
if(job.total_positions > job.current_positions)
dat += "<A href='?src=[REF(src)];[HrefToken()];removejobslot=[job.title]'>Remove</A> | "
else
Expand Down
23 changes: 21 additions & 2 deletions code/modules/admin/topic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1699,6 +1699,25 @@

src.manage_free_slots()


else if(href_list["customjobslot"])
if(!check_rights(R_ADMIN))
return

var/Add = href_list["customjobslot"]

for(var/datum/job/job in SSjob.occupations)
if(job.title == Add)
var/newtime = null
newtime = input(usr, "How many jebs do you want?", "Add wanted posters", "[newtime]") as num|null
if(!newtime)
to_chat(src.owner, "Setting to amount of positions filled for the job")
job.total_positions = job.current_positions
break
job.total_positions = newtime

src.manage_free_slots()

else if(href_list["removejobslot"])
if(!check_rights(R_ADMIN))
return
Expand Down Expand Up @@ -1896,7 +1915,7 @@
D.traitor_panel()
else
show_traitor_panel(M)

else if(href_list["initmind"])
if(!check_rights(R_ADMIN))
return
Expand All @@ -1905,7 +1924,7 @@
to_chat(usr, "This can only be used on instances on mindless mobs")
return
M.mind_initialize()

else if(href_list["create_object"])
if(!check_rights(R_SPAWN))
return
Expand Down
90 changes: 41 additions & 49 deletions code/modules/admin/verbs/randomverbs.dm
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/client/proc/cmd_admin_drop_everything(mob/M in GLOB.mob_list)
set category = null
set name = "Drop Everything"
if(!holder)
to_chat(src, "Only administrators may use this command.")
if(!check_rights(R_ADMIN))
return

var/confirm = alert(src, "Make [M] drop everything?", "Message", "Yes", "No")
Expand All @@ -26,12 +25,11 @@

if(!ismob(M))
return
if (!holder)
to_chat(src, "Only administrators may use this command.")
if(!check_rights(R_ADMIN))
return

message_admins("[key_name_admin(src)] has started answering [key_name(M.key, 0, 0)]'s prayer.")
var/msg = input("Message:", text("Subtle PM to [M.key]")) as text
var/msg = input("Message:", text("Subtle PM to [M.key]")) as text|null

if (!msg)
message_admins("[key_name_admin(src)] decided not to answer [key_name(M.key, 0, 0)]'s prayer")
Expand Down Expand Up @@ -66,7 +64,7 @@
if(operation == "set")
prompt = "Please enter the new reputation value:"

msg = input("Message:", prompt) as num
msg = input("Message:", prompt) as num|null

if (!msg)
return
Expand Down Expand Up @@ -97,11 +95,10 @@
set category = "Special Verbs"
set name = "Global Narrate"

if (!holder)
to_chat(src, "Only administrators may use this command.")
if(!check_rights(R_ADMIN))
return

var/msg = input("Message:", text("Enter the text you wish to appear to everyone:")) as text
var/msg = input("Message:", text("Enter the text you wish to appear to everyone:")) as text|null

if (!msg)
return
Expand All @@ -114,8 +111,7 @@
set category = "Special Verbs"
set name = "Direct Narrate"

if(!holder)
to_chat(src, "Only administrators may use this command.")
if(!check_rights(R_ADMIN))
return

if(!M)
Expand All @@ -124,7 +120,7 @@
if(!M)
return

var/msg = input("Message:", text("Enter the text you wish to appear to your target:")) as text
var/msg = input("Message:", text("Enter the text you wish to appear to your target:")) as text|null

if( !msg )
return
Expand All @@ -140,15 +136,14 @@
set category = "Special Verbs"
set name = "Local Narrate"

if (!holder)
to_chat(src, "Only administrators may use this command.")
if(!check_rights(R_ADMIN))
return
if(!A)
return
var/range = input("Range:", "Narrate to mobs within how many tiles:", 7) as num
var/range = input("Range:", "Narrate to mobs within how many tiles:", 7) as num|null
if(!range)
return
var/msg = input("Message:", text("Enter the text you wish to appear to everyone within view:")) as text
var/msg = input("Message:", text("Enter the text you wish to appear to everyone within view:")) as text|null
if (!msg)
return
for(var/mob/M in view(range,A))
Expand All @@ -161,9 +156,9 @@
/client/proc/cmd_admin_godmode(mob/M in GLOB.mob_list)
set category = "Special Verbs"
set name = "Godmode"
if(!holder)
to_chat(src, "Only administrators may use this command.")
if(!check_rights(R_ADMIN))
return

M.status_flags ^= GODMODE
to_chat(usr, "<span class='adminnotice'>Toggled [(M.status_flags & GODMODE) ? "ON" : "OFF"]</span>")

Expand Down Expand Up @@ -307,9 +302,9 @@ Traitors and the like can also be revived with the previous role mostly intact.
set category = "Special Verbs"
set name = "Respawn Character"
set desc = "Respawn a person that has been gibbed/dusted/killed. They must be a ghost for this to work and preferably should not have a body to go back into."
if(!holder)
to_chat(src, "Only administrators may use this command.")
if(!check_rights(R_ADMIN))
return

var/input = ckey(input(src, "Please specify which key will be respawned.", "Key", ""))
if(!input)
return
Expand Down Expand Up @@ -474,9 +469,10 @@ Traitors and the like can also be revived with the previous role mostly intact.
/client/proc/cmd_admin_add_freeform_ai_law()
set category = "Fun"
set name = "Add Custom AI law"
if(!holder)
to_chat(src, "Only administrators may use this command.")

if(!check_rights(R_ADMIN))
return

var/input = input(usr, "Please enter anything you want the AI to do. Anything. Serious.", "What?", "") as text|null
if(!input)
return
Expand All @@ -496,9 +492,10 @@ Traitors and the like can also be revived with the previous role mostly intact.
/client/proc/cmd_admin_rejuvenate(mob/living/M in GLOB.mob_list)
set category = "Special Verbs"
set name = "Rejuvenate"
if(!holder)
to_chat(src, "Only administrators may use this command.")

if(!check_rights(R_ADMIN))
return

if(!mob)
return
if(!istype(M))
Expand All @@ -515,9 +512,10 @@ Traitors and the like can also be revived with the previous role mostly intact.
/client/proc/cmd_admin_create_centcom_report()
set category = "Special Verbs"
set name = "Create Command Report"
if(!holder)
to_chat(src, "Only administrators may use this command.")

if(!check_rights(R_ADMIN))
return

var/input = input(usr, "Enter a Command Report. Ensure it makes sense IC.", "What?", "") as message|null
if(!input)
return
Expand All @@ -540,9 +538,10 @@ Traitors and the like can also be revived with the previous role mostly intact.
/client/proc/cmd_change_command_name()
set category = "Special Verbs"
set name = "Change Command Name"
if(!holder)
to_chat(src, "Only administrators may use this command.")

if(!check_rights(R_ADMIN))
return

var/input = input(usr, "Please input a new name for Central Command.", "What?", "") as text|null
if(!input)
return
Expand All @@ -554,8 +553,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
set category = "Admin"
set name = "Delete"

if (!holder)
to_chat(src, "Only administrators may use this command.")
if(!check_rights(R_ADMIN))
return

admin_delete(A)
Expand All @@ -577,8 +575,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
set category = "Admin"
set name = "Manage Job Slots"

if (!holder)
to_chat(src, "Only administrators may use this command.")
if(!check_rights(R_ADMIN))
return
holder.manage_free_slots()
SSblackbox.record_feedback("tally", "admin_verb", 1, "Manage Job Slots") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
Expand All @@ -587,8 +584,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
set category = "Special Verbs"
set name = "Explosion"

if (!holder)
to_chat(src, "Only administrators may use this command.")
if(!check_rights(R_ADMIN))
return

var/devastation = input("Range of total devastation. -1 to none", text("Input")) as num|null
Expand Down Expand Up @@ -624,8 +620,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
set category = "Special Verbs"
set name = "EM Pulse"

if (!holder)
to_chat(src, "Only administrators may use this command.")
if(!check_rights(R_ADMIN))
return

var/heavy = input("Range of heavy pulse.", text("Input")) as num|null
Expand All @@ -650,8 +645,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
set category = "Special Verbs"
set name = "Gib"

if (!holder)
to_chat(src, "Only administrators may use this command.")
if(!check_rights(R_ADMIN))
return

var/confirm = alert(src, "Drop a brain?", "Confirm", "Yes", "No","Cancel")
Expand Down Expand Up @@ -716,8 +710,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
if(EMERGENCY_AT_LEAST_DOCKED)
return

if (!holder)
to_chat(src, "Only administrators may use this command.")
if(!check_rights(R_ADMIN))
return

var/confirm = alert(src, "You sure?", "Confirm", "Yes", "No")
Expand Down Expand Up @@ -801,8 +794,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
set name = "Set Security Level"
set desc = "Changes the security level. Announcement only, i.e. setting to Delta won't activate nuke"

if (!holder)
to_chat(src, "Only administrators may use this command.")
if(!check_rights(R_ADMIN))
return

var/level = input("Select security level to change to","Set Security Level") as null|anything in list("green","blue","red","delta")
Expand All @@ -821,7 +813,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
return

if(!N.timing)
var/newtime = input(usr, "Set activation timer.", "Activate Nuke", "[N.timer_set]") as num
var/newtime = input(usr, "Set activation timer.", "Activate Nuke", "[N.timer_set]") as num|null
if(!newtime)
return
N.timer_set = newtime
Expand Down Expand Up @@ -1075,7 +1067,7 @@ GLOBAL_LIST_EMPTY(custom_outfits) //Admin created outfits
set desc = "Infects all humans with a latent organ that will zombify \
them on death."

if(!holder)
if(!check_rights(R_ADMIN))
return

var/confirm = alert(src, "Please confirm you want to add latent zombie organs in all humans?", "Confirm Zombies", "Yes", "No")
Expand All @@ -1093,7 +1085,7 @@ GLOBAL_LIST_EMPTY(custom_outfits) //Admin created outfits
set category = "Fun"
set name = "Mass Zombie Cure"
set desc = "Removes the zombie infection from all humans, returning them to normal."
if(!holder)
if(!check_rights(R_ADMIN))
return

var/confirm = alert(src, "Please confirm you want to cure all zombies?", "Confirm Zombie Cure", "Yes", "No")
Expand All @@ -1112,7 +1104,7 @@ GLOBAL_LIST_EMPTY(custom_outfits) //Admin created outfits
set name = "Polymorph All"
set desc = "Applies the effects of the bolt of change to every single mob."

if(!holder)
if(!check_rights(R_ADMIN))
return

var/confirm = alert(src, "Please confirm you want polymorph all mobs?", "Confirm Polymorph", "Yes", "No")
Expand Down Expand Up @@ -1146,7 +1138,7 @@ GLOBAL_LIST_EMPTY(custom_outfits) //Admin created outfits
set desc = "Sends a tip (that you specify) to all players. After all \
you're the experienced player here."

if(!holder)
if(!check_rights(R_ADMIN))
return

var/input = input(usr, "Please specify your tip that you want to send to the players.", "Tip", "") as message|null
Expand Down Expand Up @@ -1279,7 +1271,7 @@ GLOBAL_LIST_EMPTY(custom_outfits) //Admin created outfits
/client/proc/smite(mob/living/carbon/human/target as mob)
set name = "Smite"
set category = "Fun"
if(!holder)
if(!check_rights(R_ADMIN))
return

var/list/punishment_list = list(ADMIN_PUNISHMENT_LIGHTNING, ADMIN_PUNISHMENT_BRAINDAMAGE, ADMIN_PUNISHMENT_GIB, ADMIN_PUNISHMENT_BSA, ADMIN_PUNISHMENT_FIREBALL, ADMIN_PUNISHMENT_ROD)
Expand Down Expand Up @@ -1318,7 +1310,7 @@ GLOBAL_LIST_EMPTY(custom_outfits) //Admin created outfits


/client/proc/trigger_centcom_recall()
if(!holder)
if(!check_rights(R_ADMIN))
return
var/message = pick(GLOB.admiral_messages)
message = input("Enter message from the on-call admiral to be put in the recall report.", "Admiral Message", message) as text|null
Expand Down

0 comments on commit 5bcf8b2

Please sign in to comment.