Author Topic: Destiny's Restricted Events ported for Nullable's Permissions mod  (Read 3361 times)

This mod allows people to set event restrictions on roles or even individual people via Permissions.

Since Destiny hasn't been working on this mod since 2010, I think I am allowed to do a Permissions port of it.

RTB is no longer required for this port, and it is sort of more efficient than the other one.

Permissions is required for this. All events default to having everyone's ability to use them, unless changed for a role via the Permissions GUI.

Question 1: Help, I can't find the permission for this event!
Answer 1: This is an add-on limitation where the default events are executed before this add-on can override event addition.
First, wrench a brick and apply the output event that you want to use "onActivate -> self -> radiusImpulse". Click "Apply", and the event permission should be on the Permissions GUI (the permission for "radiusImpulse" should look like "Use Event radiusImpulse (useEvent.radiusImpulse)".

Question 2: I don't have RTB, how will I be able to enable/disable event restrictions.
Answer 2: $RestrictedEvents::Restrict is the answer. Set it to "true" or "1" on the server console to enable ("false" or "0" to disable), or on line 14 of the add-on file itself.

Download
« Last Edit: February 26, 2013, 09:44:19 PM by Axolotl2 »

so you talked about credits, requirements and issues people might run into

well that's great and all
but uh

it could use an actual description

Answer 1: This is an add-on limitation where the default events are executed before this add-on can override event addition.
Call it zzz_restrictedevents.zip

Call it zzz_restrictedevents.zip
I will do that.

EDIT: Did it, except with ZZZServer instead of ZZZ.
« Last Edit: December 27, 2012, 04:54:06 PM by Axolotl2 »

I didn't do an underscore replace thing, so it'll be done in the next version.

Nullable's Permissions Mod doesn't accept underscores on permission nor role names, causing a false error to come up on clients when they use VCE events.

Ugh, don't put the ZZZ before the name. You just need to work on the code a bit.

Here, replace this:
Code: [Select]
function registerOutputEvent(%class, %name, %parameterList, %appendClient)
{
if(!isObject(getPermissionManager().getPermission("useEvent." @ %name)))
getPermissionManager().registerPermission("Use Event" SPC %name, "useEvent." @ %name, 0);
parent::registerOutputEvent(%class, %name, %parameterList, %appendClient);
}

with this:
Code: [Select]
function onMissionLoaded()
{
%parent = parent::onMissionLoaded();
schedule(50,0,"permMan_getOutputEvents");
return %parent;
}

function permMan_getOutputEvents()
{
%iCount = getFieldCount($OutputEvent_ClassList);
for(%i = 0; %i < %iCount; %i ++) //LOOP THROUGH EVERY OUTPUT EVENT CLASS
{
%class = getField($OutputEvent_ClassList,%i);
for(%e = 0; %e < $OutputEvent_Count[%class]; %e ++) //LOOP THROUGH OUTPUT EVENTS FOR THAT CLASS
{
%eventName = $OutputEvent_Name[%class,%e];
if(!isObject(getPermissionManager().getPermission("useEvent." @ %eventName)))
getPermissionManager().registerPermission("Use Event" SPC %eventName, "useEvent." @ %eventName, 0);
}
}
}

I didn't test it, but that should work.
« Last Edit: February 24, 2013, 05:26:35 PM by Greek2me »

Ugh, don't put the ZZZ before the name. You just need to work on the code a bit.

Here, replace this:
Code: [Select]
function registerOutputEvent(%class, %name, %parameterList, %appendClient)
{
if(!isObject(getPermissionManager().getPermission("useEvent." @ %name)))
getPermissionManager().registerPermission("Use Event" SPC %name, "useEvent." @ %name, 0);
parent::registerOutputEvent(%class, %name, %parameterList, %appendClient);
}

with this:
Code: [Select]
function onMissionLoaded()
{
schedule(50,0,"permMan_getOutputEvents");
}

function permMan_getOutputEvents()
{
%iCount = getFieldCount($OutputEvent_ClassList);
for(%i = 0; %i < %iCount; %i ++) //LOOP THROUGH EVERY OUTPUT EVENT CLASS
{
%class = getField($OutputEvent_ClassList,%i);
for(%e = 0; %e < $OutputEvent_Count[%class]; %e ++) //LOOP THROUGH OUTPUT EVENTS FOR THAT CLASS
{
%eventName = $OutputEvent_Name[%class,%e];
if(!isObject(getPermissionManager().getPermission("useEvent." @ %eventName)))
getPermissionManager().registerPermission("Use Event" SPC %eventName, "useEvent." @ %eventName, 0);
}
}
}

I didn't test it, but that should work.
You're awesome, and I'll test it soon.

Though, shouldn't onMissionLoaded be parented?
« Last Edit: February 24, 2013, 05:17:46 PM by Axolotl2 »


Fixed the things that I needed to fix.

Also, when z0w0 says it's OK, I'll post it on RTB.

Wait, what if for example there is a Client event and a Minigame event called "blah"? How do you know which is which?

Wait, what if for example there is a Client event and a Minigame event called "blah"? How do you know which is which?
Not sure how to do that, and I was thinking about that scenario.

The default PermissionsMod GUI has tiny columns which present a problem in seperating different parts. In fact, some parts of it are already crammed.

Not sure how to do that, and I was thinking about that scenario.

The default PermissionsMod GUI has tiny columns which present a problem in seperating different parts. In fact, some parts of it are already crammed.
Hi. As I've said countless times before, the Permissions GUI is currently quite terrible, and if anyone is up for making a new one, please contact me ASAP. That said, (even) thanks for the point about the underscores, I'll add that to the whitelist tomorrow.
« Last Edit: February 26, 2013, 08:16:39 PM by DontCare4Free »

The Permissions GUI is currently quite terrible, and if anyone is up for making a new one, please contact me ASAP.

I'd make one if I actually had the time (okay, I definitely have time, but I just never get around to it).