[MAJOR CHANGE] Admin rank datum (#17133)

* Admin ranks update

* Permissions fix

* One missing thing

* Further rework to make database also fully work

* Adds admin rank bitflag calculator to tools

* ZA WARUDO

---------

Co-authored-by: C.L. <killer65311@gmail.com>
This commit is contained in:
Selis
2025-03-06 01:38:19 +01:00
committed by GitHub
parent caec59322e
commit 7a7ae89713
88 changed files with 1993 additions and 904 deletions
+4 -4
View File
@@ -148,7 +148,7 @@
visualnet = ghostnet
/mob/observer/dead/proc/checkStatic()
return !(check_rights(R_ADMIN|R_FUN|R_EVENT|R_SERVER, 0, src) || (client && client.buildmode) || isbelly(loc))
return !(check_rights_for(src.client, R_ADMIN|R_FUN|R_EVENT|R_SERVER) || (client && client.buildmode) || isbelly(loc))
/mob/observer/dead/Moved(atom/old_loc, direction, forced)
. = ..()
@@ -260,7 +260,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
announce_ghost_joinleave(ghostize(1))
else
var/response
if(check_rights(R_ADMIN|R_SERVER|R_MOD,FALSE,src)) //No need to sanity check for client and holder here as that is part of check_rights
if(check_rights_for(src.client, R_ADMIN|R_SERVER|R_MOD)) //No need to sanity check for client and holder here as that is part of check_rights
response = tgui_alert(src, "You have the ability to Admin-Ghost. The regular Ghost verb will announce your presence to dead chat. Both variants will allow you to return to your body using 'aghost'.\n\nWhat do you wish to do?", "Are you sure you want to ghost?", list("Admin Ghost", "Ghost", "Stay in body"))
if(response == "Admin Ghost")
if(!src.client)
@@ -604,7 +604,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
return 0
/mob/observer/dead/check_holy(var/turf/T)
if(check_rights(R_ADMIN|R_FUN|R_EVENT, 0, src))
if(check_rights_for(src.client, R_ADMIN|R_FUN|R_EVENT))
return 0
return (T && T.holy) && (is_manifest || (mind in cult.current_antagonists))
@@ -914,7 +914,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
return 1
/mob/observer/dead/proc/can_admin_interact()
return check_rights(R_ADMIN|R_EVENT, 0, src)
return check_rights_for(src.client, R_ADMIN|R_EVENT|R_DEBUG)
/mob/observer/dead/verb/toggle_ghostsee()
set name = "Toggle Ghost Vision"
@@ -6,7 +6,7 @@
/mob/living/carbon/alien/diona/confirm_evolution()
if(!is_alien_whitelisted(src, GLOB.all_species[SPECIES_DIONA]))
if(!is_alien_whitelisted(src.client, GLOB.all_species[SPECIES_DIONA]))
tgui_alert(src, "You are currently not whitelisted to play as a full diona.")
return null
@@ -180,14 +180,14 @@
for(var/current_species_name in GLOB.all_species)
var/datum/species/current_species = GLOB.all_species[current_species_name]
if(check_whitelist && CONFIG_GET(flag/usealienwhitelist) && !check_rights(R_ADMIN|R_EVENT, 0, src)) //If we're using the whitelist, make sure to check it!
if(check_whitelist && CONFIG_GET(flag/usealienwhitelist) && !check_rights_for(src.client, R_ADMIN|R_EVENT)) //If we're using the whitelist, make sure to check it!
if(!(current_species.spawn_flags & SPECIES_CAN_JOIN))
continue
if(whitelist.len && !(current_species_name in whitelist))
continue
if(blacklist.len && (current_species_name in blacklist))
continue
if((current_species.spawn_flags & SPECIES_IS_WHITELISTED) && !is_alien_whitelisted(src, current_species))
if((current_species.spawn_flags & SPECIES_IS_WHITELISTED) && !is_alien_whitelisted(src.client, current_species))
continue
valid_species += current_species_name
+1
View File
@@ -81,3 +81,4 @@
client.images += cloaked_selfimage
client.init_verbs()
SEND_SIGNAL(src, COMSIG_MOB_CLIENT_LOGIN, client)
SEND_SIGNAL(client, COMSIG_CLIENT_MOB_LOGIN, src)
+2 -2
View File
@@ -5,7 +5,7 @@
update_client_z(null)
log_access_out(src)
unset_machine()
if(admin_datums[src.ckey])
if(GLOB.admin_datums[src.ckey])
if (ticker && ticker.current_state == GAME_STATE_PLAYING) //Only report this stuff if we are currently playing.
var/admins_number = GLOB.admins.len
@@ -14,4 +14,4 @@
send2adminirc("[key_name(src)] logged out - no more admins online.")
..()
return 1
return 1
+1 -1
View File
@@ -467,7 +467,7 @@
set category = "OOC.Game"
var/is_admin = 0
if(client.holder && (client.holder.rights & R_ADMIN|R_EVENT))
if(check_rights_for(client, R_ADMIN|R_EVENT))
is_admin = 1
else if(stat != DEAD || isnewplayer(src))
to_chat(src, span_filter_notice("[span_blue("You must be observing to use this!")]"))
+3 -3
View File
@@ -83,7 +83,7 @@
/proc/is_admin(var/mob/user)
return check_rights(R_ADMIN|R_EVENT, 0, user) != 0
return check_rights_for(user.client, R_ADMIN|R_EVENT) != 0
/**
* Moved into its own file as part of port from CHOMP.
@@ -404,7 +404,7 @@ var/list/intents = list(I_HELP,I_DISARM,I_GRAB,I_HURT)
return // Can't talk in deadchat if you can't see it.
for(var/mob/M in player_list)
if(M.client && ((!isnewplayer(M) && M.stat == DEAD) || (M.client.holder && M.client.holder.rights && M.client?.prefs?.read_preference(/datum/preference/toggle/holder/show_staff_dsay))) && M.client?.prefs?.read_preference(/datum/preference/toggle/show_dsay))
if(M.client && ((!isnewplayer(M) && M.stat == DEAD) || (M.client.holder && check_rights_for(M.client, R_NONE) && M.client?.prefs?.read_preference(/datum/preference/toggle/holder/show_staff_dsay))) && M.client?.prefs?.read_preference(/datum/preference/toggle/show_dsay))
var/follow
var/lname
if(M.forbid_seeing_deadchat && !M.client.holder)
@@ -434,7 +434,7 @@ var/list/intents = list(I_HELP,I_DISARM,I_GRAB,I_HURT)
/proc/say_dead_object(var/message, var/obj/subject = null)
for(var/mob/M in player_list)
if(M.client && ((!isnewplayer(M) && M.stat == DEAD) || (M.client.holder && M.client.holder.rights && M.client?.prefs?.read_preference(/datum/preference/toggle/holder/show_staff_dsay))) && M.client?.prefs?.read_preference(/datum/preference/toggle/show_dsay))
if(M.client && ((!isnewplayer(M) && M.stat == DEAD) || (M.client.holder && check_rights_for(M.client, R_NONE) && M.client?.prefs?.read_preference(/datum/preference/toggle/holder/show_staff_dsay))) && M.client?.prefs?.read_preference(/datum/preference/toggle/show_dsay))
var/follow
var/lname = "Game Master"
if(M.forbid_seeing_deadchat && !M.client.holder)
+2 -5
View File
@@ -524,7 +524,7 @@
if(chosen_species && use_species_name)
// Have to recheck admin due to no usr at roundstart. Latejoins are fine though.
if(is_alien_whitelisted(chosen_species))
if(is_alien_whitelisted(src.client, chosen_species))
new_character = new(T, use_species_name)
if(!new_character)
@@ -600,9 +600,6 @@
src << browse(null, "window=News") //closes news window
panel.close()
/mob/new_player/proc/has_admin_rights()
return check_rights(R_ADMIN, 0, src)
/mob/new_player/get_species()
var/datum/species/chosen_species
if(client.prefs.species)
@@ -611,7 +608,7 @@
if(!chosen_species)
return SPECIES_HUMAN
if(is_alien_whitelisted(chosen_species))
if(is_alien_whitelisted(src.client, chosen_species))
return chosen_species.name
return SPECIES_HUMAN
+1 -1
View File
@@ -27,7 +27,7 @@
to_chat(src,span_warning("You have not set your scale yet. Do this on the VORE tab in character setup."))
//Can they play?
if(!is_alien_whitelisted(src,GLOB.all_species[client?.prefs?.species]) && !check_rights(R_ADMIN, 0))
if(!is_alien_whitelisted(src.client,GLOB.all_species[client?.prefs?.species]) && !check_rights(R_ADMIN, 0))
pass = FALSE
to_chat(src,span_warning("You are not allowed to spawn in as this species."))
+3 -3
View File
@@ -398,7 +398,7 @@
var/adminrank = "Player"
if(usr && usr.client && usr.client.holder)
adminrank = usr.client.holder.rank
adminrank = usr.client.holder.rank_names()
var/datum/db_query/insert_query = SSdbcore.NewQuery("INSERT INTO erro_poll_vote (id ,datetime ,pollid ,optionid ,ckey ,ip ,adminrank) VALUES (null, Now(), [pollid], [optionid], '[usr.ckey]', '[usr.client.address]', '[adminrank]')")
@@ -449,7 +449,7 @@
var/adminrank = "Player"
if(usr && usr.client && usr.client.holder)
adminrank = usr.client.holder.rank
adminrank = usr.client.holder.rank_names()
replytext = replacetext(replytext, "%BR%", "")
@@ -522,7 +522,7 @@
var/adminrank = "Player"
if(usr && usr.client && usr.client.holder)
adminrank = usr.client.holder.rank
adminrank = usr.client.holder.rank_names()
var/datum/db_query/insert_query = SSdbcore.NewQuery("INSERT INTO erro_poll_vote (id ,datetime ,pollid ,optionid ,ckey ,ip ,adminrank, rating) VALUES (null, Now(), [pollid], [optionid], '[usr.ckey]', '[usr.client.address]', '[adminrank]', [(isnull(rating)) ? "null" : rating])")