1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

Modding: Custom Tiles

Discussion in 'Suggestions & Ideas' started by Diprog, Jun 12, 2015.

Mods: Rainbows
  1. Diprog

    Diprog Bison Rider Tester
    1. FUN Servers

    Messages:
    149
    So, yea, I know, we have custom tiles, but they are SO simple. You can only add some flags when map loads.
    Cause of it you can't:
    1. damage them
    2. add breaking states
    3. change breaking sounds
    4. change destroying sounds
    5. change building sounds
    6. change collapsing sounds
    7. change particles.
    So actual custom tiles are nothing, you can't do anyhing with them, like you can do with stone, wood, etc.
     
  2. Corpsey

    Corpsey Haxor

    Messages:
    124
    You can do all of that actually..

    I just started modding, so I could be wrong, but basically to change those values you have to copy some of the base files and mod them, and then have pointers to your new files instead of the base ones. It's the only way to further the hardcoding of the amount of cases that are available when changing blocks (specifically with custom block - base block interaction in mind). Yeah, it's kind of inefficient, but it's not impossible.
     
    Last edited: Jun 12, 2015
  3. Diprog

    Diprog Bison Rider Tester
    1. FUN Servers

    Messages:
    149
    You are not right. Tiles are in engine, they are not open source. You mean fake tiles (blob tiles), which have shitty shadows, very little spaces between each other, and they eat much more recources, than a usual tile. You can't copy normal tiles (world.png)
     
  4. Corpsey

    Corpsey Haxor

    Messages:
    124
    Oh, in that case, yeah. Are there no commands that can be scripted to force custom sprites to behave like the in-engine ones?
     
  5. Diprog

    Diprog Bison Rider Tester
    1. FUN Servers

    Messages:
    149
    That's the problem, you can't add any behaviors, everything that we have is:
    Code:
    Tile::TileFlags
        SPARE_0
        SOLID
        BACKGROUND
        LADDER
        LIGHT_PASSES
        WATER_PASSES
        FLAMMABLE
        PLATFORM
        LIGHT_SOURCE
        MIRROR
        FLIP
        ROTATE
        COLLISION
        SPARE_2
        SPARE_3
        SPARE_4
    but it's kinda useless, when you can't damage them
     
  6. Corpsey

    Corpsey Haxor

    Messages:
    124
    I've been looking at some code, and it looks like it's possible... it writes custom variables to 'u8 customData', allowing a script to handle events that are out-of-engine. Again, I could be wrong (not a programmer in the slightest, but looking through the code).

    Edit: Look at Soprano's Server. He has gold tiles that behave like in-engine tiles, and you are even able to build doors out of them (another custom sprite, among others on that server) that just point to base files to function properly. Unless I'm mistaken, those are all out-of engine blobs that CAN be hit and with scripts basically do anything afaik.
     
    Last edited: Jun 12, 2015
  7. Diprog

    Diprog Bison Rider Tester
    1. FUN Servers

    Messages:
    149
    Dude, it's fake tile (blob). I don't want to use them, cause they eat more recources and cause of other reasons, that I said above. I made these fake tiles like 2 years ago, you can check them at "Official Fun CTF"
     
  8. Skinney

    Skinney THD Team THD Team Forum Moderator Tester

    Messages:
    468
    Recently additional support has been added for custom tiles, including:
    void onSetTile(CMap@ map, u32 index, TileType tile_new, TileType tile_old)
    bool onMapTileCollapse(CMap@ map, u32 offset)
    TileType server_onTileHit(CMap@ this, f32 damage, u32 index, TileType oldTileType)

    Write in your custom functionality with these hooks inside BasePNGLoader.as, or your own map loader.
     
    PeggleFrank, Diprog and RaptorAnton like this.
  9. Diprog

    Diprog Bison Rider Tester
    1. FUN Servers

    Messages:
    149
    wow, god, Skinney, I love you. I think at first I had to look at hooks. x)
    --- Double Post Merged, Jun 12, 2015, Original Post Date: Jun 12, 2015 ---
    but wait, what can I do with them, if I don't know a tile's position?
     
  10. Skinney

    Skinney THD Team THD Team Forum Moderator Tester

    Messages:
    468
    You can infer the tiles position with index or offset (provided by the hook).
     
    Last edited: Jun 13, 2015
  11. Diprog

    Diprog Bison Rider Tester
    1. FUN Servers

    Messages:
    149
    Thanks. But now I noticed that tiles don't have health, is it right?
     
  12. Corpsey

    Corpsey Haxor

    Messages:
    124
    Oh wow, I apologize I was very, very wrong. Blobs are awful.
     
  13. Skinney

    Skinney THD Team THD Team Forum Moderator Tester

    Messages:
    468
    If you want 'health' you will have to write the functionality yourself.
     
Mods: Rainbows