1. Please be advised of a few specific rules and guidelines for this section.

WIP [Help Wanted] Shipstructor the sucsessor of Madtulip's Spaceship Mod

Discussion in 'Ships' started by thakyZ, Jan 16, 2016.

  1. thakyZ

    thakyZ Cosmic Narwhal

    I have a friend that had worked on Madtulip's Spaceship Mod almost since it started. And since Mad has been too busy to update his mod, @HuggableCreep has gotten permission to continue working on Mad's mod. And as such he has renamed it and has a Github repo for it. I am also a developer for Mad's mod, but I have been busy with school, and work, and my own ambitions in developing other programs. Because of this I have not been able to contribute much.

    Currently Huggable, or his new name Royal_Jelly, has been having issues and is being overwhelmed working on the revamp of Shipstructor all on his own.

    So, I am posting this here to see if anyone is interested to help him on modding the new version of Madtulip's Spaceship Mod, called Shipstructor. If you are interested you can private message @HuggableCreep at any time, and he can get back to you.
     
  2. HuggableCreep

    HuggableCreep Big Damn Hero

    Yeah since the good ol days of enraged koala I've worked with Madtulip, however mad was the one who did all of the actual scripting and lua programming I mearly did textures back then

    Its not that I am incompitent in making content for the mod its just certian things are outside my area of expertise, I am overwhemed mostly with the Json scripting (i mess up the synatax way too often) and lua is definetly out of the question for someone as "skilled" in programming as I

    I'll tell you right now I've been pretty unmotivated and even considered droping the whole project, however I'm Willing to stay if we can muster up some interest in the project
     
  3. 82nd

    82nd Space Hobo

    I know someone who is capable of scripting, however they often troll, so I don't know if you would accept that. If the project is still even going.
     
  4. HuggableCreep

    HuggableCreep Big Damn Hero

    yeah i rarely get on these forums these days sorry about the late reply, and yeah im willing to work with pretty much anyone so as long as they can do the work

    as it stands right now the bigest hurdle is dececting whether or not a player is on the ship world, after that all thats really needed is a script that calculates if there is a hole in the shiphull and begins to "drown" the player in space
     
  5. bk3k

    bk3k Oxygen Tank

    You have options on how to do this, but it isn't bad. The real question is how to most efficiently do this.

    First about determining if you are on your ship, I think many mods already do this.
    1. IIRC there is a function to see what your world ID is, and it comes up nil when on the ship,
    2. Look to see if an entity exist in the world that matches something ship-specific like the AI console.
    3, ...or add an additional script to do these things to the AI console itself(therefore bypassing the need to check if it is a ship at all).

    Look at the Automatic irrigator mod.
    http://community.playstarbound.com/resources/automatic-irrigator.3127/
    Look into spacedino_pipeirrigator.lua
    I think small modifications of this would give you what you need. You would need permission to use the code as it isn't marked free use.

    Check out how he checks for an intact pipe. You could do much the same but for accepting any material tile in isPipe() and checking foreground instead. Some minor modifications would be to try to complete the "runner" by looking for a tile that on one side has no material in the foreground nor background. If you are on the shipworld, this would be space.

    world.material(pos, "background") for one of the neighboring spaces would return a false or nil. Then while checking for potential runners, you look for materials present which themselves are touching nothing on at least one neighbor. The point of that is to try to follow along the outside of the ship. If your runner ends up back where you started, you are in good shape. I suppose you also need to check for objects(doors) adjacent and include them as part of the runner such that people can have airlocks.

    - assuming you intend to do background checks too - is to check every tile background in between the completed runner to make sure there is a material there. Now there is a question - one of design - if you want to accept ANY material. You might reasonably say that dirt isn't sturdy enough to ensure containment, or you could just not worry about it(certainly the easy option). Assuming you did, instead of just accepting any material, you could filter for acceptable materials. 2 methods exist.

    1. White-list. Only materials that exist on the list are acceptable. This isn't desirable as it automatically excludes materials added by mods (and also new vanilla materials until you update).
    2. Black-list. Only materials that exist on the list are not acceptable. That means materials added by mods are by default accepted(unless of course they end up on the blacklist)

    In either method, make a separate function something like hullMaterial(mat) which returns either true or false. You run that for every step of the runner, and for every background tile in between. If it isn't an acceptable material, you could do a function call upon that location to destroy the material itself(like what would happen in a hull breach considering the pressure differential) and maybe even throw in a cool effect to do it.

    In any case I would not run the code to check hull integrity TOO often for performance reasons.

    After completing the outer-runner(the exterior of the ship), you probably want to check for smaller areas which would be still air-tight in the case of a breach elsewhere. Start from the outer-runner, and look for runner paths which connect different points of the outer-runner. For example inner wall combined with doors. So you would end up with distinct compartments which individually could be compromised without necessarily compromising them all. I suppose you also need to do door-state checks because an open door would break the runner or sub-runner temporarily.



    I believe the original FCS created a liquid, right? You could do that. Then attach a status to the liquid. Honestly I'm weak in this area. I haven't looked at how the liquids work because they haven't been relevant to any of my projects. I'm not sure for example if you can control their disbursement/spreading(such as ignoring gravity etc). If it can be messed with like that, you could also have the option(as an alternative to the hull integrity check described above) of having invisible liquid generating objects in space. Perhaps some at the top of the shipworld, and some at the bottom which produce a cloned variant which spreads upward? Even that wouldn't be necessary if liquid take pressure into account and again I haven't looked into it so I don't know.

    I do know that there is a function to create liquid at at location, and a function to destroy liquid at a location. It might make sense that the liquid will self-terminate after a certain time(so that if you have sealed the breach it will not continue to linger). I don't know for sure if that is even possible though. It might also be prudent that the life support vents are simply animated liquid destroyers.


    I would suspect the liquid path carries a big performance hit. So you might consider alternatives too. I don't think techs are a great path because that requires you to be equipped with them. You can modify vanilla techs, but that creates a problem with any mods that do the same. And of course you don't start off equipped with any. Completely new(mod) techs would also not work with this unless specifically designed to do so.

    Perhaps there is a more creative way to accomplish this. Perhaps in hijacking some vanilla script that would be called for the player? I think scripts/actions/entities.lua would be a candidate(as players are indeed entities), and I can't see any mods actually replacing that one. I'm not sure how that would work in practice, or even if it could. I believe most things regarding how the player functions are hard-coded unfortunately... but this isn't something I know all that well so I could be wrong. I've mostly just poked around this area some. Plus in general principal, messing with vanilla LUA scripts is probably not the greatest of ideas unless they basically only are used for one thing and that's the thing you are modding.

    Weather I think would be an option to affect the player if there was any way to add weather to the shipworld... and I have seen no way to affect how the shipworld generates beyond simple block and object placement unfortunately. This I have looked for as I have a ship mod myself. Things like world size, gravity, weather, etc seem out of reach. I would be VERY glad for someone to tell me I am mistaken here. Also I intend to play around and see if objects can affect something like world gravity, because if they can then adjustable "gravity generators" are going to be a thing in my mod and you certainly can feel free to plunder them from my mod to yours because they would fit well there too.

    I don't know off the top of my head if objects can access player status functions, but if so that would certainly be the most simple route. I'm sure projectiles can... because they do in game. I probably need to make an object designed just to do a function dump (to the log) to see what's accessible to it. Ditto with a tech. I'd have more solid answers for you and myself. Like I say if objects can do this, then it is just another script to add to the AI console and this is achieved. It would check the player location, and if not within an intact runner, apply the status.

    OR even if the objects can't directly access the status functions, that still might work. Spawn an invisible projectile to the player's location. The projectile applies the status.


    You know if you got exposed to the vacuum of space, a lack of air is the least of your worries. You'd be dead before that became a concern. The pressure differential will cause your blood to boil, and you're gonna POP. OK so that's a little too hard-core to simulate in Starbound because the slightest mistake would turn any character into a defacto-hardcore character. They could very well just die instantly upon regeneration. But it might be more fitting to cause some constant damage outside of just breathing mechanics. And they should get the cold debuff. Space is dangerous and should be respected.

    Of course if the player is wearing a suitable space-worthy armor, helmet, and pants then damage wouldn't occur(and presumably they could breath at least for a while). If they are immune to the lower temperature, then they wouldn't get the debuff. Note that these are granted by techs today, the immunity techs are gone in nightly in favor of equipment-based immunities(like it was in EK).

    Plus you might want it to suck out loose items into space. Maybe NPCs and the player too if the hole is big enough and if the player doesn't act fast.

    One other thing is that it would be odd for this sort of behavior to occur on your ship, and yet not in asteroid fields. So maybe modifying the asteroid biome to match (whatever you decide upon ) is in order. Thus your asteroid base would follow the same rules and that WOULD be pretty cool, now wouldn't it?


    I realize this is a longer answer than you where probably looking for LOL.
     
  6. HuggableCreep

    HuggableCreep Big Damn Hero

    again sorry for the late replies, Not to sound Pesimistic but we have been though most of this already

    1: the starbound world function does drop nill but apparently it diddn't work, from what i was told you cant have an argument looking for nill :L
    2+3: ship objects are hard to track unless they are stationary (locked in place), and is unreliable if they can just be placed on a planet (drowing from space on a planet is bad yo)

    and regarding the suffocations or drowning in space i should clarify starbound already does this for moons and for the lunarbase mission, if you dont have the proper tech it brings up the air bar thing
     
    Last edited: Apr 29, 2016
  7. bk3k

    bk3k Oxygen Tank

    Oh but you can. LUA isn't exactly like some other languages.

    Now when you are asking if something is true(boolean), a nil value will work the same as a false(boolean) value where as any value that isn't false or nil will make the statement true. But it isn't hard to directly test for nil.

    Code:
    function myFunction(...)
      local isNil = myOtherFunction(...)
      if type(isNil) == "nil" then doSomething() return
      else doSomethingElse()
      end
    end
    
    etc

    Be aware that an uninitialized variable(which can be referenced without being initialized) will always return nil. So a misspelling or miscapitalization can inadvertently give you a false positive. Also referencing a variable out of scope will likewise return a nil value. Anyhow this method works. For example look at this vanilla code in objects/colony/colonydeed.lua

    Code:
    function getRentLevel()
      if world.getProperty("ship.level") then return 1 end
      return world.threatLevel()
    end
    That's exactly what it is doing to check if the current world is indeed the shipworld.

    Now I do sometimes hate their code because it isn't as intuitive as it could be even when really simple like that. If their world.getProperty() function returns anything at all besides false or nil, the statement is true because in the boolean context LUA will regard all values that aren't either false or nil as true. That function would return true, 3.14, "your text here", or even a table... and they'd all be true from the boolean perspective.

    But anyhow they are looking for the ship.level property for the world. In any world but the shipworld, that will be nil(and therefore false). If it was the shipworld, getRentLevel() is gonna return 1(the lowest rent level) and the next line won't happen. Otherwise, it will return the threat level of the world. They just as well could have checked for the threat level first, because I believe that would itself come up nil on the shipworld.

    You're right in that checking for the object isn't as good a method in case some person moves it planetside. But I don't believe it is too much a hassle in checking for a particular object within the shipworld.
    Code:
    local allObjectsInShipworld = world.entityQuery(mcontroller.position(), 4000, {includedTypes = {"object"}})
    The shipworld size is fixed, so 4000 should get you all objects present without need of knowing their location. From there you just search the table for your specific object.

    One thing I'm not certain about though - I haven't played around with this - is if that function is limited to currently loaded chunks. It may well be and that would be a point against what I'm saying.

    I haven't looked into what Starbound does specifically, but I do believe it does so on a world-wide basis. So I don't think you'll be able to use that directly because.
    1. I know of no method to set those sort of parameters for the shipworld the way you can for world types and instance worlds. I'd love you know I'm wrong because I've love to change some things.
    2. If you could, you still have the problem of wanting those inside a sealed ship to be able to breath so a world-wide thing can't work. I think you're still going to have to get creative in some way.

    But then again that would make it easier if you could. Instead of a liquid that disables breathing, a liquid created by life support that enables breathing. I haven't studied up on the liquids, but I believe they can be pressurized. So if the liquid leaks out, you can't breath... and that's all it would take. I think it would be fairly unintensive performance wise too. Even if that method can't help the shipworlds(without being able to set those sort of attributes I as far as I know), that would work well for say an asteroid or moon base.

    But thinking about this has given me an idea. Before I was into actually making mods myself, I played around with taking a generated world and renaming it to be a shipworld. This was in EK days, and that almost worked... except no maxfuel attribute was the main problem. It seemed otherwise functional in that you could teleport to/from. The navigation seemed to work but... no fuel no go(even intersystem travel required some fuel IIRC).

    But now we have the upgrade system. I might be able to generate a world that matches what I want, move/rename it, and then "upgrade" it to be a legit shipworld. Or starbound might crash. Or something else might fail. But I'm gonna have to try this because it could open up some really nice possibilities.

    Weather
    Space monsters(randomly spawned) maybe including penguin pirates.
    Like you want to do - suffocation
    Freezing temperatures and possibly radiation too.
    You don't currently seem to suffer any damage in space... fixed.
    bigger shipworlds(especially because I plan on making space vehicles)
    other things too

    But then I still want it to have whatever planets in the background... hmm. And I suppose I could possibly do the opposite. Turn my station into a world. But that isn't anything special over a dungeon etc. But if I figure out something good, I'd probably just have people use the shipworld swap method.
     
  8. HuggableCreep

    HuggableCreep Big Damn Hero

Share This Page