Post your modding questions here

User avatar
You
Member
 
Posts: 41
Joined: Sat Aug 05, 2017 23:34
GitHub: Me
IRC: Me
In-game: You

Re: Post your modding questions here

by You » Tue Aug 22, 2017 21:11

Making better anti-cheat system ?
Yeah i know there are good anti-cheats, but they can be easy broken with remoding MT client to ignore them. Is possible to make anti-cheat which can't be broken that easy. Something which would not allow MT remodded client to join server ?
Who's Soulja boy?

Yuuuuuu
 

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

Re: Post your modding questions here

by cx384 » Tue Aug 22, 2017 21:56

hajo wrote:With entries in depends.txt it is possible for a mod to check if other needed mods are installed.

https://github.com/minetest/minetest/bl ... i.txt#L150
You should use minetest.get_modnames(). https://github.com/minetest/minetest/bl ... .txt#L2163
hajo wrote:Is it possible to check for a minimum version of the minetest-engine (e.g."needs 0.4.16-dev") ?

You can use minetest.get_version(). https://github.com/minetest/minetest/bl ... .txt#L2222
Can your read this?
 

wrcwpk
New member
 
Posts: 3
Joined: Thu Aug 24, 2017 23:44

Re: Post your modding questions here

by wrcwpk » Thu Aug 24, 2017 23:48

Topic: How to handle a block being right clicked(or more generally how to handle any interactions with a block)

Reason: Part of my mod involves performing a series of actions when a specified block is right clicked with a shovel

More Info(optional): I'm quite new to minetest development(thought not developmenet in general) I didn't see an event for block breaking, clicking, etc in the API, to handle this do I need to change all shovels? I'm assuming there is a more direct route that other mods have taken.
 

Nyarg
Member
 
Posts: 276
Joined: Sun May 15, 2016 04:32

Re: Post your modding questions here

by Nyarg » Fri Aug 25, 2017 02:30

wrcwpk wrote:Topic: How to handle a block being right clicked


in ..\minetest-0.4.14\doc\lua_api.txt
May be ### Node definition (`register_node`)
on_rightclick = func(pos, node, clicker, itemstack, pointed_thing)

for quick scope use something like
+ Spoiler
SNAG-25204.jpg
(192.92 KiB) Not downloaded yet
I am a noob. still yet. Not so noob ) [vml] WIP and a little proof for fun PlantedTorch )))
MT Strike 78a36b468554d101e0be3b0d1f587a555f396452 Great! Somebody have found it )
"My english isn't well" I know. I'm sorry )
 

wrcwpk
New member
 
Posts: 3
Joined: Thu Aug 24, 2017 23:44

Re: Post your modding questions here

by wrcwpk » Fri Aug 25, 2017 18:37

Deleted
Last edited by wrcwpk on Sat Aug 26, 2017 19:30, edited 1 time in total.
 

wrcwpk
New member
 
Posts: 3
Joined: Thu Aug 24, 2017 23:44

Re: Post your modding questions here

by wrcwpk » Sat Aug 26, 2017 19:26

How can I get the formatted item name? when using itemstack:get_name()?

Right now it prints table: 0x<Some hex code> where what I want is "default:dirt"
 

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

Re: Post your modding questions here

by cx384 » Sun Aug 27, 2017 07:56

wrcwpk wrote:How can I get the formatted item name? when using itemstack:get_name()?

Right now it prints table: 0x<Some hex code> where what I want is "default:dirt"

"itemstack:get_name()" should give you the name of the itemstack. https://github.com/minetest/minetest/bl ... .txt#L3536

Probably your userdata isn't an itemstack.
Maybe it is an inventory, in this case you can use "inv:get_stack(listname, i)".

Please give us more informations about your code.

By the way you can also try "itemstack:to_table().name".
Can your read this?
 

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 » Mon Aug 28, 2017 18:46

Title: Is there a way to mass-override crafts as well as create the ability to use two of the same item to somewhat carve them into things such as AxeHeads?

Reason: I want to make a Crafting Realism mod that rather than allowing to start off with wood, needing to start off with collecting stones to create tools, or at the least, the heads for the tools.
Constructing mechs and wingless aircraft since 2016.
 

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

Re: Post your modding questions here

by cx384 » Mon Aug 28, 2017 22:09

John_Constructor wrote:Title: Is there a way to mass-override crafts as well as create the ability to use two of the same item to somewhat carve them into things such as AxeHeads?

Reason: I want to make a Crafting Realism mod that rather than allowing to start off with wood, needing to start off with collecting stones to create tools, or at the least, the heads for the tools.


Yeah minetest.clear_craft(recipe).
https://github.com/minetest/minetest/bl ... .txt#L2339
Do you want to do something like the realtest game?
viewtopic.php?t=13624
Can your read this?
 

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 » Mon Aug 28, 2017 23:13

cx384 wrote:
John_Constructor wrote:Title: Is there a way to mass-override crafts as well as create the ability to use two of the same item to somewhat carve them into things such as AxeHeads?

Reason: I want to make a Crafting Realism mod that rather than allowing to start off with wood, needing to start off with collecting stones to create tools, or at the least, the heads for the tools.


Yeah minetest.clear_craft(recipe).
https://github.com/minetest/minetest/bl ... .txt#L2339
Do you want to do something like the realtest game?
viewtopic.php?t=13624


Potentially so, I'll need to look into that.
Constructing mechs and wingless aircraft since 2016.
 

User avatar
christoferlevich
Member
 
Posts: 323
Joined: Thu Dec 01, 2016 23:44
Location: Athol, Massachusetts
GitHub: ChristoferL

Re: Post your modding questions here

by christoferlevich » Tue Aug 29, 2017 11:31

John_Constructor wrote:
cx384 wrote:
John_Constructor wrote:Title: Is there a way to mass-override crafts as well as create the ability to use two of the same item to somewhat carve them into things such as AxeHeads?

Reason: I want to make a Crafting Realism mod that rather than allowing to start off with wood, needing to start off with collecting stones to create tools, or at the least, the heads for the tools.


Yeah minetest.clear_craft(recipe).
https://github.com/minetest/minetest/bl ... .txt#L2339
Do you want to do something like the realtest game?
viewtopic.php?t=13624


Potentially so, I'll need to look into that.


Couldn't you put in the same idea into effect by making nodes unbreakable against hands - and maybe the elimination of wonderful items like wooden sword and ax (these always leave me laughing).
everything can be a learning experience...
 

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 » Thu Aug 31, 2017 14:11

I looked into Realtest's description... Exactly my idea for the early game, yet rather than breaking the dirt below the trees- the player needs to start by collecting stones/rocks to make the head of the tool, honestly it would complicate it a little yet it's for the sake of realism; you can't really cut logs apart using your bare hands after digging the soil under it, you need- at the least- some kind of axe head or a saw, the concept came about quite a while before I published my first mod.
Constructing mechs and wingless aircraft since 2016.
 

User avatar
DS-minetest
Member
 
Posts: 1112
Joined: Thu Jun 19, 2014 19:49
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.
GitHub: DS-Minetest
In-game: DS

Re: Post your modding questions here

by DS-minetest » Thu Aug 31, 2017 16:08

John_Constructor wrote:I looked into Realtest's description... Exactly my idea for the early game, yet rather than breaking the dirt below the trees- the player needs to start by collecting stones/rocks to make the head of the tool, honestly it would complicate it a little yet it's for the sake of realism; you can't really cut logs apart using your bare hands after digging the soil under it, you need- at the least- some kind of axe head or a saw, the concept came about quite a while before I published my first mod.

It is already like this. The digging dirt below tree thing was just because of something else.
Last edited by DS-minetest on Sat Sep 02, 2017 16:53, 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
AspireMint
Member
 
Posts: 332
Joined: Mon Jul 09, 2012 12:59
Location: Stuck at spawn
GitHub: AspireMint
IRC: AspireMint
In-game: AspireMint

Re: Post your modding questions here

by AspireMint » Sat Sep 02, 2017 16:19

so i tried minetest.register_alias(str1, str2) and minetest.register_alias_force(str1, str2) with no success.
Anyone knows how to use it? (where to put new init.lua file with this function)

EDIT: nvm, forgot to put depends.txt :-/ , so my "mod" is loaded after mod with str1 and str2 blocks

Solved.
 

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 » Sun Sep 03, 2017 21:02

Title: How do I create a setting that toggles the existence of certain nodes?

Reason: I want to give one of my mods the ability to have certain materials of nodes disabled to the user's liking,

Extensive information: I decided I wanted to try this when converting it to a modpack wouldn't function correctly (I.E.: only the crafting area of the mod would be enabled when the rest was enabled and in that modpack; in-game result was nodes not being registered compared to crafts.).
Constructing mechs and wingless aircraft since 2016.
 

DagonX
Member
 
Posts: 13
Joined: Thu Aug 17, 2017 15:05

Re: Post your modding questions here

by DagonX » Mon Sep 04, 2017 20:51

Voxel Editor Questions

I ran into some interesting programs that are called Voxel Editors.
Most were geared towards Minecraft though.
My question is there any possible use for them in Minetest?
I was thinking of experimenting with them to do new furniture and plant/tree textures.
I have lot of hand drawn textures I have made but not whole lot of skills with blender or how to put them in Voxel related worlds.
I thought(maybe wrongly) that maybe I could find a easy to use one to work.
I really like to use my tulip tree texture somewhere and some of my silk textures on lounge chairs and chaises.
 

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

Re: Post your modding questions here

by Sergey » Mon Sep 04, 2017 21:10

Here is what is unclear yet for me?
1. How to know what tool was used inside node's on_* methods?
2. How to manipulate durability/wear bar of this tool correctly (e.g. pickaxe)?
3. How wear range 0–65535 of tools related to info in /usr/share/minetest/games/minetest/mods/default/tools.lua

For example, this is info about diamond pickaxe:
Code: Select all
minetest.register_tool("default:pick_diamond", {
   description = "Diamond Pickaxe",
   inventory_image = "default_tool_diamondpick.png",
   tool_capabilities = {
      full_punch_interval = 0.9,
      max_drop_level=3,
      groupcaps={
         cracky = {times={[1]=2.0, [2]=1.0, [3]=0.50}, uses=30, maxlevel=3},
      },
      damage_groups = {fleshy=5},
   },
   sound = {breaks = "default_tool_breaks"},
})

I don't know what all these parameters mean. I wish I know but I can't get details in official documentation. But from here (and from real experience) I know that I can use diamond pickaxe 810 times to break stone (stone pickaxe — 60 times respectively). So I don't see such info in tools.lua.
4. (from above) How I can manually increase wear state of some tool by 10 (for example) uses?
5. Is there event like register_on_toolwearout that run when active tool completely wear out?

P.S. Previous part of my questions about modding: How to…
 

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

Re: Post your modding questions here

by cx384 » Tue Sep 05, 2017 09:17

OK, Let's answer this questions.
John_Constructor wrote:Title: How do I create a setting that toggles the existence of certain nodes?
<snip>

First of all you have to create a "settingtypes.txt" file in your mod folder.
Then define your setting inside this file.
how it works
Code: Select all
#<more_info>
<setting_name>(<description>) <type> <default>

example
Code: Select all
# example_setting
mymod_disable_node_mynode(disables mynode) bool true

Now you can check the setting in your lua file.
Code: Select all
if not minetest.settings:get_bool("mymod_disable_node_mynode") then
     minetest.register_node("mymod:mynode", <node definition>)
end
Can your read this?
 

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

Re: Post your modding questions here

by cx384 » Tue Sep 05, 2017 09:40

DagonX wrote:Voxel Editor Questions

I ran into some interesting programs that are called Voxel Editors.
Most were geared towards Minecraft though.
My question is there any possible use for them in Minetest?
I was thinking of experimenting with them to do new furniture and plant/tree textures.
I have lot of hand drawn textures I have made but not whole lot of skills with blender or how to put them in Voxel related worlds.
I thought(maybe wrongly) that maybe I could find a easy to use one to work.
I really like to use my tulip tree texture somewhere and some of my silk textures on lounge chairs and chaises.

I think you are searching for meshes or node boxes which you can define in your node definition when you are registering a node.
You can also use the nodebox editor.
Can your read this?
 

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

Re: Post your modding questions here

by cx384 » Tue Sep 05, 2017 10:01

Sergey wrote:Here is what is unclear yet for me?
1. How to know what tool was used inside node's on_* methods?

You can use "player:get_wielded_item()"
Sergey wrote:2. How to manipulate durability/wear bar of this tool correctly (e.g. pickaxe)?

You can use "itemstack:get_wear()", "itemstack:set_wear(wear)" or "itemstack:add_wear(amount)"
Sergey wrote:3. How wear range 0–65535 of tools related to info in /usr/share/minetest/games/minetest/mods/default

It is well explained there.
Sergey wrote:4. (from above) How I can manually increase wear state of some tool by 10 (for example) uses?

See 2.
Sergey wrote:5. Is there event like register_on_toolwearout that run when active tool completely wear out?

No, you have to work around with "on_use".
Can your read this?
 

User avatar
orwell
Member
 
Posts: 784
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell

Re: Post your modding questions here

by orwell » Tue Sep 05, 2017 12:19

DagonX wrote:Voxel Editor Questions

I ran into some interesting programs that are called Voxel Editors.
Most were geared towards Minecraft though.
My question is there any possible use for them in Minetest?
I was thinking of experimenting with them to do new furniture and plant/tree textures.
I have lot of hand drawn textures I have made but not whole lot of skills with blender or how to put them in Voxel related worlds.
I thought(maybe wrongly) that maybe I could find a easy to use one to work.
I really like to use my tulip tree texture somewhere and some of my silk textures on lounge chairs and chaises.

This depends on the voxel editor program you use and what it can export
can you name such a program?
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

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

Re: Post your modding questions here

by Sergey » Wed Sep 06, 2017 01:04

cx384 wrote:... [Answers to Sergey] ...

Thank you very much
 

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

Re: Post your modding questions here

by Sergey » Wed Sep 06, 2017 01:05

Is there any Lua debugger I can use to debug my mod step by step, line by line, looking at what data I have after each line of execution?

Please do not advice to cram my code with print or minetest.debug statements with later scrolling down huge debug.txt file hunting for necessary messages among MT stuff.
 

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

Re: Post your modding questions here

by Sergey » Wed Sep 06, 2017 23:54

Why minetest.register_on_dignode is not recommended?
Are you going to remove that method in future?
As for me, I find it quite useful.
 

User avatar
rubenwardy
Moderator
 
Posts: 5835
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 » Wed Sep 06, 2017 23:56

Sergey wrote:Why minetest.register_on_dignode is not recommended?
Are you going to remove that method in future?
As for me, I find it quite useful.


it runs on every single node dig, so you should use the node's dig callback if possible instead
 

PreviousNext

Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 3 guests