Help Removing Ship Chunk Drop Incident

Started by SickBoyWi, April 09, 2019, 12:47:36 PM

Previous topic - Next topic

SickBoyWi

Hello all. I'm trying to remove the ship chunks falling event via source code. I've tried multiple things, and the stupid chunks still fall out of the sky.

Here's what I've tried:
I have a static class with a static constructor. In the constructor, I've tried two ways to prevent the event. Both related:
            RemoveStuffFromDatabase(typeof(DefDatabase<IncidentDef>),
                DefDatabase<IncidentDef>.AllDefs
                    .Where(id => new[]
                                     {
                                         typeof
                                         (IncidentWorker_ShipChunkDrop
                                         ) 
                                     }.SelectMany(
                                         it =>
                                             it
                                                 .AllSubclassesNonAbstract()
                                                 .Concat(
                                                     it))
                                     .ToArray()
                                     .Contains(
                                         id
                                             .workerClass) ||
                                 new[]
                                 {
                                     "ShipChunkDrop"
                                 }.Contains(
                                     id
                                         .defName))
                    .Cast<Def>());

When those failed, I tried setting the baseChance to zero, assuming that may make it so that there was no chance of this happening:
            IncidentDef shipChunkDrop = IncidentDefOf.ShipChunkDrop;
            shipChunkDrop.baseChance = 0.0f;

Still no luck. Any ideas or advice are most welcome! This is driving me nuts.

LWM

There's the scenario option to disable it?  If that's all you want, I recommend using that.

If you want to remove it for other reasons, check the code the scenario option has.

HTH,

--LWM

Kirby23590

In other words...

Why would you want to remove the Ship Chunks dropping in? (Free Steel and Components.)

Sure they might make a mess by crashing in to one of your colonist's bedrooms while they are walking around and getting upset that their room is a mess now.

But they give you free steel and components man, in other words you could try disabling that incident or event in the scenario editor when trying to play a new game if does exists.

One "happy family" in the rims...
Custom font made by Marnador.



SickBoyWi

Thanks fellas. I will definitely look at the scenario code!

I want them removed because I'm ironing out bugs in the Medieval Vanilla, and Rimhammer - The End Times mods; both of which are supposed to remove everything after the medieval era from the game!

Canute

#4
Hint how to add the scenario exclude into existing safes.
Create at first a new colony and edit the scenario to exclude the ship chunks.
Only the pawn are on the map, safe it.
Open the safegame with an texteditor, look for scenario entries and identify the entry about ship chunks.
Copy the whole passage.
Backup your safegame, just in case.
Then open your safegame with an texteditor, and insert it at the right place.
You can ingame Review Scenario at the ESC menu, to check if it worked.

But you can use
Toggles Mod
https://ludeon.com/forums/index.php?topic=48120.0
and disable Incident's ingame ! :-)