Files
vgstation13/code/modules/admin/holder2.dm
Cael_Aislinn aae42d928a Merge branch 'incremental_tg' r5200 into bs12_with_tgport
Conflicts:
	baystation12.dme
	code/__HELPERS/global_lists.dm
	code/__HELPERS/type2type.dm
	code/__HELPERS/unsorted.dm
	code/datums/datumvars.dm
	code/datums/disease.dm
	code/datums/organs/organ_external.dm
	code/datums/supplypacks.dm
	code/defines/obj.dm
	code/game/area/areas.dm
	code/game/atoms.dm
	code/game/gamemodes/cult/cult_structures.dm
	code/game/gamemodes/cult/runes.dm
	code/game/gamemodes/events.dm
	code/game/gamemodes/events/ninja_equipment.dm
	code/game/gamemodes/events/space_ninja.dm
	code/game/gamemodes/game_mode.dm
	code/game/gamemodes/gameticker.dm
	code/game/hud.dm
	code/game/jobs/access.dm
	code/game/jobs/job/civilian.dm
	code/game/machinery/alarm.dm
	code/game/machinery/cloning.dm
	code/game/machinery/computer/cloning.dm
	code/game/machinery/computer/medical.dm
	code/game/machinery/computer/syndicate_shuttle.dm
	code/game/machinery/telecomms/broadcaster.dm
	code/game/machinery/telecomms/machine_interactions.dm
	code/game/objects/effects/decals/contraband.dm
	code/game/objects/effects/signs.dm
	code/game/objects/items/devices/PDA/PDA.dm
	code/game/objects/items/devices/PDA/cart.dm
	code/game/objects/items/weapons/photography.dm
	code/game/objects/structures/door_assembly.dm
	code/game/objects/structures/window.dm
	code/game/sound.dm
	code/game/verbs/ooc.dm
	code/global.dm
	code/modules/DetectiveWork/detective_work.dm
	code/modules/DetectiveWork/evidence.dm
	code/modules/DetectiveWork/footprints_and_rag.dm
	code/modules/DetectiveWork/scanner.dm
	code/modules/admin/player_panel.dm
	code/modules/admin/verbs/adminhelp.dm
	code/modules/admin/verbs/adminpm.dm
	code/modules/awaymissions/gateway.dm
	code/modules/client/client defines.dm
	code/modules/client/client procs.dm
	code/modules/client/preferences.dm
	code/modules/clothing/spacesuits/rig.dm
	code/modules/mining/machine_processing.dm
	code/modules/mining/machine_stacking.dm
	code/modules/mining/mint.dm
	code/modules/mining/ores_coins.dm
	code/modules/mining/satchel_ore_boxdm.dm
	code/modules/mob/living/carbon/alien/alien.dm
	code/modules/mob/living/carbon/carbon.dm
	code/modules/mob/living/carbon/carbon_defines.dm
	code/modules/mob/living/carbon/human/human_damage.dm
	code/modules/mob/living/carbon/human/life.dm
	code/modules/mob/living/carbon/human/update_icons.dm
	code/modules/mob/living/living.dm
	code/modules/mob/living/say.dm
	code/modules/mob/mob.dm
	code/modules/mob/mob_cleanup.dm
	code/modules/mob/mob_defines.dm
	code/modules/mob/mob_transformation_simple.dm
	code/modules/mob/new_player/login.dm
	code/modules/mob/new_player/new_player.dm
	code/modules/mob/new_player/preferences_setup.dm
	code/modules/mob/new_player/savefile.dm
	code/modules/mob/new_player/sprite_accessories.dm
	code/modules/paperwork/folders.dm
	code/modules/paperwork/paper.dm
	code/modules/paperwork/photocopier.dm
	code/modules/projectiles/guns/energy/special.dm
	code/modules/projectiles/guns/projectile/automatic.dm
	code/setup.dm
	code/unused/mining/datum_processing_recipe.dm
	code/unused/powerarmor/powerarmor.dm
	code/world.dm
	html/changelog.html
	icons/effects/96x96.dmi
	icons/mob/head.dmi
	icons/mob/items_lefthand.dmi
	icons/mob/items_righthand.dmi
	icons/mob/suit.dmi
	icons/obj/clothing/hats.dmi
	icons/obj/clothing/suits.dmi
	icons/obj/hydroponics.dmi
	icons/obj/items.dmi
	icons/turf/areas.dmi
	icons/turf/walls.dmi
	maps/RandomZLevels/fileList.txt
	maps/RandomZLevels/spacebattle.dmm

Signed-off-by: Cael_Aislinn <cael_aislinn@yahoo.com.au>
2013-01-07 00:23:22 +10:00

90 lines
2.9 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/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
/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")
del(src)
return
admincaster_signature = "Nanotrasen Officer #[rand(0,9)][rand(0,9)][rand(0,9)]"
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.holder = null
owner = null
/*
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! not src! So if you're checking somebody's rank in a proc which they did not call
you will have to do something like if(client.rights & R_ADMIN) yourself.
*/
/proc/check_rights(rights_required, show_msg=1)
if(usr && usr.client)
if(rights_required)
if(usr.client.holder)
if(rights_required & usr.client.holder.rights)
return 1
else
if(show_msg)
usr << "<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(usr.client.holder)
return 1
else
if(show_msg)
usr << "<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()
admin_datums -= ckey
if(holder)
holder.disassociate()
del(holder)
return 1