Closed rh-github-2015 closed 4 years ago
I've got the mod picker for the map editor and the editor able to place mod terrain. #2240 means the stuff is listed on top, maybe I'd like a type/alphabetical order better, and the editor still omits mods that didn't contribute to the actual generated map, but that's easily fixed.
Test mod: Unciv-mod-example#5, code branch here.
I've fixed some issues, but now I need help.
Loading a map using an improvement defined in a mod crashed because ImageGetter was still operating on the basic ruleset, and for circle colours it looks up improvements. So I had MapEditorScreen.initialize set that ruleset and call refreshAtlas like loadGame does. Works for the map editor. (Leaving out refreshAtlas here changes nothing)
But leaving the map editor results in a mostly black screen - no tiles dawn, main menu button invisible but still operational, some city banners and unit icons still visible. Next turn seems to fix this without a trace. Even stranger, leaving map editor the other way - by resizing the window - doesn't show any issue.
I should revert the ImageGetter ruleset when leaving map editor, of course, but I'm sure that won't fix the black screen - neither the ruleset nor ImageGetter.textureRegionDrawables are lacking anything, at this point they only have extra data from mods, as the original one hadn't loaded any mods...
Ideas? Should I try to get the map editor to use its own instance of ImageGetter? Or is this just a redraw issue like if this were a windows forms program and it needs a InvalidateRegion-equivalent call? I'm a little stumped.
Turns out that disposing and reloading of the atlas file was suspect. I still don't get why letting the mods's atlants go out of scope after setTextureRegionDrawables didn't hurt before and does now.
Brainstorming playground -
zerosome testing done. Please contribute. I indend to update and collect right here in the top post.Currently, from code inspection, mods containing new BaseTerrains, TerrainFeatures or probably Resources would be moot due to... (to be successively analyzed and correctly described):
Map generator always loads base ruleset -> new features would be civilopedia onlyNo, resources do get picked up by the random generator from the new game screen - but not the editor.Conclusion: Terrain in mods is unuseable, resources and improvements OK. Map editor mod support nonexistent. Map generator lacks knowledge when it could place modded terrain. All in all, however, the groundwork present is excellent.
IdeasWIP:Map needs serializable mods collection ('requiredMods') - to be filled only with mods containing any map features actually used in tilesdoneMap parameter screen needs mod selector - either filter mods & offer only those containing map features as a checkbox list or maybe just an enable/disabledoneThe mod editor might be OK without new UI - offer them all, the resulting map should flag what's actually needed. Maybe show the list of used mods to the user in the save dialog.nah