Add rotatable in menu mode as well

master
Wuzzy 2022-02-10 20:27:31 +01:00
parent 99650cec51
commit bc6ada5c4d
1 changed files with 5 additions and 4 deletions

View File

@ -158,19 +158,20 @@ function screwdriver.use(itemstack, player, pointed_thing, is_right_click)
if not def then return end -- probably unnessesary
local rotatable = minetest.get_item_group(node.name, "rotatable")
local gs = lzr_gamestate.get_state()
-- Node MUST have 'rotatable' group
-- TODO: Allow rotation in level editing/admin mode
if rotatable <= 0 then
return itemstack
end
-- rotatable=2: rotatable if takable or if in editor mode
-- rotatable=2: rotatable if takable or if in editor/menu mode
if rotatable == 2 then
if not (def.groups.takable or lzr_gamestate.get_state() == lzr_gamestate.EDITOR) then
if not (def.groups.takable or gs == lzr_gamestate.EDITOR or gs == lzr_gamestate.MENU) then
return itemstack
end
-- rotatable=3: rotatable in editor mode only
-- rotatable=3: rotatable in editor/menu mode only
elseif rotatable == 3 then
if lzr_gamestate.get_state() ~= lzr_gamestate.EDITOR then
if gs == lzr_gamestate.EDITOR or gs == lzr_gametate.MENU then
return itemstack
end
end