Post your modding questions here

User avatar
Topywo
Member
 
Posts: 1721
Joined: Fri May 18, 2012 20:27

Re: Post your modding questions here

by Topywo » Fri Apr 25, 2014 08:40

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?


Maybe this is a relevant link:

viewtopic.php?f=9&t=7383


Edit: Quote and typo.
 

User avatar
fishyWET
Member
 
Posts: 160
Joined: Tue Jan 01, 2013 07:43
Location: Nowhere
GitHub: neinwhal
IRC: neinwhal

Re: Post your modding questions here

by fishyWET » Fri Apr 25, 2014 09:17

-
Last edited by fishyWET on Tue Apr 04, 2017 06:30, edited 1 time in total.
 

Kilarin
Member
 
Posts: 778
Joined: Mon Mar 10, 2014 00:36

Re: Post your modding questions here

by Kilarin » Fri Apr 25, 2014 11:56

Is that a bug, or a really awesome looking feature! :)
 

User avatar
Casimir
Member
 
Posts: 1163
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

Re: Post your modding questions here

by Casimir » Fri Apr 25, 2014 12:01

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.
 

User avatar
Jordach
Member
 
Posts: 4523
Joined: Mon Oct 03, 2011 17:58
Location: Blender Scene
GitHub: Jordach
IRC: Jordach
In-game: Jordach

Re: Post your modding questions here

by Jordach » Fri Apr 25, 2014 15:56

Image

I'm trying to make small pools of oil, rather than that mess you can see there, anyone got a fix to it to make it a real pool of liquid?
 

User avatar
Hybrid Dog
Member
 
Posts: 2727
Joined: Thu Nov 01, 2012 12:46

Re: Post your modding questions here

by Hybrid Dog » Fri Apr 25, 2014 17:05

Jordach wrote:Image

I'm trying to make small pools of oil, rather than that mess you can see there, anyone got a fix to it to make it a real pool of liquid?

If you use the sheet ore generation, you could use minetest.on_generated and perlin instead.

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪
 

User avatar
DeepGaze
Member
 
Posts: 332
Joined: Fri May 10, 2013 00:49
Location: Take your best guess
GitHub: DeepGaze
IRC: DeepGaze
In-game: DeepGaze

Re: Post your modding questions here

by DeepGaze » Fri Apr 25, 2014 17:08

what is wrong with this and how can i fix it:
Code: Select all
minetest.register_node("bloop:console", {
  -- ...
  on_punch = function(pos, node, puncher, pointed_thing)
    puncher:setpos({bloopxyz})
  end,
  -- ...
})
bloopxyz = "t/xyz"
minetest.register_chatcommand("t/xyz", {
    params = "bloopxyz",
    description = "send bloop to",
    privs = {bloopcontroller=false},
    func = function(name, param)
        bloopxyz = param
        minetest.chat_send_all(name.." sets the value to "..param)
    end,
})
there's no place like 127.0.0.1
The deep life Minetest text page
minetest cards
 

User avatar
Casimir
Member
 
Posts: 1163
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

Re: Post your modding questions here

by Casimir » Fri Apr 25, 2014 18:14

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.
 

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

Re: Post your modding questions here

by HeroOfTheWinds » Fri Apr 25, 2014 20:53

Topywo wrote:
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?


Maybe this is a relevant link:

viewtopic.php?f=9&t=7383


Edit: Quote and typo.

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:
Code: Select all
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
 

User avatar
Pavel_S
Member
 
Posts: 131
Joined: Sat Apr 06, 2013 11:43

Re: Post your modding questions here

by Pavel_S » Sat Apr 26, 2014 06:50

There is no "get_id()" function for entity in "lua_api.txt" .
But "minetest.luaentities" returns id`s of active entities.

So, how I can get id of "richt_clicked_entity" and get entity by id?
Of course, I can get entity by id just using
Code: Select all
function get_entity_by_id(id)
for k,v in pairs(minetest.luaentities) do
        if k == id then
         return v
   end
end

, but it`s not efficient way, if there is a lot of active objects.
 

User avatar
mimilus
Member
 
Posts: 75
Joined: Thu Mar 06, 2014 09:08
Location: France
GitHub: mimilus
IRC: Mimilus

Re: Post your modding questions here

by mimilus » Sat Apr 26, 2014 20:17

Hi

I've made a nodebox but the correponding image hasn't the correct orientation in the inventory.

Is it possible to turn the automatic inventory image ?

I've just found this http://dev.minetest.net/minetest.inventorycube but i don't want to do an image myself.
 

User avatar
Krock
Developer
 
Posts: 4469
Joined: Thu Oct 03, 2013 07:48
Location: Switzerland
GitHub: SmallJoker

Re: Post your modding questions here

by Krock » Sat Apr 26, 2014 20:23

HeroOfTheWinds wrote:At the start of my code, I had something along these lines:
Code: Select all
local mblocks = false
if (minetest.get_modpath("moreblocks")) then
     mblocks = true
end

Short it.
Code: Select all
local mblocks = minetest.get_modpath("moreblocks")

Returns string or nil. Doesn't matter, you can use it the same way as boolean.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
 

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

Re: Post your modding questions here

by HeroOfTheWinds » Sat Apr 26, 2014 21:39

Krock wrote:
HeroOfTheWinds wrote:At the start of my code, I had something along these lines:
Code: Select all
local mblocks = false
if (minetest.get_modpath("moreblocks")) then
     mblocks = true
end

Short it.
Code: Select all
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
 

User avatar
MrIbby
Member
 
Posts: 34
Joined: Sat Apr 26, 2014 23:24
GitHub: MrIbby

Re: Post your modding questions here

by MrIbby » Sat Apr 26, 2014 23:29

Topic: What text editor(s) do you guys recommend?
Reason: I'm making a mod and using WordPad.
Join the Tox revolution!
---
CC License Compatibility Chart
 

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

Re: Post your modding questions here

by HeroOfTheWinds » Sun Apr 27, 2014 00:08

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
 

User avatar
LionsDen
Member
 
Posts: 530
Joined: Thu Jun 06, 2013 03:19

Re: Post your modding questions here

by LionsDen » Sun Apr 27, 2014 03:11

I have Windows XP and use Notepad++ for my text editing needs. It has syntax highlighting and works well for my needs.
 

User avatar
Krock
Developer
 
Posts: 4469
Joined: Thu Oct 03, 2013 07:48
Location: Switzerland
GitHub: SmallJoker

Re: Post your modding questions here

by Krock » Sun Apr 27, 2014 10:56

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...
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
 

User avatar
MrIbby
Member
 
Posts: 34
Joined: Sat Apr 26, 2014 23:24
GitHub: MrIbby

Re: Post your modding questions here

by MrIbby » Tue Apr 29, 2014 02:33

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.
Join the Tox revolution!
---
CC License Compatibility Chart
 

Amaz
Member
 
Posts: 349
Joined: Wed May 08, 2013 08:26
GitHub: Amaz1
IRC: Amaz
In-game: Amaz

Re: Post your modding questions here

by Amaz » Tue Apr 29, 2014 14:44

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.
 

Kilarin
Member
 
Posts: 778
Joined: Mon Mar 10, 2014 00:36

Re: Post your modding questions here

by Kilarin » Tue Apr 29, 2014 18:14

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?

thanks!
 

User avatar
BlockMen
Developer
 
Posts: 768
Joined: Fri Mar 01, 2013 17:24
Location: Germany
GitHub: BlockMen

Re: Post your modding questions here

by BlockMen » Tue Apr 29, 2014 18:25

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?

thanks!


There is a set_look_yaw() function: https://github.com/minetest/minetest/bl ... .txt#L1826
 

Kilarin
Member
 
Posts: 778
Joined: Mon Mar 10, 2014 00:36

Re: Post your modding questions here

by Kilarin » Tue Apr 29, 2014 18:57

BlockMen wrote:There is a set_look_yaw() function: https://github.com/minetest/minetest/bl ... .txt#L1826

Thank you, that's what I needed! It's not documented in the regular part of the developers wiki.
 

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

Re: Post your modding questions here

by HeroOfTheWinds » Tue Apr 29, 2014 22:41

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
 

Kilarin
Member
 
Posts: 778
Joined: Mon Mar 10, 2014 00:36

Re: Post your modding questions here

by Kilarin » Tue Apr 29, 2014 23:10

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.

Why?
 

Amaz
Member
 
Posts: 349
Joined: Wed May 08, 2013 08:26
GitHub: Amaz1
IRC: Amaz
In-game: Amaz

Re: Post your modding questions here

by Amaz » Wed Apr 30, 2014 09:19

HeroOfTheWinds wrote:
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!
 

PreviousNext

Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 2 guests