Post your modding questions here

User avatar
stu
Member
 
Posts: 737
Joined: Sat Feb 02, 2013 02:51
GitHub: stujones11

Re: Post your modding questions here

by stu » Thu Oct 27, 2016 13:59

taikedz wrote: I can happily transfer items to and from the chest , even though I expect the return 0 to cause a denial. The chats aren't printed when de-commented either.


If you make changes to a node's formspec after placement then those changes will not take effect until you re-place the node causing on_construct to be re-called. Could that be the problem?
 

User avatar
taikedz
Member
 
Posts: 587
Joined: Sun May 15, 2016 11:11
GitHub: taikedz
IRC: DuCake
In-game: DuCake

Re: Post your modding questions here

by taikedz » Thu Oct 27, 2016 15:06

stu - whilst that was a relevant remakr, it did not resolve the prolem

orwell, I adjusted your code to match what I have, and after digging/replacing the blocks I have.... no chest inventory. Blank space above my player inventory...

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_node("interchest:wormhole_chest", {
        description = "Wormhole Chest",                 
        paramtype2 = "facedir",
        groups = {oddly_breakable_by_hand=2,choppy=3},
        after_place_node = function(pos,player,itemstack,pointedthing)
                local meta = minetest.get_meta(pos)
                local pname = player:get_player_name()
                meta:set_string("formspec",
                                "size[8,9]"..
                                "list[detached;interchest_"..pname..";0,0;8,4;]"..
                                "list[current_player;main;0,5;8,4;]" ..
                                "listring[detached;interchest_"..pname.."]" ..
                                "listring[current_player;main]")
                meta:set_string("infotext", "Wormhole Chest")
        end,
})

minetest.register_on_joinplayer(function(player)
        local pname = player:get_player_name()
        minetest.create_detached_inventory("interchest_"..pname, {
                allow_put=function (inv, listname, index, stack, player) return 0 end,
                allow_take=function (inv, listname, index, stack, player) return 0 end,
        })
end)

 

hajo
Member
 
Posts: 262
Joined: Thu Oct 13, 2016 10:45

Re: Post your modding questions here

by hajo » Fri Oct 28, 2016 03:22

Some mods have a file mod.conf, but I found no documentation about that file and its usage.

Can someone explain, or give a pointer to more info ?
Some of 'my' wiki-pages: Build-a-home - basic-robot - basic-machines - digtron
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

Re: Post your modding questions here

by kaeza » Fri Oct 28, 2016 03:37

hajo wrote:Some mods have a file mod.conf, but I found no documentation about that file and its usage.

Can someone explain, or give a pointer to more info ?

It's a text file containing mod metadata.

At the moment, only the `name` field is used. The engine uses this as the mod's "internal" name. If this is not present, the engine uses the directory name.

Simply create such a file 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
name = my_mod_name


See also: This topic, original proposal, issue #2201.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

amadin
Member
 
Posts: 471
Joined: Tue Jun 16, 2015 16:23
GitHub: Amadin

Re: Post your modding questions here

by amadin » Fri Oct 28, 2016 08:29

deleted. understood by himself
 

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Fri Oct 28, 2016 13:24

taikedz wrote:stu - whilst that was a relevant remakr, it did not resolve the prolem

orwell, I adjusted your code to match what I have, and after digging/replacing the blocks I have.... no chest inventory. Blank space above my player inventory...

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_node("interchest:wormhole_chest", {
        description = "Wormhole Chest",                 
        paramtype2 = "facedir",
        groups = {oddly_breakable_by_hand=2,choppy=3},
        after_place_node = function(pos,player,itemstack,pointedthing)
                local meta = minetest.get_meta(pos)
                local pname = player:get_player_name()
                meta:set_string("formspec",
                                "size[8,9]"..
                                "list[detached;interchest_"..pname..";0,0;8,4;]"..
                                "list[current_player;main;0,5;8,4;]" ..
                                "listring[detached;interchest_"..pname.."]" ..
                                "listring[current_player;main]")
                meta:set_string("infotext", "Wormhole Chest")
        end,
})

minetest.register_on_joinplayer(function(player)
        local pname = player:get_player_name()
        minetest.create_detached_inventory("interchest_"..pname, {
                allow_put=function (inv, listname, index, stack, player) return 0 end,
                allow_take=function (inv, listname, index, stack, player) return 0 end,
        })
end)


Please look anywhere how detached inventories work. It seems like the detached inventory has size 0. You need to set it somehow. I don't even know if my definition is right. This was just the approach, no working code.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
taikedz
Member
 
Posts: 587
Joined: Sun May 15, 2016 11:11
GitHub: taikedz
IRC: DuCake
In-game: DuCake

Re: Post your modding questions here

by taikedz » Fri Oct 28, 2016 14:19

orwell wrote:Please look anywhere how detached inventories work. It seems like the detached inventory has size 0. You need to set it somehow. I don't even know if my definition is right. This was just the approach, no working code.


Yes I've been reading up too, no hint so far as to what is going wrong. I'll keep hunting then. THanks again!
 

User avatar
Me Me and Me
Member
 
Posts: 33
Joined: Sun Jul 03, 2016 21:08
In-game: MeMeandMe2

Re: Post your modding questions here

by Me Me and Me » Sun Oct 30, 2016 23:56

I need the item-string of air to make an "abm" for a mod. Is it one of these?:
"default:air"?
"air:air"?
"air"?
My mod(s)
unternullPLUS
 

User avatar
taikedz
Member
 
Posts: 587
Joined: Sun May 15, 2016 11:11
GitHub: taikedz
IRC: DuCake
In-game: DuCake

Re: Post your modding questions here

by taikedz » Sun Oct 30, 2016 23:58

Air is simply "air"

You might also find this quickly useful http://wiki.minetest.net/Itemstrings
 

User avatar
nomohakon
Member
 
Posts: 207
Joined: Fri Aug 10, 2012 16:34
IRC: nomohakon
In-game: nomohakon

Re: Post your modding questions here

by nomohakon » Mon Oct 31, 2016 16:13

Is there a mod that has mobs that take items from marked chest and deliver them to diferently marked chest? Or mobs that follow player and collect dropped items and deliver them to marked chest? Is it even possible?
 

User avatar
azekill_DIABLO
Member
 
Posts: 3458
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: Post your modding questions here

by azekill_DIABLO » Mon Oct 31, 2016 17:54

yeah, the "living hand" from living tools go and takes back items.
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
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)

azekill_DIABLO said: Mineyoshi+ABJ+Baggins= TOPIC HIJACKED.
My Mods and Stuff | Voxellar | VoxBox on GITHUB | M.I.L.A Monster engine
WEIRD MODDING CONTEST !!!
 

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Wed Nov 02, 2016 10:31

@core devs:
What is better for performance/memory?
- 1 detached inventory that contains 200 lists, or
- 100 detached inventories that each contain 2 lists, or
- 200 detached inventories that each contain 1 list
I would prefer the first one, but don't know how lists are handled.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: Post your modding questions here

by rubenwardy » Wed Nov 02, 2016 12:00

Lists are stored in an array by their inventory. This means that a linear search needs to be done each time you do something to a list, so O(n). Detached inventories are stored in a hash map, so finding an inventory uses a hash lookup - the performance of this is variable (it depends on how good the hash algorithm is, and how well the items are partitioned) but generally a good one doesn't take more than 7 look ups [citation needed]

So #3 may be faster than #1 due to a lookup rather than a linear search, however I'd go with #1 over #3 as it's nicer conceptually, and the slow down probably isn't noticible, and also uses less objects. This needs testing though, all this is from me reading the code. There may be non-obvious factors, I didn't look into how it's transferred to Lua.
Feel free to correct me - this is not an area I've worked with yet.

A question though is why you need 200 inventory lists. That's crazy.
 

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Wed Nov 02, 2016 19:08

Worst-case scenario: 200 box wagons in one map.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
cx384
Member
 
Posts: 249
Joined: Wed Apr 23, 2014 09:38
GitHub: cx384
IRC: cx384

Re: Post your modding questions here

by cx384 » Wed Nov 02, 2016 22:37

How can I check where are mapblock and mapchunk borders?
Every 16 nodes and 5 mapblock, but where is the first mapblock?
From x=0 y=0 z=0 to x=15 y=15 z=15?
Can your read this?
 

Chiu ChunLing
Member
 
Posts: 39
Joined: Sat Oct 22, 2016 09:37

Re: Post your modding questions here

by Chiu ChunLing » Thu Nov 03, 2016 12:05

Somewhat related question, how do I get mapchunks that are already generated? Or is there a better way to use voxelmanip on existing map chunks that have already been generated (for the purpose of updating an existing world to a mod I created)?
 

User avatar
DS-minetest
Member
 
Posts: 707
Joined: Thu Jun 19, 2014 19:49
GitHub: DS-Minetest
In-game: DS

Re: Post your modding questions here

by DS-minetest » Thu Nov 03, 2016 16:40

let me show you this:
Image
made with gimp

Edit: where "Chunkboarder" is written is the mapblockboarder
Attachments
Drawing.png
Drawing.png (11.36 KiB) Viewed 2865 times
Last edited by DS-minetest on Thu Nov 03, 2016 19:31, edited 1 time in total.
Do not call me -minetest.
Call me DS or DS-minetest.
I am German, so you don't have to pm me English if you are also German.
The background is a lie.
 

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Thu Nov 03, 2016 19:07

I could swear it was documented somewhere...
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
cx384
Member
 
Posts: 249
Joined: Wed Apr 23, 2014 09:38
GitHub: cx384
IRC: cx384

Re: Post your modding questions here

by cx384 » Fri Nov 04, 2016 13:27

How to set a group for an item that was already registered?
Can your read this?
 

Chiu ChunLing
Member
 
Posts: 39
Joined: Sat Oct 22, 2016 09:37

Re: Post your modding questions here

by Chiu ChunLing » Fri Nov 04, 2016 18:22

Oh, I know this one. http://dev.minetest.net/minetest.override_item

Still looking for any info on how to get mapchunks that are already generated to run a voxelmanip on them.
 

User avatar
orwell
Member
 
Posts: 467
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
In-game: orwell

Re: Post your modding questions here

by orwell » Fri Nov 04, 2016 18:44

cx384 wrote:How to set a group for an item that was already registered?

This should also work, since you probably don't want to override the whole 'groups' 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
minetest.registered_nodes["mod:node"].groups.yourgroupname=value

afaik, override_item internally does the same
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

Chiu ChunLing
Member
 
Posts: 39
Joined: Sat Oct 22, 2016 09:37

Re: Post your modding questions here

by Chiu ChunLing » Fri Nov 04, 2016 19:06

That should work, but I had trouble with it.
 

Byakuren
Member
 
Posts: 441
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri

Re: Post your modding questions here

by Byakuren » Fri Nov 04, 2016 21:57

orwell wrote:
cx384 wrote:How to set a group for an item that was already registered?

This should also work, since you probably don't want to override the whole 'groups' 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
minetest.registered_nodes["mod:node"].groups.yourgroupname=value

afaik, override_item internally does the same

What happens if the item definition has no groups table? Does register_item create a default one?
Every time a mod API is left undocumented, a koala dies.
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

Re: Post your modding questions here

by kaeza » Fri Nov 04, 2016 22:20

Byakuren wrote:What happens if the item definition has no groups table? Does register_item create a default one?

Thanks to metatables, it inherits from a "base" definition.

Note that since Lua tables are references (i.e. they are not copied), orwell's code may cause unintended effects if the node does not define groups itself (it's unlikely, but possible nonetheless), as you would be modifying the default definition groups in-place.

The correct approach is to create a copy of the `groups` table, modify the copy, then assign it to the node:

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
local def = minetest.registered_nodes["some:name"]
local groups = table.copy(def.groups)
groups.my_group = 123
minetest.override_item("some:name", { groups=groups })


The same should be made for anything that is a table.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 

Chiu ChunLing
Member
 
Posts: 39
Joined: Sat Oct 22, 2016 09:37

Re: Post your modding questions here

by Chiu ChunLing » Sat Nov 05, 2016 03:08

Ah, that's a good point.
 

Chiu ChunLing
Member
 
Posts: 39
Joined: Sat Oct 22, 2016 09:37

Re: Post your modding questions here

by Chiu ChunLing » Sat Nov 05, 2016 05:00

cx384 wrote:How can I check where are mapblock and mapchunk borders?
Every 16 nodes and 5 mapblock, but where is the first mapblock?
From x=0 y=0 z=0 to x=15 y=15 z=15?


In trying to resolve my own issue I've gotten a more precise answer to your question, I think. If you take a position and put it through the following formula you get the minp and maxp of the generated mapchunk containing that position.
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
pos = {x=1,y=1,z=1}--or whatever position you put in
pos.x,pos.y,pos.z = 80*math.floor((p.x+32)/80)-32,80*math.floor((p.y+32)/80)-32,80*math.floor((p.z+32)/80)-32
minp = pos --this works out to {x=-32,y=-32,z=-32} for the given position pos
maxp = {y=p.y+79,x=p.x+79,z=p.z+79}--this works out to {x=47,y=47,z=47}
This implies that the center mapblock of nodes starts at {x=0,y=0,z=0} and goes to {x=15,y=15,z=15}. I inferred this by adding
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.chat_send_all(minetest.serialize(minp))
minetest.chat_send_all(minetest.serialize(maxp))
to my on_generated function to get feedback on where and when that was being called.

Hopefully I'll be able to use that to make a chatcommand that invokes my on_generated function on existing mapchunks I want to convert.
 

User avatar
cx384
Member
 
Posts: 249
Joined: Wed Apr 23, 2014 09:38
GitHub: cx384
IRC: cx384

Re: Post your modding questions here

by cx384 » Sat Nov 05, 2016 10:52

Thank you all.
Can your read this?
 

User avatar
GreenDimond
Member
 
Posts: 460
Joined: Wed Oct 28, 2015 01:26
GitHub: GreenXenith
IRC: GreenDimond
In-game: GreenDimond

Re: Post your modding questions here

by GreenDimond » Fri Nov 11, 2016 17:04

How do I apply textures to an OBJ model?
I am Green. I tend to binge-post. "All of this over a 16x16 representation of a cartoon cat ?!?! what has this world come to..." -TenPlus1, 2017.
Diz mah mods! :D ↑ github.com/minetest/minetest_game/issues/1647#issuecomment-288134572 ↑
Sand Plus - Tac Nayn - Waffles - Coming Soon: Caverealms Plus
 

User avatar
DS-minetest
Member
 
Posts: 707
Joined: Thu Jun 19, 2014 19:49
GitHub: DS-Minetest
In-game: DS

Re: Post your modding questions here

by DS-minetest » Fri Nov 11, 2016 17:14

GreenDimond wrote:How do I apply textures to an OBJ model?

with an uv map in the model?!
Do not call me -minetest.
Call me DS or DS-minetest.
I am German, so you don't have to pm me English if you are also German.
The background is a lie.
 

User avatar
GreenDimond
Member
 
Posts: 460
Joined: Wed Oct 28, 2015 01:26
GitHub: GreenXenith
IRC: GreenDimond
In-game: GreenDimond

Re: Post your modding questions here

by GreenDimond » Fri Nov 11, 2016 17:27

DS-minetest wrote:
GreenDimond wrote:How do I apply textures to an OBJ model?

with an uv map in the model?!

Ehm....wha?
I am Green. I tend to binge-post. "All of this over a 16x16 representation of a cartoon cat ?!?! what has this world come to..." -TenPlus1, 2017.
Diz mah mods! :D ↑ github.com/minetest/minetest_game/issues/1647#issuecomment-288134572 ↑
Sand Plus - Tac Nayn - Waffles - Coming Soon: Caverealms Plus
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 10 guests

cron