Thalassicus
Bytes and Nibblers
This should make the code compatible with both the unmodded game and communitas; in the global section of PlotHelpManager.lua:
then alter wherever we loop through yields (lines 225, 610, 805):
It shouldn't affect your project, and will avoid checking new yields the core game functions can't handle. The problem is core functions like plot:CalculateYield(yieldID) don't do safety checks like these. I think that's all that is necessary to make our projects compatible. I've been using them together for about a month now. I'll redo my edits with the latest version of your project and check for other compatibility notes. I really like your work.
One tip to make it easier to adapt your project to future patches: if you can keep changes limited in a file, put a simple line like "--modchange" before each area you make changes. This makes it easy when comparing patch files to tell the difference between what Firaxis changed and we changed.
Another tip is Firaxis writes their code poorly in many places, but it's best to leave that alone. They have inconsistent variable names for example. They might use "pCity" in one place, "city" in another, and "g_city" in another. It's frustrating to work with, and I used to fix these mistakes. It unfortunately just made it harder to adapt to patches, since file comparisons spit out more mismatches.
Sometimes it's not possible to do what you want with just a few small edits. When this is true, I abandon the goal of of easy adaptation and just rewrite the whole file. I did this for one or two things like InfoTooltipInclude.
PHP:
function Contains(list, value)
for k, v in pairs(list) do
if v == value then
return true
end
end
return false
end
local tileYields = {
YieldTypes.YIELD_FOOD ,
YieldTypes.YIELD_PRODUCTION ,
YieldTypes.YIELD_GOLD ,
YieldTypes.YIELD_SCIENCE ,
YieldTypes.YIELD_CULTURE ,
YieldTypes.YIELD_FAITH
}
then alter wherever we loop through yields (lines 225, 610, 805):
PHP:
for yield in GameInfo.Yields() do
if Contains(tileYields, yield.ID) then
-- do stuff
end
end
It shouldn't affect your project, and will avoid checking new yields the core game functions can't handle. The problem is core functions like plot:CalculateYield(yieldID) don't do safety checks like these. I think that's all that is necessary to make our projects compatible. I've been using them together for about a month now. I'll redo my edits with the latest version of your project and check for other compatibility notes. I really like your work.

One tip to make it easier to adapt your project to future patches: if you can keep changes limited in a file, put a simple line like "--modchange" before each area you make changes. This makes it easy when comparing patch files to tell the difference between what Firaxis changed and we changed.
Another tip is Firaxis writes their code poorly in many places, but it's best to leave that alone. They have inconsistent variable names for example. They might use "pCity" in one place, "city" in another, and "g_city" in another. It's frustrating to work with, and I used to fix these mistakes. It unfortunately just made it harder to adapt to patches, since file comparisons spit out more mismatches.
Sometimes it's not possible to do what you want with just a few small edits. When this is true, I abandon the goal of of easy adaptation and just rewrite the whole file. I did this for one or two things like InfoTooltipInclude.