I'm new to modding but am a software engineer. Tonight I decided I wanted more natural wonders and that I like the perfectworld3 map script.... So I dove into the perfectworld3 lua script and that led me to AssignStartingPlots.lua. (Excelently commented code btw). Here's the problem in this script:
-- Determine how many NWs to attempt to place. Target is regulated per map size.
-- The final number cannot exceed the number the map has locations to support.
--
-- ToDo: Hook this up to XML.
local worldsizes = {
[GameInfo.Worlds.WORLDSIZE_DUEL.ID] = 2,
[GameInfo.Worlds.WORLDSIZE_TINY.ID] = 3,
[GameInfo.Worlds.WORLDSIZE_SMALL.ID] = 16,
[GameInfo.Worlds.WORLDSIZE_STANDARD.ID] = 5,
[GameInfo.Worlds.WORLDSIZE_LARGE.ID] = 6,
[GameInfo.Worlds.WORLDSIZE_HUGE.ID] = 7
}
local target_number = worldsizes[Map.GetWorldSize()];
local iNumNWtoPlace = math.min(target_number, iNumNWCandidates);
local selected_NWs, fallback_NWs = {}, {};
for loop, NW in ipairs(NW_eligibility_order) do
if loop <= iNumNWtoPlace then
table.insert(selected_NWs, NW);
else
table.insert(fallback_NWs, NW);
end
end
Everything is still hard coded in the lua script. I hope no one is trying to use NumNatrualWonders in the XML cause it doesn't work. I did my homework too and tested it, the xml value does nothing and changing the values in AssignStartingPlots.lua worked.
I got a kick out of seeing "TODO"s in the final product as an engineer myself but is there something I should do about this? Tell someone at fraxis? Does anyone else care?
Sorry if this has already come up, I tried to search the forums and didn't find anything.
-Matt
-- Determine how many NWs to attempt to place. Target is regulated per map size.
-- The final number cannot exceed the number the map has locations to support.
--
-- ToDo: Hook this up to XML.
local worldsizes = {
[GameInfo.Worlds.WORLDSIZE_DUEL.ID] = 2,
[GameInfo.Worlds.WORLDSIZE_TINY.ID] = 3,
[GameInfo.Worlds.WORLDSIZE_SMALL.ID] = 16,
[GameInfo.Worlds.WORLDSIZE_STANDARD.ID] = 5,
[GameInfo.Worlds.WORLDSIZE_LARGE.ID] = 6,
[GameInfo.Worlds.WORLDSIZE_HUGE.ID] = 7
}
local target_number = worldsizes[Map.GetWorldSize()];
local iNumNWtoPlace = math.min(target_number, iNumNWCandidates);
local selected_NWs, fallback_NWs = {}, {};
for loop, NW in ipairs(NW_eligibility_order) do
if loop <= iNumNWtoPlace then
table.insert(selected_NWs, NW);
else
table.insert(fallback_NWs, NW);
end
end
Everything is still hard coded in the lua script. I hope no one is trying to use NumNatrualWonders in the XML cause it doesn't work. I did my homework too and tested it, the xml value does nothing and changing the values in AssignStartingPlots.lua worked.
I got a kick out of seeing "TODO"s in the final product as an engineer myself but is there something I should do about this? Tell someone at fraxis? Does anyone else care?
Sorry if this has already come up, I tried to search the forums and didn't find anything.
-Matt