Modding Questions

Discussion in 'Modding General' started by jojoa1997, Dec 9, 2013.

  1. 4aiman

    4aiman Member

    Entities is the only way to make this look like Minecraft. In fact, smooth nodes in MC are drawn like entities (torches, chests, etc). I've made smth like this before, but then lua was x40 slower than now (no cleanups, no LuaJIT, etc) and I've ended up with ~20 nodes for fire. But that fire by me wasn't huge success amongst users.
  2. jojoa1997

    jojoa1997 Member

    As of now the foire looks kind of weird. But if I make special nodeboxes for them it might work. Also could you tell me how you did it with entities. I might play around with it.
  3. 4aiman

    4aiman Member

    I've created a mesh using Blender and placed entities just like nodes. I'm currently using the same technique for ghostly_blocks that are "ghosts" of nodes with draw_type == "plantlike". That's because I've found a reasonable amount of entities to cause less lags than just one smooth nodebox.
  4. 4aiman

    4aiman Member

    I've a question:
    lua_api.txt clearly states that
    Code:
        on_blast = func(pos, intensity),
        ^ intensity: 1.0 = mid range of regular TNT
        ^ If defined, called when an explosion touches the node, instead of
          removing the node
    But how can I use it?
    I mean, there's NO problem in adding this to a nodedef and toying with it using the intensity param as a basis.

    But what CAUSES the blast?

    There's nothing about this out there in lua_api.txt.
    It's cool and stuff that 1.0 is a mid range of a regular TNT, but TNT never uses on_blast itself and never checks for it.

    What I'm looking for is a way to invoke blast with intensity of my choice at the chosen by me pos.
    I hope there is such a callback and that it will calculate intensity on it's own like this:

    Code:
        A  B  C  D  E  F  G  H  I  J  K  L  M
     1 [ ][ ][ ][ ][ ][ ][1][ ][ ][ ][ ][ ][ ]
     2 [ ][ ][ ][ ][ ][1][2][1][ ][ ][ ][ ][ ]
     3 [ ][ ][ ][ ][1][2][3][2][1][ ][ ][ ][ ]
     4 [ ][ ][ ][1][2][3][4][3][2][1][ ][ ][ ]
     5 [ ][ ][1][2][3][4][5][4][3][2][1][ ][ ]
     6 [ ][1][2][3][4][5][6][5][4][3][2][1][ ]
     7 [1][2][3][4][5][6][B][6][5][4][3][2][1]
     8 [ ][1][2][3][4][5][6][5][4][3][2][1][ ]
     9 [ ][ ][1][2][S][S][S][S][S][2][1][ ][ ]
    10 [ ][ ][ ][1][ ][1][2][1][ ][1][ ][ ][ ]
    11 [ ][ ][ ][ ][ ][ ][1][ ][ ][ ][ ][ ][ ]
    12 [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]
    13 [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]
    
    
    Let us say, stone has on_blast and can affect the intensity of a blast behind it.
    Let us asume that stone's blast_protection is only 2 points.
    Then we will see a picture like this:

    At G9 intensity should be at 5.
    But there's a block of Stone.
    It reduces Intensity by it's 2 points of blast_protection and gets destroyed.
    Nearby Stones also decrease intensity and got destroyed.
    The picture illustrates the final intensity.
  5. 4aiman

    4aiman Member

    Bump! Wanna hear an answer to the above one! :)

    Also,
    Does anyone know how to get current biome ID?
    (e.g. biome ID in some point {x=x,z=z})
    I've tried to cache biomes within on_generated but a loop through the get_mapgen_object("biomemap") slows down mapgen up to 20x times...

    Any ideas?
  6. None

    None New Member

    Is there any way to understand how map generators works? I know about source code, but this is the last thing, that I want to do.
    I am writing a mod that adds some new ores, but there is a problem — how can I find out where the nodes like default:desertstone is genereating? (default:desertstone is just an example.) I need to know this to register ores properly (wherein variable).
  7. 4aiman

    4aiman Member

    You don't have to know where some node is being generated when using wherein parameter.
    Just fill in your ore definition and the ore you want will appear inside wherein depending on the other parameters you supplied.
  8. None

    None New Member

    Yes, I know that, and I need to know where my ores will be generated :)
    It's like... "I want my ores to be generated in deserts only... hm, but what nodes are in deserts?" or "If I use this node as wherein, where my ores will be?". I want to know this for better ore placement in the world.
  9. 4aiman

    4aiman Member

    Wait, what mapgen version are you using?

    With 5 and 7 it's up to you to decide what nodes are in deserts.
    When you register a biome you supply some info on what nodes will occur there.
    Even if someone take a look at your code, there's no guarantee the "looker" would guess what biomes should be considered as deserts.
    Thus, for 5 and 7 no one can answer your first question but what nodes are in deserts? but you.

    If we're talking about the 6 version of mapgen or indev, then it is rather safe to assume that any node with "desert" in name can be considered as a part of a desert biome.
    But there are loads of "default:stone" underneath any desert, so this method won't be of a much help either.


    There's also the `biomemap` Mapgen Object that can be acessed in on_generate to get info about the biome of *every* node that has been generated. Note, that if you're planing to check every node of a certain biome, it *will* slow down the game a lot.


    If you want to get the exact positions of any registered ore you probably should look at the code here: https://github.com/freeminer/freeminer/blob/master/src/mg_ore.cpp#L126
    By looking at it you can get the idea of how ores are being generated when using "scatter".
    Then you'll have to implement smth similar in lua.
    I don't know of any other way to find the exact positions of ores.
    None likes this.
  10. None

    None New Member

    Thanks!
  11. None

    None New Member

    Hello again. I heard that using a mesh (models) in node definition, instead of a nodebox, is faster (for the game). Is it false or true?
    All what I found is this post. For now I'm thinking that this can be true, cause loading a model is faster than creating one on-the-fly (or not?), but I'm not sure.
  12. alaytangerang

    alaytangerang New Member