mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-01-02 13:32:32 +00:00
Code clean up, makes use of states PROPERLY (#12831)
* Code clean up, makes use of states PROPERLY * I forgot how to new * Fix * Changelog * 7th vueui arg is data. * Adds check if topic is proxied by vueui * Admin topic state refactor Co-authored-by: Werner <1331699+Arrow768@users.noreply.github.com>
This commit is contained in:
@@ -1,7 +1,18 @@
|
||||
/*
|
||||
This state checks that the user is an admin, end of story
|
||||
*/
|
||||
/var/global/datum/topic_state/admin_state/admin_state = new()
|
||||
/var/global/datum/topic_state/staff_state/admin_state = new(R_ADMIN)
|
||||
/var/global/datum/topic_state/staff_state/moderator_state = new(R_MOD)
|
||||
/var/global/datum/topic_state/staff_state/staff_state = new()
|
||||
|
||||
/datum/topic_state/admin_state/can_use_topic(var/src_object, var/mob/user)
|
||||
return check_rights(R_ADMIN, 0, user) ? STATUS_INTERACTIVE : STATUS_CLOSE
|
||||
/datum/topic_state/staff_state
|
||||
var/rigths_to_check = null
|
||||
|
||||
/datum/topic_state/staff_state/New(var/new_rigths = null)
|
||||
if(new_rigths)
|
||||
rigths_to_check = new_rigths
|
||||
|
||||
/datum/topic_state/staff_state/can_use_topic(var/src_object, var/mob/user)
|
||||
if(rigths_to_check == null)
|
||||
return user.client.holder ? STATUS_INTERACTIVE : STATUS_CLOSE
|
||||
return (user.client.holder && check_rights(rigths_to_check, 0, user)) ? STATUS_INTERACTIVE : STATUS_CLOSE
|
||||
|
||||
Reference in New Issue
Block a user