Ally Liberated Countries
Gives an event when liberating countries via the occupation management interface that allows allying or guaranteeing the released nation.
As a side effect, when released, a country has a 40% chance of switching to the liberator’s ideology, as well as their leader gaining an ideology-related trait. If the allying option is chosen, the country will always switch to the liberator’s ideology to stop the stupid AI from leaving the faction.
I had to implement a very janky system to check if the releasing country owned all states before the new country was released so the event wouldn’t trigger when handing back land (because handing back land and releasing countries count as the same action).
Therefore, if the state ownership array isn’t properly updated, the event may not trigger.