What I'd like is for when a specific unit joins a city, to have it build a specific building (if it doesnt already exist) immediately when it joins the city, in addition to bumping up the population a point.
Best suggestion I'd have for this is to look at spells like "create orc cage", or "dancing bear", and than use the appropriate spell properties (or python code, if those spells use python.)
By the same token, when a specific type of settler unit founds a city, I'd like to have it build a specific building as well.
For example, when an orc settler makes a city, it automatically creates an orc pit. When an orc worker joins a conquered, originally non-orc city, it bumps up the population one and automatically creates an orc pit. Or when a human worker loyal to an elf-lord joins that elf-lord's elf-city, it bumps up the population one and creates some specific human-specific building.
You might be able to do this using the EventManager.py file. There's a section "on city found" that does things like give infernals their free buildings, and you may be able to write up some code where if the founding settler had an orc promotion, than the city would have certain buildings. (I'm not actually sure exactly what code I'd use, though, if it were possible.)
For the workers additions, those could probably be done using some python code in the join spells. (Something like "if settler has promotion "orc", give city "orc pit", repeated for all the racial promotions. I'm also not sure if the exact code in this case, but am far more sure that this is possible to do.)
For my multi-racial empire fix, if you want to know exactly what it is that I'm trying to do so that you can maybe think of a better solution, here's the problem in detail:
Let's say you're race is fighting to the death, you ought to be able to draft a bunch of peasants (or arm your existing peasants) and just arm them to the teeth. That's simple enough to write. The only limits to your effective manpower is population, and the stock of weapons in your armoury (or gold).
Where the problem is occuring is ensuring that the teleri settler (either with the teleri race promotion or a teleri-specific settler, either works for me) founds a city that builds only teleri peasants, and the vanyar settler builds cities that builds only vanyar peasants (all owned by the same Civ).
The other advantage is lets say your teleri city is about to be conquered... you can evacuate most of the population, and resettle them in the vanyar city, and it just makes sene for said vanyar city to be able to draft both vanyar or teleri peasants (especially if it is mostly teleri).
If the building fix can work... what am I looking at having to alter? Can you point me in the right direction?
Perhaps use spells rather than the draft mechanic, that would require a certain building, would reduce the city population, and produce the desired peasant. You would need a token unit to start the process, of course, and (unless the "hasCasted", or some other attribute, allows the spell to not shut down other spells) would have to design the units to not need spells immediately after being drafted.
It also might be possible to adjust how to draft mechanic works, so that drafted units would have a chance to be certain types of units based on buildings in the city, though again I am not sure if this is actually possible, and how you'd go about it if it was.