Is it possible to mod the "time to caravan reform" amount on quest maps?

Started by Lady Wolf, September 16, 2017, 10:19:51 PM

Previous topic - Next topic

Lady Wolf

Just curious if it's possible to reform the 2 day/24 hour time out on quest maps before it kicks you out.

When assaulting enemy bases I've found 24 hours is barely enough time to loot and get back to the dropship (using the dropship mod ofc) before the timer hits zero, more so if I have to spend time treating seriously injured colonists in the field.

Ideally I want to just remove the timeout all together or just give it 5 days or so, any ideas what file I need to modify to change the timing for quest maps?

CannibarRechter

Which release? A17? I haven't played quests, but I was looking at the A17 C# code just now, and I'm confused. There appear to be two types of map quests, ItemStash and BanditCamp. I'm confused, because only the prior has timeouts in an obvious place (IncidentWorkers_QuestItemStash) and they are 10-30 days (which is hard coded).
CR All Mods and Tools Download Link
CR Total Texture Overhaul : Gives RimWorld a Natural Feel
CR Moddable: make RimWorld more moddable.
CR CompFX: display dynamic effects over RimWorld objects

Lady Wolf

Yes, A17, after raiding an enemy camp I only have 24 hours from the death/fleeing of the last enemy to loot the place before I get thrown off the map.

The 10-30 days time you're talking about is the timeout you have to respond to given quests. (I.e a camp asking for 1000 corn as a quest and you have 10-30 days with which to fill the order.)

CannibarRechter

I see. So I was looking for the wrong thing. It's not a timeout to kill the bandits, it's the duration after the kill. I'll look some more. This won't be moddable in XML, but it may be an easy C# patch... or not, we'll see.
CR All Mods and Tools Download Link
CR Total Texture Overhaul : Gives RimWorld a Natural Feel
CR Moddable: make RimWorld more moddable.
CR CompFX: display dynamic effects over RimWorld objects

CannibarRechter

What message does it say? Can you give me some context, things to search the core C# for?
CR All Mods and Tools Download Link
CR Total Texture Overhaul : Gives RimWorld a Natural Feel
CR Moddable: make RimWorld more moddable.
CR CompFX: display dynamic effects over RimWorld objects

CannibarRechter

Okay. Pretty sure I found what you are looking for. The offending code is in MapParent.cs, here:



namespace RimWorld.Planet
{
[StaticConstructorOnStartup]
public class MapParent : WorldObject, IThingHolder
{
public const int DefaultForceExitAndRemoveMapCountdownHours = 24;

private int ticksLeftToForceExitAndRemoveMap = -1;
...

       or (more likely) here:

....
public void StartForceExitAndRemoveMapCountdown()
{
this.StartForceExitAndRemoveMapCountdown(60000);
}


You 'll need to look around and investigate longer, because it's weird that their is 24 hours above, but then 60,000 ticks as a constant in the second one. 60,000 ticks = 24 hours. Why are these two things not related? I'm not sure.

It's probably being called from FactionBaseDefeatUtility, or if not that then CaravansBattlefield. In any case, what I would recommend you do is set up a Harmony "prefix" style method that returns false (overrides the base method) on MapParent.cs. My guess is you can just blanket change the timeout to 120000 and this will cover every instance where this occurs.

If you fail to know how to do all this, then you can help me help you. Using dev mode, is there a quick way to simulate a raid without having to go through the trouble of building one?

This might be an easy mod for me to make, but I'm not sure how to test it.
CR All Mods and Tools Download Link
CR Total Texture Overhaul : Gives RimWorld a Natural Feel
CR Moddable: make RimWorld more moddable.
CR CompFX: display dynamic effects over RimWorld objects

Lady Wolf

Quote from: CannibarRechter on September 18, 2017, 03:07:35 PM

This might be an easy mod for me to make, but I'm not sure how to test it.

Ya that's all more than a little out of my depth, I've only ever edited the .xml files? (so far)

However it is easy to use dev mode to test your mod. Just form a caravan, then on the world map once it's formed right click on an enemy settlement and choose to assault it, with dev mode on you can send the caravan instantly to the enemy camp, then once there just use one of the dev mode kill/dmg commands to take out the enemy and their turrets, once the last one dies the 24 hour cool down will begin.

And thank you for helping me with this, if I can help by testing the mod for you, or some other fashion, just let me know?

CannibarRechter

Okay. It may be the weekend before I get to this. I'm planning on adding a variety of features to my "Moddable UI" tool, renaming it simply "Moddable," and putting in some Defs for things that are not normally moddable in the Core. First release will likely be Saturday. If the changes work as expected, I'll test this to confirm that it works on 1 or 2 raids, release and you can confirm its function for longer term gameplay.
CR All Mods and Tools Download Link
CR Total Texture Overhaul : Gives RimWorld a Natural Feel
CR Moddable: make RimWorld more moddable.
CR CompFX: display dynamic effects over RimWorld objects

Lady Wolf

Sounds great, thanks!  8)

Out of curiosity, what other things are you making changeable?

CannibarRechter

My main effort is "releasing" game UI elements that are hard coded into the game. Most/all of them are bound up into private readonly data that is loaded at constructor time before mods are even processed. This includes a few of the commands that you might issue in the UI, as well as a lot of the motes and overlays, checkboxes and the like. I'm working on a total graphics overhaul for the game, completely replacing virtually everything (main exclusions for the moment are pawns, worn clothes, and walls). Walls and worn clothes seem like a lot of work; worn clothes will be my priority after the first release; there are some nice new transform tools in Gimp 2.9.X beta that might help with that.

As for the other pieces, non UI pieces, I don't have anything in mind. One poster wanted the hard-coded default buy sell values moddable. You want mission timeouts moddable. Not to hard to create custom defs, and then use C# ninja-mode code to blast over stuff that is normally unmodifiable. There are a few restrictions, but not as many as you might first think.
CR All Mods and Tools Download Link
CR Total Texture Overhaul : Gives RimWorld a Natural Feel
CR Moddable: make RimWorld more moddable.
CR CompFX: display dynamic effects over RimWorld objects

Lady Wolf

Not sure if that's the right area of the game code or not or if it would be easy to implement, but some way to configure the number/tech level, and density of various factions during world generation would be pretty neat.

(That way you can make some factions across the world more common, or with higher tech etc to change the dynamics of the gameplay when starting a new game.)

Edit:

Also I would love to see the timeout on colonists auto undrafting to be increased or removed entirely.

It's quite irritating when you draft all your colonists to handle a raid, and then are waiting for the enemy to navigate your IED field and traps to get into firing range and have your perfectly positioned snipers get bored and undrafted then go back to colony work tasks instead of staying in position for another 4 minutes and maybe not get themselves killed running back to base and into the enemy's field of fire?

CannibarRechter

I have added support for modding the Raid timeout to Moddable.

You want to: 1) install the mod, and 2) read and open the Defs file you are interested in("ModdableRaids.xml"). By default all Defs are "disabled," so you need to take an action. This is done because Moddable isn't a "mod," it's the ability to mod. I decided it was best to have each facet disabled, and require an enablement feature. I did this because each facet actually detours portions of the Rimworld code, and there's no reason to do that willy nilly, if they mod facet isn't required.

If you have your own mod running, your best creating a Patch using instructions in the Def. But if you're not going to publish, it's safe to modify Moddable Defs directly as a shortcut.

I'll look into the auto-undrafting after I finish the CompFX overlay I'm working on. This is a new overlay, similar to the Fire overlay, that enables a broad range of FX overlays. Purrrrrrdy. ;-P

CR All Mods and Tools Download Link
CR Total Texture Overhaul : Gives RimWorld a Natural Feel
CR Moddable: make RimWorld more moddable.
CR CompFX: display dynamic effects over RimWorld objects

Lady Wolf

Thanks a million for this, and nice job including documentation so those who are new to modding can adjust the file as desired.  8)

CannibarRechter

You're welcome. I added a ModdableUndrafter last night. When you download the new, if you have made patches, you'll want to look at the changes carefully. I can't recall if I was suggesting @Class or defName style in the last release, but now it's all defName style, as I consolidated the classes and renamed them (I noticed that both Raids and Undrafter had a common factor, and realized that I needed to share classes for efficiency). No change on the format otherwise, though.
CR All Mods and Tools Download Link
CR Total Texture Overhaul : Gives RimWorld a Natural Feel
CR Moddable: make RimWorld more moddable.
CR CompFX: display dynamic effects over RimWorld objects