Skip to content

Commit

Permalink
add 'states' parameter to base:falling_block
Browse files Browse the repository at this point in the history
  • Loading branch information
MihailRis committed Dec 29, 2024
1 parent 45807fd commit 9a190ac
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion res/content/base/scripts/components/falling_block.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ local body = entity.rigidbody
local rig = entity.skeleton

local blockid = ARGS.block
local blockstates = ARGS.states or 0
if SAVED_DATA.block then
blockid = SAVED_DATA.block
blockstates = SAVED_DATA.states or 0
else
SAVED_DATA.block = blockid
SAVED_DATA.states = blockstates
end

do -- setup visuals
Expand All @@ -22,7 +25,7 @@ function on_grounded()
local iy = math.floor(pos[2])
local iz = math.floor(pos[3])
if block.is_replaceable_at(ix, iy, iz) then
block.place(ix, iy, iz, block.index(blockid), 0)
block.place(ix, iy, iz, block.index(blockid), blockstates)
else
local picking_item = block.get_picking_item(block.index(blockid))
local drop = entities.spawn("base:drop", pos, {base__drop={id=picking_item, count=1}})
Expand Down

0 comments on commit 9a190ac

Please sign in to comment.