Refactorio / RedMew

The RedMew scenario code for Factorio.
https://redmew.com
GNU General Public License v3.0
176 stars 80 forks source link

Add permissions module for DO #1391

Closed RedRafe closed 7 months ago

RedRafe commented 8 months ago
RedRafe commented 7 months ago

@grilledham I've refactored the whole module and come to a satisfying conclusion.

The config module permissions turns ON/OFF globally the feature from enabled flag, as per any other config field; by default it's globally enabled but no sub-preset is turned on (so no restriction is applied to generic scenarios). Each DO scenario simply enables a permission preset by calling Config.permissions.presets.no_blueprints = true

For single-player-use when downloading from GitHub, they can disable/enable the no-BPs (or any other future preset, individually) from the config file.

An additional method for on_player_joined event is also implemented, tho not used, for future edge cases we might encounter.

Additionally, 2 commands have also been added to provide support for single-users and RedMew servers CLI:

This should give us plenty of room to expand for future applications, has global ON/OFF from config file so it's easy to manipulate, quick to use from scenario templates, & backed by admin commands in case emergency actions need to be taken. From in-game, & remotely.