Files
Aurora.3/code/modules/admin/holder2.dm
Lohikar 61b5203d24 Runtime Map Loading (#3597)
changes:

Maps are no longer compiled in, instead loaded directly from the DMMs at runtime.
Z level defines have been moved from the config to map datums.
Unit tests now use typecaches.
DMMS now actually works.
DMMS has been updated slightly.
DMMS is now capable of loading simple lists of non-text types.
DMMS is now faster when loading many types without mapped in attributes and when loading area instances.
Asteroid generation is now defined on the map datum instead of being hard-coded in SSasteroid.
Holodeck presets are now defined on the map datum.
Atmos machinery now uses Initialize().
2017-10-18 23:07:34 +03:00

108 lines
3.3 KiB
Plaintext

var/list/admin_datums = list()
/datum/admins
var/rank = "Temporary Admin"
var/client/owner = null
var/rights = 0
var/fakekey = null
var/datum/marked_datum
var/mob/living/original_mob = null
var/admincaster_screen = 0 //See newscaster.dm under machinery for a full description
var/datum/feed_message/admincaster_feed_message = new /datum/feed_message //These two will act as holders.
var/datum/feed_channel/admincaster_feed_channel = new /datum/feed_channel
var/admincaster_signature //What you'll sign the newsfeeds as
var/list/watched_processes // Processes marked to be shown in Status instead of just Processes.
/datum/admins/New(initial_rank = "Temporary Admin", initial_rights = 0, ckey)
if(!ckey)
error("Admin datum created without a ckey argument. Datum has been deleted")
qdel(src)
return
if (!current_map)
SSatlas.OnMapload(CALLBACK(src, .proc/update_newscaster_sig))
else
update_newscaster_sig()
rank = initial_rank
rights = initial_rights
admin_datums[ckey] = src
/datum/admins/proc/associate(client/C)
if(istype(C))
owner = C
owner.holder = src
owner.add_admin_verbs() //TODO
admins |= C
/datum/admins/proc/disassociate()
if(owner)
admins -= owner
owner.remove_admin_verbs()
owner.deadmin_holder = owner.holder
owner.holder = null
/datum/admins/proc/reassociate()
if(owner)
admins += owner
owner.holder = src
owner.deadmin_holder = null
owner.add_admin_verbs()
/datum/admins/proc/update_newscaster_sig()
if (!admincaster_signature)
admincaster_signature = "[current_map.company_name] Officer #[rand(0,9)][rand(0,9)][rand(0,9)]"
/*
checks if usr is an admin with at least ONE of the flags in rights_required. (Note, they don't need all the flags)
if rights_required == 0, then it simply checks if they are an admin.
if it doesn't return 1 and show_msg=1 it will prints a message explaining why the check has failed
generally it would be used like so:
proc/admin_proc()
if(!check_rights(R_ADMIN)) return
world << "you have enough rights!"
NOTE: It checks usr by default. Supply the "user" argument if you wish to check for a specific mob.
*/
/proc/check_rights(rights_required, show_msg=1, var/mob/user = usr)
if(user && user.client)
if(rights_required)
if(user.client.holder)
if(rights_required & user.client.holder.rights)
return 1
else
if(show_msg)
user << "<font color='red'>Error: You do not have sufficient rights to do that. You require one of the following flags:[rights2text(rights_required," ")].</font>"
else
if(user.client.holder)
return 1
else
if(show_msg)
user << "<font color='red'>Error: You are not an admin.</font>"
return 0
//probably a bit iffy - will hopefully figure out a better solution
/proc/check_if_greater_rights_than(client/other)
if(usr && usr.client)
if(usr.client.holder)
if(!other || !other.holder)
return 1
if(usr.client.holder.rights != other.holder.rights)
if( (usr.client.holder.rights & other.holder.rights) == other.holder.rights )
return 1 //we have all the rights they have and more
usr << "<font color='red'>Error: Cannot proceed. They have more or equal rights to us.</font>"
return 0
/client/proc/deadmin()
if(holder)
holder.disassociate()
//qdel(holder)
return 1