Modding Help Door collision

Discussion in 'Starbound Modding' started by christhedragoon, Sep 15, 2017.

  1. christhedragoon

    christhedragoon Void-Bound Voyager

    So this is a random question. But, is there a way to make it so that an open door still has it's collision active? Cause when you open a door it's collision deactivates until it's closed again.
     
  2. bk3k

    bk3k Oxygen Tank

    The collision on the doors actually comes from the doors placing metamaterial tiles(much like ships use). So you're really colliding with a tile. Here's what happens when a door opens or closes

    1. Animation state change.
    2. swap between "closedMaterialSpaces" and "openMaterialSpaces" - which means a tile setup swap.

    By default, "closedMaterialSpaces" and "openMaterialSpaces" are automatically built by the script, but you can manually define them in the object with those very attribute names. Without being defined, "closedMaterialSpaces" will be made of "metamaterial:door" or "metamaterial:lockedDoor" and it will use the same spaces the door occupies. "openMaterialSpaces" on the other hand will be an empty set by default.

    And how do you manually define these things? A fine example can be found in the "platform hatches" mod.
    Code:
    "openMaterialSpaces" : [
          [[-2,0],"metamaterial:objectplatform"],
          [[-1,0],"metamaterial:objectplatform"],
          [[0,0],"metamaterial:objectplatform"],
          [[1,0],"metamaterial:objectplatform"],
          [[2,0],"metamaterial:objectplatform"]
      ],
    
    They opted for actually drawing a platform on the open frames, and adding the metamaterial. But you can use any valid tile instead.

    This is from one of my objects.
    Code:
      "openMaterialSpaces" : [
        [ [ 0, 1 ], "lunarbaseplatform" ],
        [ [ 1, 1 ], "lunarbaseplatform" ],
        [ [ 2, 1 ], "lunarbaseplatform" ],
        [ [ 3, 1 ], "lunarbaseplatform" ],
        [ [ 4, 1 ], "lunarbaseplatform" ],
        [ [ 5, 1 ], "lunarbaseplatform" ],
        [ [ 6, 1 ], "lunarbaseplatform" ],
        [ [ 7, 1 ], "lunarbaseplatform" ]
      ],
    
    I didn't add any extra art for the open frames. The tiles themselves handle that dynamically. They're real tiles in that spot too. For example if you used dirt, you could til it and grow stuff. But changing the door state will destroy the dirt, and changing it back would put fresh(not tiled) dirt there. Of course removing the door will remove the tiles. The doors always clean up their material spaces.

    So what are the numbers about? Those are tile spaces [x, y] relative to the bottom left of the object. You also have to consider any object offsets too, so I find it easier to just always use a [0, 0] offset myself.

    Also, you can manually define the "closedMaterialSpaces" in exactly the same way.
     
    christhedragoon likes this.
  3. christhedragoon

    christhedragoon Void-Bound Voyager

    Thank you! This helped alot!
     

Share This Page