HeroOfTheWinds wrote:So, while trying to modify paramat's floatindev mod, I ran into a very vexing problem: Many of the blocks that the voxelmanip generates, including default:gravel and a couple moreblocks nodes are added to the world as fire:basic_flame. However, other blocks that I added such as obsidian and dirt_with_snow are generating perfectly fine. Near the beginning of the code, I check to see if moreblocks is installed before redefining the nodes from it I'm using so as to turn is_ground_content false. Does anyone know what could be causing this?
When using the LuaVM you don't work with the node names but the contend id. Fire has some special number (either zero or one) and therefor is used when there is an invalid id. So make sure you get the right id and there is no typo. Kind of funny that a small mistake can make the whole world go into flames.
edit: Oh, it was already answered - on the next page.
Is there a way to change how many items the middle click takes/places? I don't think so, so take this as a feature request.
@ DeepGaze
A position is a table {x, y, z}. When you do "bloobxyz = param" then you only have a string. Look into "minetest/builtin/chatcommands.lua". I think you can copy-paste most of the teleport command.
HeroOfTheWinds wrote:So, while trying to modify paramat's floatindev mod, I ran into a very vexing problem: Many of the blocks that the voxelmanip generates, including default:gravel and a couple moreblocks nodes are added to the world as fire:basic_flame. However, other blocks that I added such as obsidian and dirt_with_snow are generating perfectly fine. Near the beginning of the code, I check to see if moreblocks is installed before redefining the nodes from it I'm using so as to turn is_ground_content false. Does anyone know what could be causing this?
Thanks for the help. After posting this last night, I kept at it for about half an hour more, and found the problem. I knew it was relating to unknown nodes, but since I double checked my spelling and the names of the mods, I knew it was a logic error. And indeed it was. At the start of my code, I had something along these lines:
local mblocks = false
if (minetest.get_modpath("moreblocks")) then
mblocks = true
end
What my error was, is that the logic statement was never run since it was not in any function. Silly error, but after correcting it, everything is going good. Volcano biomes with optional coal_stone depending on mods installed are now working. This error has one more benefit: I'm thinking of purposely adding fire to that biome as a surface generation similar to grass. :P
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
local mblocks = minetest.get_modpath("moreblocks")
Returns string or nil. Doesn't matter, you can use it the same way as boolean.
Good idea, thanks! I'll implement that in the code. Will that run outside of any functions?
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
MrIbby wrote:Topic: What text editor(s) do you guys recommend?
Reason: I'm making a mod and using WordPad.
I highly recommend LuaEdit. I've been using it extensively, and it has many basic features that really help out. Plus, WordPad doesn't have syntax highlighting.
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
MrIbby wrote:Topic: What text editor(s) do you guys recommend?
Reason: I'm making a mod and using WordPad.
WordPad isn't good for modding. You need a syntax highlighter.
I'm using Notepad++ like LionsDen, that one also supports other languages like python, batch and php...
Thank you all very much! I tried using LuaEdit, but it doesn't let me highlight large selections with double click... Notepad++, however, is very easy to use.
Is it possible to add items to chests when a abm turns a random node into a chest? I've added a block that turns into a chest, and tried several ways of filling it, none of which have worked... What I want is a few (random) items inside a chest, which is added to the world via an abm. Other ways of adding a chest with things in would work as well. Thanks!
Last edited by Amaz on Tue Apr 29, 2014 21:42, edited 1 time in total.
I would like to be able to, under certain circumstances, set the players yaw to match a vehicles yaw.
Actually, I wouldn't HAVE to change the players yaw, I just need to make the camera direction change to match the direction the vehicle is moving. (when the player has deliberately chosen to lock their view to the vehicles)
But I can't figure out how to do this through lua. I can do a setyaw on an object, but it doesn't seem to work on a player. There is a get_look_yaw() function, but no set_look_yaw() function.
Is there a way to do this, or have the developers chosen that it is not wise to let mods change the players yaw or the camera direction?
Kilarin wrote:I would like to be able to, under certain circumstances, set the players yaw to match a vehicles yaw.
Actually, I wouldn't HAVE to change the players yaw, I just need to make the camera direction change to match the direction the vehicle is moving. (when the player has deliberately chosen to lock their view to the vehicles)
But I can't figure out how to do this through lua. I can do a setyaw on an object, but it doesn't seem to work on a player. There is a get_look_yaw() function, but no set_look_yaw() function.
Is there a way to do this, or have the developers chosen that it is not wise to let mods change the players yaw or the camera direction?
Amaz wrote:Is it possible to add items to chests when a abm turns a random node into a chest? I've added a block that turns into a chest, and tried several ways of filling it, none of which have worked... What I want is a few (random) items inside a chest, which is added to the world via an abm. Other ways of adding a chest with things in would work as well. Thanks!
Well, the way I would try it is to define your own treasure chest with a second abm, have your current abm spawn the special chest, then use the new abm to call inv = minetest.get_inventory() on the new node, generate a random ItemStack, then call inv:add_item() to add the random itemstack, and loop it over as many times as needed. Once that is done, swap the node with a regular chest to stop the abm.
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
yet another yaw question.
player:get_look_yaw() and player:set_look_yaw() don't seem to be using the same offset.
When I do a set_look_yaw(1.57) and follow up with a get_look_yaw, the value returned is 3.14. Setting 3.14 returns 4.71 etc. It looks like the values returned from get_look_yaw are offset by +1/2 pi from the values put in to set_look_yaw.
Amaz wrote:Is it possible to add items to chests when a abm turns a random node into a chest? I've added a block that turns into a chest, and tried several ways of filling it, none of which have worked... What I want is a few (random) items inside a chest, which is added to the world via an abm. Other ways of adding a chest with things in would work as well. Thanks!
Well, the way I would try it is to define your own treasure chest with a second abm, have your current abm spawn the special chest, then use the new abm to call inv = minetest.get_inventory() on the new node, generate a random ItemStack, then call inv:add_item() to add the random itemstack, and loop it over as many times as needed. Once that is done, swap the node with a regular chest to stop the abm.
That's just what I was looking for, thanks!
Do you have any example code? I'm not to good at "complex" things... Thanks for your help!