function GetArgumentDatas(sOrigin, tTable)
print("============================================================================================")
print("[" .. sOrigin .. "]: Dumping Event Hook Argument Data")
print("............................................................................................")
for k,v in pairs(tTable) do
local sKeyType = type(k)
local sValueType = type(v)
print("[" .. sOrigin .. "]: Key is of type " .. sKeyType .. " = " .. tostring(k) .. ", Value is of type " .. sValueType .. " = " .. tostring(v))
end
print("............................................................................................")
print("[" .. sOrigin .. "]: dump completed for this firing of the event")
print("============================================================================================")
end
--############################################### CityConquered ########################################################
function OnCityConquered(...)
--OnCityConquered(iVictoriousPlayer, iDefeatedPlayer, iNewCityID, iCityPlotX, iCityPlotY)
--iNewCityID gives the ID # the city is using for the new owner (ie, iVictoriousPlayer)
--iNewCityID will NOT as a general rule match to the ID # used for the same city for the previous owner (ie, iDefeatedPlayer)
--CityConquered fires before CityRemovedFromMap, CityAddedToMap, and CityInitialized
--Firing Order: (all functions subscribed to these events fire in this order as part of a city conquest)
-- GameEvents.CityConquered
-- Events.CityRemovedFromMap
-- Events.CityAddedToMap
-- Events.CityPopulationChanged
-- Events.CityTileOwnershipChanged (fires in succession for each tile whose ownership was altered)
-- Events.CityInitialized
-- Events.CityProductionCompleted
-- Events.CityPopulationChanged (you seem to get two firings of this event as part of a city-capture)
-- Events.CityProductionCompleted (you seem to get two or more firings of this event as part of a city-capture)
print("GameEvents.CityConquered fired for function OnCityConquered")
GetArgumentDatas("OnCityConquered", {...})
end
GameEvents.CityConquered.Add(OnCityConquered)
--############################################### CityInitialized ########################################################
function OnCityInitialized(...)
--OnCityInitialized(...)
--OnCityInitialized(iPlayer, iCityID, iX, iY)
print("Events.CityInitialized fired for function OnCityInitialized")
GetArgumentDatas("OnCityInitialized", {...})
end
function OnLoadScreenClose()
--delay until after LoadScreenClose to avoid massive dumps in the log on reloading saved game
Events.CityInitialized.Add(OnCityInitialized)
end
Events.LoadScreenClose.Add(OnLoadScreenClose)