Post your modding questions here
- kaeza
- Moderator
- Posts: 2162
- Joined: Thu Oct 18, 2012 05:00
- GitHub: kaeza
- IRC: kaeza diemartin blaaaaargh
- In-game: kaeza
- Location: Montevideo, Uruguay
- Contact:
@LionsDen: nope, sorry. that is the only way ATM
@miner: this is not the place to post such questions; there are a few topics about the subject (this is the most comprehensive one).
@miner: this is not the place to post such questions; there are a few topics about the subject (this is the most comprehensive one).
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
-
- New member
- Posts: 1
- Joined: Fri Aug 02, 2013 19:10
- fairiestoy
- Member
- Posts: 191
- Joined: Sun Jun 09, 2013 19:25
- Location: Germany
A little performance question. Im currently using this code:
Is it way more efficient to use the minetest.after(time, func, ...) routine? Globalstep would call my method every 0.05s (default). But with this alternative routine, its only called once but it needs performance for timing. So what would be the more efficient solution?
Code: Select all
function set_remote( name, param )
if param == "on" then
RC = true
else
RC = false
end
minetest.register_globalstep( rc_check )
end
function rc_check( dtime )
-- since we dont know a possible way of removing this function from minetest.globalstep,
-- just ignore further process
if RC == false then
return
elseif RC_TIMER < RC_INTERVAL then
-- we also dont want to spam a io command. SO just do it every 20 ticks (has maybe to be tweaked)
RC_TIMER = RC_TIMER + 1
return
end
RC_TIMER = 0
-- check a file for any commands in it
local mod_path = minetest.get_modpath( "timer_shutdown" )
local rc_file = io.open( mod_path..""..package.config:sub(1,1).."rc_com"..package.config:sub(1,1).."rc_file.txt", "r")
-- parsing part
local index = 1
local rccom_request = {}
for line in rc_file:lines() do
if line == nil then
break
end
for word in string.gmatch( line, "([^ ]+)" ) do
rccom_request[index] = word
index = index + 1
end
end
-- Structure of rc files: name reason shutdown time
local name = rccom_request[1]
local reason = rccom_request[2]
local time = tonumber( rccom_request[3] )
minetest.chat_send_all("*** "..name.." requested Shutdown for "..reason.." in "..time.."s")
RC = false
minetest.log( "action", name.." has initialized a remote Shutdown because of "..reason )
INTERVAL = time
minetest.register_globalstep( queue_shutdown )
-- cleanup
io.close( rc_file )
rc_file = io.open( mod_path..""..package.config:sub(1,1).."rc_com"..package.config:sub(1,1).."rc_file.txt", "w" )
io.close( rc_file )
end
Last edited by fairiestoy on Fri Aug 02, 2013 20:20, edited 1 time in total.
Interesting about new things is, to figure out how it works ...
I want the mod I'm creating to do it, not the user in a chat command. I just had to use the inefficient method of creating a bunch of nodes that are only different in texture and place each one successively using the minetest.after command. It does the job, but is not very nice looking in code esthetics.Hybrid Dog wrote:@LionsDen: maybe it works with /luatransform
What version of minetest do you use? You'll need a higher version than 0.3.x. So a 0.4..x version. Most mods work best with the git (latest) version which is not too difficult to install and compile, following this readme.txt (scroll down till -- Compiling on GNU/Linux:):bhaskar1234 wrote:Topic: How to Install Mods on Linux Ubuntu
Reason: I want to install a mod that adds mobs into Minetest
More Info: I tried to do it the way its suggested on the website but it still didn't work
https://github.com/minetest/minetest
If you experience troubles after that, read this post from Nore:
viewtopic.php?id=6450
Did that, still doesn't work.deivan wrote:Try remove the "local" word and test again. If I remember correctly the local cause some trouble some times.
So, the question still stands... how do you properly call facedir_to_dir?
I'm running 0.4.13 stable with [technic][carts][farming_plus][biome_lib][unified_inventory] and a few other mods.
- kaeza
- Moderator
- Posts: 2162
- Joined: Thu Oct 18, 2012 05:00
- GitHub: kaeza
- IRC: kaeza diemartin blaaaaargh
- In-game: kaeza
- Location: Montevideo, Uruguay
- Contact:
That depends if you just want an animated texture, or want the node to change when interacted with (punched/right-clicked). Homedecor has some example for these. The TV is animated, while the table lamp changes when you punch it.LionsDen wrote:I want the mod I'm creating to do it, not the user in a chat command. I just had to use the inefficient method of creating a bunch of nodes that are only different in texture and place each one successively using the minetest.after command. It does the job, but is not very nice looking in code esthetics.Hybrid Dog wrote:@LionsDen: maybe it works with /luatransform
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
What I wanted was when I punched the node, it activated it. In other words, a replacement node is put there and then a sort of animated countdown timer would go. After about 8 seconds with 1 frame per second shown it would finally do the action I have planned for it. I got the action down and I can play an animated texture on a node but the animation isn't reliable. It starts at seemingly random frames. The only way I could get the animation effect I wanted was to create 8 nodes and use the minetest.after command to place each one sequentially with the final action taking place afterwards. So I require the animation to always start at frame number 1, not somewhere else because it looks ridiculous. Unfortunately, the engine doesn't seem to be able to do that so I had to code an inelegant work around kludge. It works, it's just a lot more nodes registered and a bit more code to handle.kaeza wrote:That depends if you just want an animated texture, or want the node to change when interacted with (punched/right-clicked). Homedecor has some example for these. The TV is animated, while the table lamp changes when you punch it.
deivan wrote:I found this function inside the file item.lua inside the folder minetest/builtin. You have this one?
Interesting... I've got minetest.dir_to_facedir(dir) in item.lua, but not facedir_to_dir.
Edit:
Copied over the dir_to_facedir and facedir_to_dir from latest git, it works.
Edit2:
'Nother question: if static_spawnpoint is not set in minetest.conf, how large is the spawn area?
Last edited by Exilyth on Sun Aug 04, 2013 11:21, edited 1 time in total.
I'm running 0.4.13 stable with [technic][carts][farming_plus][biome_lib][unified_inventory] and a few other mods.
- fairiestoy
- Member
- Posts: 191
- Joined: Sun Jun 09, 2013 19:25
- Location: Germany
I have a little problem. The following routine seems not to work:
from the API doc on Github.
i always get a nil reference to this function. Did it changed to some extend? Im using the stable 0.4.7 client for server testing.
Code: Select all
vector.distance(p1, p2) -> number
i always get a nil reference to this function. Did it changed to some extend? Im using the stable 0.4.7 client for server testing.
Interesting about new things is, to figure out how it works ...
- fairiestoy
- Member
- Posts: 191
- Joined: Sun Jun 09, 2013 19:25
- Location: Germany
- fairiestoy
- Member
- Posts: 191
- Joined: Sun Jun 09, 2013 19:25
- Location: Germany
Would be nice if someone could answer, what way would be more efficient. :3fairiestoy wrote:A little performance question. Im currently using this code:Is it way more efficient to use the minetest.after(time, func, ...) routine? Globalstep would call my method every 0.05s (default). But with this alternative routine, its only called once but it needs performance for timing. So what would be the more efficient solution?Code: Select all
function set_remote( name, param ) if param == "on" then RC = true else RC = false end minetest.register_globalstep( rc_check ) end function rc_check( dtime ) -- since we dont know a possible way of removing this function from minetest.globalstep, -- just ignore further process if RC == false then return elseif RC_TIMER < RC_INTERVAL then -- we also dont want to spam a io command. SO just do it every 20 ticks (has maybe to be tweaked) RC_TIMER = RC_TIMER + 1 return end RC_TIMER = 0 -- check a file for any commands in it local mod_path = minetest.get_modpath( "timer_shutdown" ) local rc_file = io.open( mod_path..""..package.config:sub(1,1).."rc_com"..package.config:sub(1,1).."rc_file.txt", "r") -- parsing part local index = 1 local rccom_request = {} for line in rc_file:lines() do if line == nil then break end for word in string.gmatch( line, "([^ ]+)" ) do rccom_request[index] = word index = index + 1 end end -- Structure of rc files: name reason shutdown time local name = rccom_request[1] local reason = rccom_request[2] local time = tonumber( rccom_request[3] ) minetest.chat_send_all("*** "..name.." requested Shutdown for "..reason.." in "..time.."s") RC = false minetest.log( "action", name.." has initialized a remote Shutdown because of "..reason ) INTERVAL = time minetest.register_globalstep( queue_shutdown ) -- cleanup io.close( rc_file ) rc_file = io.open( mod_path..""..package.config:sub(1,1).."rc_com"..package.config:sub(1,1).."rc_file.txt", "w" ) io.close( rc_file ) end
Interesting about new things is, to figure out how it works ...
-
- Member
- Posts: 122
- Joined: Wed Apr 10, 2013 16:46
You should be able to do this by using an item group for the node that isn't used in other nodes and set that group to be breakable in the tool's capabilities.PenguinDad wrote:Is it possible that a node can only digged with a specific tool e.g. :Spoiler
I want to have node that you can only dig with a mithril pick.
I'm not aware of a sane way of doing this when the tool's definition doesn't contain a suitable group. (you can always redefine tools though)
-
- Member
- Posts: 122
- Joined: Wed Apr 10, 2013 16:46
Thanks.celeron55 wrote:You should be able to do this by using an item group for the node that isn't used in other nodes and set that group to be breakable in the tool's capabilities.PenguinDad wrote:Is it possible that a node can only digged with a specific tool e.g. :Spoiler
I want to have node that you can only dig with a mithril pick.
I'm not aware of a sane way of doing this when the tool's definition doesn't contain a suitable group. (you can always redefine tools though)
Topic: How do I get mods to work in game?
Reason: Because I want to install some mods
More Info: I install them into the correct folder but always get the same message:
"ModError: Failed to load and run
C:\Users\CC-JAR\Desktop\games\minetest\bin\..\mods\minetest\mesecons\init.lua"
even more info: Not sure if it matters but I'm running windows 7 64-bit.
Reason: Because I want to install some mods
More Info: I install them into the correct folder but always get the same message:
"ModError: Failed to load and run
C:\Users\CC-JAR\Desktop\games\minetest\bin\..\mods\minetest\mesecons\init.lua"
even more info: Not sure if it matters but I'm running windows 7 64-bit.
Last edited by lunisol on Wed Aug 07, 2013 05:08, edited 1 time in total.
You have it installed in minetest\mods\minetest\mesecons when it should be in minetest\mods\mesecons instead. The mod's directory needs to be in the directory name mods unless it's a modpack and then the modpack's directory needs to be in the mods directory. Hope this doesn't confuse you too much, just make note of the apostrophes.lunisol wrote:Topic: How do I get mods to work in game?
Reason: Because I want to install some mods
More Info: I install them into the correct folder but always get the same message:
"ModError: Failed to load and run
C:\Users\CC-JAR\Desktop\games\minetest\bin\..\mods\minetest\mesecons\init.lua"
even more info: Not sure if it matters but I'm running windows 7 64-bit.
Ok, thanks, It's not showing that error anymore and it's loading, but it's still not working in game. I have Jeija's Mesecon mod but I can't forge mesecons from mese. I tried going into configure but it says "there is nothing here"LionsDen wrote:You have it installed in minetest\mods\minetest\mesecons when it should be in minetest\mods\mesecons instead. The mod's directory needs to be in the directory name mods unless it's a modpack and then the modpack's directory needs to be in the mods directory. Hope this doesn't confuse you too much, just make note of the apostrophes.lunisol wrote:Topic: How do I get mods to work in game?
Reason: Because I want to install some mods
More Info: I install them into the correct folder but always get the same message:
"ModError: Failed to load and run
C:\Users\CC-JAR\Desktop\games\minetest\bin\..\mods\minetest\mesecons\init.lua"
even more info: Not sure if it matters but I'm running windows 7 64-bit.
Can you type out the path where you have the init.lua file, that file and the other files and folders are. All of that should be in the folder minetest\mods\mesecons\. If it isn't, it's not recognized by the game.lunisol wrote:Ok, thanks, It's not showing that error anymore and it's loading, but it's still not working in game. I have Jeija's Mesecon mod but I can't forge mesecons from mese. I tried going into configure but it says "there is nothing here"
all files are in C:\Users\..\minetest\mods\mesecons.LionsDen wrote:Can you type out the path where you have the init.lua file, that file and the other files and folders are. All of that should be in the folder minetest\mods\mesecons\. If it isn't, it's not recognized by the game.lunisol wrote:Ok, thanks, It's not showing that error anymore and it's loading, but it's still not working in game. I have Jeija's Mesecon mod but I can't forge mesecons from mese. I tried going into configure but it says "there is nothing here"
its a big pack of mods so the init.lua files are in their seperate folders in the mesecon folder.
(ex:
Minetest
|>mods
|>mesecons
|>Mesecons
Mesecons_alias
Mesecons_blinkyplant
Mesecons_button
Mesecons_commandblock
etc.. )
with the appropriate init.lua files in each of their own folders.
Last edited by lunisol on Thu Aug 08, 2013 22:47, edited 1 time in total.
That looks right to me. Are you using a recent version of minetest? I wonder if mesecons has changes to it that requires the latest git or something. I haven't used mesecons, pipeworks or technic for a while now because my system is just too slow for all of the abms and such.lunisol wrote:all files are in C:\Users\..\minetest\mods\mesecons.
its a big pack of mods so the init.lua files are in their seperate folders in the mesecon folder.
(ex:
Minetest
|>mods
|>mesecons
|>Mesecons
Mesecons_alias
Mesecons_blinkyplant
Mesecons_button
Mesecons_commandblock
etc.. )
with the appropriate init.lua files in each of their own folders.
Who is online
Users browsing this forum: No registered users and 9 guests