Modding Help Getting Non-Container to Open When Interacted With?

Discussion in 'Starbound Modding' started by rare_candy_bracelet, Jun 30, 2017.

  1. rare_candy_bracelet

    rare_candy_bracelet Existential Complex

    so, I'd like to make a grill, right? and I want it to pull up the Campfire crafting menu.
    grillhelp.png
    The problem is I'd like to make it open when it's being used and close when it's not, like chests and such do, but I'm not sure how to go about it. Can someone point me in the right direction here?
     
  2. projectmayhem

    projectmayhem Spaceman Spiff

    Id open a chest file and the campfire file and start tossing bits of their codes together. I'm assuming the "opening/closing" is part of being labeled a container. But that is just my assumption. But maybe you could omit the bottom part of the chest file
    Code:
     "openSounds" : [ "/sfx/objects/chest_small_open.ogg" ],
      "closeSounds" : [ "/sfx/objects/chest_small_close.ogg" ],
      "slotCount" : 16,
      "uiConfig" : "/interface/chests/chest<slots>.config",
      "frameCooldown" : 5,
      "autoCloseCooldown" : 3600
    


    and add the top of the campfire file

    Code:
     "interactAction" : "OpenCraftingInterface",
      "interactData" : {
        "config" : "/interface/windowconfig/craftingcampfire.config",
        "filter" : [ "campfire" ]
      },
    
     
  3. bk3k

    bk3k Oxygen Tank

    Well the complex way is a scripted version of the campfire interface, that messages the object to know it has been opened or closed.

    The simple way(if it still works), is this. The old cooking fire interface from Enraged Koala was in part a container. You added the input, and the output you then had to remove from the container. In case it is useful to you, I threw the whole folder containing this interface in a 7z file.
     

    Attached Files:

    projectmayhem and IHart like this.
  4. rare_candy_bracelet

    rare_candy_bracelet Existential Complex

    @bk3k & @projectmayhem thank you both! i'll try both of your solutions and get back to you on the results
     
  5. rare_candy_bracelet

    rare_candy_bracelet Existential Complex

    alright so... that was a bust. @bk3k you mentioned making a scripted version of the campfire interface, yeah? I suppose it's the only way at this point. are there any other objects that do something similar so I might just piggyback off of that code?
     
  6. cpeosphoros

    cpeosphoros Orbital Explorer

    @rare_candy_bracelet An alternative way you can try is just copying and editing some crafting stations .object from vanilla /objects/crafting and their interface from /interface/windowconfig.

    About changing the images, to reflect if the station is open or closed, you may want to replicate how vanilla's upgradable crafting stations switch animations when upgraded.

    Have a look at /objects/crafting/upgradeablecraftingobjects/upgradeablecraftingobject.lua and any upgradable station at /objects/crafting/upgradeablecraftingobjects. Then, change both the json .object and the lua script parts about upgradeStages and animationState so they reflect openClosedState.

    I can give you some code examples, if you want, but I think the better way to learn programming is trying to do it yourself. Anyways, just shout if you need further help.
     
  7. rare_candy_bracelet

    rare_candy_bracelet Existential Complex

    hey thanks a bunch man! I'd just about given up on the whole thing. I'll give it a shot, but if you wanna send those examples over later on, that'd be cool too! I did know some basic programming but that was back in highschool so a lot of it mightve just ebbed away.
     
  8. cpeosphoros

    cpeosphoros Orbital Explorer

    Ok, right. First of all, have a look at this post. I wrote that with a total beginner in mind. Please be sure that you get familiar with those concepts before trying to move on.

    In your case, however, you don't want to mess around with armor, but with crafting stations. Ok, no problem with that, you just have to look for a different set of assets.

    The ones you are looking for are mostly in the /objects/crafting, /objects/crafting/upgradeablecraftingobjects/ and /interface/windowconfig folders.

    You will want to merge some elements from craftingcampfire.config and one of the upgradeables, like craftingfurnace.config. Same thing for their .object files. Then you will need to make a very simplified version of upgradeablecraftingobject.lua, to handle your state changing behavior, and 2 sets of .frames and .png files, one for each state. You also have to grab craftingfurnace.animation and change it to reflect your states.

    All that said, if you want help with the coding properly, at least try to do something. If you encounter problems while doing that, post your code here and I, and sure more people in the community, will help you to iron it out.
     

Share This Page