forked from cacklingfiend/lignumis
		
	fix: add final fixes for Lignumis and Alien Biomes compatibility (#7)
refer to: https://discord.com/channels/1327043776715292773/1327045033077248021/1400725705867919371 Added a compatibility fix for alien biomes and lignumis. Changes: - added back the vanilla fertile tiles tha Alien Biomes remove to the tile restrictions of trees for manual and world gen spawning and planting of trees. - retains Lignumis' aesthetics of using the vanilla tiles and Nauvis' Alien Biomes - able to plant and spawn trees in Lignumis now when Alien Biomes is also enabled ps. this is the first time I contributed/made a mod for factorio, if there is anything to be improved on the syntaxes and anything do let me know. Co-authored-by: chromebomb Reviewed-on: cacklingfiend/lignumis#7 Co-authored-by: chromebomb <chromebomb@noreply.example.org> Co-committed-by: chromebomb <chromebomb@noreply.example.org>
This commit is contained in:
		
							parent
							
								
									14e16c2fdb
								
							
						
					
					
						commit
						b746a7c88c
					
				
					 3 changed files with 69 additions and 0 deletions
				
			
		
							
								
								
									
										67
									
								
								lignumis/prototypes/compatibility/alien-biomes-final.lua
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								lignumis/prototypes/compatibility/alien-biomes-final.lua
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,67 @@ | |||
| -- Lignumis + Alien Biomes Compatibility - Final Fixes | ||||
| --  | ||||
| -- This runs AFTER alien-biomes data-updates.lua to ensure our fixes aren't overridden | ||||
| -- Load order: data.lua -> data-updates.lua -> data-final-fixes.lua (THIS FILE) | ||||
| 
 | ||||
| if not mods["alien-biomes"] then  | ||||
|     return  | ||||
| end | ||||
| 
 | ||||
| -- Define Lignumis grass tiles (from mapgen.lua) | ||||
| local lignumis_grass_tiles = { | ||||
|     "grass-1", | ||||
|     "grass-2",  | ||||
|     "grass-3", | ||||
|     "grass-4", | ||||
|     "natural-gold-soil" | ||||
| } | ||||
| 
 | ||||
| -- Fix tree plant for manual planting on Lignumis grass tiles | ||||
| local tree_plant = data.raw.plant["tree-plant"] | ||||
| if mods["Diversitree"] then | ||||
|     tree_plant = data.raw.plant["s6xdvt-fake-tree"] | ||||
| end | ||||
| 
 | ||||
| if tree_plant then | ||||
|     for _, tile in pairs(lignumis_grass_tiles) do | ||||
|         local already_present = false | ||||
|         for _, existing_tile in pairs(tree_plant.autoplace.tile_restriction) do | ||||
|             if existing_tile == tile then | ||||
|                 already_present = true | ||||
|                 break | ||||
|             end | ||||
|         end | ||||
|         if not already_present then | ||||
|             table.insert(tree_plant.autoplace.tile_restriction, tile) | ||||
|         end | ||||
|     end | ||||
| end | ||||
| 
 | ||||
| -- Fix tree autoplace restrictions for natural tree spawning | ||||
| for _, tree in pairs(data.raw.tree) do | ||||
|     if tree.autoplace and tree.autoplace.tile_restriction then | ||||
|         -- Skip gold stromatolites - they should remain exclusive to natural-gold-soil | ||||
|         local is_gold_stromatolite = tree.name and (tree.name:find("stromatolite") or tree.name:find("gold")) | ||||
|          | ||||
|         if not is_gold_stromatolite then | ||||
|             -- Check if Lignumis grass tiles are missing | ||||
|             local has_lignumis_tiles = false | ||||
|             for _, existing_tile in pairs(tree.autoplace.tile_restriction) do | ||||
|                 for _, lignumis_tile in pairs(lignumis_grass_tiles) do | ||||
|                     if existing_tile == lignumis_tile then | ||||
|                         has_lignumis_tiles = true | ||||
|                         break | ||||
|                     end | ||||
|                 end | ||||
|                 if has_lignumis_tiles then break end | ||||
|             end | ||||
|              | ||||
|             -- Add Lignumis grass tiles if missing | ||||
|             if not has_lignumis_tiles then | ||||
|                 for _, tile_name in pairs(lignumis_grass_tiles) do | ||||
|                     table.insert(tree.autoplace.tile_restriction, tile_name) | ||||
|                 end | ||||
|             end | ||||
|         end | ||||
|     end | ||||
| end | ||||
|  | @ -6,6 +6,7 @@ settings["small-rock"] = nil | |||
| settings["tiny-rock"] = nil | ||||
| 
 | ||||
| -- Fix trees not being plantable on Alien Biomes tiles | ||||
| -- Note: Additional tree fixes for Lignumis grass tiles are handled in alien-biomes-final.lua | ||||
| local tile_restriction = data.raw["plant"]["tree-plant"].autoplace.tile_restriction | ||||
| for _, tile in pairs(alien_biomes.all_tiles()) do | ||||
|     if tile.tags and (table.contains(tile.tags, "dirt") or table.contains(tile.tags, "grass")) then | ||||
|  |  | |||
|  | @ -1,5 +1,6 @@ | |||
| require("aai-loaders-final") | ||||
| require("any-planet-start-final") | ||||
| require("alien-biomes-final") | ||||
| 
 | ||||
| if not data.raw.technology["legendary-quality"] then | ||||
|     table.removeValue(data.raw.technology["quality-assembler"].prerequisites, "legendary-quality") | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue