Modding Help Objects that "test" for surrounding blocks?

Discussion in 'Starbound Modding' started by lazarus78, Jul 21, 2017.

  1. lazarus78

    lazarus78 The Waste of Time

    Is there a way to easily have an object "test" surrounding blocks? More specifically, "Is there a solid block here?" or "Is there open air here?"

    I am working on adapting the concept used by the "wall support" objects that will automatically change orientation depending on where you place them, and seeing if I can use that to make a sudo-dynamic "block", and being able to test the surrounding blocks, or lack there of, would be very helpful.
     
  2. IHart

    IHart Scruffy Nerf-Herder

    Do you need it to be more complicated than "Is there a solid block here?" or "Is there open air here?" Because those Apex cameras adjust to where you place them (including ceiling I believe).

    Is it possible you would want to make this a material instead of object? The material render templates are pretty robust.

    Edit: any additional functionality you need might be found in here: http://community.playstarbound.com/resources/golemancer-core.4203/
     
  3. bk3k

    bk3k Oxygen Tank

    Code:
    #### `bool` world.tileIsOccupied(`Vec2I` tilePosition, [`bool` foregroundLayer], [`bool` includeEphemeral])
    
    Returns `true` if the specified tile position is occupied by a material or tile entity and `false` if it is empty. The check will be performed on the foreground tile layer if foregroundLayer is `true` (or unspecified) and the background tile layer if it is `false`. The check will include ephemeral tile entities such as preview objects if includeEphemeral is `true`, and will not include these entities if it is `false` (or unspecified).
    
    If you wanted LUA. There are other world functions that do useful things so there are many possible ways to do it. You wouldn't change the orientation with that, but could change your state and/or swap an amimation <tag> for the object.

    From the object's JSON though, you could have different orientations with different anchor configurations.
    "anchors", "fgAnchors", "bgAnchors" You'd end up with several orientations each checking for different possible configurations.
     
  4. lazarus78

    lazarus78 The Waste of Time

    I have been looking at similar lights, which Ive got all that working, but ive run into an issue with the collision from adjacent objects being valid anchor points.

    I would use a material, but I am working with objects 2x the size of regular blocks, which, to my knowledge won't work with the material system.

    Im hoping to avoid Lua if possible. Im not very good with it anyway. :rofl:

    I think my best bet will be mixing fg and bg, though that will be a temp solution at best... we will see...

    Anyhoo, thanks, I have a bit to work off, back to testing.
     

Share This Page