Post your modding questions here

hajo
Member
Posts: 606
Joined: Thu Oct 13, 2016 10:45
Location: DE
Contact:

Re: Post your modding questions here

by hajo » Post

christoferlevich wrote:I want a timer to start when a player enters an area/room, ..
and I want it to count time until the player exits
Example program:

Code: Select all

if not t then t=0 
  say("Timer started")
end

players = find_player(3);
if players then
  if t==0 then td=os.date("%Y-%m-%d %H:%M:%S\n") end
  t = t+1
  n = #players
  p = table.concat(players," and ")
  msg = td..t..") players here: "..p
  say(msg)
  td=""
else
  t=0  -- reset timer after players moved away
end
When players are found within 3 blocks, announce date&time once,
start counting and list players within range.
Reset timer if nobody is in range.

John_Constructor
Member
Posts: 76
Joined: Thu Jun 01, 2017 20:06
GitHub: John-Constructor
In-game: Nooberton
Location: On Minetest 24/7

Re: Post your modding questions here

by John_Constructor » Post

Okay, so I have two questions:

Title: Is it possible to make a tool that digs multiple nodes in one click?

Reason: I want to create a tool that specifically digs a 3X3 area of nodes.

Question two:

Title: How do I make it so that only when the player right-clicks an entity, and is mounted to it, that they can receive a tool and for it to get removed when unmounted?

Reason: I want to give a vehicle concept I have the ability to only give the tool when the player is mounted to the structure.
Constructing mechs and wingless aircraft since 2016.

Byakuren
Member
Posts: 816
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: Post your modding questions here

by Byakuren » Post

John_Constructor wrote:Okay, so I have two questions:

Title: Is it possible to make a tool that digs multiple nodes in one click?

Reason: I want to create a tool that specifically digs a 3X3 area of nodes.
Yes, use a minetest.register_on_dignode callback and when the player digs a node while wielding the tool, dig the area around the node.
Every time a mod API is left undocumented, a koala dies.

rommo
Member
Posts: 13
Joined: Thu Aug 31, 2017 19:48

Re: Post your modding questions here

by rommo » Post

I am using a particular map where TNT and other explosive mods dont cause any structural damage even in single player mode. They only damage users (me). What do i need to change in the code to enable damage?

User avatar
v-rob
Developer
Posts: 793
Joined: Thu Mar 24, 2016 03:19
GitHub: v-rob
IRC: v-rob
Location: Right behind you.

Re: Post your modding questions here

by v-rob » Post

How can I make a node take a very long time to dig? (about 10 seconds to dig one block)
GUI Core Developer | My Best Mods: Bridger - Slats - Stained Glass | To contact me, send a PM

User avatar
Stix
Member
Posts: 1385
Joined: Fri Aug 04, 2017 14:19
IRC: nil
In-game: Stix [+alts]
Location: USA

Re: Post your modding questions here

by Stix » Post

when i install the mod: better_bread it doesnt show up in-game, why? here is the code:

Code: Select all

--registers doublebaked_bread

minetest.register_craftitem("better_bread:doublebaked_bread", {
descrition = "doublebaked_bread",
inventory_image = "doublebaked.png",
on_use = minetest.item_eat(10)
})
minetest.register_craft({
type = "cooking",
output = "better_bread:doublebaked_bread"
recipie = "farming:bread",
})
--registers bread block

minetest.register_node("better_bread:bread_block", {
description = "bread block",
tiles = {"breadblock.png"},
groups = {oddly_breakable_by_hand = 3},
on_use = function(itemstack, user, pointed_thing),
hp_change = 20
})
minetest.register_craft({
type = "shapeless",
output = "better_bread:bread_block",
recipie = {"farming:bread", "farming:bread", "farming:bread"}
})
Hey, what can i say? I'm the bad guy.

User avatar
Stix
Member
Posts: 1385
Joined: Fri Aug 04, 2017 14:19
IRC: nil
In-game: Stix [+alts]
Location: USA

Re: Post your modding questions here

by Stix » Post

can anyone tell me why this mod doesnt work?
Attachments
better_bread.tar.gz
version 0.1
(1.79 KiB) Downloaded 24 times
Hey, what can i say? I'm the bad guy.

User avatar
Stix
Member
Posts: 1385
Joined: Fri Aug 04, 2017 14:19
IRC: nil
In-game: Stix [+alts]
Location: USA

Re: Post your modding questions here

by Stix » Post

i see its been downloaded 1 time. i cant help but wonder who downloaded it?
Hey, what can i say? I'm the bad guy.

User avatar
TumeniNodes
Member
Posts: 2874
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

Re: Post your modding questions here

by TumeniNodes » Post

Stix wrote:i see its been downloaded 1 time. i cant help but wonder who downloaded it?
a link to the thread where you got it would be better Stix
Ich mag keine grünen Eier und Schinken, ich mag sie nicht Sam I Am

User avatar
Stix
Member
Posts: 1385
Joined: Fri Aug 04, 2017 14:19
IRC: nil
In-game: Stix [+alts]
Location: USA

Re: Post your modding questions here

by Stix » Post

TumeniNodes wrote:
Stix wrote:i see its been downloaded 1 time. i cant help but wonder who downloaded it?
a link to the thread where you got it would be better Stix
its my WIP mod so thats your answer :P
ive recently updated it but it still doesnt work ill provide a download in the attachments.
Attachments
better_bread.tar.gz
version 0.1
(1.8 KiB) Downloaded 25 times
Hey, what can i say? I'm the bad guy.

User avatar
Sergey
Member
Posts: 784
Joined: Wed Jan 11, 2017 13:28
Location: Russia

Re: Post your modding questions here

by Sergey » Post

How can I write to my in-game console (that appears by pressing [T], [F10] or [/]) some info from my mod? it is for the sake of debugging code.

Commands print(), minetest.log(), minetest.debug() do not write to in-game console, but to debug.txt file. Command print() does not work all — it does not write even to debug.txt file.
Last edited by Sergey on Thu Sep 14, 2017 23:41, edited 1 time in total.

User avatar
Peppy
Member
Posts: 34
Joined: Sun Nov 06, 2016 07:34
IRC: Peppy
In-game: Peppy
Location: France

Re: Post your modding questions here

by Peppy » Post

Stix wrote:i see its been downloaded 1 time. i cant help but wonder who downloaded it?
I did ;)

Dependencies should be listed in depends.txt, one per line,not coma separated.

This code should work :

Code: Select all

--registers doublebaked_bread

minetest.register_craftitem("better_bread:doublebaked_bread", {
description = "doublebaked bread",
inventory_image = "doublebaked.png",
on_use = minetest.item_eat(10)
})

minetest.register_craft{
type = "cooking",
output = "better_bread:doublebaked_bread",
recipe = "farming:bread",
}

--registers bread block

minetest.register_node("better_bread:bread_block", {
description = "bread block",
tiles = {"breadblock.png"},
groups = {oddly_breakable_by_hand = 3},
on_use = minetest.item_eat(20)
})

minetest.register_craft{
type = "shapeless",
output = "better_bread:bread_block",
recipe = {"farming:bread", "farming:bread", "farming:bread"}
}
You may be interested in those two utilities :
Meld to compare files (available in your Xubuntu package manager).
Luacheck , to check your code.

User avatar
Stix
Member
Posts: 1385
Joined: Fri Aug 04, 2017 14:19
IRC: nil
In-game: Stix [+alts]
Location: USA

Re: Post your modding questions here

by Stix » Post

Peppy wrote:
Stix wrote:i see its been downloaded 1 time. i cant help but wonder who downloaded it?
I did ;)

Dependencies should be listed in depends.txt, one per line,not coma separated.

This code should work :

Code: Select all

--registers doublebaked_bread

minetest.register_craftitem("better_bread:doublebaked_bread", {
description = "doublebaked bread",
inventory_image = "doublebaked.png",
on_use = minetest.item_eat(10)
})

minetest.register_craft{
type = "cooking",
output = "better_bread:doublebaked_bread",
recipe = "farming:bread",
}

--registers bread block

minetest.register_node("better_bread:bread_block", {
description = "bread block",
tiles = {"breadblock.png"},
groups = {oddly_breakable_by_hand = 3},
on_use = minetest.item_eat(20)
})

minetest.register_craft{
type = "shapeless",
output = "better_bread:bread_block",
recipe = {"farming:bread", "farming:bread", "farming:bread"}
}
You may be interested in those two utilities :
Meld to compare files (available in your Xubuntu package manager).
Luacheck , to check your code.
does it work for you? cuz i still cant get it in-game no matter what way i try, it might be a issue with my copy of minetest so that is why id like to know.
Hey, what can i say? I'm the bad guy.

User avatar
Peppy
Member
Posts: 34
Joined: Sun Nov 06, 2016 07:34
IRC: Peppy
In-game: Peppy
Location: France

Re: Post your modding questions here

by Peppy » Post

Did you fix the depends.txt file too ?

This won't work :

Code: Select all

default, farming
It should be :

Code: Select all

default
farming

User avatar
Stix
Member
Posts: 1385
Joined: Fri Aug 04, 2017 14:19
IRC: nil
In-game: Stix [+alts]
Location: USA

Re: Post your modding questions here

by Stix » Post

Peppy wrote:Did you fix the depends.txt file too ?

This won't work :

Code: Select all

default, farming
It should be :

Code: Select all

default
farming
yes i have fixed it
Hey, what can i say? I'm the bad guy.

User avatar
Sergey
Member
Posts: 784
Joined: Wed Jan 11, 2017 13:28
Location: Russia

Re: Post your modding questions here

by Sergey » Post

Sergey wrote:How can I write to my in-game console (that appears by pressing [T], [F10] or [/]) some info from my mod? it is for the sake of debugging code.

Commands print(), minetest.log(), minetest.debug() do not write to in-game console, but to debug.txt file. Command print() does not work all — it does not write even to debug.txt file.
Can anybody answer me?

User avatar
Napiophelios
Member
Posts: 1020
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: Post your modding questions here

by Napiophelios » Post

Sergey wrote:
Sergey wrote:How can I write to my in-game console (that appears by pressing [T], [F10] or [/]) some info from my mod? it is for the sake of debugging code.

Commands print(), minetest.log(), minetest.debug() do not write to in-game console, but to debug.txt file. Command print() does not work all — it does not write even to debug.txt file.
Can anybody answer me?
I don't know what kind of info you want to broadcast but you
probably need to look into "chat" messages if you want it to show in game.

https://rubenwardy.com/minetest_modding ... /chat.html

User avatar
Sergey
Member
Posts: 784
Joined: Wed Jan 11, 2017 13:28
Location: Russia

Re: Post your modding questions here

by Sergey » Post

As I understand, mod's name can't be group cuz I saw recipes like

Code: Select all

{
    {"group:stone"},
    {"default:stick"},
    {"default:stick"},
}
... for stone shovel.

group name is a reserved name?
If so, what are reserved names in the game?
What if someone make mod called group?

John_Constructor
Member
Posts: 76
Joined: Thu Jun 01, 2017 20:06
GitHub: John-Constructor
In-game: Nooberton
Location: On Minetest 24/7

Re: Post your modding questions here

by John_Constructor » Post

Sergey wrote:As I understand, mod's name can't be group cuz I saw recipes like

Code: Select all

{
    {"group:stone"},
    {"default:stick"},
    {"default:stick"},
}
... for stone shovel.

group name is a reserved name?
If so, what are reserved names in the game?
What if someone make mod called group?
From my understanding, A mod can be called "Group" as long as it doesn't have any items of any name such as "Stone" or relative to any used groups, it also is most likely to interfere with crafting when you DO register such things.
Constructing mechs and wingless aircraft since 2016.

User avatar
v-rob
Developer
Posts: 793
Joined: Thu Mar 24, 2016 03:19
GitHub: v-rob
IRC: v-rob
Location: Right behind you.

Re: Post your modding questions here

by v-rob » Post

If you want a mod called "group", then name it "groups."
GUI Core Developer | My Best Mods: Bridger - Slats - Stained Glass | To contact me, send a PM

User avatar
Sergey
Member
Posts: 784
Joined: Wed Jan 11, 2017 13:28
Location: Russia

Re: Post your modding questions here

by Sergey » Post

v-rob wrote:If you want a mod called "group", then name it "groups."
No, I don't want to. At all. I was just curious what if… while looking at recipes.

How does MT distinguish e.g. itemname "default:dirt" from group "group:wood", if the format is the same "<super>:<sub>"?
Last edited by Sergey on Sat Sep 16, 2017 06:23, edited 1 time in total.

User avatar
v-rob
Developer
Posts: 793
Joined: Thu Mar 24, 2016 03:19
GitHub: v-rob
IRC: v-rob
Location: Right behind you.

Re: Post your modding questions here

by v-rob » Post

"Group" is registered in the engine.
GUI Core Developer | My Best Mods: Bridger - Slats - Stained Glass | To contact me, send a PM

User avatar
Stix
Member
Posts: 1385
Joined: Fri Aug 04, 2017 14:19
IRC: nil
In-game: Stix [+alts]
Location: USA

Re: Post your modding questions here

by Stix » Post

Question: is it possible to attach a entity to a nodebox?
Hey, what can i say? I'm the bad guy.

User avatar
rubenwardy
Moderator
Posts: 6297
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: United Kingdom
Contact:

Re: Post your modding questions here

by rubenwardy » Post

Sergey wrote:
v-rob wrote:If you want a mod called "group", then name it "groups."
No, I don't want to. At all. I was just curious what if… while looking at recipes.

How does MT distinguish e.g. itemname "default:dirt" from group "group:wood", if the format is the same "<super>:<sub>"?
It checks if the half is "group", if so it's a group.

User avatar
Sergey
Member
Posts: 784
Joined: Wed Jan 11, 2017 13:28
Location: Russia

Re: Post your modding questions here

by Sergey » Post

How to make each inventory slot hold more than 99 items (if items are stackable)?
Say, 1000 items.

Locked

Who is online

Users browsing this forum: No registered users and 2 guests