End-turn blocking

Thalassicus

Bytes and Nibblers
Joined
Nov 9, 2005
Messages
11,057
Location
Texas
Which settings determine if a notification blocks end-turn? For example, I'd like to change the "new citystate quest" notification to not block end-turn.
 
UI/InGame/WorldView/ActionInfoPanel.lua and its corresponding xml file. It explicitly checks each entry in the EndTurnBlockingTypes table, so if you want to remove the end-of-turn blocking for city-states, you just need to remove the eighth entry from that IF check in the Lua file. You wouldn't even need to modify the XML.

It's a lot harder to go the other direction, though, to add a new blocker, but it could be done. I've been considering using this mechanism in my own mod for my mythology stuff; it'd be somewhat crude, but it can be done. Unfortunately, this is a very common problem I've run into: the game, internally uses a custom table (EndTurnBlockingTypes in this case, but I've run into it for YieldTypes and ResourceTypes as well), and it's not going to modify that table if you add a new entry in the corresponding gamedata XML table. It's just a big headache, although it's not so bad in this particular case because the Lua file is NOT just looping over all elements in the table, and is instead checking each, by name, one at a time.
 
I tried removing that entry before, but it did not work. I also tried removing the notification and a few other things... I'll look over the code and see if I can figure out what's going wrong.
 
My current system is as follows. I commented out the MINOR_QUEST parts near lines 99 and 354. When I click end turn, nothing happens, and the message prints:

"ActionInfoPanel: UI thinks that we can't end turn, but the notification system disagrees"

This appears around line 145:
PHP:
else
  if (not UI.CanEndTurn()) then
    print("UI thinks that we can't end turn, but the notification system disagrees");
  end

  local iEndTurnControl = GameInfoTypes.CONTROL_ENDTURN;
  Game.DoControl(iEndTurnControl)  
end
I add a loop to hide all blocking notifications and attempt to end the turn again, but that didn't succeed. It removed the notifications, but a second click is required to end the turn, and it only worked if clicked (not if the enter key is pressed). This is what I've had for a few months... and I'm hoping there's a better solution. I've attached the file for comparison.
 

Attachments

Back
Top Bottom