#TimberAPI
1 messages ยท Page 2 of 1
i just made a copy
and that works
now i'm trying to see if the waterpumping animation can be saved
so add a sufix LM_ ๐
when i need new names i just give my keyboard a spanking ๐
you could append the modid, wouldn't solve the issue for having multiple of the same name on the same mod but would solve it for different mods at least
I don't have the mod ID there
well then all you can do is cope 
Random gen 
tbh, that would work since it's not ment to be used in the specifications for choosing another building image
You can just use the full path for that
@stone shoal what do i do wrong to change this building to be DevMode 
๐ Hidden worked
even if its then always hidden 
This should need to work 
can you try lower case
and "Type": "PlaceableObjectTool" isn't required since it's already that
will do
ok
ok ?
next info about Type ๐
Defines what tool will be created, check out TimberApi Tools to find the identifiers or check out the mod creator
was needed before with the first alpha ๐
also not
, I think
who know will try remove it later
nope this did not work ๐ฆ
"Devmode":true
"devmode": true
"DevMode": true
I mean the file name ๐
mb
Not sure if properties are capital sensetive, I do believe so
hmm well if Hidden works then i dont see a reason why it should be the file name 
hmm tryu
Believe I found a bug in the generator tho
but should not matter for the manual setting it
so try "DevModeTool":true?
Oh
whoops
objectLoader.GetValueOrDefault(new PropertyKey<bool>("DevModeTool"), false),
Didn't change it
I believe DevMode is better tho
So it will become dev mode
will keep it hidden for now
isn't hidden in your case even the better choice ?
why would you want it enabled in dev mode 
true, and if they want it they can remove the Spec
Hmm TimberAPI 0.5.5.2 does not even launch ๐ฆ

@vast otter mentOutOfRangeException: Property not found: 'FallbackGroup'
ye nvm im dum
I removed 1 FallbackGroup too much goddang
@vast otter 3rd time a charm, should work
[Error : Unity Log] ArgumentException: An item with the same key has already been added. Key: TrackIntersectionTIcon-v6
Stack trace:
System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <27586baf39bf4babbfd8a2caabe8e228>:0)
System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) (at <27586baf39bf4babbfd8a2caabe8e228>:0)
TimberApi.ToolSystem.ToolIconService.AddIcon (UnityEngine.Sprite sprite) (at <4cae64c9bbf24b2ca603f90bbb316330>:0)
TimberApi.ToolSystem.Tools.PlaceableObject.PlaceableObjectToolGenerator+<Generate>d__2.MoveNext () (at <4cae64c9bbf24b2ca603f90bbb316330>:0)
System.Linq.Lookup`2[TKey,TElement].Create (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector, System.Collections.Generic.IEqualityComparer`1[T] comparer) (at <40b481cb584843bbbf4c840095ac6811>:0)
System.Linq.GroupedEnumerable`2[TSource,TKey].GetEnumerator () (at <40b481cb584843bbbf4c840095ac6811>:0)
TimberApi.SpecificationSystem.SpecificationRepository.AddRange (System.Collections.Generic.IEnumerable`1[T] specifications) (at <4cae64c9bbf24b2ca603f90bbb316330>:0)
TimberApi.SpecificationSystem.ObjectSpecificationGenerator.Load () (at <4cae64c9bbf24b2ca603f90bbb316330>:0)
(wrapper dynamic-method) Timberborn.SingletonSystem.SingletonLifecycleService.DMD<Timberborn.SingletonSystem.SingletonLifecycleService::LoadSingletons>(Timberborn.SingletonSystem.SingletonLifecycleService)
(wrapper dynamic-method) Timberborn.SingletonSystem.SingletonLifecycleService.DMD<Timberborn.SingletonSystem.SingletonLifecycleService::LoadAll>(Timberborn.SingletonSystem.SingletonLifecycleService)
Timberborn.SingletonSystem.SingletonLifecycleAdapter.Start () (at <ba22fff6ef524e90a1e90e690a52e955>:0) (at <778bc0c07d524335aa2b9ad24f3a2144>:0)```?
@vast otter did you get this? Sorry to bother you the whole time 
just ignore me otherwise
Have not tested latest version i am still on 0.5.5.1
Same
I have no clue whats the problem here
I downloaded all your updated mods
but i dont see anything different from you and what im doing
Hmm then im not sure why, have had problem with icon having the same name as base game item but that had a different error
Eq not file name but name of icon
I feel like its trying to load both IronTeeth and Folktails
no clue why it would be doing that though
Oke, taking a break, getting really frustrated
think i know what it is its just as i said 2 icons have the same name in the icon (not file name)
Note that in this example the file name hase V2 in it but the name ingame/in assetbundle does not
so it will crash with that error you could try 0.5.5.3 and see if it works right away that is what .2+ is trying to fix
send me a message later if your still stuck and we can look at it ๐
So you have a icon specific for ironteeth and folktails?
No its old info in the meta file what the icon is called that is the problem๐
Latest seems to work
So everything is ok now ?
You can reform it into a left screen side bar ๐
or like a recent used section
or maybe somehow make quick open categories
cannot wait till i need to create a special tool for pipette
then i will prbably need help again
๐ Docs 
who reads those?
๐ค ?
Yes
I have used that but the parameter order did not work ๐
Have set order for ladder in my staircase mod but it does not move it ๐ค will send config used later
objectLoader.Get(new PropertyKey<int>("Order")),
Seems to be used somewhat
idk
, well see if you sent the rest
This is the file i used to try to move it to different toolgroup and order position
was able to move it to new toolgroup but did not move in position 
I hope you are just testing it
Because order and groupId should just be configured in the placeableObject monobehaviour
But yes this seems right, maybe try it on another mod
Doubt but maybe you cannot change your own 
its not myown its tobberts (other mod that i have as dep)
and i do can change where it is just not what order it has 
Does the order work when doing it in the placeableobject 
And know I do a Order * 10
for each building
hmm but is there a max order that im hitting maybe 
dont think so
zippi ?
have tried now without "Type" and it works ๐
without the type it works 
Maybe a typo in the type?
but then it should give an error
no what i mean is this line was not needed anymore
"Type": "PlaceableObjectTool",
No change in how "order" work
And the dep mod ?
Download version 1.4.3 from ModIO !
@vast otter [Error : Unity Log] StaircaseLeft: 20200
staircaseleft is set on order 20200
but even than I cannot get it to work 
๐ค๐ณi see so order in unity is not 10x only specs
Hmm +10 i think will be even more bad. Not sure how to do it in a good way
I just wanted to give a 10 spacing between buildings
for groups
idk why it does weird things
reee
ah no okay yeah * 10 is better
but also confusing

WoodenStairs.Folktails: 2.010.000
sheesh
Only 10x if base game object? Not mod?
Basegame WoodenStairs.Folktails is 201 becomes 2010
Mod setting StaircaseLeft to 2011
I expect it to be placed right after woodenstairs and befor anything at 202 in basegame
I do understand and like the use case to increase the value for base game tho
Cut how to know that its a modded building
It is specially done for modded buildings
not for the game
The game uses spacings between order (at least for the buildings not dev stuff or map stuff always)
But if you made your own group why would you set the orders to something like 2000
I did not move the woodenstaircase pos just where it is and you said you did 10x to numbers so basegame it is 201 and i want it after so i set it to 2020
Have to try 202 and see how it behave
But if ladder is then placed in the back thats not great because then it does not help for placing mod buildings between base game items just toolgroups
Because I did it for the ToolGroups
What if someone wants to place a group between them
And for replacing them with jsons it also helps
But if the base game is 201 I find it very weird why it ends up being WoodenStairs.Folktails: 2010000
Which would be order 201.000 and that sounds like an odd number for Timberborn to fill in 
In 0.5.5.3, only specifications like BonusTypeSpecification, WellbeingTierSpecification, NeedSpecification and RecipeSpecification works ! BuildingSpecification, don't ! Something is changed in the mod that affect how it works ?
Note also the shader fix for dirt has stopped working on U4 ๐ฎ
Well, if dev's didn't broke anything in the latest update, looks like TimberAPI managed ๐
building specifications are something specific to TimberApi, maybe the game broke it or I did.
What isn't working exactly ?
Cannot add a recipe to a building. No problem to modify a recipe ....
I blieve that was never possible
but now it is a bug :P
I think I would need the building specifications to work for some mod compatibility. I made some custom resources in my mod and it would be nice if I could make building from other mods use them ๐
Typically I'm likely going to add a "scaffolding" manufactured resource for platform and all sorts of things, but I might want to edit the ladder cost to need some.
Marked as resolved
Intended behaviour
The specification works as intended, changing the parts it has
But it cabnot make a generator or making it bake bread from a ladder
Hey, a new idea
btw, did you add that specification service?
or did i have to do that myself?
i forgot
Both incorrect

You could implementat it yourself if it takes to long bit you had other problems and league
and me being sick
Bit it was internal so you cant 
yea, but i wasnt sure who should do what
You making a pr or me fixing it

Pretty much this๐ depends if @median plinth wanted it to work like this else it needs to be made differently
wait what? Adding recipes to buildings that already have recipes should be possible. If you mean adding recipes to buildings that don't already have recipes already then that isn't possible yeah
The second, not sure if it would even work 
yup that would be possible if someone was willing to add logic that adds the required components to buildings if trying to add recipes to it
but I won't have that time sadly
I was thinking more about indexing what components are on a gameobject and just make spec that adds or removes them
based on the decration system ofcrouse
good idea, now make it and do a PR for TimberAPI 
Hey that is what I say all the time 
Then he says, no not gonna add that 
are you gonna add my Dynamic specifications?
?
DecorationSpecification 
That's the problem, cannot add another recipe to a building, just modify the existing one(s) ...
Did it work before?
Dirt mod, or Coffee time mod .... Sure it works !
You can add new recipes to a building if the building contains recipes
You cannot add recipes to a building that does not have any recipes to begin with
In the last version af TimberAPI, do not works !
You have a mod to test ?
Take dirt, for example
Has it worked in update 4 ?
YA, similar mod, coffee time was made only for U4
strange
It is still applied at the ILoadableSingleton and it sees the DirtMine Recipe, but it won't shown in the dropdown as if it's earlier initialized
Strange is that is no errors or warnings in game log, looks like is ignored.
It is initialized in the IDedicatedDecoratorInitializer
Well, who make this mod : https://mod.io/g/timberborn/m/sketch-gear-house long time ago ? ๐
I made that a long time ago
Until now, was working, based only on specifications ...
Let's see if older timberapi works else the game changed something this patch
I am very confused
How do they add the icon tho 
Is that something new in localization ?
Beaver doesn't have a MetalStaircaseNeed found in save, ignoring it. 
What did I break 
You did not break anything, staircase mod is missing
For that okay, but I broke something that the dirt recipe won't work anymore
or coffee recipe for Coffee Time ๐
Hmm, with game latest update, not working even with version 0.5.4.2 of TimberAPI... pmduda strikes again ? ๐ฎ
More like we just were lucky with th eloading order before or something
changed something so it would work for modded buildings and now its ded
Okay this is pretty bad ๐
I cannot fix this any time soon at least since i'm feeling too sick to really investegate
Not sure if it's a problem with the small change I did, or another not specificly related change
guess is the second, AssetRipper is RIP for the latest version, too ๐
but didn't give any problems right ?
I've started exporting. Wait to finish, to see what is it
what version of asset ripper are you trying alpha version or 0.3.10 or newer?
0.3.1, seems to be OK, still
well it has problems if you want to open in unity
But, for codeless , it's enough
Most expensive levee ever
If they want to survive they pay anyway
Oof, well I'd be okay probably on the science side

[Error : Unity Log] KeyNotFoundException: The given ToolId (recoveredgoodstack) cannot be found.
Stack trace:
TimberApi.ToolSystem.ToolService.GetTool (System.String id) (at <24bfd2b63dc048179e128b15aa9b2e38>:0)
PipetteTool.PipetteTool.OnSelectableObjectSelected (Timberborn.BaseComponentSystem.BaseComponent hitObject) (at C:/Users/jordy/SynologyDrive/Unity Projecten/TimberbornModsUnity Update 4/Assets/PipetteTool/Scripts/PipetteTool.cs:137)
PipetteTool.SelectionManagerPatch.Postfix (Timberborn.SelectionSystem.SelectableObject target) (at C:/Users/jordy/SynologyDrive/Unity Projecten/TimberbornModsUnity Update 4/Assets/PipetteTool/Scripts/Plugin.cs:90)
(wrapper dynamic-method) Timberborn.SelectionSystem.EntitySelectionService.DMD<Timberborn.SelectionSystem.EntitySelectionService::SelectSelectable>(Timberborn.SelectionSystem.EntitySelectionService,Timberborn.SelectionSystem.SelectableObject)
Timberborn.SelectionSystem.EntitySelectionService.Select (Timberborn.BaseComponentSystem.BaseComponent target) (at <80beb876bbd844b89421a0615bd517d1>:0)
Timberborn.CursorToolSystem.CursorTool.ProcessSelectObject () (at <971a99570b2440e0b093796d887b91f7>:0)
Timberborn.CursorToolSystem.CursorTool.ProcessInput () (at <971a99570b2440e0b093796d887b91f7>:0)
Timberborn.InputSystem.InputService.CallInputProcessors () (at <3deba2729fdf4909903ff6b90269e488>:0)
Timberborn.InputSystem.InputService.Update () (at <3deba2729fdf4909903ff6b90269e488>:0)
[Error : Unity Log] NullReferenceException: Object reference not set to an instance of an object
Stack trace:
Timberborn.CoreUI.PanelStack.Awake () (at <17ba2d2ed15e44878b307f80be58abba>:0)``` 
@stone shoal
sounds about right
Tool tool;
try
{
tool = _toolService.GetTool(selectableObjectName);
}
catch (Exception e)
{
return;
}```

Seen this report?
#๐mod-users message
@ebon sparrow Do you maybe know when the Resources and object collection are completely reset?
I believe objectCollection is on every load, but the values are still set in the Resources prefab on second load 
Resources like objects in unitys Resources folder?
Yes
those reset on game quit
if you change those assets in unity editor, it persistseven across sessions
changed values are saved on disk
๐ It can even be made persistance on quitting the game sheesh
Let's not do it,
ever 
Serialized fields are reset. I think he means the changed values if in the editor
To add a tool group in the latest release, is it just a case of adding the required specification file or do I need a script to register it?
Just specification
Ah thanks, In which case there's something I'm doing wrong - 'tis toubleshooting time! 
I did, but not sure if I've misinterpreted something
So the goal is to add a group inside the 'Power' tool group:
"Id": "Flywheels",
"GroupId": "Power",
"Order": "180",
"Type": "PlaceableObjectTool",
"Section": "BottomBar",
"NameLocKey": "ToolGroups.Flywheels",
"Icon": "Sprites/ToolgroupIcons/BasicCategory"
}```
"Type": "PlaceableObjectTool",should not exist in groups
Ah!
you sure you used the Group docs instead of the Tool docs 
okay type exists 
I think I made an oopsie
I ended up flipping back and forth between Tools and ToolGroups docs trying different things. Not getting an error message at all, just failing to load
failing to load ?
Doubt that should be caused by the spec, specially without an error
The docs did suggest that you need to use a script to register the group, but I assume that's for a custom tool or functionality?
rather than just building placement
yeah that is for creating custom types of groups
ConstructionModeToolGroup is a valid type
to show construction mode when clicking on it
so in the example above, the Prefab's Tool Group ID would be "Flywheels" right?
Yes
Just gave that a try and getting a The given ToolGroupId (flywheels) cannot be found
With the same spec posted before, but with the Type changed to ConstructionModeToolGroup
Yep - the mod.json is in the mod's root folder, but they're all specified in the ThunderKit manifest
What is the filename called ?
they don't have .json
or it doesn;t show it ?
hmmm
Maybe @vast otter knows. He has added groups already so should work
Are you btw sure you using the latest TimberApi ? obviously else you would not get that message
Pretty sure, though now you say that I'm going to check
Check staircase mods specifications as reference

Well, turns out that the actual game's version is correct, but the Unity version is not
damnit
Note add icon to asset bundle and set toolorder to Flywheels
Do ping me if you get stuck and i try to get time and help๐
Sorry about that, thought I'd changed it across but I've obviously only changed the Game's version and not done Unity's
Brill, thank you! ๐
Hmm, same error, think there's something I'm not doing right
Do other specifications work ?
The Faction Specs work, but I'm having a look at Staircases to make sure it's all correct
Ah, different error now, FallbackGroup isn't documented but It's in Staircases so I'm just going to mirror it and see if that works
Ayyyy that's done the trick
Final spec:
"Id": "Flywheels",
"GroupId": "Power",
"Order": "181",
"Icon": "battery.flywheels/battery_flywheels/BasicCategory",
"NameLocKey": "ToolGroups.Flywheels.DisplayName",
"FallbackGroup": false
}```
it did, I think it was the Icon path - I was using the absolute path rather than the asset bundle's path
https://github.com/Timberborn-Modding-Central/TimberAPI_Docs/issues/20 Can you make a list with things that were missing/wrong
in like bullet points
Added!
More than happy to contribute to the docs, but will need to brush up on Git, been a while ๐
its really just git commit -m "commit message" and git push that you need for this
I'm assuming the Docs can only use plain markdown since they get shown on the wiki page? Or can I use mermaid for diagrams?
just markdown iirc
Its a bit more than that since you need to fork it first, and make a PR after
Also I feel like I'd want to do a PR rather than a push
You can't push ๐
It's been 'me' proofed ๐
@vast otter, @median plinth, @severe solar
Part of @calm copper request is to add under the ToolGroupSpecification example.
_NOTE:_ The specification must be stored in a file with the specific name to be recognized properly. E.g. the file name can be `ToolGroupSpecification.foo.bar.original.json`, where prefix `ToolGroupSpecification`, suffix `original`, and extension `json`
are **required**. You can put arbitrary text between _prefix_ and _suffix_. See more in [specification naming](../specifications/index.md#specification-naming).
I kinda understand why to add, but also feels wrong. Reason original.json doesn't have to be required if you overwriting an existing one.
Maybe just a note to link to the naming of specifications would be enough and fit better?
Ya a link to how to name specifications feels better and more centreralized place if stuff change down the road
If the link points to a specific section, then yes - it would be much better to have a link. As of now the group/tool specification naming is not described in the central place. To figure out the prefix requirement, I had to check how the other mods were done.
I'll spend some time tonight to suggest more updates to the docs.
What's the recommended way of creating tools in runtime? Let's say I have a logic that decides how many and which tools should be present in the bottom bar. The file based specification approach doesn't fit well here.
Depends on what it is, i have updated Pipette Tool, which is an instance. Therefore you load it using the dependencycontainer. Object tools are created with a constructor
What do you mean with runtime? Do you wan to add tools to the bottombar midgamd?
No, at the start of the game, but I want to decide which tools to add programatically.
Csn you give an example of why/when? Could not quite recommend it since it would remove the customability
E.g. I maintain my own config file. There I can setup rules to show particular tools. A rule can look like "advanced settings = true", which results in creating a dozen of new tools that are not visible otherwise. Or, even a more complicated example, there can be some custom script-kind config that defines actions, and I want to make tools for them.
Tbh, I don't fully understand the current approach. Why keeping tool specification in file if it won't work without code support anyway? Why not just configuring the tool in runtime?
The feature is not made for code modders, but it isn't made harder
It's there to have full control over the tools and behaviour as a third party (user, modpacks, dependent mods) to change them
The implementation of the systems also fixes some small thing like the game crash when same order is used
Let's say I created a mod with tool "remove dynomites" (just a silly example). I';ve created all teh classes and the specification file. Now, how can any modeer to customize anything without asking me to modify the code? Icon and the text, that all that can be changed painless.
At some point I thought it's possible to create multiple specifications with the same Type, just passing different arguments. But it didn't work.
This would make sense. I crate one type, and many people can create their own tools.
Might not be super intuitive but the best approach I would suggest is to make make an ISpecificationGenerator and generate specifications with
{
"Hidden": true
}
That you DO NOT want in the bottombar based on the config
ISpecificationGenerator isn't documented though since it was more like an internal feature before
Its heavily used in the ToolSystem code
The name implies it only generates the specification. But how about the factories? As of now every tool needs its own factory. At least I haven't figured out yet how to make factories runtime.
Every type tool need its own factory, for most tool they probably need their own factory.
But if your tool would place platforms in an area and have like a 3x3, 4x4, 5x5 tool you could make 1 type for that with an ToolInformation property AreaSize or something
Can also be used for custom ability say you use colors for highlighting
How about range selection? Let's say I have a common code that decides what to do with the selected objects, but the selection criteria is configurable, and I want a separate tool for every criteria.
Like, I can provide 2 criterias initially, and users may want to add a dozen more lately.
If you think it would be the same Tool behaviour just with some other settings sure
But I cannot decide that for you ๐ in the end I cannot block if it would be misused
Do you mean it can be accomplished with the ToolInformation? It didn't work for me because the code complained there are duplicated tools.
Duplicated tools ?
One sec, I'll reproduce it pretty quick.
Lol. Now it works fine. I think, last time I made a copy of the specification and didn't update the Id.
probably
With the same type and different ToolInformation I get exactly what I need.
Well, kind of. Ideally I'd prefer to fully control it from the code ๐
Well it was like that before but just isn't handy whenever more modders would join, and even now it already had limitations
Because someone wanted to make a overhaul on the bottombar which wasn't possible
Yeah, I remember the order ID problem. It was the first thing I learned. I was surpised the conflicts are not maintained in the stock code.
stock code ?
The Timberborn game core. The bottom bar is their functionality, after all.
they are not maintained, so we can be sure that no 2 tools has the same order
I figured it out ๐ I'm just saying that I would expect that something that is not defined as enum should tolerate duplications and have a tie break algo. It's just me.
we have a tie break algo. If there is a tie, exception is thrown and you have to resolve the tie :P

I agree it is not the best, nor mod friendly, but this is a really old code, so it is as it is ๐คทโโ๏ธ
Trust me, I know what does "old code" term mean
Half of my working time I'm fighting with the legacy.
well, it is not that way - it is not legacy code
it is code written with different priorities in mind
Lets go back here for a bit.
Icon, background color, position, order, visibility can be easily modified by just editing the specification file.
They obviously cannot change it's behaviour.
Depending on you it can also could be customizable with the description/name.
If it's done like this: https://github.com/Timberborn-Modding-Central/TimberAPI/blob/main/Core/TimberApi/ToolSystem/Tools/BotGenerator/BotGeneratorToolFactory.cs
It would not be possible since the loc key would be fixed, I didn't want to add more to maintain for the default tools.
In my world it's called "legacy", but it's essentially the same. Something that was made long time ago, and that time back it did make sense.
I see now also that I didn't add the toolGroup to that button, so it cannot even be changed to a ToolGroup 
for me "legacy code" usually means that old module, which was written without any code standards, that is too brittle to even touch ;)
Water mechanics 
I got your point. "Old" means "it's still good, but used to be better back in the day" ๐คฃ
no, why? water mechanics is relatively new code :)
So we can have aquaducts now ?
yes, you could have aqueducts from the beginning
the point is, you need to find manpower to do it ;)

"An aqueduct is a watercourse constructed to carry water from a source to a distribution point far away". I disagree that we have it!
I said "you could have it"
Ah, my bad.
@calm copper for the Tools also a more recommended way to create compared to what Tobbert said.
Recommended: https://github.com/Timberborn-Modding-Central/TimberAPI/blob/main/Core/TimberApi/ToolSystem/Tools/BuilderPriority/BuilderPriorityToolFactory.cs
Creating an instance from the dependency container is just a lazy way to do it because this way people aren't able to create the same exact ToolType in different locations since it's a singleton.
Thanks. I will read through it.
As said by knatte, and myself, prefferable to just have links to the detailed information instead of writing it down.
If you want to make such big changes prefer to keep these things in mind:
-
Keep it as much single responsible so no duplicated information over different pages occur (the redirect links)
-
Make things not too long or for one specific use case only. (Like this has indeed something to do with creating tools but not with registering https://github.com/Timberborn-Modding-Central/TimberAPI_Docs/pull/21/files#:~:text=public override ToolDescription Description() If you could find a way to descripe those 2 different thing seperately would be great. Maybe a full Tool guide on a different sub page?)
-
Might be annoying, but maybe could be handy to make a seperated PR if you change different pages? if some are good they can already be implementd but that's up to you.
-
The rest you will see in a review, it's my first doc so just trying things out. In general I'll like to keep the information only on the feature needs and not exampling the reasons why something is usefull because of the game.
If you did something because of some other docs, just link the docs so I can see their examples
I'm totally OK if the entire PR will be rejected ๐ It's more like "guesses" at this point since I don't feel confident about the logic and the design if the API. If you find any line in this PR useful, then the goal is already achieved and the spent time was not wasted.
In a company where I work, we have a concept of "codelab". I.e. for any topic, regardless how complex it is, there is a walkthrough that you pass step by step and end up with working basic application. Those, who need advanced things, can read deeper, and for this purpose there are links to "special cases" during the codelab. Like, "you could make it more flexible, but more complex - see here how". I guess, I tried to walk on your docs from this perspective. I was literally making my first mod from the scratch (before, I got someone's mod and patched it with my code to play with things).
Whats a mdo?
Not sure if code lab would work very well since its all. Very seperated concept and could require all for all examples. But well see what you make from it 
Maybe on a sub page make your first X guide
Or the other way around
This is a good idea. I'm currently working on amod. So this experience can be used.
I remember vagely when I made mods as well 
And for the PR, feel free to consider it as just my personal notebook which I shared just in case ๐
After working for some time in enterprise dev, I ended up with a conclusion, that the good docs are the most useful to myself. You make something, it works for couple of years, and then out of nowhere people come and ask you do add a feature to the long forgotten code. This is the moment when the docs and following the good practices pay off.
Do you see this repo https://github.com/Timberborn-Modding-Central/TimberAPI/tree/main
I did. Read thru all the examples... and understood not that much ๐ Then, I forked from KyP-timberborn-mods and there the journey started.
The examples should the only things that could be understood 
That is your coddelab pretty much
In the big companies there is a position of technical writer. This person intentionally has not programming background. It helps to be unbiased. The main mistake of any programmer who makes a doc is that we assume the reader knows "the basic stuff". And who decides what's "basic"?
FWIW, my employer company is big, but we don't have tech writers ๐
We don't have any docs, but yeah I just finished college anyway
But we do have a rule: "code is the doc". Which means, your code must be written so that it either doesn't require documentation, or the documentation is already in the method comments.
Comments
@ebon sparrow
C# has a very good documentary system. If you keep them in good shape, there are tools that can make cute doc sites for you. Like Sandcastle.
Here's how it can look like: https://ihsoft.github.io/KSPDev_Utils/. It was all built from the comments.
Tools set for Kerbal Space Program mods developemnt
ยฏ_(ใ)_/ยฏ
Ehh
Not my cup a tea
Also find that as confusing as just readon code thoug xD
In the today's world of intelligent IDE's, the dedicated help sites becomes less useful. However, the role of the comments in the code only increases. I'd not be surprised that one day an AI will be presented that uses the comments for deep learning.
AI driven code completion is already a very powerefull feature that saves a ton of time.
code pilot was pretty bad I heard
no comments! ;P
At work I use a proprietary AI system. It rocks! Sometimes it's enough to type just two characters in ktor to have the whole class implemented.
It applies to the common cases, of course. AI cannot invent the code for you.
we are using Github Copilot and it is also quite good
sometimes it can really impress :)
Are you using JetBrains Rider?
yep
I need to try the copilot then. I use RD too.
Did you have any problems with it connecting tho? I saw some reviews that it keeps forgetting and working pretty slow
Not yet the time to test it out
Ooh, then i will also give it a try
Btw, in case someone didn't know it, RD subscription can be given for free if you write mods/plugins.
it usually has a bit of a lag, like 0.2-0.4 sec to which you need to get used to
but I had no connection problems
Ive been using the school subscribtion. Will be able to use that for another few years
The free "modders" one is pretty good. It has a lot of stuff (most of which I never used or going to use).
The free subscription is kinda making me not yet paying for a personal one 
Which language version is recommended for Timebreborn? I usually use 9.0.
.net standard 2.1
That's not the language version ๐
.NET Standard 2.1 C# 8.0
Now it is.
Dafuq is lagnuage version?
But pretty sure 9 and some 10 feature versions work just fine
I believe bepinex also causes some things to work more than should
like file based namespace works fine
Many things in 9.0 are just syntax sugar. They work fine in any runtime.
But there are edge cases.
I'm writing my mod in .NETFramework v4.8, C# 9.0. It works fine with the latest game version. However, it's not a reliable sign of compatibility.
TimberApi also uses C# 9 it seems
<TargetFramework>netstandard2.1</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>9</LangVersion>
ah, i found a new, very minor thing :
if a group description is written on two lines, the screen location will be based on the first (top) line and not the last one, making the text clip with the icons.

I assume you are using a loc key, and groups with enters are supposely not supported by the base game
yes there's two lines in my lockkey.
i can make it into one, but just so you know ๐
Make a custom groupvisualization or fix it with a remake of the original one ๐
I'm implementing IPersistentEntity on my component and adding it to a block object. On save the IPersistentEntity.Save is called just fine. However, on load my component doesn't get restored. Why? Where should I register it?
Ha! That was my first idea.
You need initializing in 2 places
TWO palces? I know only one.
So if its not saved, then in start or awake. If its saved, after the load
Maybe intialize is not the correct word
No, it's a basic component added to a constructible object.
I add a component like this:
BaseInstantiator.AddComponent<IFTTTAutomationTestRule>(selectedObject.GameObjectFast)
The added component implements IPersistentEntity, which I can see behaving as expected on save. However, on load the component doesn't get restored on the object.
Does it have serialized fields?
It doesn't as of now, but I tried a case with a serialized int field. This is how I save:
public void Save(IEntitySaver entitySaver) {
TestValue = 123;
DebugEx.Warning("*** state saved: {0}", TestValue);
var saver = entitySaver.GetComponent(savableKey);
saver.Set(TestValueKey, TestValue);
}
Its always good to check both component and the field if they exist
Can cause crash on runtime
Furthermore, its better to use the decorator system to add that component
As i dont see a reason why you cannot
I'd love to know more about the decorator stuff. How do I do it?
Heh. No worries. I know at least one mod that does it - SimpleFloodgateTriggers. I'm goign to check their code.
I send in modders chat
is there any tutorial on how to actually get your prefabs in game? All i see in mods are a bunch of seeming random files
my guess is that i need specifications but thats about it
//FactionSpecification.Folktails.json
{
"CommonBuildings": [
"me.darkeyedragon.steamworks/steamworks/PipeStraight.Folktails"
]
}
thats what i figured out so far
We do have my minimal mod setup #1042573456732082206 that can be used as a base but in a nut shell its:
1 add model to a prefab that has the components needed for the typ of building see base game for examples(asset ripper)
2. Set prefabname to uniq name
3. Add building to manifest(R)
3 add path to specification
manifest?
Thunderkit is the king
If doing stuff with models
To build the asset bundle and move stuff to right place
Even has a video how to verify that minimal mod setup works
i already have all that i just need to know how to get the game to load it
Do you have a mod.json file?
yeah
{
"Name": "SteamWorks",
"Version": "1.0.0",
"UniqueId": "me.darkeyedragon.steamworks",
"MinimumApiVersion": "0.5.3",
"MinimumGameVersion": "0.3.5.2",
"EntryDll": "SteamWorks.dll",
"Assets": [
{
"Prefix": "me.darkeyedragon.steamworks",
"Scenes": [
"InGame"
]
}
]
}
So spec is "uniqid/assetbundle name/prefabname"
lets see if this boots at all
else see you in beaver-noices? ๐
sure
Are there any tricks with injections in the BaseComponent descendants?
I have the following (simplified) code:
MyClass : BaseComponent {
[Inject]
MyClass(BaseInstantiator baseInstantiator) {}
}
The ktor is not called at all. Moreover, it breaks the normal class initialization.
Basecomponent has nothing todo with that. Basecomponent is just a Timberborn version of mono behavrio which is used to have caches when getting components to increase performance. Injections is bindito and is just to get acces to singletons before the awake
It still doesn't give the answer why it's not working.
Sorry, i didnt understand what is not working? Gonna google ktor
Aaah, inject InjectDependencies replaces the constructor
ktor = constructor
Yeah, usually I cannot. But with inject it compiles and "kind of" working (not). But it explains what's happenning.
Not very intuitive, though.
One more side effect I found is that local fields doesn't get initialized if there is an inject attributed ktor. Is it an expected behavior?
inject is not for ktors
I never had a constructor in a monobehavior
if you can have ktors, then you should inject via them - singletons
if your class is mono behavior, then having a ktor is a mistake
you should use inject attribute for a inject method
Ah, so the [inject] thing is for an arbitrary method that should "replace" ktor?
yes, becouse in MB you can't have ktors
Got it. It makes sense. Thank you.
Btw, do you have any statistics on injecting "many arguments" vs "one argument"? I.e. will it be faster if my component injects just one argument instead of a dozen? Given the component is created for a considerable number of game objects.
If you need them you need them
we never noticed it to be a factor
tho we believe that more then ~5 is too many
There are at least two ways to optimize it. I'm asking to figure out if it makes sense.
Got it.
I just noticed that game freezes on save game load, and assumed it's Bindito doing all the deps resolution work. Thus, assumed less complexity may improve the timing.
more so the fact everything has to be loaded from disk more so than binding i think
I believe it mostly actually loading the assets, not the associated code
ig you could check disk read/write to confirm
afaik it is template system in works
i wonder how much of that time is parsing json
don't remember exactly, but around few seconds
dozen max
depends on mapsize and buildings i imagine
Parsing json might be intensive, for my mod that loads 3000 specifications its only 10 secs to 14 secs
My system is mostly idle during the load. The only growing paremeter is RAM. CPU is below 25% and disk is idle (fast nvme drive).
keep in ming that unity mostly uses 1 core
so CPU below 25% might mean that 1 core is at 100% and rest is idle
well, this is for sure area for improvement, but, well...
people got used to it ๐
multithreading is a slippery slope 
Not much to do if it's Bindito thread. However, if it's the asset loading, this can be parallelized. Not sure about the template module, probably not.
it's connected to instantiating and calling awakes - and unity requires it to be done from main thread
I find it funny how easy unity makes game development, but the moment you need any kind of performance gain you gotta start altering the engine itself
...and this is how we endup with the custom prefab formats ๐
I wonder if they (makers of Unity) are trying to do anythign with it. I get the problem of multi-threaded 3d engine. But at least the scene loading could be improved.
I think this is a common problem with multi purpose tools
good at everything, best at nothing
I think it is more of our problem, then Unity
I was blown away by Dyson Sphere Program - no idea how they do it, never bothered to check
but they also use Unity and they load a game in mere seconds
oh they basically ripped out the entire engine at this point
probably we will end there too soon xD
they have some interesting blog posts regarding the development
Learning one more engie for making mods woudl be too much for me.
i dont think much would change on our end tbh
well not more than now
the endpoints would still be the same
Bindito does most of the heavy lifting
Btw, is Bindito a home brewed system? I tried to google, but didn't find any useful docs.
Yea, timberborn devs created it
It explains why I found nothing.
A note then adding subgroups or groups you have to set assets to apply to all
Timberborn is calling Resource.Load directly
Resources.Load<BinaryData>(meshyDescription.ModelName);```
Could this result in TimberAPI not updating the path to a assetbundle?
Yes, wtf
Their resource loader is just a small wrapper why use this 
@ebon sparrow Would it be possible to change?
The only thing i can imagen is it being required before bindito
no, called ingame
Change what?
Instead of calling Resources.Load directly, to use IAssetLoader
sorry, IResourceAssetLoader*
I'm pretty sure its impossible, since it is used also in editor
In editor ?
But the code is ran at runtime, no?
Sounds hacky, because of meshy
?
why hacky? Using Unity API is now hacky?
using unity is hacky, yes
which class is this?
MeshyPrefabOptimier i beli8eve
yeah, it looks like in MeshyPrefabOptimizer it is a mistake and IResourceAssetLoader should be loaded
how big of a pain it is @severe solar ?
Sorry? I dont understand the question its not possible and you ask how much it sucks
I believe the other way around, it's a mistake and can be fixed. How much does it suck so he'll take a priority
yep
We cannot use meshy as modders
Or @stone shoal needs to make a small patch workaround
Or i need to
I'm currently on the way so I cannot look at the code look at the code but I believe I believe it's not possible to patch that function directly function directly so the work around would be a little bit bigger
tobbert lagging
Using speech recognition in my car it's the my car it's the best
@stone shoal Im updating my power trigger mod to U4 and the linking objects inside TimberAPI works in a game saved but when I try to start the linking process I get an error
[Error : Unity Log] ArgumentException: An item with the same key has already been added. Key: GravityBattery.Folktails(Clone) (UnityEngine.GameObject)
Stack trace:
System.Collections.Generic.Dictionary2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <cbc72d4a9767498db39486e941a498e3>:0) System.Collections.Generic.Dictionary2[TKey,TValue].Add (TKey key, TValue value) (at <cbc72d4a9767498db39486e941a498e3>:0)
TimberApi.ObjectSelectionSystem.PickObjectTool.StartPicking[T] (System.String title, System.String description, System.Func2[T,TResult] validateCandidate, System.Action1[T] callback) (at <24bfd2b63dc048179e128b15aa9b2e38>:0)
TANSTAAFL.TIMBERBORN.PowerGenerationTriggers.UI.StartLinkingButton.StartLinkEntities[T] (TimberApi.EntityLinkerSystem.EntityLinker linker, System.Action createdLinkCallback)
must be
_allCandidates.Add(item.GameObjectFast, item);
the line thworing the error
@severe solar said it worked fine without any changes, I have no idea how to use that code
It's just a copy paste from the base game to this, so it can still be used
Im gonna try in a new game instead of the save from U3
In a new game I get the same error
@severe solar do you have a sample using it?
I didnt find why it would work on U3 but not on TAPI, Im gonna build TAPI tomorrow with a TryAdd instead and see if it works
_allCandidates.TryAdd(item.GameObjectFast, item);
I believe before it wasnt using a dictionary 
But you are somehow adding the object twice now
What do you do to make it crash
[Error :SteamWorks] Failed to deserialize: version string does not match regex
Might be nice to show the actual regex requirements in the error message
the pattern
{
"Name": "SteamWorks",
"Version": "1.0.0",
"UniqueId": "darkeyedragon.steamworks",
"MinimumApiVersion": "0.5.5",
"MinimumGameVersion": "4.0",
"EntryDll": "SteamWorks.dll",
"Assets": [
{
"Prefix": "darkeyedragon.steamworks",
"Scenes": [
"InGame"
]
}
]
}
this seems fine?
or is it 0.4
so 0.4.0 ?
oh that as wel yea
[Warning:SteamWorks] Skipped: Minimum game version required: 4.0.0.0, current game version: 0.4.7.0
but that's and error he will get next ๐, ^ that one
yeah looks like it
patch should be optional too imo
as they dont break api
or shouldn't according to spec
It could break things in the game tho
i mean technically yeah
but this means every time any update comes out you will need to update your mod just to update the number in case it doesnt break
this can cause a lot of "dead" mods over time that could potentially still work even tho the dev is MIA
It truely is tho
Fixed orders when loading the save file again
[Error : Unity Log] NullReferenceException: Object reference not set to an instance of an object
Stack trace:
TimberApi.ToolSystem.Tools.PlaceableObject.PlaceableObjectToolGenerator+<Generate>d__2.MoveNext () (at <36a8415ba25744f1935294089b9a80f3>:0)
System.Linq.Lookup`2[TKey,TElement].Create (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector, System.Collections.Generic.IEqualityComparer`1[T] comparer) (at <fa6dfabea46b4d38a92695d5d0cf891d>:0)
System.Linq.GroupedEnumerable`2[TSource,TKey].GetEnumerator () (at <fa6dfabea46b4d38a92695d5d0cf891d>:0)
TimberApi.SpecificationSystem.SpecificationRepository.AddRange (System.Collections.Generic.IEnumerable`1[T] specifications) (at <36a8415ba25744f1935294089b9a80f3>:0)
TimberApi.SpecificationSystem.ObjectSpecificationGenerator.Load () (at <36a8415ba25744f1935294089b9a80f3>:0)
(wrapper dynamic-method) Timberborn.SingletonSystem.SingletonLifecycleService.DMD<Timberborn.SingletonSystem.SingletonLifecycleService::LoadSingletons>(Timberborn.SingletonSystem.SingletonLifecycleService)
(wrapper dynamic-method) Timberborn.SingletonSystem.SingletonLifecycleService.DMD<Timberborn.SingletonSystem.SingletonLifecycleService::LoadAll>(Timberborn.SingletonSystem.SingletonLifecycleService)
Timberborn.SingletonSystem.SingletonLifecycleAdapter.Start () (at <ab814a1829494fd8bc5bee93ae7dd9a7>:0)
[Error : Unity Log] NullReferenceException: Object reference not set to an instance of an object
Stack trace:
Timberborn.CoreUI.PanelStack.Awake () (at <47341c47a58b4d64aabfcf4df7c26692>:0)
getting the following exception when loading into a map
did something change on the specification format in u4?
derp was missing an icon

The same thing I was doing on U3, I took it from what the floodgates trigger did, later Im gonna try it just changing TAPI to a TryAdd and see if the rest of the mod works ok
it crashes when I click the button to highlight the available objects to link
they are gravity batteries added to a IRegisteredComponent
@stone shoal have you understood yet why the ruins toolgroup is not shown in map editor?
when you get to know why maybe you can add a parameter to tell to show in map editor for other toolgroups ๐ซฐ
what ?
ah
I tried to make it work for mapeditor
But than the 2 bottombars existed so not sure if I want to rework that one as well
So gonna try to make it not hidden
ok
But my brain is kinda fried and tired after work, so I don't have much energy to work on TimberApi lately
no problem take your time i do have alot IRL to
I was indeed re-registering the gravity batteries on my mod, got it fixed for U4 now
Whats the best point to add data to a component?
Essentially i want to add some data to an array on a component when a map is loaded.
but i'm not sure what entry point i'd use for that
since custom specifications don't work in unity
i basically want something like the right picture
but i cant do that with specifications cuz unity doesnt support it
so the alternative is to do it in code
i see there is an ISpecificationGenerator in tapi but i'm not sure thats what i need
and where to call that logic
With Timberborn specifications youcan do that with ease
IDK if unity scripts are also called specifications but
well how then? the logic is identical on the left, but it doesnt allow me to use serialized classes in unity
specifications are not done with unity
so i make a specification generator then?
No generators are there for data that already exists
You just make a specifications for each building or whatever it is
Look at recipes
will do
please forgive my mesage, i was at the top thinking i was at the latest discussion. I meanto instead thank you for your tireless effort to make and mantain the mod, I could never do such work, not inclined that way. Thank you again.
i'm getting this error :
[Error : Unity Log] ArgumentException: An item with the same key has already been added. Key: dam2x3up
Stack trace:
System.Collections.Generic.Dictionary2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <cbc72d4a9767498db39486e941a498e3>:0) System.Collections.Generic.Dictionary2[TKey,TValue].Add (TKey key, TValue value) (at <cbc72d4a9767498db39486e941a498e3>:0)
TimberApi.ToolSystem.ToolIconService.AddIcon (UnityEngine.Sprite sprite) (at <4cae64c9bbf24b2ca603f90bbb316330>:0)
TimberApi.ToolSystem.Tools.PlaceableObject.PlaceableObjectToolGenerator+<Generate>d__2.MoveNext () (at <4cae64c9bbf24b2ca603f90bbb316330>:0)
System.Linq.Lookup2[TKey,TElement].Create (System.Collections.Generic.IEnumerable1[T] source, System.Func2[T,TResult] keySelector, System.Collections.Generic.IEqualityComparer1[T] comparer) (at <fa6dfabea46b4d38a92695d5d0cf891d>:0)
System.Linq.GroupedEnumerable2[TSource,TKey].GetEnumerator () (at <fa6dfabea46b4d38a92695d5d0cf891d>:0) TimberApi.SpecificationSystem.SpecificationRepository.AddRange (System.Collections.Generic.IEnumerable1[T] specifications) (at <4cae64c9bbf24b2ca603f90bbb316330>:0)
TimberApi.SpecificationSystem.ObjectSpecificationGenerator.Load () (at <4cae64c9bbf24b2ca603f90bbb316330>:0)
(wrapper dynamic-method) Timberborn.SingletonSystem.SingletonLifecycleService.DMD<Timberborn.SingletonSystem.SingletonLifecycleService::LoadSingletons>(Timberborn.SingletonSystem.SingletonLifecycleService)
(wrapper dynamic-method) Timberborn.SingletonSystem.SingletonLifecycleService.DMD<Timberborn.SingletonSystem.SingletonLifecycleService::LoadAll>(Timberborn.SingletonSystem.SingletonLifecycleService)
Timberborn.SingletonSystem.SingletonLifecycleAdapter.Start () (at <ab814a1829494fd8bc5bee93ae7dd9a7>:0)
[Error : Unity Log] NullReferenceException: Object reference not set to an instance of an object
Stack trace:
Timberborn.CoreUI.PanelStack.Awake () (at <47341c47a58b4d64aabfcf4df7c26692>:0)
This should not be possible, unless you have a prefab with the same name. Which isnt allowed in general
that is a bit puzzling, the prefab is not named like that, only the icon...
did i accidentally use it somewhere else too ?๐ค
Hmmm
Or I do it at 2 places and forgot to fix it
Or you might not have the latest version?
oh did you fix that issue where it was upset when i use the same icon multiple times ?
Yes fixed that pretty fast tho
oh, ahah
didn't update anythign
to be honest i'm too scared of breaking everything when updating ๐
cause i never can remember how to do it
oh right, TimberAPI is just a mod right ? just toss it in the right folder and here you go ?
I think so
Seemy latest video it has the step of updating timberapi๐ #1042573456732082206
i think i could update it without problem ๐
but i have an other small problem now : empty category buttons no longer naturally disappear ๐
I made some custom category because i wanted to regroup some buildings in a different way from what the base game does, so i don't actually have anything in the "wood" category for example, yet it still displays.
i suppose since you remade the buttons entirely, there must be some hidden specifications such as "ToolGroupSpecification.Wood" right ? if i make a .replace that is completely empty, might that work ?
wait no, that would break the other factions
hmm...
Check my water extention how i hide base game with spec and check staircase mod how i move where woodenstairs is placed
๐ฎ ya should be able to set wood as hidden:true
True
would be great if a tab is hidden if nothing is added to it๐ฅน
i'll check
thanks
hmm... i can hide individual buildings but for me that's not a problem since i have full control on the faction specification
i don't know if adding "hidden : true" to a toolgroup works but i guess i can try
oh actually that works !
The you can hide it, maybe i csn fix this but was bit hard
nah it's okay. you surely have more important things to fix, and i'm probably the only troublemaker here that needs to destroy entrie categorites, so as long as i have a way that's good enough.
It seemed it was quite important in the end xd
And on that matter... i'm unable to load the custom white beaver skins somehow. ๐
Stack trace:
TimberApi.AssetSystem.AssetLoader.Load[T] (System.String prefix, System.String pathToFile, System.String name) (at <24bfd2b63dc048179e128b15aa9b2e38>:0)
TimberApi.AssetSystem.AssetLoader.Load[T] (System.String prefix, System.String path) (at <24bfd2b63dc048179e128b15aa9b2e38>:0)
TimberApi.AssetSystem.AssetLoader.Load[T] (System.String path) (at <24bfd2b63dc048179e128b15aa9b2e38>:0)
TimberApi.ResourceAssetSystem.ResourceAssetLoader.Load[T] (System.String path) (at <24bfd2b63dc048179e128b15aa9b2e38>:0)
Timberborn.Beavers.BeaverTextureSetter.Start () (at <e49ef50372814472874184010c2a1044>:0)
[Error : Unity Log] NullReferenceException: Object reference not set to an instance of an object
Stack trace:
Timberborn.CoreUI.PanelStack.Awake () (at <47341c47a58b4d64aabfcf4df7c26692>:0)```
and yet absolutely everything else loaded just fine ๐ค
This ks a different error than the meshy error tho
Also not with capital letters?
yeah that's what i did.
ah
well that would be problematic
i mean the mod can work without
@jagged python doe beaver materials also do something weird with meshy like loading the binary ?
Its really the asset that is not found, find it kinda weird it has a other error than with the meshy buildings
let's wait for the cavalry to arrive then 
it used to work in V3 though.
Meshy uses materials provided by IMaterialRepository. It has only one method that returns material by given name. Our implementation internally uses simple list with materials predefined in inspector. I guess TAPI should inject its own implementation somehow (to allow for materials e.g. from asset bundles).
Alright, find the error still kinda weird than. Since it complains about the resourceLoader
Will check it thanns
thanks !
on an unrelated note, since TimberAPI now replace categorybutton mod, would it be possible to have it also put all those bridges in a subgroup directly ? i thought about doing it in my mod, but i'm afraid mods might want to do it too resulting in incompatibilities.
if you want i can prepare the specifications for you ๐
@vast otter does this already in one of his mods.
The best would be that its a seperate mod then
No incompability issues. But they whos specification is going to be picked will be random
oh, okay. that's not apocalyptic at least.
I don't think that will be funny that at every load to start searching where are located the bridges or other stuffs in menu ๐ฌ
If you always play with the same mods it keeps the same
And thats more a you need to fix problem 
@stone shoalSorry to bother again 
How would i load a custom specification file?
I took a look at Recipe like you said before, but it also loads the specifications from the components, which i can't do
essentially i think the best way to go about this is have a json specification i can load for each pipe
which i can then add to my FluidTransputSpecificationProvider
Since this cannot be done inside unity
[SerializeField]
private FluidTransputSpecification[] _transputSpecifications = new FluidTransputSpecification[0];
[Serializable]
public class FluidTransputSpecification : BaseComponent
No idea what you mean loafs from the component
in unity you can edit fields if you mark them as serializable. Normally you can do this with classes too, but not when they're not there at compile time or something (idk exactly how it works, but apparently you cant do it when modding the game)
things like this
it works for primitive types
but not classes
normally here you'd be able to add array elements of that type and have its fields filled out and create that class behind the scenes
like there
But this arent specification files
then why are they called specfications
Because fun
They kinda do the same i suppose
And they can do more with them
But it would be possible to convert all those to actual specifications
yeh but this is turning out to be a giant pain in the butt
@severe solar how did you do the first categorybutton when you had components to set categorybuttons
else maybe look at last categorybutton it reads Spec files
ya i have added them together with my path extention. you can joink my icon and spec (just change path to icon and lockey and your good to go or if you want set waterbeaver to req path extention ๐
I loaded the json and overwrite the relevant components
first verion you had so we added a component to each object(In unity)
github maybe have that code still there
that was just to fake it to be a building
not really relevant here, though i dont know what the conversation is about here
the thing we discussed before with the serializable classes
to create components to add to a prefab if i get it correct
(and set parameters in it)
you cannot recreate this
u either use that, or use jsons
or use a hardcoded class
i know, but i want a proper way to read the jsons
yeah i'll just do that then, i wanted to include thme in the asset
but then idk how to read it
or do a patch to the game if your custom component exist do not do power transfer?
but categorybutton do read Specifications!
i want to avoid patching if i can
here you have an example of how to use Ispecificationservice https://github.com/TobbyTheBobby/TimberbornModsUnity/blob/master/Assets/MorePaths/Scripts/Core/MorePathsCore.cs
tnx
private void LoadPathSpecifications()
{
var list = _specificationService.GetSpecifications(_pathSpecificationObjectDeserializer).Where(specification => specification.Enabled).ToList();
var orderedList = list.OrderBy(specification => specification.ToolOrder);
PathsSpecifications = orderedList.ToImmutableArray();
}
specificly that part
you dont need the ordering or anything
To use it, you need to create a class like PathSpecification, which is easy to understand
That class is used to read the json and convert it to a useable class
Do they need to be in the asset bundle?
not really, but would make sense
Not if its a specification ๐
well the most sense would be on the prefab but guess we cant have nice things xD
But then mod users cannot easily change it 
they dont have ot
Ye than its less nice
What if you make 3 lose basic lists
And make an editor script to use it easily 
cant
Not sure if an editor script csn go that far
Why not
Magic
do you load the json anywhere or is it just in the specification folder?
i dont load them, thats all done by TAPI
and yes, location should be <mod folder>/Specifications/<Speification jsons>
and the naming of the specification? NameSpecification.Faction.Prefab?
Whatever you want, as long as the first part ends with Specification and has the same name as your class
ah ok
hmm i see
is there no easy way to make objects out of the json?
{
"Transputs": [
{
"Offset": [
0,
0,
0
],
"Direction": "Down"
},
{
"Offset": [
0,
0,
0
],
"Direction": "Up"
}
]
}
this would be the json
i feel like it would be easier to just use newtonsoft or whatever to parse the json at this point
well that is the layout, but how would i get Offset?
i just started a league game
you will need to give it the PrefabName aswell for example
call first where that is the one
but these are all on the same prefab
yea, its an array
oh, sorry
but that will be just the same logic as before
you will have an array of items
oooh, you mean that you have to load underlaying items
now i understand
yeah hah
finish your game, i wont go anywhere 
sure
are you trying to use a mod that is not Update 4 compatible?
see pins in #๐mod-users you need to reinstall all mods with update 4 and check the google sheet for a list of confirmed working mods
In the tool specification, does the Icon field specify a Sprite? Or a texture? I created two sprites from one texture (sprite mode = multiple). The texture is recognized well in the specification, but the sprites made of it are not.
So, based on my tests it seems the icon is loaded as Texture2D resource, not as a Sprite. Extrude edges on the sprite object also has no effect on the final icon in the tool.
Icon is a spritr not multiple
these are the settings i use in unity to allow a png to be a icon
It's about what I was using. However, just setting "multiple" is not what breaks the things. You also need to go to the sprite editor and make the slices. Each slice gets it's own unqiue name of a sprite, but TimberAPI doesn't see these names.
Nor it respects "extrude edges" setting on the sprite. The only way I found working to add padding, was modifying the texture itself and adding padding into the bitmap.
about the "toolspecification" thing we can use to modify existing buildings without modding them in and out, what does the name actually target ? typically i got the silly idea of wanting to replace the birch tree, but it is not in the factionspecifications because all factions are supposed to have birch. so can i make a toolspeficication.birch.json (of building specification) that just disables it by changing the prefab name while my custom tree (that is backward compatible with birch) highjacks the spot ?
I doubt they have it manually added in the object collector, so should be in some specification I believe
You cannot change a prefabName
hmm
oh !
you're right
i never looked into this folder before, but there is one called prefabcollections
that list various things
so i can remove the brich from this list, and add it as unique ressource back in other factions
thanks !
probably]
was it considered to make the options of mods create a file for each settlement instead of being a global one? and then giving the option of editing the config during the game?
when a save is loaded, look for a config file with the save name, if it exists call a method in the mod passing the new config values
and do the same if the user edits the config during game
That is probably not going to happen, if you want your specifications in specific faction online the specification should be made that way
Would to much hassle to do that in TimberApi for all specifications to maintain
There might come something with configs tho
what do you mean something with configs
that will probobly break mapeditor! so you cant plant birch
mapeditor do not load any faction Spec!
i use a prefabcollection to be able to add stuff in map editor
so i just add the birch to the map editor list too, should do the trick ?
you just have to try it out ๐
hmm...if it is part of the map editor tools it seems to be added to every faction immediately
probobly ya dam is and other map editor parts is set a devmode so thats why its now shown in normal play
wonder how they did the trees only for certen factions. but then again you cant plant those in map editor
oh that's easy, basically the IT only trees replace normal trees
anyway, got it to work
i don't know what happens if some crazy weirdo tries to make maps with my mod though
but do mapeditor still work and normal faction have birch?
or did you manange to replace basegame item? birch and replace with yours? 
well they still have birch
but i have entire tool categories hidden in the FT and IT so to be honest playing them seems a pretty by idea with my mod installed
but i'll probably do a thing with the new game menu so people don't get mistaken when my mod is active
map editor still works but no longer have birch
honestly it would be nice if they fixed that, what if i want my map to have wild carrots ? ๐
it's just "backwardcompatible prefab : birch"
but this means that if they load and save a map they cant load it without your mod without losing the "pink birch" trees
ah, i see what you mean, no FT and IT still have regular birch
and loading my faction without having it installed might be troublesome ๐
im talking about what happens if you have your mod installed open a map in mapeditor save and then load without your mod all pink birch will then just disappear because base game birch do not have backwardcompatible prefab
but that is what it is just place a note in description if they dont read it its there fault ๐
but you can't place pink birch, nor birch in the map editor with my mod active
sorry i'm not sure i understand ๐
aha ๐ฎ so what then happens if you load a map with birch on it in the mapeditor do it just remove it?
๐ฆ
but now that i think about it...i can mod it all back in !
well then maybe add it to trees collection even if it is added to all factions
hmm... no that's kind of whacky
oh well, let's not use map editor with this mod i guess ๐
what is not whacky we are modding ๐
some one will do it to customize to be able to play your faction and then all will break 
or get it to crash in mapeditor and see that as a feature they should not be there with the mod active ๐
(change mod.json Scenes : all to ingame and it will crash)
Crash is the best safety๐
Is it possible to get an example image of how levee.meshy file looks like in unity on your end?(Like image 2)
to verify that we get how to import it correctly in unity.
This is because currently i can not get it to show the model in unity when i have the meshy file and it feels like im missing a step to get a prefab or something. to have multiple components one with binary data and one model metadata i only get a file that i cant read and nether can unity :S
do we need a plugin to unity 2?
because i can only suspect that you dont only see a unrecognized file in unity and not the model
1: image is how the meshy that i export look like in unity (not recognized)
2: image is how a prefab that is exported look like and they do not look the same even.(this is more what i expect to include in the mod)
I figured the problem with spriets with splices: they need to be loded differently in Unity. Instead of Resources.Load it should be Resources.LoadAll. Thus, sprite slices just cannot be used as tool icons.
Meshy files are not recognised by Unity by default, but may be deserialized by custom ScriptedImporter class. Our implementation (which allows for preview in editor) is however a strict Editor only code, so it does not get included in final build. If you'd like to create a preview, you'd need to write your own ScriptedImporter (that reads the file and uses MeshyReader and MeshyImporter classes to create preview mesh).
(or kindly ask devs to share theirs ๐ )
it would be great help to to be able to see in the editor but then again that is not the reason why we are not able to get it ingame only a visual aid. if you dont want to share that is what it is but would love it if possible
Ingame you should crash atm, at least the way @lofty lark did it. This should be fixed with TimberApi
Because unity was like... let's not make the load method in asset bundles work the same as the resource folder loader
๐ฅน
Knatte you cannot code right ?
ya ๐ฆ
Well than nvm
Maybe I have time today, but else Ill fix that tomorrow (as far as I know how without being able to test)
Then the reloading error is also pushes at least
and people can test out meshy
But the unity editor script would be very much appreciated 
I finally found out what was the issue prevening me from loading the custom white beaver skins !
it was simply that it was no longer the material being called but the png. easy peasy.
also fixes a small issue we had with the kits having dark arm and legs for some reason, thanks devs ! ๐
they look like bunnies 
Lmao they do ๐
well as long as you don't say rats... they won't try to gnaw your throat while you sleep ๐
add them red eyes and they are rats ;)
lab rats maybe
White rats make actually nice pets ๐
this doesn't seem to work
"Ingame"
]```
it tells me
```[Error :WaterBeaverFaction] Failed to deserialize: Requested value 'Ingame' was not found.```
maybe it is case sensitive? try ingame or InGame ?
ah, good point
what are the other possible "scenes" ?
i think i need the mod active in the main menu, it crashed when clicking on "new game"
don't knwo TAPI nomenclature, but scenes are MainMEnu, Game, MapEditor
for once we actually have this in the docs https://timberapi.com/custom_assets/#register-custom-assets
MainMenu and InGame seem to do the trick, thanks !
I must admit, this specification approach is a powerful tool when you get used to it. With just one class that accepts tool info, I created a dozen of tools that do different things.
I know right and also makes it user/dependencyMod friendly
Question. Let's say someone makes his own tool buttons. Can he use a type class from my mod? Or any mod fwiw. Or should it be a type from the DLL that's listed in the mod.json?
If you add a mod as dependency, you can use what is in that mod .
Ah! The dependency link is needed. It makes sense.
well technically not i think, if it exists at runtime thats all that really matters. But you want to ensure your dependency is loaded before your mod does anything related to it. Though for in-game stuff it'll always already be loaded.
But def best practise to include it. That way mod.io can have its dependencies linked too
YA, that's to prevent a crash due to accesing something that do not exist ...
So, it's nice to have, but not required? I agree, that having an explicit dep is a good practice. Just trying to clarify the case.
Yeah
In fact, if dependency mod do not exist, the mod that depends on it will not be loaded .
Which totally makes sense.
Best case is TimperAPI. If is not installed, what mod will be loaded ? Except ModManager, WindChanger, Fixnearplane and ...
It's definetly required if you don't want to cause problems
TimberApi uses it to order everything correctly
ooo, penetration charges, totally want this mod! 
explosives for a 3x3 area would be cool too
You want to start a war ?
or maybe win one? 
MapTnt: lowers the whole map that doesn't have a building on it 
or it could blow like a + the center point and the tiles orthogonally adjacent
This would be kind of a cheat. In 3x3 area, the very middle point is not reachable in case of the area is elevated or deep in the terrain. My mod simply schedules a dynamite setup, but the builders still need to come and make it as usual.
its not a cheat if you make it cost the right amount
For the charges you can try the alpha build: https://github.com/ihsoft/IFTTT_Automation/releases/tag/Alpha-0
I actually use this feature in my current games to do terraforming ๐
You mean making this 3x3 setup a single building? Well, this might work. But I feel it would need more skills than I currently have. I was listening in discord about makign new buildings, but never tried myslef.
yeah, a new explosive
With a cost of, say, 9 charges and 2 planks. Indeed, it would be a good thing for terraforming.
yes, it can cost more in resources than 9 explosives even, the big benefit is that you only need 1 builder trip instead of 9
Why just one? In order to bring 9 charges you'd need 9 trips.
I don't recall the weight of the charge though.
But with planks cost an extra trip would be required for sure.
a new explosive type Big Explosive, that to produce costs more than 9 explosives, but to build its just 1 Big Explosive
Quick question on UI, looks like setting margin is only on anonymous function and setting background is only available when using CreateFragmentBuilder - am I missing something to be able to set a background and a margin?
I feel like I'm missing something, but a bit lost

Seems like it


