• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

Mithkabob

Major
77 Badges
Oct 12, 2014
531
772
  • Victoria 2: Heart of Darkness
  • Hearts of Iron III: Their Finest Hour
  • Knights of Pen and Paper +1 Edition
  • Leviathan: Warships
  • Majesty 2
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Semper Fi
  • Victoria 2: A House Divided
  • Crusader Kings II
  • Cities: Skylines Deluxe Edition
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - Snowfall
  • Stellaris
  • Stellaris: Leviathans Story Pack
  • Stellaris - Path to Destruction bundle
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Charlemagne
  • Cities in Motion
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Hearts of Iron III
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • For the Motherland
  • Crusader Kings II: Monks and Mystics
  • Europa Universalis IV: Mandate of Heaven
  • Hearts of Iron IV: Together for Victory
  • Stellaris: Digital Anniversary Edition
  • Europa Universalis IV: Rights of Man
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Cadet
  • Stellaris Sign-up
  • Victoria 3 Sign Up
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Pillars of Eternity
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
  • Cities: Skylines
  • Warlock: Master of the Arcane
In the ImmaterialResourceManager function CalculateLocalResources:

I'd like an API call out between the {land value is multiplied by the coverage / 1000 and the clamping of all the numbers to ushort range} that passes the (ushort[] buffer, int[] global, byte pollution, int landValue) through so that I can have a function that modifies the land value based on the services available.

I'd just override the ImmaterialResourceManager, but since everything uses it with static calls, I'd have to replace every building AI class, and probably half the UI just to change the land value calculations.
 
This *can* be done, but it requires a lot of seriously hackish methods to do so. (You need to replace the entire function pointer in native Mono-land to one of your own implementation) And with that, you'd also have to copy/paste that whole method.

I'll do a quick write-up and post some code on how to do the method detouring sometime soon when I have more time to explain it all.