Modding Discussion Colony Manager (WIP title)

Discussion in 'Starbound Modding' started by cybersam, Sep 5, 2016.

  1. cybersam

    cybersam Subatomic Cosmonaut

    so... i've been trying to learn the modding on this game and try my first steps in lua
    it is frustrating at time having no real way to realtime debug and always having to stop the game so the log is written..
    but i've been doing some progress
    anyway...

    the actual mod idea:
    create a termianl to manage a colony.
    features planned so far:
    • add output node to colonydeeds that power on when rent is due
    • add a terminal to interact with
    • collect rent
    • show a list of all the tenants
    • equip tenants with equipment *
    • accept quests at the terminal instead of going to the tenant
    • implement a power system like adding electricity generators that produce energy that will be used to power different things (though not sure if its feasable)
    • maybe some other thinks later on
    * still need to find out if this is possible

    already working in my testmod:
    • add output node to colonydeeds that power on when rent is due
    • add a terminal to interact with
    • collect rent
    here is a mockup of how its currently planned
    the ui is in the mod but the only working part is the collect rent button the other elements are just a mockup

    with that all said, i'd like to have some thoughts of you guys, like if guys t hinks it worth it or some ideas to add or features to remove from the list or add

    ofcourse if you think your can help finishing this would also be great
    as you can see from the termal... in the mockup... i'm not really good with sprites (just used existing sprites from vanilla and put them together)


    Termanl not connectected
    mokup.png

    Terminal Connected
    mokup2.png
     
  2. LordBaconator

    LordBaconator Scruffy Nerf-Herder

    How are you detecting the tenants to populate the terminal, and how you collecting the rent?

    I'm going to need to know both of those things to support compatibility with this in the future if you get anywhere with it.
     
  3. cybersam

    cybersam Subatomic Cosmonaut

    well currently...
    i'm adding a new outputnode and a script to the colonydeed
    that script is for controlling the node and a bit more convenience for my terminal...
    in this i call the function from the vanilla script to get the tenants and recreated a function to get the rrent
    well the rent function just spawns the treasure from the rent pool and resets the the rent timer like the vanilla script
    only difference is it puts the position at the terminals position and not the deedsposition

    other then that i'm not doing anything with the colony deed
    the script itself shouldn't overwrtie anytihng so it should be compatible with any other mod
    i guess the only problem would be if we add a node on the same spot ^_^'''
     
  4. LordBaconator

    LordBaconator Scruffy Nerf-Herder

    Sounds good. The mod I'm concerned about compatibility with (Colony Tweaks) already has wiring input and output functions like you described so I imagine I'd just have to add in your alternate rent spawning function.

    This is all for a time in the future, though. :nurutease:

    Carry on, good sir.
     
  5. cybersam

    cybersam Subatomic Cosmonaut

    well i'll check that mod out and make changes to mine accordingly so that it will be compatible ^_^
    edit...
    aww... crap its a steam workshop only mod...
    i had hoped i could download it normally...

    well... will have to get it from steam... and i wanted to avoid the workshop mods... -.-
     
    Last edited: Sep 6, 2016
  6. LordBaconator

    LordBaconator Scruffy Nerf-Herder

    I'm keeping it on Steam until I feel like it's 1.0 worthy; fair warning.

    Also still in the process of changing stuff in the scripts. Mostly just need to create better algorithms.
     
  7. cybersam

    cybersam Subatomic Cosmonaut

    ah... so you are the author...

    well if you want... we can combine both mod together...
    as you already have some good stuff going already...

    i'm currently working on my interface and trying to populate the list with actual tenant data

    so instead of having 2 seperate mods for colony stuff we could just combine it and work together...
    that is... if you want to ^_^
     
  8. cybersam

    cybersam Subatomic Cosmonaut

    litle update on the progress....

    i finally managed to fix my problem with the list and its showing the tenants...
    so i'll probably release the first version this weekend...
    it will only allow for collecting all the rents and show the tenants (and maybe the details for each... atleast thats the next i'm concentrating on)
     
  9. bk3k

    bk3k Oxygen Tank

    As for the wiring, the main options then would be
    1. A second wire node. You use object.setOutputNodeLevel instead of object.setAllOutputNodes

    A major difference being you'll have to make sure the deed has that node before outputting(else crash the script) where as object.setAllOutputNodes I believe does that check internally already for you. But then that's easy to check for. I used
    Code:
      storage.maxInputNode = ( #(config.getParameter("inputNodes", {})) - 1 )
      storage.maxOutputNode = ( #(config.getParameter("outputNodes", {})) - 1 )
    
    -- and later something like
    
    if storage.maxOutputNode >= 0 then
      doStuff()
    else
      all_isLost()
    end
    
    2. Just one output node. You detect what is hooked up with object.getOutputNodeIds and then send your terminal info with
    world.callScriptedEntity. You call a function intended to receive the data, and send the data as arguments. The terminal can probably otherwise ignore the actual input node.

    Or maybe it makes more sense to do the opposite. I mean to keep compatibility between mods, but without requiring both to use either.
    Terminal uses object.getInputNodeIds and finds the deeds. Uses world.callScriptedEntity to call a function on the deeds to get info or otherwise control. Those functions may not be used by Colony Tweaks directly, but would be present to be used by Colony Manager.

    I'm just shooting ideas for you. I'd like to see more out of the colony system and have done some thinking on that myself.

    --edited/added--

    You might also check out what's been done here
    http://community.playstarbound.com/threads/tenant-pack.113856/
    Much of that could be incorporated if you like. Open permissions, and also he said he isn't great with LUA but can do content alright. I don't know if he'd be interested in helping out, but the tenants (or some variation) could be used anyhow.

    It is in line with the idea of discouraging the minimalist colonies. Where as I'm more interested in the concept than a specific implementation.
     
    Last edited: Sep 12, 2016
    cybersam likes this.
  10. cybersam

    cybersam Subatomic Cosmonaut

    thanks for the input...
    but the thing with the nodes...
    well... we can't check if there is a node already and decide not to add one...
    so we will have a conflict there...
    if we use the same position it might glitch out or cause somekinde of bug where both mods wont work...
    not sure how it will affect the game till we actually run both mods simultaneously...

    as for that mod... you recommended... too bad the author wasn't on for months now...

    hmm...
    while i'm writing this i got an idea...

    how about we create a mod that add the nodes to the colonydeed and both our functionality, that is if we aren't doing the samething...
    and use that as a base for our mods...
    we would use both our mods as addons so to speak...

    that way we won't we won't have to think too much about compatitbility ^_^


    (will download your mod on steam... its still there right ? ^_^)
     
  11. LordBaconator

    LordBaconator Scruffy Nerf-Herder

    For the record Colony Tweaks has this:
    (It sends power to output when rent is ready)
    Code:
    object.setAllOutputNodes(isRentDue())
    
        -- Avoid rettrigering
        if self.interactionDebouncer > 0.0 then
            self.interactionDebouncer = self.interactionDebouncer - dt
        end
    
        if object.getInputNodeLevel(0) and self.interactionDebouncer <= 0 then
            onInteraction({ sourceId = 0 })
            self.interactionDebouncer = 1.0
        end
    When it adds nodes to the actual colony deed object it does this:
    (If you do an add operation over a path location that already exists like /scripts it effectively acts like a remove and replace operation, so keep that i mind)
    Code:
    [
        {"op" : "replace", "path" : "/scripts", "value" :
        [
            "/objects/spawner/colonydeed/script/colonydeedmodified.lua",
            "/objects/spawner/colonydeed/script/scanningmodified.lua",
            "/objects/spawner/colonydeed/script/timermodified.lua",
            "/scripts/util.lua"
        ]},
        {
            "op": "add",
            "path": "/inputNodes",
            "value": [ [-1, 1] ]
        },
        {
            "op": "add",
            "path": "/outputNodes",
            "value": [ [0, 1] ]
        }
    ]
    This identical code is applied to all of the Themed Deeds available from Themed Colony Deeds when my patch mod is applied, as well.
     
    Last edited: Sep 12, 2016
  12. cybersam

    cybersam Subatomic Cosmonaut

    so the base is the same... i'm doing only that part for the deed that would confict...
    the only other thing i'm doing is adding functions to get all the tenants...

    though...
    for that i'm using require to load the colonydeed.lua to just ne able to use the functions from that one...
    so i don't have to rewrite existing code... that way no double code...
    to make it compatible i'd need to recreate the functions i use...


    note:
    i've just subscribed to your mod on steam... just need to locate it then i can have a look and try to make ny mod compatible to yours ^_^
     
  13. LordBaconator

    LordBaconator Scruffy Nerf-Herder

    It shouldn't be extremely difficult. There's a function in the modified deed lua that returns a calculated rent level. You'll have access it when you spawn rent in the world (via world.spawnTreasureInWorld). Currently the levels your mod outputs will be wrong through no fault of your own. I need to implement a temporary memory for rent level because I have to account for objects contained within a house and those don't get counted correctly if the house isn't loaded entirely in the world chunks.
     
  14. cybersam

    cybersam Subatomic Cosmonaut

    you could add a new config parameter in your mod for the deeds...
    and all i have to do is check for that parameter and use your pool instead of the default one or load your script instead of the vanilla one to get the correct parameters
     
    bk3k likes this.
  15. LordBaconator

    LordBaconator Scruffy Nerf-Herder

    Code:
    [
        {"op" : "replace", "path" : "/scripts", "value" :
        [
            "/objects/spawner/colonydeed/script/colonydeedmodified.lua",
            "/objects/spawner/colonydeed/script/scanningmodified.lua",
            "/objects/spawner/colonydeed/script/timermodified.lua",
            "/scripts/util.lua"
        ]},
        {
            "op": "add",
            "path": "/inputNodes",
            "value": [ [-1, 1] ]
        },
        {
            "op": "add",
            "path": "/outputNodes",
            "value": [ [0, 1] ]
        },
        [
        {
            "op": "add",
            "path": "/deed/colonyTweaks",
            "value": true
        }
    ]
    ]
    The patch looks like that now. Obviously it won't be in the version you have on your disk but you can just copy that in for testing.
     
  16. bk3k

    bk3k Oxygen Tank

    That's idea #1 and I think idea #2 was the better idea. What I meant with #1 was
    FIrst you go ahead and patch the nodes on. You don't have to care what nodes would have been there, although you need to be sure your patch hit last.
    You just use the 2nd(node 1). So for your purposes, the other nodes isn't used.

    But as I say, the second idea is better.

    That is a shame, but his assets are open permission. Not only I'm pretty sure he doesn't mind anyone using them, but I believe he's stated before that he was looking for people to take over his mods. But if he got back on, he might be interested in contributing more.

    Something like a package dependency system. Base-in-a-box and Pilch's FCS do this.

    Also there's what I did with the automatic doors with regard to my (terribly incomplete) debugger package. When not needed, the functions are replaced with blank functions so I can afford to forget to comment them out but without inspiring errors. I just need to change self.doDebug from true to false

    You could see what I mean here. And for that matter feel use any code you find useful. https://github.com/bk3000/Automatic-Doors

    --edit/addition-- Speaking of github... that wouldn't be the worst idea for your projects if you are going to collaborate in any way. Even if for no other reason than keeping your project compatible with others.
     
    Last edited: Sep 12, 2016
  17. LordBaconator

    LordBaconator Scruffy Nerf-Herder

    For the record bk3k I also looked at Tenant Pack and said "Nope. This doesn't coincide with my vision at all and doesn't actually provide me with any useful information that wasn't already obvious." It was also never released to Steam which is my primary focus anyway. A lot of what he did was just copy/paste identical tenant data and make the requirements higher meaning you would have to respawn a tenant if you wanted to expand their house.

    I opted to just create my own assets and my own rule set.

    Also @cybersam, one thing you could consider doing in your console is adding a way to turn on and off the vacated state mode of colony deeds. I'm turning it on by default with my changes (as of right now because I decided it was appropriate), but it's not available in vanilla. What the mode does is allow tenants to leave a house without having their data deleted (ex. if they leave because part of the house was broken for too long) so that when the home is stable again they can return and be the same tenant with the same physical attributes.
     
    bk3k likes this.
  18. LordBaconator

    LordBaconator Scruffy Nerf-Herder

  19. bk3k

    bk3k Oxygen Tank

    Oh I forgot to reply to this part earlier. That you can't get a real-time readout isn't true.

    http://community.playstarbound.com/...-on-window-mac-and-linux.104151/#post-2747149

    An alternative option would be (if using notepad++)
    File/Reload from disk
    I think it has an auto reload option somewhere, but the need to reload doesn't get triggered in real time even as the log itself does get written in real time.
    You could consider adding a hotkey to reload the file. In fact I should do that myself. Possibly some plugin auto-reloads files on a timer. If not, one could be written.

    And thinking about this, I really should hook up a second monitor again. Something to throw my logs on while the game runs. It would make other tasks easier too. I never quite have enough monitor real estate.
     
    cybersam likes this.
  20. LordBaconator

    LordBaconator Scruffy Nerf-Herder

    Why the hell was -loglevel debug not documented anywhere? :nuruconfused:
    Enabling debug log was literally the first thing I looked for. Something that basic should be findindable in a google search. :nurumad:
     

Share This Page