Dan Duncombe wrote:Is there any way to make a block heal any player within a 20 block radius? The block name is 'decoblock:eyestone_active'.
get_objects_inside_radius(pos, radius)
set_hp(hp)
Aqua wrote:Is it possible to make a player jump higher currently?
Evergreen wrote:Aqua wrote:Is it possible to make a player jump higher currently?
I think so with the new api for the player physics override, but Idk how to do it.
1244 wrote:I have problem with rightclick event in register node. This function working ok if I don't hold shift("sneak"). When I hold shift function isn't working. Why?
1244 wrote:I have problem with rightclick event in register node. This function working ok if I don't hold shift("sneak"). When I hold shift function isn't working. Why?
Evergreen wrote:I know this doesn't have to do with mods, but how large is a chunk(otherwise known as block)? And how can I tell that I am on the edge of a chunk?
local pos = player:getpos()
local relpos = { x=pos.x % 16, y=pos.y % 16, z=pos.z % 16 }
if relpos.x <= 1 or relpos.x >= 15 or relpos.y <= 1 or relpos.y >= 15 or relpos.z <= 1 or relpos.z >= 15 then
-- I am at the edge
else
-- I am not
end
Evergreen wrote:I know this doesn't have to do with mods, but how large is a chunk(otherwise known as block)? And how can I tell that I am on the edge of a chunk?
PilzAdam wrote:EDIT: 2500 POSTS!!!!
why do mapblocks generate 5*5*5 and not 16*16*16PilzAdam wrote:Evergreen wrote:I know this doesn't have to do with mods, but how large is a chunk(otherwise known as block)? And how can I tell that I am on the edge of a chunk?
As jojoa said, a mapblock is 16x16x16 nodes. However, the map generator always generates 5x5x5 mapblocks at once.
To see if you are at the edge of the mapblock just look at the animation of lava. It is by default not synced (there is a setting for that in minetest.conf), so you can see the mapblock borders.
EDIT: 2500 POSTS!!!!
jojoa1997 wrote:why do mapblocks generate 5*5*5 and not 16*16*16
minetest.register_node("thaumtest:cauldron_full",{
drawtype="nodebox",
paramtype = "light",
tiles = {"default_wood.png"},
groups = {choppy=2},
node_box = {
type = "fixed",
fixed = {
{-0.500000,-0.375000,-0.500000,-0.375000,0.500000,0.500000},
{0.375000,-0.375000,-0.500000,0.500000,0.500000,0.500000},
{-0.500000,-0.375000,-0.500000,0.500000,0.500000,-0.375000},
{-0.500000,-0.375000,0.375000,0.500000,0.500000,0.500000},
{-0.500000,-0.312500,-0.500000,0.500000,0.312500,0.500000},
{-0.500000,-0.500000,-0.500000,-0.375000,0.500000,-0.375000},
{0.375000,-0.500000,-0.500000,0.500000,0.500000,-0.375000},
{0.375000,-0.500000,0.375000,0.500000,0.500000,0.500000},
{-0.500000,-0.500000,0.375000,-0.375000,0.500000,0.500000},
}
}
})
minetest.register_node("thaumtest:cauldron_empty",{
drawtype="nodebox",
description= "Cauldron",
paramtype = "light",
tiles = {"default_wood.png"},
groups = {choppy=2},
node_box = {
type = "fixed",
fixed = {
{-0.500000,-0.375000,-0.500000,-0.375000,0.500000,0.500000},
{0.375000,-0.375000,-0.500000,0.500000,0.500000,0.500000},
{-0.500000,-0.375000,-0.500000,0.500000,0.500000,-0.375000},
{-0.500000,-0.375000,0.375000,0.500000,0.500000,0.500000},
{-0.500000,-0.500000,-0.500000,-0.375000,0.500000,-0.375000},
{0.375000,-0.500000,-0.500000,0.500000,0.500000,-0.375000},
{0.375000,-0.500000,0.375000,0.500000,0.500000,0.500000},
{-0.500000,-0.500000,0.375000,-0.375000,0.500000,0.500000},
{-0.500000,-0.375000,-0.500000,0.500000,-0.312500,0.500000},
}
}
on_rightclick = function(pos, node, clicker, itemstack)
if itemstack:get_name() == "bucket:bucket_water" then
minetest.env:set_node(pos, "thaumtest:cauldron_full")
end
end
}
})
--
-- Item definition defaults
--
local stack_max = 99
if tonumber(minetest.setting_get(stack_max)) then
stack_max = tonumber(minetest.setting_get(stack_max))
print("[builtin] stack_max = ".. tonumber(minetest.setting_get(stack_max)) .."")
end
minetest.nodedef_default = {
-- Item properties
type="node",
-- name intentionally not defined here
description = "",
groups = {},
inventory_image = "",
wield_image = "",
wield_scale = {x=1,y=1,z=1},
stack_max = stack_max,
-- . . .
minetest.register_node("thaumtest:cauldron_full",{
drawtype="nodebox",
paramtype = "light",
tiles = {"default_wood.png"},
groups = {choppy=2},
node_box = {
type = "fixed",
fixed = {
{-0.500000,-0.375000,-0.500000,-0.375000,0.500000,0.500000},
{0.375000,-0.375000,-0.500000,0.500000,0.500000,0.500000},
{-0.500000,-0.375000,-0.500000,0.500000,0.500000,-0.375000},
{-0.500000,-0.375000,0.375000,0.500000,0.500000,0.500000},
{-0.500000,-0.312500,-0.500000,0.500000,0.312500,0.500000},
{-0.500000,-0.500000,-0.500000,-0.375000,0.500000,-0.375000},
{0.375000,-0.500000,-0.500000,0.500000,0.500000,-0.375000},
{0.375000,-0.500000,0.375000,0.500000,0.500000,0.500000},
{-0.500000,-0.500000,0.375000,-0.375000,0.500000,0.500000},
}
}
})
minetest.register_node("thaumtest:cauldron_empty",{
drawtype="nodebox",
description= "Cauldron",
paramtype = "light",
tiles = {"default_wood.png"},
groups = {choppy=2},
node_box = {
type = "fixed",
fixed = {
{-0.500000,-0.375000,-0.500000,-0.375000,0.500000,0.500000},
{0.375000,-0.375000,-0.500000,0.500000,0.500000,0.500000},
{-0.500000,-0.375000,-0.500000,0.500000,0.500000,-0.375000},
{-0.500000,-0.375000,0.375000,0.500000,0.500000,0.500000},
{-0.500000,-0.500000,-0.500000,-0.375000,0.500000,-0.375000},
{0.375000,-0.500000,-0.500000,0.500000,0.500000,-0.375000},
{0.375000,-0.500000,0.375000,0.500000,0.500000,0.500000},
{-0.500000,-0.500000,0.375000,-0.375000,0.500000,0.500000},
{-0.500000,-0.375000,-0.500000,0.500000,-0.312500,0.500000},
}
},
on_rightclick = function(pos, node, clicker, itemstack)
if itemstack:get_name() == "bucket:bucket_water" then
minetest.env:set_node(pos, "thaumtest:cauldron_full")
end
end,
}
})
(...)
on_rightclick = function(pos, node, clicker, itemstack)
if itemstack:get_name() == "bucket:bucket_water" then
minetest.env:set_node(pos, "thaumtest:cauldron_full")
end
end,
} <-- REMOVE THIS
})
Evergreen wrote:Tried it and it still doesn't work. Code:Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
-code-
minetest.env:set_node(pos, {name="thaumtest:cauldron_full"})
local stack_max = 99
if minetest.setting_get("stack_max") then
stack_max = minetest.setting_get("stack_max")
end
kaeza wrote:Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
(...)
on_rightclick = function(pos, node, clicker, itemstack)
if itemstack:get_name() == "bucket:bucket_water" then
minetest.env:set_node(pos, "thaumtest:cauldron_full")
end
end,
} <-- REMOVE THIS
})
BlockMen wrote:Evergreen wrote:Tried it and it still doesn't work. Code:Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
-code-
It is caused by the bucket mod. -> https://github.com/minetest/minetest_game/blob/master/mods/bucket/init.lua#L42
When it is changed to on_use() [in bucket mod] it works fine.
^
Edit: Casimirs solution is better (to use on_punch()).
And it has to beYour phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
minetest.env:set_node(pos, {name="thaumtest:cauldron_full"})
12:13:01: ERROR[main]: ServerError: LuaError: error: ...rett/Desktop/Minetest/bin/../mods/thaumtest/init.lua:43: attempt to index local 'itemstack' (a nil value)
12:13:01: ERROR[main]: stack traceback:
Evergreen wrote:Getting closer, but now I get an error when punching the cauldron with the bucket.Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
12:13:01: ERROR[main]: ServerError: LuaError: error: ...rett/Desktop/Minetest/bin/../mods/thaumtest/init.lua:43: attempt to index local 'itemstack' (a nil value)
12:13:01: ERROR[main]: stack traceback:
on_punch = function(pos, node, puncher)
if puncher:get_wielded_item():get_name() == "bucket:bucket_water" then
minetest.env:set_node(pos, {name="thaumtest:cauldron_full"})
end
end,
on_punch = function(pos, node, puncher)
if puncher:get_wielded_item():get_name() == "bucket:bucket_water" then
minetest.env:set_node(pos, {name="thaumtest:cauldron_full"})
minetest.env:replace({item="bucket:bucket_empty"})
end
end,
BlockMen wrote:Evergreen wrote:Getting closer, but now I get an error when punching the cauldron with the bucket.Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
12:13:01: ERROR[main]: ServerError: LuaError: error: ...rett/Desktop/Minetest/bin/../mods/thaumtest/init.lua:43: attempt to index local 'itemstack' (a nil value)
12:13:01: ERROR[main]: stack traceback:
Of cause you get this error, because on_punch gives no itemstack -> https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L1737
you have to change it to thisYour phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
on_punch = function(pos, node, puncher)
if puncher:get_wielded_item():get_name() == "bucket:bucket_water" then
minetest.env:set_node(pos, {name="thaumtest:cauldron_full"})
end
end,
Evergreen wrote:minetest.env:replace({item="bucket:bucket_empty"})
local inv = puncher:get_inventory()
inv:remove_item("main", itemstack)
itemstack = ItemStack("bucket:bucket_empty")
inv:add_item("main", itemstack)
player:set_wielded_item(itemstack)
Users browsing this forum: No registered users and 48 guests