Barotrauma

Barotrauma

Not enough ratings
Paintable Items Addon Creation
By LeCrazyy
This is a quick guide that touches on the basics of modding Barotrauma but more specifically adding colours and support for other items for the Paintable Items mod, in this guide's example, we will be making a cyan diving suit colour and then adding support for cult clothing.

This guide will go over three things:
1 - Setting up the file structure for a mod, and using notepad++ with .xml addon.
2 - Adding a new color as an addon for Paintable Items.
3 - Adding support for other items, from vanilla or other mods.
   
Award
Favorite
Favorited
Unfavorite
Speed Run Edition:
File Setup
In Barotrauma/LocalMods create a new folder with any name, inside create 2 files: filelist.xml and items.xml.




Inside filelist.xml copy and paste the following text:

<contentpackage name="Mod Name" >
</contentpackage>


Above </contentpackage> type <Item file="%ModDir%/items.xml" />

Items File Setup/Recolouring Items
Open up items.xml.
Type:
<Items>

</Items>

Paste in the following code between the 2 lines:

<Item name="NAMEHERE" identifier="IDHERE" variantof="VARIANTOFHERE" inventoryiconcolor="R,G,B,255" spritecolor="R,G,B" >
<Fabricate suitablefabricators="apaintstation" requiredtime="REQUIREDTIME" >
<RequiredItem identifier="BASEITEM" amount="1"/>
<RequiredItem identifier="REQUIREDITEM" amount="AMOUNTREQUIRED"/>
</Fabricate>
</Item>




Change the identifier "IDHERE" to anything, recommend: "divingsuitcyan" to keep it simple, change the variantof "VARIANTOFHERE" to "acopydivingsuit" (this will make more sense in the adding items section).
Change the name "NAMEHERE" to anything, recommended "Cyan Painted Diving Suit"
Change both "R,G,B" values to the corresponding red, green and blue values from 0 to 255, best tested in the submarine editor in game, I think the value 0,255,240 looks good for cyan.







Change the "REQUIREDTIME" to a number, the actual time to craft will be half due to no skill requirement. I chose "20" for diving suits personally.
Change the "BASEITEM" to "divingsuit".
Change "REQUIREDITEM" to the desired crafting ingredient, my recommendation is "bluepaint" and then copy and paste the entire line to also add "greenpaint", full list of options I'd recommend at bottom of guide.
Change "AMOUNTREQUIRED" to the desired amount of paint/material you want, I use "2" for diving suits normally.



Then if you relaunch the game, you should now have the mod in the mod menu, and when both Paintable Items and your mod are enabled, you should see the new item in the paint station.
Adding Support For New Items
In Barotrauma/Content/Items/Jobgear/Cultist open cultist_gear.xml, press ctrl f and search for cultistrobes and find the one with id="cultistrobes" copy all of that item's code: (<Item> all the way down to </Item>)







Back in our own mod, open items.xml (You can have it in the same file as the recolor from before if you done that, otherwise create the file using the same steps from the recolor section), and paste it between <Items> and </Items>.








Change the ID of the "cultistrobes" to anything, recommend "copycultistrobes", change name from "" to anything, recommend "copy cultist robes".
Usually just below the first line will be PreferredContainer lines, remove these lines.






Find the Price section, next to the baseprice="x" add sold="false" if it was not there, remove any other sold="true" if needed below.



Remove the entire <Fabricate> section if it exists, we do not want copy items to be crafted. Cult robes do not have crafting by default.

Fix all "lazy" texture file paths that don't include the entire path e.g. "cultist.png" should be "Content/Items/JobGear/Cultist/cultist.png".



If the item is from another mod you can use %ModDir:WorkshopId% for filepaths instead of %ModDir%, replace WorkshopId with the mod's workshop ID (the string of 10 numbers on the url for the mod).

You can now use the identifier of this copied item to replace VARIANTOFHERE in the example code for coloring, each color requiring a new item type similar to the cyan.

For example, you could copy the cyan code and change it to become a cyan cult robe using this:

<Item name="Cyan Painted Cultist Robes" identifier="cultistrobescyan" variantof="copycultistrobes" inventoryiconcolor="0,255,240,255" spritecolor="0,255,240" >
<Fabricate suitablefabricators="apaintstation" requiredtime="6" >
<RequiredItem identifier="cultistrobes" amount="1"/>
<RequiredItem identifier="bluepaint" amount="1"/>
<RequiredItem identifier="greenpaint" amount="1"/>
</Fabricate>
</Item>