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

Implement nuke protect, fix move_items #229

Merged
merged 7 commits into from
Dec 9, 2022

Conversation

oof2win2
Copy link
Contributor

Changed _C.move_items* to be _C.copy_items_stack, which copies items, and _C.move_items_stack, which moves items.

Added an addon called nukeprotect, which prevents players without a flag from having specific items in their inventories.

config/nukeprotect.lua Outdated Show resolved Hide resolved
modules/addons/nukeprotect.lua Outdated Show resolved Hide resolved
modules/addons/nukeprotect.lua Outdated Show resolved Hide resolved
@oof2win2
Copy link
Contributor Author

I added the new config, though I'm not sure if this is a good way to do it so that it is "modular".

Copy link
Member

@Cooldude2606 Cooldude2606 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Firstly, I dont see any reason to use tostring on the keys.
Secondally, if you want to make it modular then you should include the event name in the config:

{
  {
    inventory = defines.inventory.character_ammo,
    event = defines.events.on_player_ammo_inventory_changed,
    items = {
      ["atimic-bomb"] = true
    }
  }
}

This will alow you to use a for loop within the module code.

for _, area in ipairs(config) do
  if #area.items > 0 then
    Event.add(area.event, ...)
  end
end

config/expcore/roles.lua Outdated Show resolved Hide resolved
@Cooldude2606 Cooldude2606 added Feature Request Request for a new feature to be added Next Release Features which should be included for next release and removed Feature Request Request for a new feature to be added labels Jul 24, 2022
@oof2win2
Copy link
Contributor Author

Implemented the desired modularity of the code

Copy link
Member

@Cooldude2606 Cooldude2606 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Cooldude2606 Cooldude2606 merged commit 1b833ed into explosivegaming:dev Dec 9, 2022
@oof2win2 oof2win2 deleted the feature/nukeprotect branch December 9, 2022 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Next Release Features which should be included for next release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants