benrob0329 wrote:Not perfect, but MUCH better:
minetest.register_abm({
nodenames = {"tutorial:decowood"},
interval = 10,
chance = 1,
action = function(pos)
pos.y = pos.y + 1
end,
})
minetest.register_abm({
nodenames = {"tutorial:decowood"},
interval = 10,
chance = 1,
action = function(pos, node)
pos.y = pos.y + 1
if minetest.get_node(pos).name == "air" then
minetest.set_node(pos, node)
pos.y = pos.y - 1
minetest.remove_node(pos)
end
end,
})Foghrye4 wrote:bidaian, "pos" table in function is just a copy of an information about actual node position. Changing it will do nothing. You need to delete node on a old position and add on a new. Check how to do it here: http://dev.minetest.net/Category:Methods
Hybrid Dog 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
minetest.register_abm({
nodenames = {"tutorial:decowood"},
interval = 10,
chance = 1,
action = function(pos, node)
pos.y = pos.y + 1
if minetest.get_node(pos).name == "air" then
minetest.set_node(pos, node)
pos.y = pos.y - 1
minetest.remove_node(pos)
end
end,
})
xeranas wrote:How I can reset player skybox to default server? I want temporally change user skybox and then return to 'normal'.
everamzah wrote:Is it possible to make modifications to an ItemStack using the on_take callback of a detached inventory?
bidaian wrote:It does, but in one iteration it goes as high as it can. It was on the ground one second and underneath the branches in the next move. I'll work on it. Thanks also for bringing up the relationship with the environment. I was ready to go through anything that was already there :).
Foghrye4 wrote:everamzah wrote:Is it possible to make modifications to an ItemStack using the on_take callback of a detached inventory?
Yes. Don't forget to call "set_stack("listname", i, stack)" with your modificated stack on receiver inventory.
Hybrid Dog wrote:bidaian wrote:It does, but in one iteration it goes as high as it can. It was on the ground one second and underneath the branches in the next move. I'll work on it. Thanks also for bringing up the relationship with the environment. I was ready to go through anything that was already there :).
the code should actually make it move 1 m ("perform one iteration") every 10 seconds
time(P) = (log(P*chance)/log(1-1/chance)+1)*interval
interval = 10; chance = 1
time(P) = lim(chance → 1, (log(P*chance)/log(1-1/chance)+1)*10)
= lim(h → 0, (log(P*(h+1))/log(1-1/(h+1))+1)*10)
= 1*10 = 10 = interval
Maybe it works if you disable catch_up
minetest.add_item(player:getpos(), "mymod:myitem")rubenwardy wrote:Take a look at this chapter: http://rubenwardy.com/minetest_modding_ ... ories.html
You don't store items at a player's position, you store them in a player.
player = minetest.env:get_player_by_name("singleplayer")
minetest.add_item(player:getpos(), "mymod:myitem")Hybrid Dog wrote:AnxiousInfusion, where do you use this code?
AnxiousInfusion wrote:rubenwardy wrote:Take a look at this chapter: http://rubenwardy.com/minetest_modding_ ... ories.html
You don't store items at a player's position, you store them in a player.
Your guide has been a thoroughly helpful tool but I have not communicated well what I am trying to achieve. I actually want the item to be dropped at the player's position and I have had some success with: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
player = minetest.env:get_player_by_name("singleplayer")
minetest.add_item(player:getpos(), "mymod:myitem")
The only problem being "singleplayer" limits the mod to offline, solo use. Is there a more generic term I could use to refer to the player?
minetest.add_item(player:getpos(), ItemStack("mymod:myitem"))
AnxiousInfusion wrote:I'm still trying to understand how set_breath() can be used to decrement the bubbles bar, and how to bind a key to execute a function. Does Lua not allow this?
Hybrid Dog wrote:There are the functions minetest.on_key_press and minetest.on_key_release:
http://dev.minetest.net/User:Hybrid_Dog ... _functions
KCoombes wrote:Is it possible to add to/create new PlayerArgs via a mod, or will I have to edit the sourcecode?
array = { initializingvalue = {0} }
math.randomseed(os.clock()*100000000000)
minetest.register_globalstep(function(dtime)
for _, user in pairs(minetest.get_connected_players()) do
item = user:get_player_name()
array.item = array.item + dtime;AnxiousInfusion 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
array = { initializingvalue = {0} }
math.randomseed(os.clock()*100000000000)
minetest.register_globalstep(function(dtime)
for _, user in pairs(minetest.get_connected_players()) do
item = user:get_player_name()
array.item = array.item + dtime;
attempt to perform arithmetic on field 'item' (a nil value)
Users browsing this forum: No registered users and 2 guests