Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable nukes completely #245

Merged
merged 2 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion config/nukeprotect.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,9 @@ return {
},
},
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
ignore_admins = true, -- @setting ignore_admins Ignore admins, true by default. Allows usage outside of the roles module
disable_nuke_research = true, -- @setting disable_nuke_research Disable the nuke research, true by default
disable_nuke_research_names = {
["atomic-bomb"] = true
} -- @setting disable_nuke_research_names The names of the researches to disabled
}
16 changes: 13 additions & 3 deletions modules/addons/nukeprotect.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
--- Disable new players from having certain items in their inventory, most commonly nukes
-- @addon Nukeprotect

local Event = require 'utils.event' --- @dep utils.event
local Roles = require 'expcore.roles' --- @dep expcore.roles
local config = require 'config.nukeprotect' --- @dep config.nukeprotect
local Event = require 'utils.event' --- @dep utils.event
local Roles = require 'expcore.roles' --- @dep expcore.roles
local config = require 'config.nukeprotect' --- @dep config.nukeprotect
local move_items_stack = _C.move_items_stack --- @dep expcore.common


Expand Down Expand Up @@ -34,3 +34,13 @@ for _, inventory in ipairs(config.inventories) do
end)
end
end


if config.disable_nuke_research then
Event.add(defines.events.on_research_started, function(event)
local name = event.research.name
if config.disable_nuke_research_names[name] then
event.research.force.cancel_current_research()
end
end)
end
Loading