When Mods Break: Incident Not Initialised

Incident Not Initialised. It’s a fairly informative error message. It tells me that I’ve broken one of my mods again.

To explain in more detail, I had a lucky break today when I released a broken update for a mod on Steam and here on the site. I might not have noticed the problem until some irate user complained about getting errors. As it turned out, I had a feeling that I’d done something wrong, so I loaded up RimWorld and did a bit of basic testing, finding an error right away.

This isn’t the first time I’ve managed to break a mod that was working fine by adding a new wrinkle and then not doing all the necessary testing. In future, I’ll have to stop and think about whether I’ve really covered all the possible cases.

Because I didn’t. I loaded up an existing save, didn’t see anything immediately wrong, and then I went ahead and updated the mod on Workshop. What I should have done was start a new game and fired the Solar Flare incident at least once. 😛

However, I did come up with a fairly neat solution to the problem.

Basically, my modded incident worker in the original DLL did not inherit the necessary features to work properly, because I goofed and set it to inherit directly from IncidentWorker, instead of IncidentWorker_MakeMapCondition.

What a dumb mistake that was. Maybe I meant to type that in full or copy and paste, but obviously that didn’t happen and now I’m writing this cautionary tale.

I don’t have a code repository and I wasn’t at home so I had to copy my mod from the Workshop directory, decompile my DLL, and make a new project to patch it. The decompile wasn’t clean because I didn’t think to download Zhentar’s awesome fork of ILSpy from his GitHub. So I had to fix a few little things here and there.

Maybe now I will consider the benefits of using a repository.

Anyway, the neat part is that instead of overwriting the entire DLL, I just needed to add a second one and point to that one instead from the incident XML file. The broken class is still there in the original DLL, but it isn’t referenced.

Good enough for a quick fix.

Obviously, this isn’t an impressive feat in the eyes of a professional coder. But that’s not the audience I’m writing for. There’s plenty of modders out there, experimenting with all sorts of interesting stuff that they might not know the ins and outs of.

If one of them is you, the point I’m trying to make is that your projects don’t need to be single monolithic screeds of code. They can be modular. And it might make it easier to fix things when they go wrong.

Obviously for the purposes of efficiency you might want some things to be bundled up in the same library, but it doesn’t always have to be so.

Thanks for reading. 🙂

RimWorld – Winter is Here changelog

Alpha 8

v1.0.0 – Initial release.

  • Tweaked hides to offer only a 25% factor at best to minimum comfy temperature offsets when making clothes out of them.
  • Parkas reduced to -32C (minimum) and -6C (maximum) offsets.

v1.0.1 – Parkas also reduce global work speed by 3%.

v1.1.2 – Winter warrior edition.

  • Winter apparel added: heavy duster, winter jacket, thermal pants and thermal shirt.
  • Added new PawnKindDefs and modified FactionDefs.
  • New pawns have more cash to spend on apparel and use the new cold weather tagged clothing.
  • Renamed the mod folder.

v1.2.0 – Merged in the Lamps, Lanterns and Kits mod.

  • Small orange lamp – limited illumination radius, low power usage. Suitable for use near to a worktable.
  • Mining lantern – glows yellow. Must be fabricated at a smithing table first. Deconstructs to yield a lantern kit.
  • Outdoor battery kits – waterproof. Must be fabricated at the smithing table.
  • Hydroponics kit – nuclear powered, removing the need for an external power source. Hardened against solar flare activity. Make one at the smithing table.
  • Campfire kit – mostly wood. Mostly. Make one at the smithing table.
  • New trader type – oddments. Sells mining lanterns, hydroponics kits, campfire kits, and winter apparel.
  • Renamed the mod folder again.

v1.2.1 – Fixed a minor XML bug (still red message o’ doom though).

v1.3.0 – Even More Kits edition

  • Producton kits: Cooking, Butchery, Smithing, Sculpting and Stonecutting.
  • Security kits: Steel and Plasteel kits for creating improvised turrets.
  • Fixed the Hydroponics Kit. Now uses Uranium Cells instead of Uranium in the recipe. Uranium cells can be crafted at a rate of 7 per 20 Uranium at the smithing bench.
  • Added Prison Meals for both original and kit-based cook stove, from the Space Meals mod.

v1.3.2 – Minor fixes and additions.

  • Apparel tags are reworked. Lower value pawns will not spawn in with power armour.
  • Pawns can spend more on apparel when spawning in – parkas and other winter apparel can be expensive.
  • Tailoring kit is added.

v1.3.4 – More fixes and additions.

  • Pawns from other factions will use the knitted tuque (cloth) only. In theory, leaves more apprel money to use on covering the rest of the pawn. You can still make tuques from any fabric you like.
  • Winter apparel added by the mod can only be crafted from hides. Existing apparel made from fabric will not be affected, but will also no longer be available.
  • Kit turrets now leave wrecks when they explode. The wrecks can be smelted down for 80 steel to compensate for the lack of traditional resource drop. This is true for both steel kit and plasteel kit turrets.

v1.3.5 – Minor fix. Tailoring kits should now be available from oddments traders.
v1.3.6 – Minor juggling of hides insulation values – some animals with good resistance to cold had terrible temperature offsets on hide.
v1.3.7 – Retextures of kit-based cook stove, butcher’s table, stonecutter’s table, tailoring bench, and hydroponics basin.

Alpha 9

v1.4.1 – Upgrade In Progress edition.

  • Turret kits can be upgraded to enhanced versions at the smithing table, crafting skill 6 required.
  • An advanced smithing table can be crafted. Cost: 150 Steel & 5 Uranium Cells. Does not require external power, immune to solar flares. Research required to build the advanced smithing table.
  • Enhanced turret kits can be upgraded to more advanced versions at the advanced smithing table, requiring a crafting skill of 8-12.
  • A uranium power core can be crafted at the advanced smithing table and is a component in the hardened turret upgrade.
  • Hardened turrets drop a deactivated uranium power core when they explode, as well as a turret wreck.
  • Blaster turrets require a charge rifle to make. When the blaster or disruptor turrets are subsequently destroyed, they yield an charge rifle and a turret wreck.
  • Stonecutting skill change mod added – stonecutting is done by colonists with the Mining job.
  • More hide insulation value adjustments.
  • Deactivated uranium power cores can be reactivated at the advanced smithing table.
  • Winter pawns and extra apparel have been deprecated for now.
  • Oddments trader now carries a few more apparel items and will buy them from you.
  • Smithing, tailoring and sculpting tables: compatibility changes.
  • Stonecutting is prioritised before mining, per the Stonecutting Skill Change mod.

v1.4.3 – Fixes and improvements.

  • Additional A8 to A9 updates – impassable work tables become passable.
  • Worktables built from kits now leave some raw resources when destroyed.
  • Re-added winter apparel and pawns.
  • Fixed missing cowboy hat at tailoring table.
  • Adjustments to insulation and stuff cost of winter apparel.
  • Added apparelRequired tags for pirates and mercenaries – less naked pawns.
  • Added a RW Launcher mod option to play without winter stuff.
  • Adjusted max pawn generation ages – no more geriatric pirates!

v1.4.4 – More nerfing.

  • Quality affects the insulation stats on apparel less than before.
  • Winter pawns get apparel which is in slightly better repair, and have an improved pool of money to spend on winter apparel.
  • Added the gladius to the kit-based smithing table.
  • Rebalanced winter pawn point costs.

v1.4.5 – Low point winter pawns, more meals, fixes and Wastelanders.

  • Added low-point winter pawns. Their equipment is poor quality or worse, and their skills tend to be lower.
  • The max generation age for low-point pawns is 20. They may very rarely carry items from the mod, or wood logs.
  • Adjusted winter pawn item quality and health upward slightly.
  • Low-point tribal pawns get less money for weapons.
  • Fix: Oddments trader will now buy your excess winter apparel.
  • Fix: All prison meals can be cooked at the kit-based cook stove.
  • Per the newest version of Space Meals mod, single meals for colonists can be cooked. These do not stack.
  • Per the newest version of Space Meals mod, there are variants of the simple meal, currently vegetable and meat soup.
  • Support added for Wastelanders addon.