Modding Discussion Let's talk about gravity

Discussion in 'Starbound Modding' started by GonDragon, Jun 12, 2017.

  1. GonDragon

    GonDragon Pangalactic Porcupine

    With the new update, it comes a new system to handle 0 gravity environments. That's a cool adition, because in the past, the 0 gravity environments (Like the asteroid fields from FU) looked a little bit clunky, with the NPC and the PC stucked in the jump animation.

    Now, whit this update, also come new problems. Zero gravity is not just an invisible buff that changes the gravity multiplier to 0, it's a more deep and hardcoded mechanic. If we understand and found ways to alternate between 0G and Normal G, we could do some cools things like, I don't know, a space rifle that inflicts a zero gravity debuff on it's enemy? Just use your imagination.

    Now, I open this topic so we can share our discoveries in the matter. I did a little investigation, and I do not found very much, but I will share my little research.


    New Lua Bidings:
    • bool mcontroller.zeroG() : Returns `true` if the movement controller is at a world position without gravity or if gravity has been disabled. Returns False otherwise.
    • void world.setDungeonGravity(`DungeonId` dungeonId, `Maybe<float>` gravity) : Sets the overriding gravity for the specified dungeon id, or returns it to the world default if unspecified.
    Old mechanic for asteroid fields removed: Now, they do not use a global status effect to inflict in you low gravity (or no gravity), so you couldn't set an "Inmmunity status effect" anymore.

    Dungeons Manages Gravity: As far as I know, for localy manage the gravity, you should use a dungeon.


    While I wait for your answers, I will keep investigating. For now, I have two paths to follow. One, is find a way to directly change the gravity influence in a PC or NPC; This is ideal and it could be the best solution. The other, is find a way to dinamically set a group of tiles into a dungeon, without spawning a new dungeon; If it works right, it could be a nice workaround, but I don't know if that's possible.
     
  2. Sparklink

    Sparklink Pangalactic Porcupine

    stats/effects/lowgrav/lowgrav.statuseffect

    {
    "name" : "lowgrav",
    "effectConfig" : {
    "gravityModifier" : 0.3
    },
    "defaultDuration" : 15,

    "scripts" : [
    "lowgrav.lua"
    ],

    "animationConfig" : "lowgrav.animation",

    "label" : "Light",
    "icon" : "/interface/statuses/lowgrav.png"
    }

    Just play with this for for a few minutes and you should get the desired effect.
     
  3. GonDragon

    GonDragon Pangalactic Porcupine

    Thanks for sharing! This could be usefull for anyone who needs to emulate 0 Gravity.

    I weel keep looking for ways to enable the gravity in 0G environments.
     
  4. Sparklink

    Sparklink Pangalactic Porcupine

    You could possibly give the status effect I showed you a negative value to increase the effects of gravity on people; I have not yet tested it myself, but I do not see any reason why it would not work.
     
  5. NexusTheBrony

    NexusTheBrony Parsec Taste Tester

    i know in some games a negative value is just negated and read as a positive value
     
  6. GonDragon

    GonDragon Pangalactic Porcupine

    This status effect works altering the Gravity Multiplier of the player. That means, if the gravity it's 1, and the gravity multiplier it's 0.5, then: 1 * 0.5 = 0.5, so that's your gravity... but if there is no gravity: 0 * m = 0.

    In the past, I managed the 0 gravity of Fracking Universe with a Immunity Status Effect: If you have this status, then the 0 gravity will not affect you, so you could handle your gravity in any way you want. But in this new 1.3 release of Starbound, they put an animation for zero gravity inthe characters, so the way the game handle the 0 gravity, it's different than the form that FU used to handle the 0 gravity, so I couldn't just apply an immunity status effect to apply gravity in a 0 gravity world (Like the asteroid belt, for example).
     

Share This Page