so im in the process of redoing a horrible messy admin code file where it has all the different admin powers. the problem is the distribution of the verbs are more or less set in a category and repeatedly copy and pasted for each other type of admin that has those verbs. So example gm1 would have mute gm2 would have a copy paste of the verb mute gm 3 copy and paste of mute etc what is the simplest way to distribute the verbs for each different level of admin without having to have 20 mute verbs and instead just it referencing the 1 mute verb as the source for it. Example: gm 1 2 and 3 have mute and get it from the only mute verb instead of copy and pasting the mute verb code 3 times
1
2
Feb 17 2016, 9:23 am
|
|
For starters, you could use only a single mute verb to handout to GMs, instead of using multiple different copies. Then you could remove the unused versions afterwards.
|
if you change it to be client procs, you can then have the admin checks on client.New() and have it add the verbs to the client's verb list using client.verbs += /client/proc/name.
a verb is just a proc that is automatically added to the verb list, so procs can have set name / set category etc. see https://github.com/tgstation/-tg-station/blob/master/code/ modules/admin/admin_verbs.dm for an example (note, per our copy right license, to use our code in your projects, you MUST make your project open source as well, but you can use it as a design example as long as you don't actually use any of the code) |
If I get what you are saying correctly, you are trying to distribute different verbs for different levels the way I did it was I assigned by path, so for example
var Remember this is just a basic layouts that probably has all kinds of bugs because I did this in like two minutes. |
In response to Lummox JR
|
|
how so?
|
In response to Dragonpearl123
|
|
Things like that are best handled in a configuration file. It's not hard to write something to read such a file (especially with the new text handling routines in 510), and that way your admin system is much, much more flexible.
Various SS13 branches have been doing this sort of thing for a while. |
In response to Lummox JR
|
|
Goodness me, I have much to learn!
|
yeah but say i have a list of admin powers right? i want to be able to pick and choose the verbs so i dont need to have a section for each power.say admin was to have ban unban mute then if moderator needs the mute verb i shouldnt have to make a preset category for what the mod gets by copy and pasting the mute code i just want to be able to take it from the admin section instead
|
In response to Mastergamerxxx
|
|
I'm not sure I follow. But there are lots of ways to categorize admin verbs and levels of admins. Maybe you could describe what sort of system you want.
|
i just wanted a way to give verbs to different levels of admin/gms without having to put a duplicate of a verbs code under each level of admin that i wanted that level to also have. EX: admin and GM1 having mute verb without me having to copy and paste mob/verb/mute() and all the code for both ranks
|
In response to Mastergamerxxx
|
|
I'm pretty sure I just did it up there, although as Lummox JR said 'Hard-coding admin names in the code is a terrible, terrible idea.'
It doesnt have to be under mob/verb/mute() in fact I dont think it should be. it should have its town designated path that way you could just add a certain path so mob/admin/verb/mute() and give all the verbs under admin to someone etc... |
In response to Mastergamerxxx
|
|
How did you do it?
|
its a temporary check system but it does work wonders for the tests i ran with the verb version
mob |
Having separate vars for each GM type isn't really a great way to go. Typically all you'll need are either a GM level (one var), or bitflags defining their powers (also one var).
|
Also, you can just keep the GM verbs under a list for each level and add them when you reach a higher level. What I mean is: you're adding every single verb of the previous GM level and adding new ones on top. You could just do something like GM2_verbs = GM1 + other verbs. Obviously that's just pseudo-code and you need to store verbs granted on each level on a associative list and whatnot.
|
1
2