From 28e3b3fd620b644e8c507d1ea7833d57a19dc27d Mon Sep 17 00:00:00 2001 From: phosit Date: Thu, 28 Dec 2023 20:22:48 +0000 Subject: [PATCH] [Maps] Add water level support to Flood In addition to the existing "Shallow" water level two water levels are added: - Deep: Only ships can reach other islands - Rising: The water level changes from Shallow to Deep to a level where the home islands are flooded. Accepted By: @real_tabasco_sauce Comments By: @marder, @vladislavbelov Differential Revision: https://code.wildfiregames.com/D5139 This was SVN commit r27992. --- .../GameSettings/GameSettingsLayout.js | 1 + .../data/mods/public/maps/random/flood.js | 7 +++--- .../data/mods/public/maps/random/flood.json | 24 ++++++++++++++++--- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingsLayout.js b/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingsLayout.js index 620c45f721..f513d42925 100644 --- a/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingsLayout.js +++ b/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingsLayout.js @@ -14,6 +14,7 @@ var g_GameSettingsLayout = [ "TeamPlacement", "Landscape", "Biome", + "WaterLevel", "SeaLevelRiseTime", "Daytime", "TriggerDifficulty", diff --git a/binaries/data/mods/public/maps/random/flood.js b/binaries/data/mods/public/maps/random/flood.js index f3adf46a58..dcf19e9c70 100644 --- a/binaries/data/mods/public/maps/random/flood.js +++ b/binaries/data/mods/public/maps/random/flood.js @@ -48,7 +48,8 @@ const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TE const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1]; const heightSeaGround = -2; -const heightLand = 2; +const heightLand = 6; +const heightStartingIslands = 2; const shoreRadius = 6; var g_Map = new RandomMap(heightSeaGround, tWater); @@ -75,7 +76,7 @@ for (let i = 0; i < numPlayers; ++i) new ClumpPlacer(diskArea(1.4 * defaultPlayerBaseRadius()), 0.8, 0.1, Infinity, playerPosition[i]), [ new LayeredPainter([tShore, tMainTerrain], [shoreRadius]), - new SmoothElevationPainter(ELEVATION_SET, heightLand, shoreRadius), + new SmoothElevationPainter(ELEVATION_SET, heightStartingIslands, shoreRadius), new TileClassPainter(clHill) ]); @@ -223,7 +224,7 @@ for (let size of [scaleByMapSize(3, 6), scaleByMapSize(5, 10), scaleByMapSize(8, numb * scaleByMapSize(15, 45)); g_Map.log("Painting shorelines"); -paintTerrainBasedOnHeight(1, heightLand, 0, tMainTerrain); +paintTerrainBasedOnHeight(1, heightStartingIslands, 0, tMainTerrain); paintTerrainBasedOnHeight(heightSeaGround, 1, 3, tTier1Terrain); g_Map.log("Creating grass patches"); diff --git a/binaries/data/mods/public/maps/random/flood.json b/binaries/data/mods/public/maps/random/flood.json index 07d2da9f2e..9a7d987e51 100644 --- a/binaries/data/mods/public/maps/random/flood.json +++ b/binaries/data/mods/public/maps/random/flood.json @@ -2,7 +2,7 @@ "settings" : { "Name" : "Flood", "Script" : "flood.js", - "Description" : "A great flood has moved across the valley enabling ships and troops to battle in chest deep waters.", + "Description" : "[color=\"red\"]IMPORTANT NOTE: AI PLAYERS DON'T WORK WITH RISING WATER[/color]\n\nA great flood moves across the valley. At some point you have to evacuate your units and use ships to reach the mainland and the other players.", "SupportedBiomes": [ "generic/temperate", "generic/arctic", @@ -12,8 +12,26 @@ "generic/india", "generic/autumn" ], - "Keywords": [], + "TriggerScripts": [ + "random/flood_triggers.js" + ], + "Keywords": ["trigger"], "Preview" : "flood.png", - "CircularMap" : true + "CircularMap" : true, + "WaterLevels":[ + { + "Name": "Rising", + "Description": "The water rises. The homeislands will become uninhabitable.", + "Default": true + }, + { + "Name": "Shallow", + "Description": "The water doesn't rise. Ships and troops can battle in chest deep waters." + }, + { + "Name": "Deep", + "Description": "The water doesn't rise. You have to use ships to travel to the mainland." + } + ] } }