Last active
May 1, 2019 13:32
-
-
Save TinkerWorX/8e737ae02a1db510c13611ff09b68445 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local v = SimplexNoise.FractalSum2DNoise(map.cell.x + x / 48.00, map.cell.y + y / 48.00, 3) | |
| local mx = x - 24 | |
| local my = y - 24 | |
| local tx = mx * 128.00 | |
| local ty = my * 128.00 | |
| local tz = v * 256.00 | |
| math.randomseed((map.cell.x * 48 + mx) + (map.cell.y * 48 + my) * 48) | |
| if deformTerrain then | |
| TerrainDeformCrater(tx, ty, 1, -tz, 0, false) | |
| else | |
| tz = 0.00 | |
| end | |
| if v < -0.20 then | |
| SetTerrainType(tx, ty, FourCC("Lrok"), math.random(1, math.random(1, 18)), 1, 0) | |
| if v < -0.30 and math.random() < math.abs(v) then | |
| CreateDestructableZ(FourCC("LTrc"), tx + math.random(-8.00, 8.00), ty + math.random(-8.00, 8.00), tz - 16.00, math.floor(math.random() * 360), 0.40 + math.abs(v) + 0.20 * math.random(), math.floor(math.random() * 6)) | |
| elseif v < -0.20 and v > -0.35 and math.random() < 0.05 then | |
| if math.random() < 0.10 then | |
| unit.create(Player(PLAYER_NEUTRAL_AGGRESSIVE), FourCC('ngna'), tx + math.random(-8.00, 8.00), ty + math.random(-8.00, 8.00), math.floor(math.random() * 360)) | |
| else | |
| unit.create(Player(PLAYER_NEUTRAL_PASSIVE), FourCC('nrac'), tx + math.random(-8.00, 8.00), ty + math.random(-8.00, 8.00), math.floor(math.random() * 360)) | |
| end | |
| end | |
| elseif v < 0.00 then | |
| SetTerrainType(tx, ty, FourCC("Ldrt"), math.random(1, math.random(1, 18)), 1, 0) | |
| elseif v < 0.20 then | |
| SetTerrainType(tx, ty, FourCC("Lgrs"), math.random(1, math.random(1, 18)), 1, 0) | |
| else | |
| SetTerrainType(tx, ty, FourCC("Lgrd"), math.random(1, math.random(1, 18)), 1, 0) | |
| if v > 0.30 and math.random() < math.abs(v) then | |
| CreateDestructableZ(FourCC("LTlt"), tx + math.random(-8.00, 8.00), ty + math.random(-8.00, 8.00), tz - 16.00, math.floor(math.random() * 360), 0.40 + math.abs(v) + 0.20 * math.random(), math.floor(math.random() * 10)) | |
| elseif v > 0.20 and v < 0.35 and math.random() < 0.05 then | |
| if math.random() < 0.10 then | |
| unit.create(Player(PLAYER_NEUTRAL_AGGRESSIVE), FourCC('ngz1'), tx + math.random(-8.00, 8.00), ty + math.random(-8.00, 8.00), math.floor(math.random() * 360)) | |
| else | |
| unit.create(Player(PLAYER_NEUTRAL_PASSIVE), FourCC('npig'), tx + math.random(-8.00, 8.00), ty + math.random(-8.00, 8.00), math.floor(math.random() * 360)) | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment