Modding Discussion Player Station as Player Ship

Discussion in 'Starbound Modding' started by Nexus Of Chaos, Mar 31, 2018.

  1. Nexus Of Chaos

    Nexus Of Chaos Parsec Taste Tester

    Is there any way to either:
    1. Make the player's ship into one of the player-deployed space stations, or
    2. add the space station console thing to the player's ship (or at least the gravity slider)?
    I'm asking this because I have a mod that adds the ability to navigate in zero-gravity without a mech and I would find it cool if I could have a zero-gravity ship to do the same with
     
  2. bk3k

    bk3k Oxygen Tank

    As far as I'm aware, I don't think you could place a dungeon directly by blockKey. Although I've never tried.

    You can place an object of course. That object could run a script which uses world.placeDungeon() so you certainly could in that way. If necessary, the object could self-destruct after.

    Note that you absolutely must attempt to place an object which in the blockKey has this
    Code:
    "flags" : [ "playerSpawn" ],
    else starbound will freak out. But that could be your station teleporter and could align with the where it would be placed in the "playerstation" dungeon.
     
  3. Nexus Of Chaos

    Nexus Of Chaos Parsec Taste Tester

    would this new player station have compatibility with mods that affect the objects on the vanilla station? I have a mod that adds more expansion rooms and another that adds a tile protection toggle to the console (and a third that makes the world bigger, but we won't be using that world, so no effect)
     
  4. Nexus Of Chaos

    Nexus Of Chaos Parsec Taste Tester

    I don't really know how to make the object to replace the player's ship, but I would find it cool if the mod was made
     
  5. bk3k

    bk3k Oxygen Tank

    Probably most station mods would work, but not for example my "Boundless Space Stations" wouldn't because that changes the world size the stations normally spawn within rather than affecting anything about that dungeon. The shipworld's are 2048 x 2048 size (not changable) which is a bit bigger than vanilla station worlds anyhow.

    You don't make an object replace the player's ship. You make a ship mod - which by definition replaces the player's ship. Only you make a "ship" that is nearly nothing at all, save for an object with
    Code:
    "flags" : [ "playerSpawn" ],
    in the blockKey, and a script that spawns the "playerstation" duntion in init(). Probably you'd spawn the dungeon with an offset that overlaps the location of this object, such that it places the player within the station. It wouldn't do to have a new player floating in space LOL.

    edit:
    Also don't use any "red" blocks you see in other blockImages. With the vanilla RGBA mapping, those place indestructible metamaterial tiles aka invisible walls. Normal ships use those overlapped where the image of a ship wall/floor/ceiling exists. You wouldn't have reason to do so.
     
  6. Nexus Of Chaos

    Nexus Of Chaos Parsec Taste Tester

    I still don't know how to do that, but at least I know it can be done
    I assume the gravity slider in the station's console will affect the gravity despite being a different world?
     
  7. bk3k

    bk3k Oxygen Tank

    Just look at some ship mods to figure out how shipworlds themselves work. Especially something simple that lets you build your own (complex ones exists too). The short of it is that ships are an illusion. You have only tiles (including metamaterial tiles) and objects. They're placed via the blockImages(which must be a literal RGBA match) and those RGBA combinations are defined via a blockKey.

    You then add images (in the .structure files) to create the illusion you have anything beyond a few tiles and objects, but in this case I'm not sure you'd really want to. Now as for the station console, the script controls gravity as such -
    Code:
    function setGravity(gravity)
      storage.gravity = gravity
      world.setDungeonGravity(0, gravity)
      world.setDungeonGravity(65532, gravity)
      world.setDungeonGravity(65531, gravity)
    end
    
    That first argument to world.setDungeonGravity() is the dungeonID so I guess it depends what dungeon ID gets assigned. I don't know if it would be different when spawned from an object. But even it it was different, the script could simply be altered to look at the dungeon ID at the position of the object itself. and change that gravity.
     

Share This Page