Changed ignore_role to ignore_permission

This commit is contained in:
Cooldude2606
2021-04-24 01:53:05 +01:00
parent cdded68ffb
commit 7fb1a14cb3
3 changed files with 7 additions and 9 deletions

View File

@@ -210,7 +210,8 @@ Roles.new_role('Regular','Reg')
'command/rainbow',
'command/go-to-spawn',
'command/me',
'standard-decon'
'standard-decon',
'bypass-entity-protection'
}
:set_auto_assign_condition(function(player)
if player.online_time >= hours3 then

View File

@@ -1,6 +1,6 @@
return {
ignore_admins = true, --- @setting ignore_admins If admins are ignored by the protection filter
ignore_role = 'Regular', --- @setting ignore_role This role will be ignored by the protection filter, leave nil if expcore.roles is not used
ignore_permission = 'bypass-entity-protection', --- @setting ignore_permission Players with this permission will be ignored by the protection filter, leave nil if expcore.roles is not used
repeat_count = 5, --- @setting repeat_count Number of protected entities to be removed to count as repeated
repeat_lifetime = 3600*20, --- @setting repeat_lifetime How old repeats must be before being removed
refresh_rate = 3600*5, --- @setting refresh_rate How often old repeats will be removed

View File

@@ -32,12 +32,9 @@ for _, config_key in ipairs{'always_protected_names', 'always_protected_types',
end
-- convert ignore role if present
if config.ignore_role then
local Roles = require 'expcore.roles'
local role = Roles.get_role_by_name(config.ignore_role)
config.ignore_role = function(player)
return Roles.player_has_role(player, role)
end
local Roles
if config.ignore_permission then
Roles = require 'expcore.roles' --- @dep expcore.roles
end
----- Global Variables -----
@@ -157,7 +154,7 @@ Event.add(defines.events.on_pre_player_mined_item, function(event)
local player = game.get_player(event.player_index)
-- Check if the player should be ignored
if config.ignore_admins and player.admin then return end
if config.ignore_role and config.ignore_role(player) then return end
if config.ignore_permission and Roles.player_allowed(player, config.ignore_permission) then return end
-- Check if the entity is protected
if check_always_protected(entity) or EntityProtection.is_entity_protected(entity)