mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-12 06:21:50 +00:00
add 'states' parameter to base:falling_block
This commit is contained in:
parent
45807fdcb1
commit
9a190acb8b
1 changed files with 4 additions and 1 deletions
|
|
@ -3,10 +3,13 @@ local body = entity.rigidbody
|
||||||
local rig = entity.skeleton
|
local rig = entity.skeleton
|
||||||
|
|
||||||
local blockid = ARGS.block
|
local blockid = ARGS.block
|
||||||
|
local blockstates = ARGS.states or 0
|
||||||
if SAVED_DATA.block then
|
if SAVED_DATA.block then
|
||||||
blockid = SAVED_DATA.block
|
blockid = SAVED_DATA.block
|
||||||
|
blockstates = SAVED_DATA.states or 0
|
||||||
else
|
else
|
||||||
SAVED_DATA.block = blockid
|
SAVED_DATA.block = blockid
|
||||||
|
SAVED_DATA.states = blockstates
|
||||||
end
|
end
|
||||||
|
|
||||||
do -- setup visuals
|
do -- setup visuals
|
||||||
|
|
@ -22,7 +25,7 @@ function on_grounded()
|
||||||
local iy = math.floor(pos[2])
|
local iy = math.floor(pos[2])
|
||||||
local iz = math.floor(pos[3])
|
local iz = math.floor(pos[3])
|
||||||
if block.is_replaceable_at(ix, iy, iz) then
|
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
|
else
|
||||||
local picking_item = block.get_picking_item(block.index(blockid))
|
local picking_item = block.get_picking_item(block.index(blockid))
|
||||||
local drop = entities.spawn("base:drop", pos, {base__drop={id=picking_item, count=1}})
|
local drop = entities.spawn("base:drop", pos, {base__drop={id=picking_item, count=1}})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue