Modding Help Accessing "renderLayer" via LUA Script or .animation file

Discussion in 'Starbound Modding' started by Charlatan, Feb 7, 2017.

  1. Charlatan

    Charlatan Parsec Taste Tester

    Oi there,

    however I try, it seems I can't set the "renderLayer" of the object via LUA. I've tried reaching it with object.setConfigParameter, and with animator.animationState.

    Since the Object LUA table has own bindings for the different orientation parameters, I suppose I am trying to access it the wrong way there. Why the animator version won't work is a riddle to me - after all the "image" is set up the same as the entry in the orientations.

    BTW, both versions dont cause any errors, neither ingame nor in the log. Adding any other change to animstate (like the image itself) works fine.



    Code:
    function update(dt)
        if storage.layerstate == 1 then
            if animator.animationState("layerstate") ~= "front" then
                object.setConfigParameter("orientations.renderLayer", "player+1")
            end
        elseif storage.layerstate == 2 then
            if animator.animationState("layerstate") ~= "background" then
                object.setConfigParameter("orientations.renderLayer", "player-1")
            end
        end
    end
    



    Code:
    "parts"  :  {
          "light"  :  {
            "properties"  :  {
              "centered"  :  false,
              "zLevel"  :  1
            },
            "partStates"  :  {
               "animstate"  :  {
                  "front"  :  { "properties"  :  { "image"  :  "<partImage>:default.<frame>", "renderLayer" : "player+1" } },
                  "background"  :  { "properties"  :  { "image"  :  "<partImage>:default.<frame>", "renderLayer" : "player-1" } }
                  }
               }
            }
    }
     
  2. bk3k

    bk3k Oxygen Tank

    From the lua side, I don't think you'd do orientations.anything. I know it is counter-intuitive, but you can put about any attribute within an orientation and it will behave exactly as though it would if defined at the base level. But that allows you to do different things. It could have a different placement of wire nodes, different default states, different light colors, or even different health amounts.

    So you'd read this with object.getConfigParameter("renderLayer")
    thus I assume you'd have to use object.setConfigParameter("renderLayer") to set it.

    Maybe that will work and maybe it won't depending if the attribute is read after. Another thing to try would be animator.setGlobalTag("renderLayer", "player+1")
    But I might be barking up the wrong tree there. I'm not 100% sure the limits of what you can accomplish with that function are. I know you can set "direction", processing directives and such. There are a few similar functions in the animator table,
     
  3. Charlatan

    Charlatan Parsec Taste Tester

    I tried through those options, sadly to no avail.

    Via the .animation file, it can be done by moving the actual image away from the object and into a permanently visible, motionless particle effect - but thats not just lackluster but also prone to cause lag when its more than a few objects.

    Overall, it would be great if anyone knew how this parameter exactly works - after all, pretty much the only thing we know about it is that it sets a zLevel compared to an object or entity (and platforms, but platforms are technically objects instead of blocks)

    I always end up having to try get the options/results that might be hardcoded/Impossible >.<
     
    Last edited: Feb 7, 2017

Share This Page