update entities.spawn(...) semantics to the docs state

This commit is contained in:
MihailRis
2024-07-17 10:17:20 +03:00
parent 51a57d3d1f
commit 1b99a48849
9 changed files with 23 additions and 13 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ ready = false
target = -1
ARGS = ARGS or {}
local dropitem = ARGS.item or {}
local dropitem = ARGS
if SAVED_DATA.item then
dropitem.id = item.index(SAVED_DATA.item)
dropitem.count = SAVED_DATA.count
@@ -26,7 +26,7 @@ function on_grounded()
block.set(ix, iy, iz, block.index(blockid))
else
local picking_item = block.get_picking_item(block.index(blockid))
local drop = entities.spawn("base:drop", pos, {item={id=picking_item, count=1}})
local drop = entities.spawn("base:drop", pos, {base__drop={id=picking_item, count=1}})
drop.rigidbody:set_vel(vec3.spherical_rand(5.0))
end
entity:despawn()
+1 -1
View File
@@ -17,7 +17,7 @@ function on_hud_open()
local pvel = {player.get_vel(pid)}
local ppos = vec3.add({player.get_pos(pid)}, {0, 0.7, 0})
local throw_force = vec3.mul(player.get_dir(pid), DROP_FORCE)
local drop = entities.spawn("base:drop", ppos, {item={
local drop = entities.spawn("base:drop", ppos, {base__drop={
id=itemid,
count=1
}})
+2 -1
View File
@@ -1,6 +1,7 @@
local function update(x, y, z)
if block.is_replaceable_at(x, y-1, z) then
entities.spawn("base:falling_block", {x+0.5, y+0.5, z+0.5}, {block='base:sand'})
entities.spawn("base:falling_block", {x+0.5, y+0.5, z+0.5},
{base__falling_block={block='base:sand'}})
block.set(x, y, z, 0)
end
end