Any chance that an event could be raised when the base-game permissions are changed?
I leave it up to the author of such a possible event as to whether it would raise with details for every change, or just general updates.
Event for on-permissions-changed?
Re: Event for on-permissions-changed?
I would also love to have this feature!!
I would not even care if the event contained any permission change details...
And if multiple permissions changed in the same tick (assuming that changes happen during the GUI-close-tick (similar to on_runtime_mod_setting_changed event)) one event during that tick would be sufficient for what I'm trying to do.
Maybe there is just a way to tell when a user closed the permissions GUI? (Exploring this idea now...)
Please & Thanks!
-Kizrak
Re: Event for on-permissions-changed?
Code: Select all
local function on_gui_closed(event)
local gui_type = event.gui_type
if gui_type == defines.gui_type.permissions then
log("resetPermissions()")
end
end
script.on_event({
defines.events.on_gui_closed,
},on_gui_closed)
Re: Event for on-permissions-changed?
I'm not against adding this event but I want to make sure I'm understanding what kind of event is being asked for. Do you just want to know "when anything permissions changes" or more gradual?
Right now these are the sets of actions that can happen:
Player added/removed from permission group
Permission group created/deleted
Permission group permission enabled/disabled
Permission group all permissions enabled/disabled
A singular "something changed" event is easy. I just want to be sure that's ok rather than having to make a bunch of different logic for conveying all the permissions actions through events.
Right now these are the sets of actions that can happen:
Player added/removed from permission group
Permission group created/deleted
Permission group permission enabled/disabled
Permission group all permissions enabled/disabled
A singular "something changed" event is easy. I just want to be sure that's ok rather than having to make a bunch of different logic for conveying all the permissions actions through events.
If you want to get ahold of me I'm almost always on Discord.
Re: Event for on-permissions-changed?
I don't want to speak for Kovus, but my current goal just involves tracking permission changes any time the player (or another mod) updates them.
In my mod, players do not have a body (like a RTS) so I'm using permissions to disable crafting/mining/any-type-of-inventory-usage, and basically players have to build a base entirely with ghosts that robots construct. If they want to move something, they have to have logistic bots move it. If they want to build something, they must use construction bots. I want to ensure when new forces/permissions/players are added, that they retain their body-less permissions.
Currently/hackily, any time any permission change is detected (AKA the GUI close event for permissions window) I disable all desired permissions for all permission groups.
In my mod, players do not have a body (like a RTS) so I'm using permissions to disable crafting/mining/any-type-of-inventory-usage, and basically players have to build a base entirely with ghosts that robots construct. If they want to move something, they have to have logistic bots move it. If they want to build something, they must use construction bots. I want to ensure when new forces/permissions/players are added, that they retain their body-less permissions.
Currently/hackily, any time any permission change is detected (AKA the GUI close event for permissions window) I disable all desired permissions for all permission groups.
Re: Event for on-permissions-changed?
It's been over a year. At the time, I was implementing a mod to be a super-set of permissions (which could be exported/imported between games). Since we couldn't create custom permissions (primarily for multiplayer administrative tools), I was looking to grab updates from the permissions changes to keep in sync.
The more granular, the less work I'd have to do on the mod side. Though, that might come at the cost of calling the same event handler(s) multiple times in a single tick; provided permissions are modified on-save as kizrak suggested.
The more granular, the less work I'd have to do on the mod side. Though, that might come at the cost of calling the same event handler(s) multiple times in a single tick; provided permissions are modified on-save as kizrak suggested.
Re: Event for on-permissions-changed?
It seems, it is impossible to know who is changing permissions, if there are multiple admins in the same game.
This is a bit of an issue and could be solved by having an event.
This is a bit of an issue and could be solved by having an event.
Re: Event for on-permissions-changed?
Ok, I added the following events for the next release: on_permission_group_edited, on_pre_permission_string_imported, on_permission_string_imported, on_per_permission_group_deleted, on_permission_group_deleted, and on_permission_group_added.
If you want to get ahold of me I'm almost always on Discord.