Timberborn

Timberborn

34 ratings
Moddable Prefab (U7 ✅)
   
Award
Favorite
Favorited
Unfavorite
Mod
File Size
Posted
Updated
139.453 KB
Mar 19 @ 10:43am
Nov 11 @ 10:05am
6 Change Notes ( view )

Subscribe to download
Moddable Prefab (U7 ✅)

In 1 collection by Luke ✞ Jesus Saves ✞
Luke's U7 Compatible Mods
101 items
Description
This mod is no longer needed for v1.0 as all prefabs are now templates/JSON.
It will not receive any update.

With this mod, modders can make a lot more with 100% code-less mods (using JSONs). Previously they cannot modify values put inside a Prefab (including buildings' Science cost, Material , Power etc.) without using code. Now they can do it with JSONs.

Note to players: This mod does nothing by itself. It is for modders to create mods and you probably subscribe to this mod as a dependency for other mods to work.

Simply create blueprints files and that's it. It can be Blueprints\PrefabModder\AddLumbermill.json, the name and path does not matter as long as it is in the Blueprints folder. Below are some examples of what you can do with this mod.

If you need any help, please ping me on the Timberborn's Official Discord server. You can also check out my Modding Guide[datvm.github.io] for more information on where to find out about the names and values (right now it's still a WIP but the first 2 parts are already there). You can also check out Berry Bie and Timbits & Timbots, they are JSON-only mods (no C# code or assets).

For more info, contact me on official Discord ( https://discord.gg/timberborn ), on #mod-creator channel or Moddable Prefab[discord.com] channel.

===

Change logs

v10.0.0: Simply throw an error for Timberborn v1.0 so players can disable it.

v7.2.0: You can now specify Factions that the modifiers apply to.

v7.1.2: Should work with April 02 update now, dependent mods don't need to do anything.

v7.1.1:
- Fixed Prefab being modified twice again when the game is loaded the 2nd time onwards. This mostly affected "AppendArray" specs.
- Added a Distinct() call for all "AppendArray" specs so string[] or array of structs should only contain unique values when multiple mods append the same values.

v7.1.0:
- Added PrefabAddComponentSpec support for adding components to a prefab (GameObject).
- Allow single quote ' in the NewValue property instead of double quote only. They are converted into double quote under the hood. Use \' if you want to keep it as '.
- Allow underscore _ as ValuePath to set the current Component value.

Remove all sciences

Set all BuildingSpec _scienceCost to 0, which means all buildings are unlocked from start:

{ "PrefabModderSpec": { "ComponentType": "Timberborn.Buildings.BuildingSpec", // BuildingSpec is valid but a full name is better "ValuePath": "_scienceCost", "NewValue": "0" } }

Change a specific building:

Now it's not very good to apply a change to all buildings. Let's change only the Dam by... adding 1 Science cost:

{ "PrefabModderSpec": { "ComponentType": "Timberborn.Buildings.BuildingSpec", // BuildingSpec is valid but a full name is better "PrefabNames": [ "Dam.Folktails", "Dam.IronTeeth" ], // Optional in case multiple things may match the ComponentType "ValuePath": "_scienceCost", "NewValue": "1", // It must be a string that is a JSON "AppendArray": true, // We will use this later but here it is ignored because the value is not an array "Factions": [ "Folktails", "IronTeeth" ] // Optional, if not specified, it applies to all factions } }

Change building material cost:

Say we want to make Dam cheaper by adding 1 Plank to it:

{ "PrefabModderSpec": { "ComponentType": "Timberborn.Buildings.BuildingSpec", "PrefabNames": [ "Dam.Folktails", "Dam.IronTeeth" ], "ValuePath": "_buildingCost", "NewValue": "[{\"_goodId\": \"Plank\", \"_amount\": 1}]", "AppendArray": true // Add to the array instead of replacing it } }

Now that's a little too much, now it costs 20 Logs and 1 Plank. Let's change the cost completely to 10 Logs and 1 Plank:

{ "PrefabModderSpec": { "ComponentType": "Timberborn.Buildings.BuildingSpec", "PrefabNames": [ "Dam.Folktails", "Dam.IronTeeth" ], "ValuePath": "_buildingCost", "NewValue": "[{\"_goodId\": \"Log\", \"_amount\": 10}, {\"_goodId\": \"Plank\", \"_amount\": 1}]" } }

Note: Removing a certain value is not supported. Accessing a specific index in an array is not supported. You can only change the whole array.

Add a recipe to a building:

Well you could have done that with Moddable and Unlockable Recipe but with this mod, you can also add/remove recipes to buildings and change other stuff as well, so it's up to your choice.

The below code add Treated Plank recipe to Lumber Mill. You can also create your own recipe and add it to the building.

{ "PrefabModderSpec": { "ComponentType": "Timberborn.Workshops.ManufactorySpec", "PrefabNames": [ "LumberMill.Folktails", "LumberMill.IronTeeth" ], "ValuePath": "_productionRecipeIds", "NewValue": "[\"TreatedPlank\"]", "AppendArray": true // Add a new recipe } }

Add range to a building

From v7.1.0 you can now add new components into an existing prefab like a building using PrefabAddComponentSpec. The below code add ContinuousEffectBuildingSpec and RangedEffectBuildingSpec into the Hedge building:

{ "PrefabAddComponentSpec": { "ComponentType": "Timberborn.Buildings.BuildingSpec", "PrefabNames": [ "Hedge.Folktails", "Hedge.IronTeeth" ], "AddComponents": [ "Timberborn.RangedEffectSystem.ContinuousEffectBuildingSpec", "Timberborn.RangedEffectSystem.RangedEffectBuildingSpec" ] } }

You can then also add values to those components:

{ "PrefabModderSpec": { "ComponentType": "Timberborn.RangedEffectSystem.ContinuousEffectBuildingSpec", "PrefabNames": [ "Hedge.Folktails", "Hedge.IronTeeth" ], "ValuePath": "_", "NewValue": "{'_effectSpecs':[{'_needId':'Hedge','_pointsPerHour':1,'_satisfyToMaxValue':true}]}" } } { "PrefabModderSpec": { "ComponentType": "Timberborn.RangedEffectSystem.RangedEffectBuildingSpec", "PrefabNames": [ "Hedge.Folktails", "Hedge.IronTeeth" ], "ValuePath": "_", "NewValue": "{'_effectRadius':3}" } }

===
Source code is available at: https://github.com/datvm/TimberbornMods
Popular Discussions View All (1)
5
Jul 14 @ 11:38pm
Specify prefab
Luke ✞ Jesus Saves ✞
11 Comments
Luke ✞ Jesus Saves ✞  [author] Oct 27 @ 7:57pm 
Yes, you would need to edit the BuildingSpec I think. Building auto unlocks if their science cost is 0.
OldGamer Oct 27 @ 1:30pm 
Hi Luke, would it be possible with this MOD to unlock the sluices from the start and change the materials from 5 planks and 5 metal blocks to 5 planks and 5 gears?
Luke ✞ Jesus Saves ✞  [author] Jul 14 @ 10:06pm 
I don't think Steam comment is good for this discussion so I created a discussion here: https://steamcommunity.com/workshop/filedetails/discussion/3447837683/582769417678692070/
Luke ✞ Jesus Saves ✞  [author] Jul 14 @ 1:40pm 
Oh yeah sorry I wasn't able to write guide for this one yet 😅 it wasn't high on the priority list because I have plenty of example on this one. Do you have a specific problem you need help immediately with? You can ask me on Discord, ping me @theapologist316 on #mod-creators channel should be good.
crashfly Jul 13 @ 3:46pm 
your modding guide has a missing link on #4 - using json and moddable prefabs.

i am hoping to use this mod to tweak the defaults of another mod.
Panchito Mágico Jun 30 @ 4:02am 
Solved!
I am searching, reading and fixing it by myself! Do not worry and thanks! :)
Luke ✞ Jesus Saves ✞  [author] Jun 30 @ 3:51am 
Hi, will need a longer log than that to find out which mod or what is causing it. You can post it on Discord, people there are very helpful!
Panchito Mágico Jun 29 @ 10:13pm 
I like your art, pictures and icons! Sweet mods!

Also, I am getting this: Timberborn.MapMetadataSystemUI.MapMetadataPanel.get_MapNameLocKey(), any ideas? Thanks!
Cheez Mar 20 @ 10:06pm 
no
Luke ✞ Jesus Saves ✞  [author] Mar 20 @ 10:04pm 
Hey I think you are right but as a modder I can't really make any good assets. Could you please provide some good one so I replace this bad art? Thanks!