Modding Help Return object's facing direction?

Discussion in 'Starbound Modding' started by Nemasys, Dec 6, 2016.

  1. Nemasys

    Nemasys Cosmic Narwhal

    Hey, folks, here';s the sitch. I've been modifying @winterbraid's Planetary Clocks mod that @Iroaseta updated to implement a few functional time pieces for my Orcana race. The thing is that I'm not too familiar with Lua or the functions available in the API. One change in particular is giving me a problem. I want to be able to allow a clock to be placed in either a left or right facing orientation like other objects, but still use the rotating hands. The problem with this is that as soon as the image is flipped to the left facing orientation, the hands' rotations also flip and start going counterclockwise. I am able to reverse it using lines like animator.scaleTransformationGroup("minutes", {-1, 1}), but I only want this to happen when the clock faces left. How would I go about getting the facing direction of the object so I can implement an if statement for that?

    I've been working on this off and on for a few days now. Fortunately it's all working wonderfully except for this one flipping issue. Any assistance with this would be a huge help.

    Thanks!
     
  2. Errors4l

    Errors4l Spaceman Spiff

    Use:
    world.getObjectParameter(entity.id(), "direction")
    If your object orientations are formatted the same as the vanilla object (some wooden table) I checked, it should return "left" or "right". It is still advised to log the output before implementing anything that might not work.
    sb.logInfo(sb.printJson(world.getObjectParameter(entity.id(), ""), 1))
     
    Nemasys likes this.
  3. Nemasys

    Nemasys Cosmic Narwhal

    Errors4l, thank you so much. That was exactly what I needed. Everything is working perfectly.
     
    Errors4l likes this.

Share This Page