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.Nathan.S 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.Krock wrote:Here you can find a simple use of meshnodes:Nathan.S wrote:<snip> I believe that RBA added support a while back. <snip> but I can't find any documentation on it. <snip>
https://github.com/RealBadAngel/meshnod ... r/init.lua
Post your modding questions here
- HeroOfTheWinds
- Member
- Posts: 470
- Joined: Wed Apr 23, 2014 23:16
- GitHub: HeroOfTheWinds
- IRC: WindHero
- Location: Hawaii
Re: Post your modding questions here
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
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: 2836
- Joined: Thu Nov 01, 2012 12:46
- GitHub: HybridDog
Re: Post your modding questions here
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]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.
but you can dynamically change objects, the itemframes mod does it
- BrunoMine
- Member
- Posts: 1082
- Joined: Thu Apr 25, 2013 17:29
- GitHub: BrunoMine
- Location: SP-Brasil
- Contact:
How to make indestructible sword?
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},
}
})
- Hybrid Dog
- Member
- Posts: 2836
- Joined: Thu Nov 01, 2012 12:46
- GitHub: HybridDog
https://github.com/HybridDog/superpick/blob/master/init.lua
set the uses to 0 could work https://github.com/HybridDog/superpick/ ... it.lua#L29brunob.santos wrote:Where should I change?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}, } })
Re: Post your modding questions here
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?
Re: Post your modding questions here
That's one of the reasons my daughter likes minecraft more. That and the fact that all her friends have itJericho 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?
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
A list of my mods can be found here
-
- Member
- Posts: 4290
- Joined: Sun Sep 09, 2012 17:31
- GitHub: Sokomine
- IRC: Sokomine
- In-game: Sokomine
Re: Post your modding questions here
I'm afraid that can't be done easily with a mod. Perhaps my chesttools mod 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?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?
A list of my mods can be found here.
- Linuxdirk
- Member
- Posts: 3219
- Joined: Wed Sep 17, 2014 11:21
- In-game: Linuxdirk
- Location: Germany
- Contact:
Re: Post your modding questions here
So you’re saying that whole inventory thing needs a complete re-implementation? :)Sokomine wrote:I'm afraid that can't be done easily with a mod.
-
- Member
- Posts: 4290
- Joined: Sun Sep 09, 2012 17:31
- GitHub: Sokomine
- IRC: Sokomine
- In-game: Sokomine
Re: Post your modding questions here
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.Linuxdirk wrote: So you’re saying that whole inventory thing needs a complete re-implementation? :)
A list of my mods can be found here.
- Linuxdirk
- Member
- Posts: 3219
- Joined: Wed Sep 17, 2014 11:21
- In-game: Linuxdirk
- Location: Germany
- Contact:
Re: Post your modding questions here
Could maybe solved simultaneously with inventory rewrite because of bug 1374.Sokomine wrote:but it wouldn't be trivial.
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).
- Linuxdirk
- Member
- Posts: 3219
- Joined: Wed Sep 17, 2014 11:21
- In-game: Linuxdirk
- Location: Germany
- Contact:
Re: Post your modding questions here
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?
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?
- ExeterDad
- Member
- Posts: 1717
- Joined: Sun Jun 01, 2014 20:00
- In-game: ExeterDad
- Location: New Hampshire U.S.A
Re: Post your modding questions here
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.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?
Perhaps I'm misunderstanding your issue also :)
HOMETOWN -Our little server. Keep the HOMETOWN chatter @ http://hometownserver.com - Our server map: http://media.hometownserver.com
- Linuxdirk
- Member
- Posts: 3219
- Joined: Wed Sep 17, 2014 11:21
- In-game: Linuxdirk
- Location: Germany
- Contact:
Re: Post your modding questions here
At one point the time must be registered, right? Or can I simply write minetest.after([…]) without any registering function?ExeterDad wrote:If you ran your timer with minetest.register_on_joinplayer it would fire with every player joining.
- Casimir
- Member
- Posts: 1207
- Joined: Fri Aug 03, 2012 16:59
- GitHub: CasimirKaPazi
Re: Post your modding questions here
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.
@ 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.
- Krock
- Developer
- Posts: 4650
- Joined: Thu Oct 03, 2013 07:48
- GitHub: SmallJoker
- Location: Switzerland
- Contact:
Re: Post your modding questions here
"context" is the current node.Casimir wrote:In formspec "list[context;fuel;2,3;1,1;]" What am I supposed to use as "context"?
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
- Casimir
- Member
- Posts: 1207
- Joined: Fri Aug 03, 2012 16:59
- GitHub: CasimirKaPazi
Re: Post your modding questions here
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.
The node:
I think the problem is because the formspec is defined in a separate function.
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
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,
- Linuxdirk
- Member
- Posts: 3219
- Joined: Wed Sep 17, 2014 11:21
- In-game: Linuxdirk
- Location: Germany
- Contact:
Re: Post your modding questions here
[tl;dr]TIL: Lua error messages are useless and Minetest mods aren’t completely parsed before execution :)
So while …
… prints [the current time]: doStuffHere being executed every 6 seconds as expected …
… 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 …
… it works as expected.
I just was confused about the error message and thought the timer has to be registered with something.
While messing around I noticed that mods seem not to be parsed completely before executed.Casimir wrote:Maybe post a part of your code, so the problem becomes clear.
So while …
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
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
Because when I use …
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)
I just was confused about the error message and thought the timer has to be registered with something.
- kaeza
- Moderator
- Posts: 2162
- Joined: Thu Oct 18, 2012 05:00
- GitHub: kaeza
- IRC: kaeza diemartin blaaaaargh
- In-game: kaeza
- Location: Montevideo, Uruguay
- Contact:
Re: Post your modding questions here
"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,
Then in `on_rightclick`:
Please note: the code above is untested.
You will have to modify your `generate_formspec` function to define the node (and thus inventory) location explicitly,
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
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,
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
Check out my stuff! | Donations greatly appreciated! PayPal
- Casimir
- Member
- Posts: 1207
- Joined: Fri Aug 03, 2012 16:59
- GitHub: CasimirKaPazi
Re: Post your modding questions here
Ok, location is a table, so I had to use the position.
It somehow looks ugly, but it works.
Code: Select all
local l_xyz = ""..pos.x..","..pos.y..","..pos.z..""
.."list[nodemeta:"..l_xyz..";fuel;0,1;1,1;]"
- Hybrid Dog
- Member
- Posts: 2836
- Joined: Thu Nov 01, 2012 12:46
- GitHub: HybridDog
Re: Post your modding questions here
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.Linuxdirk wrote:[tl;dr]TIL: Lua error messages are useless and Minetest mods aren’t completely parsed before execution :)
While messing around I noticed that mods seem not to be parsed completely before executed.Casimir wrote:Maybe post a part of your code, so the problem becomes clear.
So while …
… prints [the current time]: doStuffHere being executed every 6 seconds as expected …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
… 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.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
Because when I use …
… it works as expected.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)
I just was confused about the error message and thought the timer has to be registered with something.
The mods of a server aren't run on every cIient, just the server uses them, the clients may be modified by them.
-
- Member
- Posts: 14
- Joined: Tue Nov 25, 2014 22:46
- In-game: Zeno_Effect
Re: Post your modding questions here
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: 2836
- Joined: Thu Nov 01, 2012 12:46
- GitHub: HybridDog
Re: Post your modding questions here
Do you mean the one of mesecons?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?
Re: Post your modding questions here
If you do mean mesecoms then look here. http://mesecons.net/items.phpHybrid Dog wrote:Do you mean the one of mesecons?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?
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
A list of my mods can be found here
-
- Member
- Posts: 14
- Joined: Tue Nov 25, 2014 22:46
- In-game: Zeno_Effect
Re: Post your modding questions here
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.
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.
Re: Post your modding questions here
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.
viewtopic.php?id=628
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
A list of my mods can be found here
Who is online
Users browsing this forum: No registered users and 13 guests