Thalassicus
Bytes and Nibblers
When the active player purchases a building ProductionPanel.lua runs this code:
I added a call to one of my own events:
Sometimes Game.CityPurchaseBuilding executes (plays sound, deducts gold), but does not actually place the building in this city. This is perplexing! The function is in the game core only Firaxis has access to, so I can't directly figure out what the problem is. Does anyone have a clue what might be going on?
Further info:
PHP:
elseif (eOrder == OrderTypes.ORDER_CONSTRUCT) then
Game.CityPurchaseBuilding(city, iData);
bSomethingPurchased = true;
I added a call to one of my own events:
PHP:
elseif (eOrder == OrderTypes.ORDER_CONSTRUCT) then
Game.CityPurchaseBuilding(city, iData);
bSomethingPurchased = true;
LuaEvents.BuildingConstructed(player, city, iData);
Sometimes Game.CityPurchaseBuilding executes (plays sound, deducts gold), but does not actually place the building in this city. This is perplexing! The function is in the game core only Firaxis has access to, so I can't directly figure out what the problem is. Does anyone have a clue what might be going on?
Further info:
Spoiler :
PHP:
LuaEvents.BuildingConstructed = LuaEvents.BuildingConstructed or function(player, city, buildingID) end
function OnBuildingConstructed(player, city, buildingID)
log:Info("BuildingConstructed %15s %15s %30s", player:GetName(), city:GetName(), GameInfo.Buildings[buildingID].Type)
MapModData.buildingsAlive[City_GetID(city)][buildingID] = true
SavePlot(city:Plot(), "buildingsAlive_"..buildingID, true)
end
LuaEvents.BuildingConstructed.Add(OnBuildingConstructed)
function SavePlot(plot, key, value)
return saveDB.SetValue(string.format("%s_plot%s_%s", MOD_ID, Map_GetPlotID(plot), key), value)
end