Skip to content

Conversation

Emojigit
Copy link
Member

No description provided.

Comment on lines +161 to +162
local idef = core.registered_items[iname]
if idef.groups.drawer_public == 1 then
Copy link
Member

Choose a reason for hiding this comment

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

idef might be nil when items are removed from the game. This is an edge-case, but yet a potential bug.

Also I suggest to move all protection checks to a local function so that on_rightclick and on_punch use the identical checks.

for _,itemStack in pairs(upgrades) do
local iname = itemStack:get_name()
local idef = core.registered_items[iname]
if idef.groups.drawer_public == 1 then
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if idef.groups.drawer_public == 1 then
if idef and idef.groups.drawer_public == 1 then

for _,itemStack in pairs(upgrades) do
local iname = itemStack:get_name()
local idef = core.registered_items[iname]
if idef.groups.drawer_public == 1 then
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if idef.groups.drawer_public == 1 then
if idef and idef.groups.drawer_public == 1 then

@mazes-80
Copy link
Contributor

Have a look at my PR.
It also allows to have public drawers not globally but at drawers level.

@mazes-80 mazes-80 mentioned this pull request Feb 21, 2023
@Emojigit Emojigit closed this Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants