Skip to content

Commit

Permalink
Adds a confirmation check for aheals (#10740)
Browse files Browse the repository at this point in the history
* no more fuckups

* Removed panel change and TGUI-ifies some admin topic procs

* Revert "no more fuckups"

This reverts commit 483ef97.
  • Loading branch information
Tsar-Salat authored May 21, 2024
1 parent a4613d0 commit 162ce22
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 20 deletions.
36 changes: 20 additions & 16 deletions code/modules/admin/topic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@
if(!check_rights(R_ADMIN))
return
if(SSticker && SSticker.mode)
return alert(usr, "The game has already started.", null, null, null, null)
return tgui_alert(usr, "The game has already started.")
if(!istype(SSticker.mode, /datum/game_mode/dynamic))
return alert(usr, "The game mode has to be dynamic mode.", null, null, null, null)
return tgui_alert(usr, "The game mode has to be dynamic mode.")
var/roundstart_rules = list()
for (var/rule in subtypesof(/datum/dynamic_ruleset/roundstart))
var/datum/dynamic_ruleset/roundstart/newrule = new rule(SSticker.mode)
Expand Down Expand Up @@ -856,7 +856,7 @@
to_chat(usr, "This cannot be used on instances of type /mob/living/silicon/ai.")
return

if(alert(usr, "Send [key_name(M)] to Prison?", "Message", "Yes", "No") != "Yes")
if(tgui_alert(usr, "Send [key_name(M)] to Prison?", "Message", list("Yes", "No")) != "Yes")
return

M.forceMove(pick(GLOB.prisonwarp))
Expand All @@ -879,7 +879,7 @@
to_chat(usr, "<span class='warning'>[M] doesn't seem to have an active client.</span>")
return

if(alert(usr, "Send [key_name(M)] back to Lobby?", "Message", "Yes", "No") != "Yes")
if(tgui_alert(usr, "Send [key_name(M)] back to Lobby?", "Message", list("Yes", "No")) != "Yes")
return

log_admin("[key_name(usr)] has sent [key_name(M)] back to the Lobby.")
Expand All @@ -893,7 +893,7 @@
if(!check_rights(R_FUN))
return

if(alert(usr, "Confirm?", "Message", "Yes", "No") != "Yes")
if(tgui_alert(usr, "Confirm?", "Message", list("Yes", "No")) != "Yes")
return

var/mob/M = locate(href_list["tdome1"])
Expand All @@ -920,7 +920,7 @@
if(!check_rights(R_FUN))
return

if(alert(usr, "Confirm?", "Message", "Yes", "No") != "Yes")
if(tgui_alert(usr, "Confirm?", "Message", list("Yes", "No")) != "Yes")
return

var/mob/M = locate(href_list["tdome2"])
Expand All @@ -947,7 +947,7 @@
if(!check_rights(R_FUN))
return

if(alert(usr, "Confirm?", "Message", "Yes", "No") != "Yes")
if(tgui_alert(usr, "Confirm?", "Message", list("Yes", "No")) != "Yes")
return

var/mob/M = locate(href_list["tdomeadmin"])
Expand All @@ -971,7 +971,7 @@
if(!check_rights(R_FUN))
return

if(alert(usr, "Confirm?", "Message", "Yes", "No") != "Yes")
if(tgui_alert(usr, "Confirm?", "Message", list("Yes", "No")) != "Yes")
return

var/mob/M = locate(href_list["tdomeobserve"])
Expand Down Expand Up @@ -1007,6 +1007,9 @@
to_chat(usr, "This can only be used on instances of type /mob/living.")
return

// We query the admin who sent the adminheal if they are sure
if(tgui_alert(usr, "A full adminheal was called on [src], approve or deny?", "Aheal Query", buttons = list("Approve", "Deny")) != "Approve")
return
L.revive(full_heal = 1, admin_revive = 1)
message_admins("<span class='danger'>Admin [key_name_admin(usr)] healed / revived [key_name_admin(L)]!</span>")
log_admin("[key_name(usr)] healed / Revived [key_name(L)].")
Expand Down Expand Up @@ -1330,7 +1333,7 @@
return

if(!SSticker.HasRoundStarted())
alert("The game hasn't started yet!")
tgui_alert(usr,"The game hasn't started yet!")
return

var/mob/M = locate(href_list["traitor"])
Expand Down Expand Up @@ -1411,10 +1414,10 @@
paths += path

if(!paths)
alert("The path list you sent is empty.")
tgui_alert(usr,"The path list you sent is empty.")
return
if(length(paths) > 5)
alert("Select fewer object types, (max 5).")
tgui_alert(usr, "Select fewer object types, (max 5).")
return

var/list/offset = splittext(href_list["offset"],",")
Expand Down Expand Up @@ -1525,7 +1528,7 @@
return
if(SSticker.IsRoundInProgress())
var/afkonly = text2num(href_list["afkonly"])
if(alert("Are you sure you want to kick all [afkonly ? "AFK" : ""] clients from the lobby??","Message","Yes","Cancel") != "Yes")
if(tgui_alert(usr,"Are you sure you want to kick all [afkonly ? "AFK" : ""] clients from the lobby??","Message",list("Yes","Cancel")) != "Yes")
to_chat(usr, "Kick clients from lobby aborted")
return
var/list/listkicked = kick_clients_in_lobby("<span class='danger'>You were kicked from the lobby by [usr.client.holder.fakekey ? "an Administrator" : "[usr.client.key]"].</span>", afkonly)
Expand Down Expand Up @@ -1683,10 +1686,11 @@
else if(href_list["slowquery"])
if(!check_rights(R_ADMIN))
return

var/answer = href_list["slowquery"]
if(answer == "yes")
log_query_debug("[usr.key] | Reported a server hang")
if(alert(usr, "Had you just press any admin buttons?", "Query server hang report", "Yes", "No") == "Yes")
if(tgui_alert(usr, "Did you just press any admin buttons?", "Query server hang report", list("Yes", "No")) == "Yes")
var/response = input(usr,"What were you just doing?","Query server hang report") as null|text
if(response)
log_query_debug("[usr.key] | [response]")
Expand All @@ -1701,7 +1705,7 @@
else if(href_list["rebootworld"])
if(!check_rights(R_ADMIN))
return
var/confirm = alert("Are you sure you want to reboot the server?", "Confirm Reboot", "Yes", "No")
var/confirm = tgui_alert(usr,"Are you sure you want to reboot the server?", "Confirm Reboot", list("Yes", "No"))
if(confirm != "Yes")
return
restart()
Expand Down Expand Up @@ -1995,9 +1999,9 @@
return

if(SSticker.HasRoundStarted())
return alert(usr, "The game has already started.", null, null, null, null)
return tgui_alert(usr, "The game has already started.")
if(GLOB.master_mode != "secret")
return alert(usr, "The game mode has to be secret!", null, null, null, null)
return tgui_alert(usr, "The game mode has to be secret!")
var/dat = {"<B>What game mode do you want to force secret to be? Use this if you want to change the game mode, but want the players to believe it's secret. This will only work if the current game mode is secret.</B><HR>"}
for(var/mode in config.modes)
dat += {"<A href='?src=[REF(src)];[HrefToken()];f_secret2=[mode]'>[config.mode_names[mode]]</A><br>"}
Expand Down
2 changes: 2 additions & 0 deletions code/modules/admin/verbs/adminjump.dm
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@
to_chat(src, "No areas found.")
return
var/area/A = tgui_input_list(src, "Pick an area", "Send Mob", sorted_areas)
if(isnull(A))
return
if(!istype(A))
return
if(M.forceMove(safepick(get_area_turfs(A))))
Expand Down
7 changes: 5 additions & 2 deletions code/modules/admin/verbs/randomverbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -545,9 +545,12 @@ Traitors and the like can also be revived with the previous role mostly intact.
if(!mob)
return
if(!istype(M))
alert("Cannot revive a ghost")
tgui_alert(usr, "Cannot revive a ghost")
return
M.revive(full_heal = 1, admin_revive = 1)
// We query the admin who sent the adminheal if they are sure
if(tgui_alert(usr, "A full adminheal was called on [src], approve or deny?", "Aheal Query", buttons = list("Approve", "Deny")) != "Approve")
return
M.revive(full_heal = TRUE, admin_revive = TRUE)

log_admin("[key_name(usr)] healed / revived [key_name(M)]")
var/msg = "<span class='danger'>Admin [key_name_admin(usr)] healed / revived [ADMIN_LOOKUPFLW(M)]!</span>"
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@
SEND_SIGNAL(src, COMSIG_LIVING_UPDATE_HEALTH)

//proc used to ressuscitate a mob
/mob/living/proc/revive(full_heal = 0, admin_revive = 0)
/mob/living/proc/revive(full_heal = FALSE, admin_revive = FALSE)
SEND_SIGNAL(src, COMSIG_LIVING_REVIVE, src, full_heal, admin_revive)
if(full_heal)
fully_heal(admin_revive)
Expand Down Expand Up @@ -637,7 +637,7 @@
update_mobility()

//proc used to completely heal a mob.
/mob/living/proc/fully_heal(admin_revive = 0)
/mob/living/proc/fully_heal(admin_revive = FALSE)
restore_blood()
setToxLoss(0, 0) //zero as second argument not automatically call updatehealth().
setOxyLoss(0, 0)
Expand Down

0 comments on commit 162ce22

Please sign in to comment.