#Building HP & Renovation

109 messages · Page 1 of 1 (latest)

delicate sedge
#

Steam Workshop: https://steamcommunity.com/sharedfiles/filedetails/?id=3559268095
Mod.io: https://mod.io/g/timberborn/m/building-hp-renovation

This mod adds HP and Renovations to buildings, with an optional Maintenance system that uses the new HP mechanic.

HP

  • Every building now has a base Durability (10), modified by its construction materials.
  • Buildings with no Material Cost (such as District Centers or Lumberjack Flags) are invulnerable, since making them destructible would only create annoyance when deleting and rebuilding.

This system is designed to support other mods, but also includes an optional Maintenance feature:

  • Buildings slowly lose HP over time (configurable).
  • Default rate: –1 HP per day (for example, a Lodge with 50 HP lasts about 2–3 seasons).

Buildings can regain Durability or even become Invulnerable through Renovations.

Renovations

Buildings can undergo Renovations:

  • They continue functioning normally while being renovated.
  • Only one Renovation can be active on a building at a time.
  • Some Renovations are repeatable; others are permanent and cannot be canceled.
  • Renovation materials are non-refundable once collected.

Examples included in this mod:

  • Repair: Restores a % of HP. Cost scales with the building’s construction cost.
  • Basic Reinforcement: Permanently increases Durability. Has 3 levels; only the highest applies. Higher levels can be built directly without lower ones.
  • Invulnerable Reinforcement: Temporarily grants Invulnerability. Cannot be canceled.
  • Metal Gear Solid: For buildings that use Gears (in construction cost or recipes). Permanently grants +150 Durability and +10% Productivity.
  • Manufactory Overdrive: Boosts Productivity for a short period, followed by a cooldown with reduced Productivity. While boosted, the building’s HP decays rapidly.
mod.io

This mod adds HP and Renovations to buildings, with an optional Maintenance system that uses the new HP mechanic.

#

Renovation Stockpile

To avoid micromanagement, renovation materials are drawn directly from existing Stockpiles (Piles, Warehouses, Tanks).

  • Stockpiles gain a new toggle: Supply materials for Renovation.
  • Priority affects supply: higher-priority Stockpiles are used first.
  • Renovations only begin once all required materials can be gathered at once.
  • Materials cannot be delivered gradually.
  • Renovations themselves also have a Material Priority setting: higher-priority Renovations receive materials first when supply is limited.
#

Detailed Formulas

Material Durability

Each building’s Durability is calculated from its construction cost, based on both the strength of each material and their proportion in the total cost.

  • Calculation logic: see BuildingMaterialDurabilityService.cs.
  • Material strength values are defined in BuildingMaterialDurabilitySpec and are moddable.
  • Default values: see attached table.

Examples:

  • A building made from 10 Metal Blocks → 500 Material Durability (plus 10 from Base Durability = 510 total).
  • A building made from 10 Logs + 1 Metal Block82 Material Durability.

Repair Cost

Repairing a building uses one material type, chosen as:

  1. The most plentiful material in the construction cost.
  2. If tied, the material with higher strength is used.
  • Full repair (100% HP) costs 50% of the original cost of that material.
  • Repairs are broken down into 10% increments of HP.
  • If the increment is not a whole number, the recovered HP% is scaled up proportionally, but never exceeds 50%.

Calculation details: see BuildingRepairService.cs .

willow bloom
#

Hello, one question: do ALL buildings and decorative items now have to be accessible in order to repair them?

Because some of mine are out of reach... and should the mod only be used with a new game, or does it also work with an old one?

delicate sedge
# willow bloom Hello, one question: do ALL buildings and decorative items now have to be access...
  1. no, because quite a lot of buildings are not "reachable" (i.e. without entrances etc). basically as long as you have material, you can perform renovation, there is no added logistics (it makes the process easier and also I don't need to code complicated behaviors)
  2. I haven't tested yet but you should be able to enable/disable this mod mid way. At least for enabling because I always test my mod with existing saves. now that you mentioned it, I rarely test my mod with new games lol
willow bloom
fallow swan
#

Question. What happen if you failed to renovate ? Building(s ) get destroyed to rubble ? If YES, recovered materials are % of game settings from building cost - renovation (failed) cost ?

delicate sedge
#

nope, no refund in anyway

#

once material is gathered by the renovation, it's gone, no way to get back.

fallow swan
#

So, nuke them 💥

delicate sedge
willow bloom
delicate sedge
delicate sedge
#

as for if it will be available to mod.io, usually for big mods (like #1348869700062412810 ), I keep it on Steam only for a while because it's likely I will need to update frequently to fix bugs and add essential features. So I don't need to frequently update on both sites.

willow bloom
delicate sedge
#

yeah and right now it's quite barebone anyway. maybe when I add Earthquake to #1379728375396040806 , this mod will be more interesting 😛

willow bloom
delicate sedge
#

right........ back to it lol

#

you know we devs have something about, making new stuff is more exciting than fixing broken old stuff lol

willow bloom
delicate sedge
#

no, I am not annoyed at all 😅 I do need to fix broken stuff I made anyway 😛

delicate sedge
willow bloom
delicate sedge
#

nope, there are only 2 extension mods for Moddable Weather

delicate sedge
pearl spindle
#

Hi, I'm getting "renovation lacks materials" error message. But I have the supplies needed.

delicate sedge
#

my mod can't "surprise" you by just siphoning resources without you knowing it, so you have to explicitly opt-in 😛

#

see the "Renovation Material and Stockpile" section in the description

valid cobalt
#

@delicate sedge I am getting this error while loading a saved game / continuing a previous game... Any chance you can give a suggestion how I can fix this...
v0.7.10.8-1ec3a71-xsm
InvalidOperationException: Already renovating
BuildingHP.Components.Renovations.BuildingRenovationComponent.Renovate (BuildingHP.Services.Renovations.BuildingRenovation r, Timberborn.PrioritySystem.Priority priority) (at D:/Personal/Mods/Timberborn/TimberbornMods/BuildingHP/Components/Renovations/BuildingRenovationComponent.cs:73)

delicate sedge
#

v7.0.2: Fixed loading a save with a previous version where renovation could be built on unfinished buildings.

delicate sedge
valid cobalt
delicate sedge
#

I think I should change the "Supply material" option to opt-out (i.e. checked by default)

#

people are getting surprised their renovation are not going.

delicate sedge
#

v7.0.3: Material supply is now opt-out.

valid cobalt
#

hi again @delicate sedge .
I got another error I think is related to this mod. I saw I have a bunch of buildings that needs repair in the status area on the left. I clicked on it and the game crashed. I have attached the logs.

delicate sedge
delicate sedge
#

and, is it possible that one of your building was destroyed as a result of being damaged?

valid cobalt
delicate sedge
#

thank you. could be something related to my Scientific Projects crashing too, something was creating a lot of entities

old gulch
#

I guess that there could be a race condition between clicking the status icon, and then th building disappears,

#

or maybe you need to trigger the status icon update when destroying buildings?

#

otherwise status icon is still there, but the building is not

delicate sedge
#

must be another mod making entities with special code somehow without the game's usual flow

#

also the game's ToggleStatus never disasble on building delete.

delicate sedge
#

@calm valve any chance you create some entity and destroy them without going through EntityService.Delete? I remember you talked about it quite a while ago

#

@old gulch is that method within a patch path of More Mods Log?

old gulch
#

I assume tubes count as buildings, not sure if that could account for so many though.

#

I can add a patch for it if necessary (should IsSelectable just return False if it can't find the object?) Is it easy to reproduce?

#

I won't have time to look at it this week/weekend though.

delicate sedge
calm valve
delicate sedge
valid cobalt
#

I am not playing Leafcoats for this save.. I am however using the Greedy Embers faction which includes Emberpelts. I do not have that much buildings - maybe even if you include pipes.

delicate sedge
valid cobalt
#

Thank you though. Maybe I should reduce my mods 😅

delicate sedge
old gulch
#

It won't be able to print the cause because it's a null pointer, best case it could just suppress the crash.

delicate sedge
old gulch
#

That miight work

prisma veldt
#

@delicate sedge Hi I found two "LV.BHP.BaseDurability" in enUS.csv. Is this a mistake?

delicate sedge
#

@placid haven thought on making duplicate entries within a localization file throws instead? 😛

placid haven
#

No. It is intended that localization files won't crash the game

old gulch
#

but they could at least have a warning when they're loaded

delicate sedge
#
    private static IEnumerable<LocalizationRecord> ReadRecords(string localization, StreamReader reader)
    {
        try
        {
            return new CsvContext().Read<LocalizationRecord>(reader);
        }
        catch (Exception ex)
        {
            // ...
            Debug.LogError(text); // this would throw.
            return Enumerable.Empty<LocalizationRecord>();
        }
    }
delicate sedge
delicate sedge
#

v7.0.4: Fixed duplicate text entry causing faulty tooltip text (visual only). Updated the note text about Renovation, also moved it below the button to Start Renovation. Thanks @prisma veldt for reporting.

old gulch
#

I think only Debug.LogException triggers the crash scene, Debug.LogError should be fine.

delicate sedge
#

oh you are right

#

but I can't remember what would cause a crash, I remember seeing one before

delicate sedge
# placid haven No. It is intended that localization files won't crash the game

here you go, put an extra comma on an entry and I am pretty sure it's intended 😛

InvalidDataException: Localization file contains errors:
Unnecessary comma found in enUS_in_...\Timberborn\Mods\StreamGaugeTracker\version-0.7\Localizations\enUS.csv (line 13)
  at Timberborn.Localization.LocalizationCsvValidator.InformAboutErrors () [0x00058] in <d69dd7ec612549aba34287f3defcab0e>:0 
  at Timberborn.Localization.LocalizationCsvValidator.Validate (UnityEngine.TextAsset textAsset) [0x0000e] in <d69dd7ec612549aba34287f3defcab0e>:0 
  at Timberborn.Localization.LocalizationLoader+<ReadLocalizationFiles>d__11.MoveNext () [0x00069] in <d69dd7ec612549aba34287f3defcab0e>:0 
  at Timberborn.Localization.LocalizationLoader.GetLocalization (System.String localizationKey, System.Boolean isExperimental) [0x000fc] in <d69dd7ec612549aba34287f3defcab0e>:0 
  at Timberborn.Localization.LocalizationService.Load (System.String localizationCode) [0x0001f] in <d69dd7ec612549aba34287f3defcab0e>:0 
  at Timberborn.Language.LanguageLoader.Load () [0x00011] in <80934173d91f4ddbb145ea06f2bba4b3>:0 
  at Mods.MoreModLogs.SingletonSystemPatch.ErrorReporter (System.Action fn) [0x00093] in C:\Users\Norman\Documents\src\Timberborn-MoreModLogs\SingletonSystemPatch.cs:53 
  at (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition.Timberborn.SingletonSystem.SingletonLifecycleService.LoadSingletons_Patch1(Timberborn.SingletonSystem.SingletonLifecycleService)
  at Timberborn.SingletonSystem.SingletonLifecycleService.LoadAll () [0x0009a] in <37714495c7b34fbf87491c89893567c4>:0 
  at Timberborn.SingletonSystem.SingletonLifecycleUnityAdapter.Start () [0x00000] in <37714495c7b34fbf87491c89893567c4>:0 
old gulch
#

I think it's the difference between a syntactic error, and semantic error.

#

badly formed failes will fail to load,

#

but well formed files with poor/bad data will load successfully and not prevent the game from running

placid haven
old gulch
#

Yea, I think setting an existing key should be fine.

#

I think the warning would be if you set the same key twice in one file

valid cobalt
#

I tried playing this after a few updates since I was getting a lot of crashes before. I am still getting errors from this mod.
I am playing with Emberpelts faction and a bunch of other mods too. I played it without this mod and never crashed and tried reenabling it after the most recent update, but it failed during gameplay (after maybe 2 minutes of loading the game).
here is my Exception log.

delicate sedge
#

@calm valve is it true EP does not have Treated Plank?

#

pretty bad since it's available to both official factions so mods would expect it to be available everywhere

fallow swan
#

Ya, you need to make a separate building for Emberpelts. Maybe, to be build, require planks and bricks ?

delicate sedge
#

there is no code in Renovation to separate for Factions.

#

it would be a totally new property/logic etc

calm valve
sharp wolf
#

would it work to declare treated plank as a backwards compatible id of bricks for example?

calm valve
#

I'm not sure

#

I was thinking at one point I should make one of those addon mods that adds an Emberpelts Lumbermill and gives them Treated planks, for mod compatability.

#

Some other mods replace the need for treated planks with just planks, and Pine Resin. Others replace them with something else, like Bricks.

severe grove
#

would be nice if a solution can be found, these errors always catch me by surprise. only to realize that the lack of treated plank is the issue

#

The game will crash as soon as you click on a renovation that requires treated planks. If you could see the goods requirements for a renovation on the Renovations main screen, players could at least be more cautious not to click the ones that need Treated Planks.

sharp wolf
#

it would crash there too, if it tried to show the icon

severe grove
#

the game will crash if an icon is shown in the UI? how

#

but if it does, just text is also an option

delicate sedge
severe grove
#

@delicate sedge FYI I was playing around with the new Beavline Renovations and I got a crash when I deleted a small storage building that was connecting input and output storages with a production building

delicate sedge