Pottus / Texture-Studio

86 stars 90 forks source link

Restrict groups from being edited by other players. #39

Closed Crayder closed 8 years ago

Crayder commented 8 years ago

RCON feature. RCON will be able to lock a group ID so that only they can edit.

Maybe allow certain players to edit the groups too.

Commands:

/restrict (restricts group from being edited by all players except the supplied and RCON)
        <Group ID> - Group to restrict.
        <Optional Array: Player ID's> - Players to allow. If none are given only RCON can edit, otherwise only RCON and the given players can edit.
/unrestrict (allows all editing again)
        <Group ID> - Group to unrestrict.

/restrict will reset each time it is called.

In each editing command check for group restriction, like the other macroes.

Restrictions will not be saved.

When an allowed player is disconnected, they will be removed from the allowed list. When they reconnect they will still not be allowed (no accts). They will need to be added again in /restrict.

Crayder commented 8 years ago

I think I'm going to try only adding the check to /sel, /csel, /lsel. This will prevent the players from even selecting objects in the group.

In the restricting commands I'll just loop through and deselect the objects for players that have them selected.

EDIT: I'll also add it to /gadd, /gselmodel, and other commands that select objects, whether it's for single object selection (CurrObject) or group selection (GroupedObjects).

Crayder commented 8 years ago

Need to find a workaround for /clone, so players can clone objects they are restricted from

Perhaps a simple new parameter in /clone for indexes, I actually meant to do this before anyways.

Crayder commented 8 years ago

Well this is going easier than expected... I have the majority of it done already. I just have to add the commands and test. I'll need some test subjects, so if anyone reads this and is up for it let me know.

Crayder commented 8 years ago

Note: I've only added the possibility to restrict groups 1-50.

I haven't added restriction to group 0 yet because that it going to be a bit of a separate thing. New objects and imported stuff are automatically set to group 0. What I'm going to do there is add the ability to change each player's default group. When I do that 0 will be allowed to be restricted because players will be able to create objects directly in other groups. There will be a message for players when there default group is a restricted group that they are not allowed to edit, something like "Your current default group is a restricted group, please change your default group with /default ".

Crayder commented 8 years ago

Ok, so I haven't tested it (only thing left to do).

I just have one problem that I know can occur, the assigned players can all disconnect. When they do the group will be editable by all with the way I have it set up. I'm not sure if I should leave it like that or add another way to restrict the group. (#FIXED in commit below)