Modding Help Tool that paints objects

Discussion in 'Starbound Modding' started by mastercookie, Feb 14, 2017.

  1. mastercookie

    mastercookie Existential Complex

    MrMagical (the author of dyemod) showed this before he went quiet:

    i would really love to have a tool like that (hopefully not only me)
    i looked into painttool to check if u can switch block painting to object painting, but ive no idea if its possible:
      "itemName" : "painttool",
      "price" : 0,
      "inventoryIcon" : "paintergunicon.png",
      "maxStack" : 1,
      "rarity" : "Essential",
      "description" : "Primary fire applies paint, secondary changes colour. ^green;Quick select with [Y] key.",
      "shortdescription" : "Paint Mode",
      "fireTime" : 0.05,
      "blockRadius" : 3,
      "altBlockRadius" : 1,
      "twoHanded" : true,
      "strikeSounds" : [ "/sfx/tools/paint_splash.ogg" ],
      "largeImage" : "paintgunlarge.png",
      "tooltipKind" : "mm",
      "category" : "Tool",
      "image" : "/items/tools/paintergunvariants.png:0",
      "endImages" : [ "/humanoid/any/ball.png", "/humanoid/any/tileglow.png", "/humanoid/any/4tileglow.png", "/humanoid/any/ball.png" ],
      "handPosition" : [-1.5, -0.5],
      "firePosition" : [5, 0],
      "segmentsPerUnit" : 1,
      "nearControlPointElasticity" : 0.1,
      "farControlPointElasticity" : 0.9,
      "nearControlPointDistance" : 0.9,
      "targetSegmentRun" : 1,
      "innerBrightnessScale" : 20,
      "firstStripeThickness" : 0.2,
      "secondStripeThickness" : 0.05,
      "minBeamWidth" : 1,
      "maxBeamWidth" : 5,
      "maxBeamJitter" : 0.2,
      "minBeamJitter" : 0.1,
      "minBeamTrans" : 0.6,
      "maxBeamTrans" : 0.6,
      "minBeamLines" : 1,
      "maxBeamLines" : 5,
      "colorNumbers" : [
        [0, 0, 0, 0], "red", "blue", "green", "yellow", "orange", [210, 45, 193, 255], "black", "white"
      "colorKeys" : [
        "", ".red", ".blue", ".green", ".yellow", ".orange", ".pink", ".black", ".white"
    i also tried making dyemod work again, but u need to know lua, im getting this error:

    [string "/objects/dyeengine/scripts/itemConfig.lua"]:18: attempt to call a nil value (field 'itemType')
    stack traceback:
       [C]: in field 'itemType'
       [string "/objects/dyeengine/scripts/itemConfig.lua"]:18: in field 'get'
       [string "/objects/dyeengine/scripts/dyeEngine.lua"]:4: in field 'all'
       [string "/objects/dyeengine/dyestation/dyestation.lua"]:14: in function <[string "/objects/dyeengine/dyestation/dyestation.lua"]:8>
    any help on this matter is appreciated
    Charlatan likes this.
  2. AmazonValkyrie

    AmazonValkyrie Spaceman Spiff

    You are definitely not the only one! In fact, a lot of people have been bringing it up at blog previews, but there's still been no official response that I know of. @Charlatan was looking into this recently, in hopes of accomplishing the same, but when last we spoke he wasn't too optimistic at being able to revive this feature properly, and I do believe he was working with LUA script to figure it out. It would be really nice if CF would just add this in again already, everybody would want this. Absolutely everybody.
    Charlatan likes this.
  3. Charlatan

    Charlatan Parsec Taste Tester

    With @bk3k 's help, I AT LEAST now know of a limited way to implement this (with a separate painting tool). Very limited - I can make it for my own mod's objects, but applying this to every vanilla object would be a megalomaniac effort and equally problematic with compatibility.

    However, things are slowly looking more clear, and i'll look into it again later today.
  4. mastercookie

    mastercookie Existential Complex

    if it involves some sort of whitelist of all dyeable vanilla objects, i can do this, its just time consuming.

    EDIT: there is actually a list of them in dyestation.object (in dyemod)
    Charlatan likes this.
  5. Charlatan

    Charlatan Parsec Taste Tester

    Nice to see your initiative! I'll take a look at the dye mod. If there is a solution involving this, it'd be great to have that list.

    Some Trivia so that everyone is up-to-date:

    The way items are colored, has always been entirely different to objects, and there's no way this method could be properly applied on objects anyway:

    1.) The equipable items have, in their .item file, a block of data, a list, which tells the game, for each color, how to swap the pixels of 3 specific colors codes into 3 different color codes. (using their HTML code)
    That's why all color-able parts of an item are always painted in 3 shades or orange in the .png files.

    2.) This list is understood through an index, the first entry is 0 and the default, then the dye colors follow as 1-11. The index a color belongs to is also noted in the dye items' .augment files.
    3.) A lua script, shared among all dyes, takes that index, finds it in the .item file and then performs the palette swap mentioned in point 1.).

    Objects used their .frame files instead, and the hope I had, to find any clues on how to restore the pre 1.0 coloring, was hampered by this:

      "itemName" : "reddye",
      "rarity" : "Common",
      "inventoryIcon" : "reddye.png",
      "description" : "A red dye. Can be used to dye armour.",
      "shortdescription" : "Red Dye"

    There's no parameter or script or anything, just the absolute minimum to work as an item. So coloring objects was hardcoded for sure!

    The solution we have ATM:

    Everyone who mods here surely saw the <color> tag is still all over the place, coming after .png in an .object 's image, right?
    That can be simply used as an entry in the .frames file. Adding an .animation we can define it as an exchangeable tag. Adding a .lua, we can give it a message.setHandler function which swaps the tag with the color string we want. Finally, we make an activeitem which I suggest swaps through colors with right click, and using it sends the appropriate world.sendEntityMessage to the object you aim at.

    This would require adding .animation and .lua to all colorable objects. Sucks, but it's all we have atm, and it could at least easily allow us to add recoloring to our own mods' objects.
    Last edited: Feb 14, 2017
    AmazonValkyrie and mastercookie like this.
  6. mastercookie

    mastercookie Existential Complex

    soo i see how items and objects are different, but what about applying block colouring to objects? my guess its not that simple as well...

    on the current solution: i kind of get the idea, but what about dyemod? it managed to do it without additional lua and animation files.
    maybe its not possible anymore after 1.0?

    anyways if theres some boring matter of adding/tweaking lots of files, ill be glad to help :)
    Charlatan likes this.
  7. Charlatan

    Charlatan Parsec Taste Tester

    I don't know why people keep saying this ^^
    Neither Dyemod, nor any other "additional color" mod works on furniture / objects.

    Anyway thanks for offering help, i'll post as soon as I know more !
  8. mastercookie

    mastercookie Existential Complex

    dyemod worked on objects, i used it for my mod as well as vanilla objects. heres the proof :D


    i remember there was a problem of colours being in messed up order.
    Charlatan likes this.
  9. bk3k

    bk3k Oxygen Tank

    I'll have to check out dyemod then. Maybe I can figure it out. I've been thinking about doing this, and also I'm planning several object modification stations and well as tools. Maybe a foreground/background tile switcher tool too. I might add them into Hull Plating after reviving it(probably pending only recipe changes at this point).

    I intend to add support for what @Charlatan is talking about. I figured the tool could use a entityQuery check that calls functions, and the tool actually disregards the return because it is the objects(via that function call) that initiate the change. The parameters passed to the function could be what tag to switch, and what to switch it too.

    So there is the <color> switching method, and I intend to look at processing directives to get a handle on those for more options.
    Charlatan likes this.
  10. The | Suit

    The | Suit Agent S. Forum Moderator

    You shouldn't have to make an animation file for each state.
    From the looks of it all he did is change the object property to specify a specific color.

    If you take a look at my Purchaable pets - I have a single frames file for all my houses.
    And each object specifies a specific color for each house.

    At which point it can be changed to a different color with,
    object.setConfigParameter(`String` key, `Json` value)

    I am guessing what he did is - make a gun that shoots a particle, with right click to change colors.
    With left click which talks to any object which is under the mouse.
    Charlatan likes this.
  11. mastercookie

    mastercookie Existential Complex

    initially to dye an object in dyemod, u put it in hotbar and use it on the dyestation. The gun was never implemented, MrMagical just teased it :(
    Charlatan likes this.
  12. Charlatan

    Charlatan Parsec Taste Tester

    My bad - that's good news ! It is obvious we were looking at different mods here. But do you have a link to an up-to-date version?
    It's not , is it? Because that one is pre-1.0 :/

    I already got this ready as a separate .activeItem. My mod (upcoming version) has a so-called "Decoration Displacer" which "locks" the interactable decos of my mod by making them non-interactable through objectQuery + sendEntityMessage. Adjusting those files to swap colors instead could probably be done within minutes.

    That is done through an objectQuery set to the smallest possible radius.
    This radius won't get smaller than roughly the size of 1 in-game tile and tends to be quite inaccurate, but that was easily solved by adding the option "Nearest" and only using world.sendEntityMessage on the first entry of the array returned by the query.

    That's the core problem I started out with, Mr. Suit.
    The very first and most straight-forward thing I tried was to use object.setConfigParameter(`String` key, `Json` value) to either set a new value for the image or frame, but no matter how I set it up, I could not edit any entry inside the "orientations" block at all.
  13. mastercookie

    mastercookie Existential Complex

    well that the problem with the mod it doesnt have working version atm. there's fanmade one

    u need to delete items folder (it has duplicates dyes) and it still wont work. the only thing i could fix is change entity.setInteractive(true) to object.setInteractive(true) in dyestation.lua

    i posted errors i got in the first post, unfortunately no idea how to fix them.

    also i dont remember how to craft the station, i use spawnitem dyestation.object
    Last edited: Feb 15, 2017
    Charlatan likes this.
  14. Charlatan

    Charlatan Parsec Taste Tester

    You merely need to go into the items folder, open each dye .item and change their name / ID.
    Then the same has to be done in the player.config file.

    I simply changed reddye into reddye2 (and so on) Unfortunately, if you try to use it on an object, nothing happens. Also, you can only try by placing the object into a container (while holding a dye on your cursor, you can't access the objects tab of your inventory.)
  15. mastercookie

    mastercookie Existential Complex

    why would u even bother with dyes? they werent used to paint objects.
    u just used an object on a dyestation. the problem is dyestation gives a bunch of lua errors and therefore not active
    Charlatan likes this.
  16. mastercookie

    mastercookie Existential Complex

    any news guys? dont let my hopes die :(

    anyways i'll start a new thread on trying to bring dyemod back to life, because putting 2 things in one thread isnt very smart
    Charlatan likes this.
  17. Odditer

    Odditer Tentacle Wrangler

    can't you just use the paint tool on the MM?
    Charlatan likes this.
  18. mastercookie

    mastercookie Existential Complex

    now why i didnt think about that? :nuruhappy:
    Charlatan likes this.
  19. Charlatan

    Charlatan Parsec Taste Tester

    Oi, your hopes need a much longer life expectancy :p
    It's just been one day. I for my part have been kinda busy, but I definitely wont give up on this. Just, no news yet.

    Yeah it could be patched so that it works on objects.

    No matter how you see it, however, it requires editing every target-able object too.
  20. mastercookie

    mastercookie Existential Complex

    there are 284 objects in dyemod's whitelist , but it was pre-1.0, i dont think there's much more now (smth tells me there's less).

    but if u got the base scripts, adding those is just a matter of time, clearly the hardest part is making the whole thing work.
    Charlatan likes this.

Share This Page