Skip to content

Commit

Permalink
feat: First attempt and migrating maraxsis to use 2.0 noise expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
notnotmelon committed Sep 22, 2024
1 parent 40fea6f commit 2c69492
Show file tree
Hide file tree
Showing 12 changed files with 285 additions and 842 deletions.
17 changes: 1 addition & 16 deletions control.lua
Original file line number Diff line number Diff line change
@@ -1,26 +1,11 @@
_G.h2o = require 'scripts.constants'
require 'lib.lib'

local prototypes = {
h2o.prototypes = {
[h2o.MARAXSIS_SURFACE_NAME] = require 'scripts.map-gen.surfaces.maraxsis',
[h2o.TRENCH_SURFACE_NAME] = require 'scripts.map-gen.surfaces.maraxsis-trench',
}

for _, prototype in pairs(prototypes) do
local as_array = {}
local i = 1
for noise_layer, setting in pairs(prototype.noise_layers) do
if not setting.cellular then
as_array[i] = noise_layer
i = i + 1
end
end
prototype.noise_layers_as_array = as_array
end

h2o.prototypes = prototypes

require 'scripts.map-gen.map-gen'
require 'scripts.submarine'
require 'scripts.drowning'
require 'scripts.waterway'
Expand Down
3 changes: 1 addition & 2 deletions data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ require 'prototypes.sonar'
require 'prototypes.quantum-computer'
require 'prototypes.torpedoes'
require 'prototypes.water-treatment'
require 'prototypes.maraxsis'
require 'prototypes.planet.maraxsis'
require 'prototypes.big-cliff-explosive'
require 'prototypes.hydraulic-science-pack'
require 'prototypes.autoplace'
require 'prototypes.tile.lava'
require 'prototypes.tips-and-tricks.tips-and-tricks'

Expand Down
54 changes: 0 additions & 54 deletions prototypes/autoplace.lua

This file was deleted.

12 changes: 2 additions & 10 deletions prototypes/maraxsis.lua → prototypes/planet/maraxsis.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
local planet_map_gen = require('prototypes/planet/planet-map-gen')
local asteroid_util = require('__space-age__.prototypes.planet.asteroid-spawn-definitions')

data:extend {h2o.merge(data.raw.planet.gleba, {
Expand All @@ -17,16 +18,7 @@ data:extend {h2o.merge(data.raw.planet.gleba, {
order = 'ce[maraxsis]',
pollutant_type = 'nil',
solar_power_in_space = 150,
--[[autoplace = {
autoplace_settings = { ---@diagnostic disable-next-line: missing-fields
entity = {treat_missing_as_default = false}, ---@diagnostic disable-next-line: missing-fields
tile = {treat_missing_as_default = false}, ---@diagnostic disable-next-line: missing-fields
decorative = {treat_missing_as_default = false},
}, ---@diagnostic disable-next-line: missing-fields
cliff_settings = {
cliff_elevation_0 = 1024
}
},--]]
map_gen_settings = planet_map_gen.maraxsis(),
distance = 15,
orientation = 0.95,
})}
Expand Down
175 changes: 175 additions & 0 deletions prototypes/planet/planet-map-gen.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
require 'prototypes/planet/planet-maraxsis-map-gen'
local planet_map_gen = require('__space-age__/prototypes/planet/planet-map-gen')
-- get vanilla planets from space age

planet_map_gen.maraxsis = function()
return
{
terrain_segmentation = 1,
water = 0,
property_expression_names =
{
elevation = 'maraxsis_elevation',
temperature = 'temperature_basic',
moisture = 'moisture_basic',
aux = 'aux_basic',
cliffiness = '1',
cliff_elevation = 'cliff_elevation_from_elevation',
},
cliff_settings =
{
name = 'cliff-vulcanus',
cliff_elevation_0 = 0.07,
-- Ideally the first cliff would be at elevation 0 on the coastline, but that doesn't work,
-- so instead the coastline is moved to elevation 80.
-- Also there needs to be a large cliff drop at the coast to avoid the janky cliff smoothing
-- but it also fails if a corner goes below zero, so we need an extra buffer of 40.
-- So the first cliff is at 80, and terrain near the cliff shouln't go close to 0 (usually above 40).
cliff_elevation_interval = 0.1,
cliff_smoothing = 0, -- This is critical for correct cliff placement on the coast.
richness = 0.98
},
autoplace_controls =
{
['sulfuric-acid-geyser'] = {},
},
autoplace_settings =
{
['tile'] =
{
settings =
{
['highland-dark-rock'] = {},
['highland-dark-rock-2'] = {},
['lowland-cream-cauliflower'] = {},
['lowland-cream-cauliflower-2'] = {},
['lowland-cream-red'] = {},
['midland-turquoise-bark'] = {},
['midland-turquoise-bark-2'] = {},
['midland-cracked-lichen'] = {},
['midland-cracked-lichen-dull'] = {},
['midland-cracked-lichen-dark'] = {},


--[[['lowland-brown-blubber'] = {},
['lowland-olive-blubber'] = {},
['lowland-olive-blubber-2'] = {},
['lowland-olive-blubber-3'] = {},
['lowland-pale-green'] = {},
['lowland-red-vein'] = {},
['lowland-red-vein-2'] = {},
['lowland-red-vein-3'] = {},
['lowland-red-vein-4'] = {},
['lowland-red-vein-dead'] = {},
['lowland-red-infection'] = {},
['midland-yellow-crust'] = {},
['midland-yellow-crust-2'] = {},
['midland-yellow-crust-3'] = {},
['midland-yellow-crust-4'] = {},
['highland-yellow-rock'] = {},
['pit-rock'] = {},--]]
}
},
['decorative'] =
{
settings =
{
['urchin-cactus'] = {},

-- nauvis decoratives
['v-brown-carpet-grass'] = {},
['v-green-hairy-grass'] = {},
['v-brown-hairy-grass'] = {},
['v-red-pita'] = {},
-- end of nauvis
['vulcanus-rock-decal-large'] = {},
['vulcanus-dune-decal'] = {},
['vulcanus-sand-decal'] = {},
['vulcanus-lava-fire'] = {},
['calcite-stain'] = {},
['calcite-stain-small'] = {},
['sulfur-stain'] = {},
['sulfur-stain-small'] = {},
['sulfuric-acid-puddle'] = {},
['sulfuric-acid-puddle-small'] = {},
['crater-small'] = {},
['crater-large'] = {},
['pumice-relief-decal'] = {},
['small-volcanic-rock'] = {},
['medium-volcanic-rock'] = {},
['tiny-volcanic-rock'] = {},
['tiny-rock-cluster'] = {},
['small-sulfur-rock'] = {},
['tiny-sulfur-rock'] = {},
['sulfur-rock-cluster'] = {},
['waves-decal'] = {},

['yellow-lettuce-lichen-1x1'] = {},
['yellow-lettuce-lichen-3x3'] = {},
['yellow-lettuce-lichen-6x6'] = {},
['yellow-lettuce-lichen-cups-1x1'] = {},
['yellow-lettuce-lichen-cups-3x3'] = {},
['yellow-lettuce-lichen-cups-6x6'] = {},
['green-lettuce-lichen-1x1'] = {},
['green-lettuce-lichen-3x3'] = {},
['green-lettuce-lichen-6x6'] = {},
['green-lettuce-lichen-water-1x1'] = {},
['green-lettuce-lichen-water-3x3'] = {},
['green-lettuce-lichen-water-6x6'] = {},
['honeycomb-fungus'] = {},
['honeycomb-fungus-1x1'] = {},
['honeycomb-fungus-decayed'] = {},
['split-gill-1x1'] = {},
['split-gill-2x2'] = {},
['split-gill-red-1x1'] = {},
['split-gill-red-2x2'] = {},
['veins'] = {},
['veins-small'] = {},
['mycelium'] = {},
['coral-water'] = {},
['coral-land'] = {},
['black-sceptre'] = {},
['pink-phalanges'] = {},
['pink-lichen-decal'] = {},
['green-cup'] = {},
['brown-cup'] = {},
['blood-grape'] = {},
['brambles'] = {},
['polycephalum-slime'] = {},
['polycephalum-balloon'] = {},
['fuchsia-pita'] = {},
['wispy-lichen'] = {},
['grey-cracked-mud-decal'] = {},
['barnacles-decal'] = {},
['nerv-roots-dense'] = {},
['nerv-roots-light'] = {},
['nerv-roots-veins-dense'] = {},
['nerv-roots-veins-light'] = {},
--["tentacles"] = {},
--shared
['light-mud-decal'] = {},
['dark-mud-decal'] = {},
['cracked-mud-decal'] = {},
['red-desert-bush'] = {},
['white-desert-bush'] = {},
['red-pita'] = {},
['green-bush-mini'] = {},
['green-croton'] = {},
['green-pita'] = {},
['green-pita-mini'] = {},
['lichen-decal'] = {},
['shroom-decal'] = {},
}
},
['entity'] =
{
settings =
{
['h2o-water-shader'] = {},
}
}
}
}
end

return planet_map_gen
52 changes: 52 additions & 0 deletions prototypes/planet/planet-maraxsis-map-gen.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
data:extend {{
type = 'noise-expression',
name = 'maraxsis_starting_area',
expression = '1000'
}}

data:extend {{
type = 'noise-expression',
name = 'maraxsis_distance_from_0_0',
expression = 'sqrt(x * x + y * y)'
}}

data:extend {{
type = 'noise-expression',
name = 'maraxsis_elevation_bonus',
expression = [[
(1 - maraxsis_distance_from_0_0 / maraxsis_starting_area)
]]
}}

data:extend {{
type = 'noise-expression',
name = 'maraxsis_moisture',
expression = [[
abs(multioctave_noise{x = x,
y = y,
persistence = 0.25,
seed0 = map_seed,
seed1 = 1,
octaves = 3,
input_scale = 1300,
output_scale = 1})
]]
}}

data:extend {{
type = 'noise-expression',
name = 'maraxsis_elevation',
expression = [[
100 * if(
maraxsis_distance_from_0_0 < maraxsis_starting_area,
maraxsis_moisture + maraxsis_elevation_bonus,
min(1, maraxsis_moisture)
)
]]
}}

data:extend {{
type = 'noise-expression',
name = 'maraxsis_water_32x32',
expression = '(x % 32 + y % 32) == 0'
}}
Loading

0 comments on commit 2c69492

Please sign in to comment.