[1.1] My Enemy is My Friend (No permanent enemies, no daily faction decay)

Started by Moogie, April 03, 2020, 12:43:39 PM

Previous topic - Next topic

Moogie

A combo-mod that makes all vanilla factions marked as "PermanentEnemy = true" to no longer be true, and stops the gradual arbitrary gain/loss of faction reputation.

Quest scripts were patched to prevent generation errors (the "unresolvable description" errors) that occur when the game attempts to find a PermanentEnemy faction and fails to find one.

Factions that were previously marked as "PermanentEnemy = true" now have "mustStartOneEnemy = true" instead, as part of the effort to appease the quest scripts.

The end result of all this is that you will start a game with the same general setup of factions, allies and enemies, except you can now eventually befriend the Pirates and Savages factions if you wish, and these relationships won't decay without good reason. Additionally, you may now receive quests from previously enemy-only factions if your reputation with them isn't too terrible.

https://github.com/MoogieOuttaMyDepth/RimworldMods/tree/master/My%20Enemy%20is%20My%20Friend

Testers desired: I want to be sure there are no unforseen consequences to having no PermanentEnemy factions. The game will yellowtext warn in the logs about it, but aside from the quest system, I was unable to find any part of the game code that relies on the existence of a PermanentEnemy. So I think it should be okay, and I've been using it in my own game without any red errors popping up, but I want to be sure.

GrumpyProgrammer

Getting two errors on startup:


[My Enemy is My Friend] Patch operation Verse.PatchOperationReplace(/Defs/QuestScriptDef/root[@Class="QuestNode_Sequence"]/nodes/li[@Class="QuestNode_Delay"]/node[@Class="QuestNode_Sequence"]/nodes/li[@Class="QuestNode_RandomNode"]/nodes/li[@Class="QuestNode_Sequence"]/nodes/li[@Class="QuestNode_GetFaction"]/mustBePermanentEnemy) failed
file: /media/DataDrive/Software/RimWorld/RimWorld1-1-2589Linux/Mods/My Enemy is My Friend/Patches/EnemyFriendNoDecay.xml

[My Enemy is My Friend] Patch operation Verse.PatchOperationReplace(/Defs/QuestScriptDef/root[@Class="QuestNode_Sequence"]/nodes/li[@Class="QuestNode_IsTrue"]/node[@Class="QuestNode_Sequence"]/nodes/li[@Class="QuestNode_Equal"]/node[@Class="QuestNode_GetFaction"]/mustBePermanentEnemy) failed
file: /media/DataDrive/Software/RimWorld/RimWorld1-1-2589Linux/Mods/My Enemy is My Friend/Patches/EnemyFriendNoDecay.xml


This is on a Linux system, Update 1.1.2589. I have a ton of mods enabled, though this error appears right after VGP patching (though what that could do with quests, I have no idea). I don't have any other mods that touch quests as far as I know.

I also tried it with just Harmony, Core, ModManager, and My Enemy is My Friend loaded. Same errors.

Moogie

Sorry it took me so long to respond to this! I just went through upgrading my system from Win7 to Win10 and that put everything on hold for a while.

If you replace the contents of EnemyFriendNoDecay.xml with this, it should no longer give errors:

<?xml version="1.0" encoding="utf-8" ?>

<Patch>
<Operation Class="PatchOperationSequence">
<success>Always</success>
<operations>
<li Class="PatchOperationReplace">
<xpath>/Defs/FactionDef//goodwillDailyGain</xpath>
<value>
<goodwillDailyGain>0</goodwillDailyGain>
</value>
</li>
<li Class="PatchOperationReplace">
<xpath>/Defs/FactionDef//goodwillDailyFall</xpath>
<value>
<goodwillDailyFall>0</goodwillDailyFall>
</value>
</li>
<li Class="PatchOperationInsert">
<xpath>/Defs/FactionDef//permanentEnemy[.="true"]</xpath>
<value>
<mustStartOneEnemy>true</mustStartOneEnemy>
</value>
</li>
<li Class="PatchOperationReplace">
<xpath>/Defs/FactionDef//permanentEnemy</xpath>
<value>
<permanentEnemy>false</permanentEnemy>
</value>
</li>
<li Class="PatchOperationReplace">
<xpath>/Defs/QuestScriptDef/root[@Class="QuestNode_Sequence"]/nodes/li[@Class="QuestNode_GetFaction"]/mustBePermanentEnemy</xpath>
<value>
<mustBePermanentEnemy>false</mustBePermanentEnemy>
</value>
</li>
<li Class="PatchOperationReplace">
<xpath>/Defs/QuestScriptDef/root[@Class="QuestNode_Sequence"]/nodes/li[@Class="QuestNode_Delay"]/node[@Class="QuestNode_Sequence"]/nodes/li[@Class="QuestNode_RandomNode"]/nodes/li[@Class="QuestNode_Sequence"]/nodes/li[@Class="QuestNode_GetFaction"]/mustBePermanentEnemy</xpath>
<value>
<mustBePermanentEnemy>false</mustBePermanentEnemy>
</value>
</li>
<li Class="PatchOperationReplace">
<xpath>/Defs/QuestScriptDef/root[@Class="QuestNode_Sequence"]/nodes/li[@Class="QuestNode_IsTrue"]/node[@Class="QuestNode_Sequence"]/nodes/li[@Class="QuestNode_Equal"]/node[@Class="QuestNode_GetFaction"]/mustBePermanentEnemy</xpath>
<value>
<mustBePermanentEnemy>false</mustBePermanentEnemy>
</value>
</li>
</operations>
</Operation>
</Patch>