Post your modding questions here

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

Re: Post your modding questions here

by hajo » Tue Sep 12, 2017 17:09

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
Location: On Minetest 24/7
GitHub: John-Constructor
In-game: Nooberton

Re: Post your modding questions here

by John_Constructor » Wed Sep 13, 2017 02:00

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 » Wed Sep 13, 2017 02:46

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 » Wed Sep 13, 2017 14:56

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
Member
 
Posts: 700
Joined: Thu Mar 24, 2016 03:19
Location: Right behind you.
GitHub: v-rob

Re: Post your modding questions here

by v-rob » Thu Sep 14, 2017 04:56

How can I make a node take a very long time to dig? (about 10 seconds to dig one block)
 

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

Re: Post your modding questions here

by Stix » Thu Sep 14, 2017 18:11

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.
Next release of your favorite game? "Bugfixes" --Wuzzy
[OLD]The new Minetest-offtopic can be found here: https://minetestoftopic.createaforum.com/index.php
 

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

Re: Post your modding questions here

by Stix » Thu Sep 14, 2017 19:55

can anyone tell me why this mod doesnt work?
Attachments
better_bread.tar.gz
version 0.1
(1.79 KiB) Downloaded 20 times
Hey, what can i say? I'm the bad guy.
Next release of your favorite game? "Bugfixes" --Wuzzy
[OLD]The new Minetest-offtopic can be found here: https://minetestoftopic.createaforum.com/index.php
 

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

Re: Post your modding questions here

by Stix » Thu Sep 14, 2017 20:07

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.
Next release of your favorite game? "Bugfixes" --Wuzzy
[OLD]The new Minetest-offtopic can be found here: https://minetestoftopic.createaforum.com/index.php
 

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

Re: Post your modding questions here

by TumeniNodes » Thu Sep 14, 2017 22:02

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: 1379
Joined: Fri Aug 04, 2017 14:19
Location: USA
IRC: nil
In-game: Stix [+alts]

Re: Post your modding questions here

by Stix » Thu Sep 14, 2017 22:10

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 21 times
Hey, what can i say? I'm the bad guy.
Next release of your favorite game? "Bugfixes" --Wuzzy
[OLD]The new Minetest-offtopic can be found here: https://minetestoftopic.createaforum.com/index.php
 

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

Re: Post your modding questions here

by Sergey » Thu Sep 14, 2017 23:20

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
Location: France
IRC: Peppy
In-game: Peppy

Re: Post your modding questions here

by Peppy » Thu Sep 14, 2017 23:29

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: 1379
Joined: Fri Aug 04, 2017 14:19
Location: USA
IRC: nil
In-game: Stix [+alts]

Re: Post your modding questions here

by Stix » Fri Sep 15, 2017 00:13

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.
Next release of your favorite game? "Bugfixes" --Wuzzy
[OLD]The new Minetest-offtopic can be found here: https://minetestoftopic.createaforum.com/index.php
 

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

Re: Post your modding questions here

by Peppy » Fri Sep 15, 2017 04:39

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: 1379
Joined: Fri Aug 04, 2017 14:19
Location: USA
IRC: nil
In-game: Stix [+alts]

Re: Post your modding questions here

by Stix » Fri Sep 15, 2017 15:06

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.
Next release of your favorite game? "Bugfixes" --Wuzzy
[OLD]The new Minetest-offtopic can be found here: https://minetestoftopic.createaforum.com/index.php
 

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

Re: Post your modding questions here

by Sergey » Fri Sep 15, 2017 21:51

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: 986
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: Post your modding questions here

by Napiophelios » Fri Sep 15, 2017 22:41

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 » Fri Sep 15, 2017 23:15

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
Location: On Minetest 24/7
GitHub: John-Constructor
In-game: Nooberton

Re: Post your modding questions here

by John_Constructor » Fri Sep 15, 2017 23:44

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
Member
 
Posts: 700
Joined: Thu Mar 24, 2016 03:19
Location: Right behind you.
GitHub: v-rob

Re: Post your modding questions here

by v-rob » Sat Sep 16, 2017 00:17

If you want a mod called "group", then name it "groups."
 

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

Re: Post your modding questions here

by Sergey » Sat Sep 16, 2017 00:24

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
Member
 
Posts: 700
Joined: Thu Mar 24, 2016 03:19
Location: Right behind you.
GitHub: v-rob

Re: Post your modding questions here

by v-rob » Sat Sep 16, 2017 04:31

"Group" is registered in the engine.
 

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

Re: Post your modding questions here

by Stix » Sat Sep 16, 2017 18:53

Question: is it possible to attach a entity to a nodebox?
Hey, what can i say? I'm the bad guy.
Next release of your favorite game? "Bugfixes" --Wuzzy
[OLD]The new Minetest-offtopic can be found here: https://minetestoftopic.createaforum.com/index.php
 

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

Re: Post your modding questions here

by rubenwardy » Sat Sep 16, 2017 19:31

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 » Sun Sep 17, 2017 01:45

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

PreviousNext

Return to Modding Discussion



Who is online

Users browsing this forum: Winter94 and 2 guests