Make Buildings Unbuildable To Puppets

Joined
Jan 7, 2009
Messages
620
How can I exclude buildings from puppet cities? I'm pretty sure it's possible as there are some buildings (Barracks line) that they never build. Thanks in advance.
 
GameEvents.CityCanConstruct.Add(function(iPlayer, iCity, iBuildingType) ... end)

along with

city:IsPuppet() or city:IsOccupied()
 
I was worried it would be through lua :/

Can you do me a big favor and point me to the vanilla files that do this? I am hopeless with lua but I think I can back out the parts that I need if I can see the example.
 
Hacked out of my mod "Unique Building - Basilica" (and changed a bit)

Code:
local iBuildBarracks = GameInfo.Buildings["BUILDING_BARRACKS"].ID

function OnCityCanConstruct(iPlayerId, iCityId, iBuildingType)
  if (iBuildingType == iBuildBarracks) then
    local pPlayer = Players[iPlayerId]
    local pCity = pPlayer:GetCityByID(iCityId)

    return (not pCity:IsPuppet())
  end

  return true
end
GameEvents.CityCanConstruct.Add(OnCityCanConstruct)
 
Back
Top Bottom