Modding Help Assigning tenants beds and sending them there.

Discussion in 'Starbound Modding' started by Kitta, Jul 31, 2016.

  1. Kitta

    Kitta Void-Bound Voyager

    Hello,

    I have an idea for creating a mod where i would assign a bed to a tenant and they would go to their bed when going to sleep. I have some ideas and concerns but i will need some help.

    Main Concern:
    Because of the way the game currently works, i can only assume that a space inside the tenant living space is only known to the spawning AI as habitable or inhabitable. It directly does not have any information about the room itself other then generic values such as theme of the room, and possibly it's size and specific flags for special npc's such as merchants.
    Possible Solution:
    If this is true, i will need to create some function that will test for the bed that the tenant has in the room before i can assign it. (if there are multiple, i would just pick the first one on the list)

    Idea 1:
    Before a tenant goes to sleep, from studying how the AI behaves, the tenant finds the closest bed first in a spherical fashion. Any bed closest to them by pure world distance (even if its much further to actually get to it) will be chosen as long as it's not already occupied. Then the AI moves to that bed and interacts with it.
    Implementation:
    If this is true, and if i can change the way this works, i would like to disable the looking for a bed function and instead directly send them to their assigned bed (assigned on spawn).

    Idea 2: Assign a location at which the bed is located and send them there BEFORE the test for closest bed locations run. This might be impossible if the code i need for this needs to be inside an existing function that i cant edit externally.

    I cant just see how the core runs internally (or at least i am not aware of how this could be done) and from studying other mods and the game docs i have only gotten more confused. Some mods add an "override" inside the villager files when adding a new variable, but i don't think i understand the process of doing that correctly, nor how to actually use added variables.

    I have created a recipe for an existing item in the game that is not craftable, stick of ram, but that is as extensively as i understand modding this game.

    I have also worked on stardew valley mods that added events and changed behavior of mailbox and npc's, but i was able to open the project through the StardewModdingAPI inside of visual studio and actually analyze the code running, analyzing the values i can work with and adding new ones, as well as tapping into events. But since that was c# coding with events and a debuggable exe, that experience is not useful here.

    So if anyone has any ideas or where i can get more information as to how to actually add, edit, or remove functions and variables from tenants, i would GREATLY appreciate it.
    Thank you.
     

Share This Page