Modding Help What does this mean in that context?

Discussion in 'Starbound Modding' started by Wheee321, Feb 8, 2017.

  1. Wheee321

    Wheee321 Subatomic Cosmonaut

    Hello again dear Starbound modding community,

    I am originally from austria, so I am not a native english speaker. Anyway I'm apologizing for my bad english now and in future. I get along with modding mostly, but sometimes I don't understand what I'm reading because of the (technical) context.
    Here's my question:
    I found that lua function:

    Code:
    #### `bool` mcontroller.isCollisionStuck()
    
    Returns whether the movement controller is currently stuck colliding. Movement controllers can stick if the `stickyCollision` movement parameter is set.
    Don't get me wrong, I understand the words, but I dont know what that means in that context.

    It would be very kind if someone could explain that to me.

    Thanks, Wheee
     
  2. bk3k

    bk3k Oxygen Tank

    this seems to only be used in \npcs\bmain.lua
    And what it does should be more obvious in this context
    Code:
    function checkStuck()
      if mcontroller.isCollisionStuck() and not npc.isLounging() then
        -- sloppy catch-all correction for various cases of getting stuck in things
        -- due to bad spawn position, failure to exit loungeable (on ships), etc.
        local poly = mcontroller.collisionPoly()
        local pos = mcontroller.position()
        for maxDist = 2, 4 do
          local resolvePos = world.resolvePolyCollision(poly, pos, maxDist)
          if resolvePos then
            mcontroller.setPosition(resolvePos)
            break
          end
        end
      end
    end
    
    If you use something like notepad++, the search feature has a "find in files" tab that lets you search an exact string like
    Code:
    mcontroller.isCollisionStuck(
    That's VERY handy to find actual examples of the code in use. You can make the search faster of course by filtering to *.lua
     
    Wheee321 likes this.
  3. Wheee321

    Wheee321 Subatomic Cosmonaut

    Thanks very much bk3k!
    Yes I use notepad++, didn't know that find in files - function until now
    Again: thanks very much for the help!
     

Share This Page