Liquid Vibranium (help needed)

  • AwkwardStare
    2nd Apr 2019 Member 0 Permalink

    I've been interested in making a Lua script for this by myself for a while but I can't seem to get the job done. I've been testing this out using using the latest version of Jacob1's mod first attempt was to take the properties of the solid vibranium element and switch one of the properties to liquid like this:

     

    local element = elem.allocate("DUMB", "LVBR") elem.element(element, elem.element(elem.DEFAULT_PT_VIBR)) elements.property(elements.DUMB_PT_LVBR, "Properties", TYPE_LIQUID) elements.property(elements.DUMB_PT_LVBR, "State", ST_LIQUID) elem.property(magic, "Name" , "LVBR") elem.property(magic, "Liquid Vibranium")

     

    ...which didn't work very well, since the properties of the new element were the same as the original but without the charging and the explosions. This makes me think that I have to make a new element and implement the functions that the original vibranium has, but with slightly tweaked graphics. This is something that I'm having a hard time figuring out since it involves looking at the C++ source code and dragging things over into Lua, where it's sometimes unclear as to what I need to do. If I'm gonna do this properly, I'll need to also modify the solid and broken forms of vibranium so that they can turn into liquid vibranium upon contact with, say, BIZR or something.

     

    I can figure out how to create new particles, change pressures in explosions and similar things but graphics and modification of other variables in the ways that I'm proposing are not something that I understand even after looking at some of the scripts on the Starcatcher server since the wiki doesn't seem to cover some of the API functions that I'm seeing within the scripts. I need help in knowing what functions to call, how and where to call them and so on so that I can build this thing. (Or if someone can build it for me and leave it for me to learn from, I'll appreciate that too!)

    Edited once by AwkwardStare. Last: 3rd Apr 2019
  • jacob1
    3rd Apr 2019 Developer 0 Permalink
    It would be nice if you could copy the update function from VIBR to your element, but that isn't possible. It's only possible to add additional update functions to elements, not get the existing function and do anything with it.

    So you would probably have to reimplement VIBR.cpp in Lua in order to do this. I think even just that makes it a huge effort that may not be worth it. VIBR.cpp requires a lot of function calls so doing it in Lua would be incredibly slow.
    That said, if you do want to reimplement it I could point out specific functions you need to call for each thing VIBR does.


    Which api functions aren't covered? They should all at least be listed, but some functions in the Simulation api aren't documented.
  • AwkwardStare
    4th Apr 2019 Member 0 Permalink

    @jacob1 (View Post) Thanks for the heads up. I've gone through both the guide which is linked on the wiki and some of the scripts on the Starcatcher server, and using all of that I've made some sort of liquid vibranium element which is slow and sometimes crashes TPT for a reason which I cannot determine. It differs from vibranium quite a lot, which is why I'll probably name it something else when I have a go at making something that's more faithful to the original. I've managed to implement things like the charging and the flashing effect. There isn't really an overall style to what I've built since in some places different methods for things which should be the same have worked while others haven't. I haven't put it on the server because I don't think it's quite ready for that yet. Some of the LVBR disappears while it's emitting stuff just before the explosion.

     

    https://ghostbin.com/paste/gzx2w

    Edited once by AwkwardStare. Last: 4th Apr 2019