ph8jPf9M wrote:how can i randomise or shuffle items in a chest?
ph8jPf9M wrote:how can i randomise or shuffle items in a chest?
local inv = get_inv_from_somewhere()
local list = inv:get_list("main")
-- Shuffle list here
inv:set_list("main", list)
Failed to load and run script from /home/pyros/.minetest/wrightflyer/init.lua:
/usr/share/minetest/builtin/game/register.lua:97: attempt to index local ‘prototype’ (a nil value)
stack traceback:
/usr/share/minetest/builtin/game/register.lua:97 in function ‘register_entity’
/home/pyros/.minetest/mods/wrightflyer/init.lua:203: in main chunk
Check debug.txt for details.
cx384 wrote:How can I set and get a table for a node in meta data?
I know set_string(name, value) get_string(name) set_int(name, value) get_int(name) .
Is it possible to save a whole table in meta?
A table like that {"default:coal_lump", "default:sandstone", test, {"default:stone", "default:sandstone"}}
meta:set_string("your_key", minetest.serialize(your_table))your_table=minetest.deserialize(meta:get_string("your_key"))Pyros wrote:I'm having a problem with my airplane mod: my version of the Wright Flyer!
(Okay, okay, I admit. I'm just editing Pavel_S's helicopter mod.)
However, I have an error: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
Failed to load and run script from /home/pyros/.minetest/wrightflyer/init.lua:
/usr/share/minetest/builtin/game/register.lua:97: attempt to index local ‘prototype’ (a nil value)
stack traceback:
/usr/share/minetest/builtin/game/register.lua:97 in function ‘register_entity’
/home/pyros/.minetest/mods/wrightflyer/init.lua:203: in main chunk
Check debug.txt for details.
Can anybody help?
EDIT: Sorry, cx384, for bumping in ahead of you. Oops.
Pyros wrote: Sorry, cx384, for bumping in ahead of you. Oops.
orwell wrote:cx384 wrote:How can I set and get a table for a node in meta data?
I know set_string(name, value) get_string(name) set_int(name, value) get_int(name) .
Is it possible to save a whole table in meta?
A table like that {"default:coal_lump", "default:sandstone", test, {"default:stone", "default:sandstone"}}
So, if I understand you right, you want to save a table as a single metadata key.
Metadata do not allow to save tables directly. Instead, you can serialize it (convert it into a string).
Save table: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
meta:set_string("your_key", minetest.serialize(your_table))
Retrieve table: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
your_table=minetest.deserialize(meta:get_string("your_key"))
burli wrote:Can I change cloud height from a mod?
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation) on_punch = function(pos, node, puncher)
local meta = minetest.get_meta(pos)
local name = puncher:get_player_name()
local inv = meta:get_inventory()
local srclist = inv:get_list("src")
local dstlist = inv:get_list("dst")
local cooked = nil
if srclist then
cooked = crafter.get_craft_result({method = "churn", width = 3, items = srclist})
end
-- check if churn is ready to operate
if inv:is_empty("src") then
minetest.chat_send_player(name,"Churn is empty!")
elseif not inv:room_for_item("dst",cooked.item) then
minetest.chat_send_player(name,"Churn is full!")
else
-- this is the actual working function of the churn
-- Put result in "dst" list
inv:add_item(dstlist, cooked)
-- take stuff from "src" list
inv:remove_item(srclist, 1)
end
end,2016-08-25 11:41:35: INFO[Main]: Started digging
2016-08-25 11:41:35: VERBOSE[Server]: TOSERVER_INTERACT: action=0, item=2, pointed=[node under=5,5,32 above=6,5,32]
2016-08-25 11:41:35: VERBOSE[Main]: OpenALSoundManager::maintain(): 0 playing sounds, 58 sound names loaded
2016-08-25 11:41:36: INFO[Main]: Left button released (stopped digging)lua_api.txt wrote:remove_item(listname, stack)
inv:add_item("dst", cooked)
inv:remove_item("src", 1)
orwell wrote:lua_api.txt wrote:remove_item(listname, stack)
You see the name in there?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
inv:add_item("dst", cooked)
inv:remove_item("src", 1)
should be the right way to do it.
No problem, anybody makes mistakes...
ABJ wrote:Is it possible to change the playermodel and ground collision model?
kaeza wrote:ABJ wrote:Is it possible to change the playermodel and ground collision model?
Player model is possible, via use of the Player API (requires `default` mod).
The collision box is editable for other entities, but hardcoded for the player. I'm pretty sure there are pull requests/issues requesting this functionality, but too lazy to search for them.
HTH
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)minetest.register_craftitem.....
.....
on_use = function(user)
minetest.chat_send_all(tostring(user))
my_function(user)
end on_use = function(itemstack, user, pointed_thing)
minetest.chat_send_all(user:get_player_name() )
my_function(user)
end
Users browsing this forum: No registered users and 8 guests