local direction = minetest:facedir_to_dir(minetest.env:get_node(pos).param2)
local direction = minetest.facedir_to_dir(minetest.env:get_node(pos).param2)
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
Hybrid Dog wrote:@LionsDen: maybe it works with /luatransform
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
deivan wrote:Try remove the "local" word and test again. If I remember correctly the local cause some trouble some times.
LionsDen wrote:Hybrid Dog wrote:@LionsDen: maybe it works with /luatransform
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.
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?
vector.distance(p1, p2) -> number
fairiestoy wrote:A little performance question. Im currently using this code: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 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
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?
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.[/spoiler]
celeron55 wrote: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.[/spoiler]
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.
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)
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.
LionsDen wrote: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.
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: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: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"
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: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.
Users browsing this forum: No registered users and 15 guests