1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-03-05 15:05:57 +02:00
This commit is contained in:
SimonFlapse 2019-10-12 23:23:54 +02:00
parent a128e0d234
commit ae3fc079a5
3 changed files with 196 additions and 2 deletions

View File

@ -0,0 +1,167 @@
local cliffs = {}
local Public = {}
local orientation = {
['none-to-west'] = 'east-to-none',
['west-to-none'] = 'none-to-east',
['east-to-none'] = 'none-to-west',
['none-to-east'] = 'west-to-none',
['north-to-west'] = 'east-to-north',
['west-to-north'] = 'north-to-easy',
['north-to-east'] = 'west-to-north',
['east-to-north'] = 'north-to-west',
['west-to-south'] = 'south-to-east',
['south-to-west'] = 'east-to-south',
['east-to-south'] = 'south-to-west',
['south-to-east'] = 'west-to-south',
['north-to-south'] = 'south-to-north',
['south-to-north'] = 'north-to-south',
['north-to-none'] = 'none-to-north',
['none-to-north'] = 'north-to-none',
['south-to-none'] = 'none-to-south',
['none-to-south'] = 'south-to-none'
}
function Public.cliff(_, _, world)
local world_x = math.abs(world.x) -- 0 = 0
local world_y = world.y + 0.5 -- 0 = 0.5
local x = cliffs[world_x]
if x then
local y = x[world_y]
if y then
local cliff_orientation = y[1]
if world.x < 0 then
local flipped_orientation = orientation[y[1]]
if flipped_orientation then
cliff_orientation = flipped_orientation
end
end
return {name = 'cliff', cliff_orientation = cliff_orientation, always_place = true, enable_cliff_removal = true}
end
end
end
cliffs = {
[378] = {
[-29.5] = {'none-to-west'},
[-17.5] = {'east-to-west'},
[18.5] = {'west-to-east'},
[30.5] = {'west-to-none'}
},
[366] = {
[-25.5] = {'north-to-west'},
[-29.5] = {'east-to-south'},
[-9.5] = {'north-to-west'},
[-13.5] = {'east-to-south'},
[10.5] = {'west-to-south'},
[14.5] = {'north-to-east'},
[26.5] = {'west-to-south'},
[30.5] = {'north-to-east'}
},
[370] = {
[-29.5] = {'east-to-west'},
[-13.5] = {'north-to-west'},
[-17.5] = {'east-to-south'},
[14.5] = {'west-to-south'},
[18.5] = {'north-to-east'},
[30.5] = {'west-to-east'}
},
[374] = {
[-29.5] = {'east-to-west'},
[-17.5] = {'east-to-west'},
[18.5] = {'west-to-east'},
[30.5] = {'west-to-east'}
},
[362] = {
[-21.5] = {'north-to-west'},
[-25.5] = {'east-to-south'},
[-9.5] = {'east-to-none'},
[-5.5] = {'north-to-none'},
[6.5] = {'east-to-none'},
[10.5] = {'none-to-east'},
[22.5] = {'west-to-south'},
[26.5] = {'north-to-east'}
},
[358] = {
[-17.5] = {'north-to-west'},
[-21.5] = {'east-to-south'},
[18.5] = {'west-to-south'},
[22.5] = {'north-to-east'}
},
[354] = {
[-13.5] = {'north-to-west'},
[-17.5] = {'east-to-south'},
[14.5] = {'west-to-south'},
[18.5] = {'north-to-east'}
},
[382] = {
[-17.5] = {'east-to-west'},
[18.5] = {'west-to-east'}
},
[350] = {
[-13.5] = {'east-to-south'},
[-9.5] = {'north-to-south'},
[-5.5] = {'north-to-south'},
[-1.5] = {'north-to-south'},
[2.5] = {'north-to-south'},
[6.5] = {'north-to-south'},
[10.5] = {'north-to-south'},
[14.5] = {'north-to-east'}
}
}
return Public
--[[
31 | 350, 2.5 | north-to-south
  32 | 350, 6.5 | north-to-south
  33 | 362, 6.5 | east-to-none
  34 | 350, 10.5 | north-to-south
  35 | 362, 10.5 | none-to-east
  36 | 366, 10.5 | west-to-south
  37 | 350, 14.5 | north-to-east
  38 | 366, 14.5 | north-to-east
  39 | 354, 14.5 | west-to-south
  40 | 370, 14.5 | west-to-south
  41 | 354, 18.5 | north-to-east
  42 | 370, 18.5 | north-to-east
  43 | 358, 18.5 | west-to-south
  44 | 374, 18.5 | west-to-east
  45 | 378, 18.5 | west-to-east
  52 | 382, 18.5 | west-to-east
  53 | 358, 22.5 | north-to-east
  54 | 362, 22.5 | west-to-south
  55 | 362, 26.5 | north-to-east
  56 | 366, 26.5 | west-to-south
  57 | 366, 30.5 | north-to-east
  58 | 370, 30.5 | west-to-east
  65 | 374, 30.5 | west-to-east
  71 | 378, 30.5 | west-to-none
1 | 378, -29.5 | none-to-west
  2 | 366, -25.5 | north-to-west
  3 | 366, -29.5 | east-to-south
  4 | 370, -29.5 | east-to-west
  5 | 374, -29.5 | east-to-west
  6 | 362, -21.5 | north-to-west
  7 | 362, -25.5 | east-to-south
  8 | 358, -17.5 | north-to-west
  9 | 358, -21.5 | east-to-south
  10 | 354, -13.5 | north-to-west
  11 | 354, -17.5 | east-to-south
  12 | 370, -13.5 | north-to-west
  13 | 370, -17.5 | east-to-south
  14 | 374, -17.5 | east-to-west
  15 | 378, -17.5 | east-to-west
  16 | 382, -17.5 | east-to-west
  23 | 350, -13.5 | east-to-south
  24 | 366, -9.5 | north-to-west
  25 | 366, -13.5 | east-to-south
  26 | 350, -9.5 | north-to-south
  27 | 362, -9.5 | east-to-none
  28 | 350, -5.5 | north-to-south
  29 | 362, -5.5 | north-to-none
  30 | 350, -1.5 | north-to-south
]]

View File

@ -7,6 +7,8 @@ local table = require 'utils.table'
local Random = require 'map_gen.shared.random'
local Event = require 'utils.event'
local cliffs = require 'map_gen.maps.space_race.cliff_generator'
local seed1 = 17000
local seed2 = seed1 * 2
@ -190,10 +192,12 @@ start_resources = b.apply_effect(start_resources, no_biters)
wilderness_land = b.add(start_resources, wilderness_land)
wilderness_land = b.apply_entity(wilderness_land, cliffs.cliff)
local wilderness_land_left = b.translate(wilderness_land, -(width_1 + width_2) / 2, 0)
local wilderness_land_right = b.translate(b.flip_x(wilderness_land), (width_1 + width_2) / 2, 0)
local wilderness_ditch = b.line_y(width_3)
wilderness_ditch = b.change_tile(wilderness_ditch, true, 'out-of-map')
wilderness_ditch = b.if_else(b.change_tile(b.translate(b.line_y(width_3 - 1), -1, 0), true, 'out-of-map'), wilderness_ditch)
wilderness_ditch = b.if_else(b.change_tile(b.rectangle(3, 17), true, 'landfill'), wilderness_ditch)
local rocket_silo_shape = b.rectangle(9, 9)
rocket_silo_shape = b.change_tile(rocket_silo_shape, true, 'landfill')
@ -203,6 +207,16 @@ local wilderness_ditch_left = b.translate(wilderness_ditch, -(width_1 / 2 + widt
local wilderness_ditch_right = b.translate(b.rotate(wilderness_ditch, math.pi), (width_1 / 2 + width_2 + width_3 / 2), 0)
local wilderness = b.any({wilderness_shallow_water, wilderness_ditch_left, wilderness_ditch_right, wilderness_land_left, wilderness_land_right})
local map = b.if_else(wilderness, b.full_shape)
local limited_safe_zone = b.rectangle(512, 512)
--limited_safe_zone = b.invert(limited_safe_zone)
limited_safe_zone_right = b.translate(limited_safe_zone, -(256 + width_1/2 + width_2), 0)
limited_safe_zone_left = b.translate(limited_safe_zone, 256 + width_1/2 + width_2, 0)
limited_safe_zone = b.add(limited_safe_zone_right, limited_safe_zone_left)
--limited_safe_zone = b.change_tile(limited_safe_zone, true, 'out-of-map')
local map = b.add(wilderness, limited_safe_zone)
--map = b.if_else(wilderness, b.full_shape)
return map

View File

@ -120,6 +120,19 @@ Event.on_init(
silo = surface.create_entity {name = 'rocket-silo', position = {x = -388.5, y = 0.5}, force = force_USA}
silo.minable = false
local wall
wall = surface.create_entity{name = 'stone-wall', position = {x = 384.5, y = 18.5}, always_place = true, force = 'neutral'}
wall.destructible = false
wall = surface.create_entity{name = 'stone-wall', position = {x = 384.5, y = -17.5}, always_place = true, force = 'neutral'}
wall.destructible = false
wall = surface.create_entity{name = 'stone-wall', position = {x = -384.5, y = 18.5}, always_place = true, force = 'neutral'}
wall.destructible = false
wall = surface.create_entity{name = 'stone-wall', position = {x = -384.5, y = -17.5}, always_place = true, force = 'neutral'}
wall.destructible = false
local gun_turret
gun_turret = surface.create_entity {name = 'gun-turret', position = {x = 383, y = 0}, force = force_USSR}
gun_turret.insert({name = 'firearm-magazine', count = 200})