I've thought about this a bit more and am wondering: does this really need to be a district? Would it suffice to just surgically patch a few things in the source code and instead allow colonies to be founded inside others' territory, and (maybe separately) not be swept up by expanding borders?
If I've learned anything from Flintlock, it's that often a few well-placed minor changes to the codebase can achieve a lot. And after reflecting a bit, I realized there's actually quite a bit wired in the game about how colonies work that it'd be much simpler just to slightly tweak instead of trying to reinvent the wheel as a district. The art is maybe the easy part, other things like handling when a rival civ unit enters them, drawing the "Colony, <Civ> <Resource>" text and borders in the UI, not to mention tradenet calculating who-gets-the-resource and so on - that's code I'm hesitant to recreate in districts code if there's an easier way. (especially given that we're leaning towards just keeping the vanilla graphics).
So anyway I did a small experiment and found the function that, when a game is started or a civ's territory grows, checks for (among many other things) colonies within someone's territory and if found, removes them. For that specific check, I just overrode it and always returned false, so no colonies are removed due to being in someone's territory. And the result is:
View attachment 754829
View attachment 754830
(and from Babylon's perspective, no dyes)
View attachment 754833
Success! We can have extraterritorial colonies and the resources extraction just *works* with barely any code changes at all.
I also found how the "Build Colony" button checks (whether to show it or not and allow a worker to build one) happen and can pretty easily override those (I think). So basically, barring unforeseen snags, it's relatively simple to just let players both build and keep colonies in other people's territories, without it needing to be a district. This would all be set via C3X configs, of course.
Additionally, I found where in the code leaders' attitudes towards one another is determined. I think I could just add some negative value (users could configure, e.g. -4) to the base relationship score for each colony in someone else's territory.
So long story short, it appears straightforward to allow users to found and keep foreign colonies, and also allow relations to deteriorate due to that. This seems pretty compelling and interesting to me, and also, more realistic, as when one civ's borders expand, another civ's people on that territory don't magically disappear, but instead may become a point of contention. Not to mention expropriating resources actually, well, happens in the real world.
What do you think? I'm inclined to go this route instead of making it a special district type.
The only downsides I see are that, if not a district, we aren't able to layer in technology/wonder/whatever checks districts allow for, and also custom graphics, etc. But in the great scheme of things that seems minor to me.
I need to investigate on this one. This may actually be the trickiest piece. I'm thinking I can patch how vanilla workers search for candidate colony tiles and override the check that only considers resources on tiles with no territory owner. If that is possible, this could work without much coding.
Creating an extraterritorial colony is kind of an aggressive act, so we'd need to think through the right circumstances for workers to do so. Maybe if one civ's military strength is "much stronger" than the other civ's? (I don't know how that check currently works). Or any other factors that should be considered, if they're not too complex?