Post your modding questions here

User avatar
HeroOfTheWinds
Member
 
Posts: 470
Joined: Wed Apr 23, 2014 23:16
GitHub: HeroOfTheWinds
IRC: WindHero

Re: Post your modding questions here

by HeroOfTheWinds » Thu Nov 13, 2014 03:50

Nathan.S wrote:
Krock wrote:
Nathan.S wrote:<snip> I believe that RBA added support a while back. <snip> but I can't find any documentation on it. <snip>

Here you can find a simple use of meshnodes:
https://github.com/RealBadAngel/meshnod ... r/init.lua


Thanks, but I've already got that part figured out, it's the figuring out how to have two different models, or three, for the same node and the engine will place either the top, bottom, or side that's tripping me up.

This is a universal problem with nodes: you can't dynamically change textures/meshes/nodeboxes. You need to register three versions of it, then decide which one to place.
Nam ex spatio, omnes res venire possunt.
Why let the ground limit you when you can reach for the sky?
Back to college now, yay for sophomore year schedules. :P
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Fri Nov 14, 2014 19:13

HeroOfTheWinds wrote:Thanks, but I've already got that part figured out, it's the figuring out how to have two different models, or three, for the same node and the engine will place either the top, bottom, or side that's tripping me up.

This is a universal problem with nodes: you can't dynamically change textures/meshes/nodeboxes. You need to register three versions of it, then decide which one to place.[/quote]
but you can dynamically change objects, the itemframes mod does it
 

User avatar
BrunoMine
Member
 
Posts: 902
Joined: Thu Apr 25, 2013 17:29
GitHub: BrunoMine

How to make indestructible sword?

by BrunoMine » Fri Nov 14, 2014 21:52

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_tool("default:sword_wood", {
   description = "Espada de Madeira",
   inventory_image = "default_tool_woodsword.png",
   tool_capabilities = {
      full_punch_interval = 1.2,
      max_drop_level=0,
      groupcaps={
         snappy={times={[2]=0.01, [3]=0.01}, uses=2, maxlevel=1},
      },
      damage_groups = {fleshy=2},
   }
})

Where should I change?
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

https://github.com/HybridDog/superpick/blob/master/init.lua

by Hybrid Dog » Sat Nov 15, 2014 09:06

brunob.santos wrote:
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_tool("default:sword_wood", {
   description = "Espada de Madeira",
   inventory_image = "default_tool_woodsword.png",
   tool_capabilities = {
      full_punch_interval = 1.2,
      max_drop_level=0,
      groupcaps={
         snappy={times={[2]=0.01, [3]=0.01}, uses=2, maxlevel=1},
      },
      damage_groups = {fleshy=2},
   }
})

Where should I change?
set the uses to 0 could work https://github.com/HybridDog/superpick/ ... it.lua#L29
 

Jericho
New member
 
Posts: 5
Joined: Fri Jun 27, 2014 18:35
In-game: Jericho

Re: Post your modding questions here

by Jericho » Sun Nov 16, 2014 01:56

I want to make it to where when I shift click an item in my chest, it will move the entire stack to the top empty slot in my inventory, and vice versa, how would I do that?
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Mon Nov 17, 2014 01:07

Jericho wrote:I want to make it to where when I shift click an item in my chest, it will move the entire stack to the top empty slot in my inventory, and vice versa, how would I do that?

That's one of the reasons my daughter likes minecraft more. That and the fact that all her friends have it
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

Re: Post your modding questions here

by Sokomine » Mon Nov 17, 2014 23:51

Jericho wrote:I want to make it to where when I shift click an item in my chest, it will move the entire stack to the top empty slot in my inventory, and vice versa, how would I do that?

I'm afraid that can't be done easily with a mod. Perhaps my [url="https://forum.minetest.net/viewtopic.php?f=9&t=10160&hilit=chesttools"]chesttools mod[/url] might help you. It allows to swap your inventory and that of a chest, to drop or take out everything in one go, and even extends that to bags. It's not exactly what you asked for, but probably close enough?
A list of my mods can be found here.
 

User avatar
Linuxdirk
Member
 
Posts: 497
Joined: Wed Sep 17, 2014 11:21
GitHub: dsohler
In-game: Linuxdirk

Re: Post your modding questions here

by Linuxdirk » Tue Nov 18, 2014 00:04

Sokomine wrote:I'm afraid that can't be done easily with a mod.

So you’re saying that whole inventory thing needs a complete re-implementation? :)
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

Re: Post your modding questions here

by Sokomine » Tue Nov 18, 2014 00:12

Linuxdirk wrote:So you’re saying that whole inventory thing needs a complete re-implementation? :)

Not necessarily. Just what was asked for is more complicated because there are no good hooks for that particular functionality. But then, perhaps on_metadata_inventory_take does provide information about which keys where pressed. I'm not sure right now. Anyway, a mod would still be only server-side and not help much on multiplayer servers if it's not installed there. Guess the client could be changed to do that, but it wouldn't be trivial.
A list of my mods can be found here.
 

User avatar
Linuxdirk
Member
 
Posts: 497
Joined: Wed Sep 17, 2014 11:21
GitHub: dsohler
In-game: Linuxdirk

Re: Post your modding questions here

by Linuxdirk » Tue Nov 18, 2014 00:56

Sokomine wrote:but it wouldn't be trivial.

Could maybe solved simultaneously with inventory rewrite because of bug 1374.

I know that a lot of people know or played Minecraft: Their inventory management is actually pretty decent with a lot of great key and mouse button combinations for moving things around (and it’s super smooth even on very high latency servers).
 

User avatar
Linuxdirk
Member
 
Posts: 497
Joined: Wed Sep 17, 2014 11:21
GitHub: dsohler
In-game: Linuxdirk

Re: Post your modding questions here

by Linuxdirk » Sat Nov 22, 2014 19:33

Hey, since I accidentally posted my modding question in the wrong thread I re-post it here :)

As far as I understand mods are loaded individually for each player on a server. Is there a way to load a mod only once – or is there a better solution for having a mod running only once on the server independent of the amount of players?

For example: I write a mod that sets a timer and performs /time 12000 every 5 minutes (I know I can store the time and therefore freeze it, but that’s not my point here. I just use /time because it affects the whole server – You can add any command here if you want *g* AGAIN: The command or changing/setting time is COMPLETELY IRRELEVANT for the question I have!).

5 Players join the game. One player each minute. Since mods are loaded for each player, how do I prevent the time setting to 12000 every minute triggered by each one of the players after 5 minutes? (Or – again – any other command imaginable, since the command is irrelevant for my question, please excuse me repeating that over and over again *g*)

The players are random players and the timer must not be bound to anyone of the players.

Is there something like a “fake player” representing the server where I can bind the timer to?
 

User avatar
ExeterDad
Member
 
Posts: 1121
Joined: Sun Jun 01, 2014 20:00
In-game: ExeterDad

Re: Post your modding questions here

by ExeterDad » Sat Nov 22, 2014 19:41

Linuxdirk wrote:Hey, since I accidentally posted my modding question in the wrong thread I re-post it here :)

As far as I understand mods are loaded individually for each player on a server. Is there a way to load a mod only once – or is there a better solution for having a mod running only once on the server independent of the amount of players?

For example: I write a mod that sets a timer and performs /time 12000 every 5 minutes (I know I can store the time and therefore freeze it, but that’s not my point here. I just use /time because it affects the whole server – You can add any command here if you want *g* AGAIN: The command or changing/setting time is COMPLETELY IRRELEVANT for the question I have!).

5 Players join the game. One player each minute. Since mods are loaded for each player, how do I prevent the time setting to 12000 every minute triggered by each one of the players after 5 minutes? (Or – again – any other command imaginable, since the command is irrelevant for my question, please excuse me repeating that over and over again *g*)

The players are random players and the timer must not be bound to anyone of the players.

Is there something like a “fake player” representing the server where I can bind the timer to?

Isn't the mod only loaded one time server side on start up? Then changed behavior is available from that point on? If you ran your timer with minetest.register_on_joinplayer it would fire with every player joining.

Perhaps I'm misunderstanding your issue also :)
٩(̾●̮̮̃̾•̃̾)۶

Kibbie and I have a beautiful public server now! HOMETOWN
 

User avatar
Linuxdirk
Member
 
Posts: 497
Joined: Wed Sep 17, 2014 11:21
GitHub: dsohler
In-game: Linuxdirk

Re: Post your modding questions here

by Linuxdirk » Sat Nov 22, 2014 19:50

ExeterDad wrote:If you ran your timer with minetest.register_on_joinplayer it would fire with every player joining.

At one point the time must be registered, right? Or can I simply write minetest.after([…]) without any registering function?
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

Re: Post your modding questions here

by Casimir » Sat Nov 22, 2014 20:24

In formspec "list[context;fuel;2,3;1,1;]" What am I supposed to use as "context"?

@ Linuxdirk, the mods only run on the server and they only run once independent from how many players there are. Maybe post a part of your code, so the problem becomes clear.
Last edited by Casimir on Sat Nov 22, 2014 20:57, edited 2 times in total.
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: Post your modding questions here

by Krock » Sat Nov 22, 2014 20:55

Casimir wrote:In formspec "list[context;fuel;2,3;1,1;]" What am I supposed to use as "context"?

"context" is the current node.
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

Re: Post your modding questions here

by Casimir » Sat Nov 22, 2014 20:57

But I get the error that the inventory "undefined" was not found.
I think the problem is because the formspec is defined in a separate function.
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
freiprotector.generate_formspec = function (meta)
   local formspec = "size[8,9]"
      .."label[0,0;Use Minegeld to protect the area.]"
      .."list[context;fuel;0,1;1,1;]"
      .."image[1,1;1,1;freiprotect_fuel.png]"
      .."label[0,2;Members:]"
      .."list[current_player;main;0,5;8,4;]"
end

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
   after_place_node = function(pos, placer)
      local meta = minetest.get_meta(pos)
      meta:set_string("owner", placer:get_player_name() or "")
      meta:set_string("infotext", "Protected by "..meta:get_string("owner"))
      meta:set_string("members", "")
      local inv = meta:get_inventory()
      inv:set_size("fuel", 1)
   end,
   on_rightclick = function(pos, node, clicker, itemstack)
      local meta = minetest.get_meta(pos)
      if freiprotector.can_dig(1, pos, clicker, true) then
         minetest.show_formspec(
            clicker:get_player_name(),
            "freiprotector_"..minetest.pos_to_string(pos),
            freiprotector.generate_formspec(meta)
         )
      end
   end,
 

User avatar
Linuxdirk
Member
 
Posts: 497
Joined: Wed Sep 17, 2014 11:21
GitHub: dsohler
In-game: Linuxdirk

Re: Post your modding questions here

by Linuxdirk » Sat Nov 22, 2014 22:13

[tl;dr]TIL: Lua error messages are useless and Minetest mods aren’t completely parsed before execution :)

Casimir wrote:Maybe post a part of your code, so the problem becomes clear.

While messing around I noticed that mods seem not to be parsed completely before executed.

So while …

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_on_joinplayer(function(player)
   minetest.after(6, doStuffHere)
end)

function doStuffHere()
    -- doing some random stuff here and call the timer again
    minetest.debug(os.date('%X')..': doStuffHere being executed')
    minetest.after(6, doStuffHere)
end

… prints [the current time]: doStuffHere being executed every 6 seconds as expected …

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.after(6, doStuffHere)

function doStuffHere()
    -- doing some random stuff here and call the timer again
    minetest.debug(os.date('%X')..': doStuffHere being executed')
    minetest.after(6, doStuffHere)
end

… breaks with a pretty useless error message telling me about an Invalid core.after invocation […] in function 'assert'. instead of telling me that doStuffHere() was not recognized/defined.

Because when I use …

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
function doStuffHere()
    -- doing some random stuff here and call the timer again
    minetest.debug(os.date('%X')..': doStuffHere being executed')
    minetest.after(6, doStuffHere)
end

minetest.after(6, doStuffHere)

… it works as expected.

I just was confused about the error message and thought the timer has to be registered with something.
 

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 » Sat Nov 22, 2014 22:15

"context" is the location of the inventory. If used in a formspec assigned to a node, it means "use the inventory of this node". Since you are showing the formspec via `show_formspec`, there's no "current node" to speak of.

You will have to modify your `generate_formspec` function to define the node (and thus inventory) location explicitly,
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
freiprotector.generate_formspec = function (location)
   local formspec = "size[8,9]"
      .."label[0,0;Use Minegeld to protect the area.]"
      .."list["..location..";fuel;0,1;1,1;]"
      .."image[1,1;1,1;freiprotect_fuel.png]"
      .."label[0,2;Members:]"
      .."list[current_player;main;0,5;8,4;]"
end


Then in `on_rightclick`:
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
   on_rightclick = function(pos, node, clicker, itemstack)
      local meta = minetest.get_meta(pos)
      if freiprotector.can_dig(1, pos, clicker, true) then
         minetest.show_formspec(
            clicker:get_player_name(),
            "freiprotector_"..minetest.pos_to_string(pos),
            freiprotector.generate_formspec(meta:get_inventory():get_location())
         )
      end
   end,


Please note: the code above is untested.
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
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

Re: Post your modding questions here

by Casimir » Sat Nov 22, 2014 23:45

Ok, location is a table, so I had to use the 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
   local l_xyz = ""..pos.x..","..pos.y..","..pos.z..""

      .."list[nodemeta:"..l_xyz..";fuel;0,1;1,1;]"

It somehow looks ugly, but it works.
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Sun Nov 23, 2014 10:05

Linuxdirk wrote:[tl;dr]TIL: Lua error messages are useless and Minetest mods aren’t completely parsed before execution :)

Casimir wrote:Maybe post a part of your code, so the problem becomes clear.

While messing around I noticed that mods seem not to be parsed completely before executed.

So while …

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_on_joinplayer(function(player)
   minetest.after(6, doStuffHere)
end)

function doStuffHere()
    -- doing some random stuff here and call the timer again
    minetest.debug(os.date('%X')..': doStuffHere being executed')
    minetest.after(6, doStuffHere)
end

… prints [the current time]: doStuffHere being executed every 6 seconds as expected …

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.after(6, doStuffHere)

function doStuffHere()
    -- doing some random stuff here and call the timer again
    minetest.debug(os.date('%X')..': doStuffHere being executed')
    minetest.after(6, doStuffHere)
end

… breaks with a pretty useless error message telling me about an Invalid core.after invocation […] in function 'assert'. instead of telling me that doStuffHere() was not recognized/defined.

Because when I use …

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
function doStuffHere()
    -- doing some random stuff here and call the timer again
    minetest.debug(os.date('%X')..': doStuffHere being executed')
    minetest.after(6, doStuffHere)
end

minetest.after(6, doStuffHere)

… it works as expected.

I just was confused about the error message and thought the timer has to be registered with something.

The mod is loaded from the top left to the bottom right, I think. So doStuffHere is nil when minetest.after puts it into its table of functions and timers.
The mods of a server aren't run on every cIient, just the server uses them, the clients may be modified by them.
 

Zeno Effect
Member
 
Posts: 14
Joined: Tue Nov 25, 2014 22:46
In-game: Zeno_Effect

Re: Post your modding questions here

by Zeno Effect » Fri Nov 28, 2014 04:41

I have tried looking it up but can not find an answer anywhere. Can someone tell me how you use a command block and what exactly you can do with one?
 

Hybrid Dog
Member
 
Posts: 2460
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Fri Nov 28, 2014 18:33

Zeno Effect wrote:I have tried looking it up but can not find an answer anywhere. Can someone tell me how you use a command block and what exactly you can do with one?

Do you mean the one of mesecons?
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Fri Nov 28, 2014 19:23

Hybrid Dog wrote:
Zeno Effect wrote:I have tried looking it up but can not find an answer anywhere. Can someone tell me how you use a command block and what exactly you can do with one?

Do you mean the one of mesecons?

If you do mean mesecoms then look here. http://mesecons.net/items.php
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

Zeno Effect
Member
 
Posts: 14
Joined: Tue Nov 25, 2014 22:46
In-game: Zeno_Effect

Re: Post your modding questions here

by Zeno Effect » Fri Nov 28, 2014 22:34

I do mean the mesecon one and all it says on their site is it is like the one in minecraft but give no direction how how to input commands, if it needs to be powered, etc.

This is exactly what mesecons.net has to say about the command block....

"Command block

Craft recipe
There is no crafting recipe as this should only be available for server admins.

Description
Quite similar to the Minecraft counterpart. Executes server commands."

but this does not really tell me anything about how to use it and how it is activated.
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Post your modding questions here

by Don » Sat Nov 29, 2014 00:03

If you ask on the mesecon thread you might get an answer. Jeija is back from what I hear and hopefully Mesecons will be maintained and forum questions answered in a timely manor.
https://forum.minetest.net/viewtopic.php?id=628
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

Zeno Effect
Member
 
Posts: 14
Joined: Tue Nov 25, 2014 22:46
In-game: Zeno_Effect

Re: Post your modding questions here

by Zeno Effect » Sat Nov 29, 2014 06:06

Cool, thanks for telling me about it Don. I will check it out soon. :)
 

Rochambeau
Member
 
Posts: 68
Joined: Tue Sep 23, 2014 11:37

Re: Post your modding questions here

by Rochambeau » Tue Dec 09, 2014 19:28

How can i modify existing mobs mods (for example Mobs Redo oder Creatures) to prevent spawning hostile mobs in protected areas?
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: Post your modding questions here

by TenPlus1 » Tue Dec 09, 2014 19:56

In Mobs Redo mod, edit the api.lua file and insert the following after line:794

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
-- Check protection under bogus nick so protected areas are safe from mobs
if minetest.is_protected(pos, "-") then
   return
end
 

User avatar
srifqi
Member
 
Posts: 508
Joined: Sat Jun 28, 2014 04:31
GitHub: srifqi
IRC: srifqi
In-game: srifqi

Re: Post your modding questions here

by srifqi » Wed Dec 10, 2014 08:58

Topic: Set Configuration
I've tried to add this simple code inside 'builtin' mod 'mainmenu' folder:
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
core.setting_set("example_configuration","LOL")

But, Minetest doesn't save the configuration and send me this in debug.txt
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
ERROR[main]: Error writing configuration file: "path\to\minetest\bin\..\minetest.conf"
ERROR[main]: Error writing configuration file: "path\to\minetest\bin\..\minetest.conf"

What's wrong with my code?
I'm from Indonesia! Saya dari Indonesia!
Terjemahkan Minetest!
Mods by me. Modifikasi oleh saya.

Pronounce my nick as in: es-rifqi (IPA: /es rifˈki/)
 

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 » Wed Dec 10, 2014 10:40

It was reported here.
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
 

PreviousNext

Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 12 guests

cron