Skip to content

Commit

Permalink
Rejuvinate and ProccallAlert
Browse files Browse the repository at this point in the history
alert_proccall


x


fix


x
  • Loading branch information
realforest2001 committed Jul 10, 2023
1 parent f49a226 commit 0fb6bf7
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 33 deletions.
3 changes: 3 additions & 0 deletions code/__DEFINES/admin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,6 @@ var/global/list/note_categories = list("Admin", "Merit", "Commanding Officer", "
#define ANTIGRIEF_NEW_PLAYERS 1
/// Enables antigrief entirely: Nobody can activate explosives on the Almayer, unless the ship crashed.
#define ANTIGRIEF_ENABLED 2

/// Proc has been blocked by IsAdminAdvancedProcCall()
#define PROC_BLOCKED "PROCCALL BLOCKED"
1 change: 0 additions & 1 deletion code/__HELPERS/type2type.dm
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@
if(rights & R_POSSESS) . += "[seperator]+POSSESS"
if(rights & R_PERMISSIONS) . += "[seperator]+PERMISSIONS"
if(rights & R_STEALTH) . += "[seperator]+STEALTH"
if(rights & R_REJUVINATE) . += "[seperator]+REJUVINATE"
if(rights & R_COLOR) . += "[seperator]+COLOR"
if(rights & R_VAREDIT) . += "[seperator]+VAREDIT"
if(rights & R_SOUNDS) . += "[seperator]+SOUND"
Expand Down
1 change: 0 additions & 1 deletion code/_globalvars/bitfields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ DEFINE_BITFIELD(rights, list(
"POSSESS" = R_POSSESS,
"PERMISSIONS" = R_PERMISSIONS,
"STEALTH" = R_STEALTH,
"REJUVENATE" = R_REJUVINATE,
"COLOR" = R_COLOR,
"VAREDIT" = R_VAREDIT,
"SOUNDS" = R_SOUNDS,
Expand Down
12 changes: 8 additions & 4 deletions code/controllers/configuration/configuration.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@

/datum/controller/configuration/proc/admin_reload()
if(IsAdminAdvancedProcCall())
return
alert_proccall("configuration admin_reload")
return PROC_BLOCKED
log_admin("[key_name(usr)] has forcefully reloaded the configuration from disk.")
message_admins("[key_name_admin(usr)] has forcefully reloaded the configuration from disk.")
full_wipe()
Expand All @@ -33,7 +34,8 @@

/datum/controller/configuration/proc/Load(_directory)
if(IsAdminAdvancedProcCall()) //If admin proccall is detected down the line it will horribly break everything.
return
alert_proccall("configuration Load")
return PROC_BLOCKED
if(_directory)
directory = _directory
if(entries)
Expand Down Expand Up @@ -117,7 +119,8 @@

/datum/controller/configuration/proc/full_wipe()
if(IsAdminAdvancedProcCall())
return
alert_proccall("configuration full_wipe")
return PROC_BLOCKED
entries_by_type.Cut()
QDEL_LIST_ASSOC_VAL(entries)
entries = null
Expand Down Expand Up @@ -163,7 +166,8 @@

/datum/controller/configuration/proc/LoadEntries(filename, list/stack = list())
if(IsAdminAdvancedProcCall())
return
alert_proccall("configuration LoadEntries")
return PROC_BLOCKED

var/filename_to_test = world.system_type == MS_WINDOWS ? lowertext(filename) : filename
if(filename_to_test in stack)
Expand Down
23 changes: 11 additions & 12 deletions code/global.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,19 @@
#define R_POSSESS (1<<5)
#define R_PERMISSIONS (1<<6)
#define R_STEALTH (1<<7)
#define R_REJUVINATE (1<<8)
#define R_COLOR (1<<9)
#define R_VAREDIT (1<<10)
#define R_SOUNDS (1<<11)
#define R_SPAWN (1<<12)
#define R_MOD (1<<13)
#define R_MENTOR (1<<14)
#define R_HOST (1<<15)
#define R_PROFILER (1<<16)
#define R_NOLOCK (1<<17)
#define R_EVENT (1<<18)
#define R_COLOR (1<<8)
#define R_VAREDIT (1<<9)
#define R_SOUNDS (1<<10)
#define R_SPAWN (1<<11)
#define R_MOD (1<<12)
#define R_MENTOR (1<<13)
#define R_HOST (1<<14)
#define R_PROFILER (1<<15)
#define R_NOLOCK (1<<16)
#define R_EVENT (1<<17)

/// The sum of all other rank permissions, other than host or profiler.
#define RL_EVERYTHING (R_BUILDMODE|R_ADMIN|R_BAN|R_SERVER|R_DEBUG|R_PERMISSIONS|R_POSSESS|R_STEALTH|R_REJUVINATE|R_COLOR|R_VAREDIT|R_EVENT|R_SOUNDS|R_NOLOCK|R_SPAWN|R_MOD|R_MENTOR)
#define RL_EVERYTHING (R_BUILDMODE|R_ADMIN|R_BAN|R_SERVER|R_DEBUG|R_PERMISSIONS|R_POSSESS|R_STEALTH|R_COLOR|R_VAREDIT|R_EVENT|R_SOUNDS|R_NOLOCK|R_SPAWN|R_MOD|R_MENTOR)
/// Truely everything
#define RL_HOST (RL_EVERYTHING|R_HOST|R_PROFILER)
// 512.1430 increases maximum bit flags from 16 to 24, so the following flags should be available for future changes:
Expand Down
3 changes: 3 additions & 0 deletions code/modules/admin/NewBan.dm
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ var/savefile/Banlist
RemoveBan(A)

/client/proc/cmd_admin_do_ban(mob/M)
if(IsAdminAdvancedProcCall())
alert_proccall("cmd_admin_do_ban")
return PROC_BLOCKED
if(!check_rights(R_BAN|R_MOD)) return

if(!ismob(M)) return
Expand Down
1 change: 0 additions & 1 deletion code/modules/admin/admin_ranks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ var/list/admin_ranks = list() //list of all ranks with associated rights
if("permissions","rights") rights |= R_PERMISSIONS
if("possess") rights |= R_POSSESS
if("stealth") rights |= R_STEALTH
if("rejuv","rejuvinate") rights |= R_REJUVINATE
if("color") rights |= R_COLOR
if("varedit") rights |= R_VAREDIT
if("event") rights |= R_EVENT
Expand Down
10 changes: 8 additions & 2 deletions code/modules/admin/callproc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ GLOBAL_PROTECT(LastAdminCalledProc)
*/
/proc/HandleUserlessProcCall(user, datum/target, procname, list/arguments)
if(IsAdminAdvancedProcCall())
return
alert_proccall("HandleUserlessProcCall")
return PROC_BLOCKED
var/mob/proccall_handler/handler = GLOB.AdminProcCallHandler
handler.add_caller(user)
var/lastusr = usr
Expand All @@ -90,7 +91,8 @@ GLOBAL_PROTECT(LastAdminCalledProc)
*/
/proc/HandleUserlessSDQL(user, query_text)
if(IsAdminAdvancedProcCall())
return
alert_proccall("HandleUserlessSDQL")
return PROC_BLOCKED

var/mob/proccall_handler/handler = GLOB.AdminProcCallHandler
handler.add_caller(user)
Expand Down Expand Up @@ -224,6 +226,10 @@ GLOBAL_PROTECT(LastAdminCalledProc)
/proc/IsAdminAdvancedProcCall()
return (GLOB.AdminProcCaller && GLOB.AdminProcCaller == usr?.client?.ckey) || (GLOB.AdminProcCallHandler && usr == GLOB.AdminProcCallHandler)

/proc/alert_proccall(procname = "Unknown")
to_chat(usr, SPAN_BOLDWARNING("Warning: Force attempt has been logged."))
message_admins("[key_name(usr)] has attempted to execute a restricted proc. ([procname])")

/client/proc/callproc_datum(datum/called_datum as null|area|mob|obj|turf)
set category = "Debug"
set name = "Datum ProcCall"
Expand Down
7 changes: 5 additions & 2 deletions code/modules/admin/holder2.dm
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,18 @@ you will have to do something like if(client.admin_holder.rights & R_ADMIN) your
return 0

/client/proc/deadmin()
if(IsAdminAdvancedProcCall())
alert_proccall("deadmin")
return PROC_BLOCKED
if(admin_holder)
admin_holder.disassociate()
QDEL_NULL(admin_holder)
return 1
return TRUE

/client/proc/readmin()
if(admin_datums[ckey])
admin_datums[ckey].associate(src)
return 1
return TRUE

/datum/admins/proc/check_for_rights(rights_required)
if(rights_required && !(rights_required & rights))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/topic/topic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@
message_admins("[key_name_admin(usr)] has sent [key_name_admin(M)] to the thunderdome. (Observer.)", 1)

else if(href_list["revive"])
if(!check_rights(R_REJUVINATE)) return
if(!check_rights(R_MOD)) return

var/mob/living/L = locate(href_list["revive"])
if(!istype(L))
Expand Down
3 changes: 2 additions & 1 deletion code/modules/client/client_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,8 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list(
*/
/client/proc/init_verbs()
if(IsAdminAdvancedProcCall())
return
alert_proccall("init_verbs")
return PROC_BLOCKED
var/list/verblist = list()
var/list/verbstoprocess = verbs.Copy()
if(mob)
Expand Down
15 changes: 7 additions & 8 deletions config/example/admin_ranks.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
# +BAN = the ability to ban, jobban and fullban
# +STEALTH = the ability to stealthmin (make yourself appear with a fake name to everyone but other admins
# +POSSESS = the ability to possess objects
# +REJUV (or +REJUVINATE) = the ability to heal, respawn, modify damage and use godmode
# +COLOR = the ability to use the OOC > "Set OOC Color - Self" verb
# +BUILD (or +BUILDMODE) = the ability to use buildmode
# +SERVER = higher-risk admin verbs and abilities, such as those which affect the server configuration.
Expand All @@ -36,16 +35,16 @@ Mentor +MENTOR +COLOR


Trial Moderator +MOD +SERVER +COLOR
Moderator +MOD +SERVER +BAN +REJUV +COLOR +NOLOCK
Trial Admin +ADMIN +MOD +SERVER +BAN +REJUV +SPAWN +STEALTH +VAREDIT +COLOR
Admin +ADMIN +MOD +SERVER +BAN +REJUV +SPAWN +STEALTH +VAREDIT +POSSESS +SOUND +COLOR +BUILDMODE
Moderator +MOD +SERVER +BAN +COLOR +NOLOCK
Trial Admin +ADMIN +MOD +SERVER +BAN +SPAWN +STEALTH +VAREDIT +COLOR
Admin +ADMIN +MOD +SERVER +BAN +SPAWN +STEALTH +VAREDIT +POSSESS +SOUND +COLOR +BUILDMODE


Coder +MOD +SERVER +BAN +VAREDIT +SPAWN +DEBUG +COLOR
Mapper +MOD +VAREDIT +COLOR +BUILDMODE +SPAWN
Spriter +MOD +VAREDIT +SPAWN +COLOR
Developer +ADMIN +MOD +SERVER +BAN +VAREDIT +SPAWN +DEBUG +REJUV +POSSESS +BUILDMODE +SOUND +COLOR
Lead Spriter +ADMIN +MOD +SERVER +REJUV +VAREDIT +BUILDMODE +SPAWN +DEBUG +COLOR
Developer +ADMIN +MOD +SERVER +BAN +VAREDIT +SPAWN +DEBUG +POSSESS +BUILDMODE +SOUND +COLOR
Lead Spriter +ADMIN +MOD +SERVER +VAREDIT +BUILDMODE +SPAWN +DEBUG +COLOR


Host +EVERYTHING
Expand All @@ -55,6 +54,6 @@ Head Dev +EVERYTHING


Legacy Mentor +MENTOR +COLOR
Senior Moderator +ADMIN +MOD +SERVER +BAN +REJUV +SPAWN +STEALTH +VAREDIT +POSSESS +SOUND +COLOR +BUILDMODE
Senior Admin +ADMIN +MOD +SERVER +BAN +REJUV +SPAWN +STEALTH +VAREDIT +POSSESS +SOUND +COLOR +BUILDMODE +DEBUG
Senior Moderator +ADMIN +MOD +SERVER +BAN +SPAWN +STEALTH +VAREDIT +POSSESS +SOUND +COLOR +BUILDMODE
Senior Admin +ADMIN +MOD +SERVER +BAN +SPAWN +STEALTH +VAREDIT +POSSESS +SOUND +COLOR +BUILDMODE +DEBUG

0 comments on commit 0fb6bf7

Please sign in to comment.