Skip to content

Commit

Permalink
Merge pull request #1232 from Refactorio/Claude477-venice
Browse files Browse the repository at this point in the history
crashsite_venice(presets)
  • Loading branch information
grilledham authored Sep 12, 2021
2 parents 86a1aa7 + 160b395 commit 04de727
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 2 deletions.
5 changes: 3 additions & 2 deletions map_gen/data/presets/venice.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
return {
local b = require 'map_gen.shared.builders'
return b.decompress({
height = 2903,
width = 3833,
data = {
Expand Down Expand Up @@ -2906,4 +2907,4 @@ data = {
{5,3833,},
{5,3833,},
}
}
})
74 changes: 74 additions & 0 deletions map_gen/maps/crash_site/presets/venice.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
local b = require 'map_gen.shared.builders'
local MGSP = require 'resources.map_gen_settings'

local type = type
local water_tiles = b.water_tiles
local path_tiles = b.path_tiles

local pic = require 'map_gen.data.presets.venice'
local world_map = b.picture(pic)

local x_offset, y_offset = 0, 180
world_map = b.translate(world_map, x_offset, y_offset)


local scale = 1
local height = 4000 * scale
local width = 4000 * scale

world_map = b.scale(world_map, scale)


local bounds = b.rectangle(width, height)
bounds = b.translate(bounds, x_offset * scale, y_offset * scale)

local config = {
scenario_name = 'crashsite-venice',
map_gen_settings = {
MGSP.starting_area_very_low,
MGSP.ore_oil_none,
MGSP.enemy_none,
MGSP.cliff_none
},
grid_number_of_blocks = 15,
mini_grid_number_of_blocks = 29,
bounds_shape = bounds
}

local Scenario = require 'map_gen.maps.crash_site.scenario'
local crashsite = Scenario.init(config)

local function get_tile_name(tile)
if type(tile) == 'table' then
return tile.tile
else
return tile
end
end

local function map(x, y, world)
local tile = world_map(x, y, world)
if not tile then
return tile
end

local world_tile_name = get_tile_name(tile)
if not world_tile_name or water_tiles[world_tile_name] then
return tile
end

local crashsite_tile = crashsite(x, y, world)
local crashsite_tile_name = get_tile_name(crashsite_tile)
if path_tiles[crashsite_tile_name] then
return crashsite_tile
end

if type(crashsite_tile) == 'table' then
crashsite_tile.tile = world_tile_name
return crashsite_tile
end

return tile
end

return map
1 change: 1 addition & 0 deletions map_gen/maps/crash_site_venice.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
return require 'map_gen.maps.crash_site.presets.venice'
1 change: 1 addition & 0 deletions scenario_templates/crashsite-venice/map_selection.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
return require 'map_gen.maps.crash_site_venice'

0 comments on commit 04de727

Please sign in to comment.