mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
feat: nukeprotect modularity
This commit is contained in:
@@ -1,12 +1,30 @@
|
||||
return {
|
||||
[tostring(defines.inventory.character_ammo)] = {
|
||||
["atomic-bomb"] = true
|
||||
}, -- @setting ammo The items to not allow in the player's ammo inventory
|
||||
[tostring(defines.inventory.character_armor)] = {}, -- @setting armor The items to not allow in the player's armor inventory
|
||||
[tostring(defines.inventory.character_guns)] = {}, -- @setting gun The items to not allow in the player's gun inventory
|
||||
[tostring(defines.inventory.character_main)] = {
|
||||
["atomic-bomb"] = true
|
||||
}, -- @setting main The items to not allow in the player's main inventory
|
||||
inventories = {
|
||||
{
|
||||
inventory = defines.inventory.character_ammo,
|
||||
event = defines.events.on_player_ammo_inventory_changed,
|
||||
items = {
|
||||
["atomic-bomb"] = true
|
||||
},
|
||||
},
|
||||
{
|
||||
inventory = defines.inventory.character_armor,
|
||||
event = defines.events.on_player_armor_inventory_changed,
|
||||
items = {},
|
||||
},
|
||||
{
|
||||
inventory = defines.inventory.character_guns,
|
||||
event = defines.events.on_player_gun_inventory_changed,
|
||||
items = {},
|
||||
},
|
||||
{
|
||||
inventory = defines.inventory.character_main,
|
||||
event = defines.events.on_player_main_inventory_changed,
|
||||
items = {
|
||||
["atomic-bomb"] = true
|
||||
},
|
||||
},
|
||||
},
|
||||
ignore_permisison = "bypass-nukeprotect", -- @setting ignore_permisison The permission that nukeprotect will ignore
|
||||
ignore_admins = true, -- @setting ignore_admins Ignore admins, true by default. Allows usage outside of the roles module
|
||||
}
|
||||
|
||||
@@ -24,34 +24,13 @@ local function check_items(player, type)
|
||||
end
|
||||
end
|
||||
|
||||
if table_size(config[tostring(defines.inventory.character_ammo)]) > 0 then
|
||||
Event.add(defines.events.on_player_ammo_inventory_changed, function(event)
|
||||
local player = game.get_player(event.player_index)
|
||||
|
||||
check_items(player, defines.inventory.character_ammo)
|
||||
end)
|
||||
end
|
||||
|
||||
if table_size(config[tostring(defines.inventory.character_armor)]) > 0 then
|
||||
Event.add(defines.events.on_player_armor_inventory_changed, function(event)
|
||||
local player = game.get_player(event.player_index)
|
||||
|
||||
check_items(player, defines.inventory.character_armor)
|
||||
end)
|
||||
end
|
||||
|
||||
if table_size(config[tostring(defines.inventory.character_guns)]) > 0 then
|
||||
Event.add(defines.events.on_player_gun_inventory_changed, function(event)
|
||||
local player = game.get_player(event.player_index)
|
||||
|
||||
check_items(player, defines.inventory.character_guns)
|
||||
end)
|
||||
end
|
||||
|
||||
if table_size(config[tostring(defines.inventory.character_main)]) > 0 then
|
||||
Event.add(defines.events.on_player_main_inventory_changed, function(event)
|
||||
local player = game.get_player(event.player_index)
|
||||
|
||||
check_items(player, defines.inventory.character_main)
|
||||
end)
|
||||
for _, inventory in ipairs(config.inventories) do
|
||||
if #inventory.items > 0 then
|
||||
Event.add(inventory.event, function(event)
|
||||
local player = game.get_player(event.player_index)
|
||||
if player and player.valid then
|
||||
check_items(player, inventory.inventory)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user