mirror of
https://github.com/Refactorio/RedMew.git
synced 2024-12-12 10:04:40 +02:00
Update HilbertSandTrap.lua
Updated to include suggestions and hotfixes and generally clean up the code a little.
This commit is contained in:
parent
2ee83ea4d6
commit
bfecb67c50
@ -13,13 +13,34 @@ ScenarioInfo.set_map_extra_info('Only the native grasses are suitable to build o
|
||||
--enable Hydra
|
||||
local hail_hydra = global.config.hail_hydra
|
||||
hail_hydra.enabled = true
|
||||
--tweak hydra settings. Defualt settings are WAY too hard (circa 2019-02-22 hydra)
|
||||
--This section will need updated in the future pending changes to how hydra is configured (PR #795)
|
||||
hail_hydra.hydras = {
|
||||
-- spitters
|
||||
['small-spitter'] = {['small-worm-turret'] = 0.05}, --default 0.2
|
||||
['medium-spitter'] = {['medium-worm-turret'] = 0.05}, --defualt 0.2
|
||||
['big-spitter'] = {['big-worm-turret'] = 0.05}, --defualt 0.2
|
||||
['behemoth-spitter'] = {['big-worm-turret'] = 0.2}, --default 0.4
|
||||
-- biters
|
||||
['medium-biter'] = {['small-biter'] = 0.4}, --default 1.2
|
||||
['big-biter'] = {['medium-biter'] = 0.4},--default 1.2
|
||||
['behemoth-biter'] = {['big-biter'] = 0.4},--default 1.2
|
||||
-- worms
|
||||
['small-worm-turret'] = {['small-biter'] = .75},--defualt 2.5
|
||||
['medium-worm-turret'] = {['small-biter'] = .75, ['medium-biter'] = 0.3}, --default 2.5, .6
|
||||
['big-worm-turret'] = {['small-biter'] = 2.0, ['medium-biter'] = 1.0, ['big-biter'] = 0.5} --defualt 3.8, 1.3, 1.1
|
||||
}
|
||||
hail_hydra.evolution_scale = .7
|
||||
-- define map settings
|
||||
|
||||
--Ore settings. I feel very-high frequency is required to keep the sand from eating all the ores
|
||||
-- Richness and size can be changed to tweak balance a bit.
|
||||
local ore_settings = {
|
||||
autoplace_controls = {
|
||||
coal = {
|
||||
frequency = 'very-high',
|
||||
richness = 'normal',
|
||||
size = 'small'
|
||||
size = 'normal'
|
||||
},
|
||||
['copper-ore'] = {
|
||||
frequency = 'very-high',
|
||||
@ -28,8 +49,8 @@ local ore_settings = {
|
||||
},
|
||||
['crude-oil'] = {
|
||||
frequency = 'very-high',
|
||||
richness = 'low',
|
||||
size = 'small'
|
||||
richness = 'normal',
|
||||
size = 'normal'
|
||||
},
|
||||
['iron-ore'] = {
|
||||
frequency = 'very-high',
|
||||
@ -38,8 +59,8 @@ local ore_settings = {
|
||||
},
|
||||
stone = {
|
||||
frequency = 'very-high',
|
||||
richness = 'low',
|
||||
size = 'small'
|
||||
richness = 'normal',
|
||||
size = 'normal'
|
||||
},
|
||||
['uranium-ore'] = {
|
||||
frequency = 'very-high',
|
||||
@ -48,15 +69,7 @@ local ore_settings = {
|
||||
}
|
||||
}
|
||||
}
|
||||
local biter_settings = {
|
||||
autoplace_controls = {
|
||||
['enemy-base'] = {
|
||||
frequency = 'very-high',
|
||||
richness = 'very-high',
|
||||
size = 'very-high'
|
||||
}
|
||||
}
|
||||
}
|
||||
-- Another section that can be used for balance. Setting richness above normal is not recommended
|
||||
local tree_settings = {
|
||||
autoplace_controls = {
|
||||
trees = {
|
||||
@ -66,9 +79,9 @@ local tree_settings = {
|
||||
}
|
||||
}
|
||||
}
|
||||
local starting_area = {
|
||||
starting_area = 'very-small'
|
||||
}
|
||||
|
||||
-- This seems to be a decent balance between small pools of water and not blocking entire sections
|
||||
-- of the maze near spawn by lakes
|
||||
local water_settings = {
|
||||
terrain_segmentation = 'high',
|
||||
water = 'low'
|
||||
@ -78,9 +91,9 @@ RS.set_map_gen_settings(
|
||||
{
|
||||
MGSP.cliff_none,
|
||||
MGSP.grass_only,
|
||||
MGSP.enemy_very_high,
|
||||
MGSP.starting_area_very_low,
|
||||
ore_settings,
|
||||
biter_settings,
|
||||
starting_area,
|
||||
tree_settings,
|
||||
water_settings
|
||||
}
|
||||
@ -107,15 +120,21 @@ local function no_trees(_, _, world, tile)
|
||||
end
|
||||
return tile
|
||||
end
|
||||
--start hilbert design
|
||||
local line_1 = b.translate(b.rectangle(6, 16), -5, 0)
|
||||
--start hilbert design. Note: The following code does contain bugs. Jayefuu and R.Nukem are aware of
|
||||
--this and will look into fixing it at a later date. For now keep hilbert_levels = 2
|
||||
--The following values can be changed to adjust the width of the maze and sand
|
||||
local block_width = 6
|
||||
local block_length = 16
|
||||
local scale_factor = 11
|
||||
local hilbert_levels = 2 -- do not change unless the algorithm has been fixed
|
||||
|
||||
local line_1 = b.translate(b.rectangle(block_width, block_length), -5, 0) --adjust size of rectangle to change maze width
|
||||
local tier_1 =
|
||||
b.any {
|
||||
line_1,
|
||||
b.rotate(line_1, degrees(-90)),
|
||||
b.rotate(line_1, degrees(-180))
|
||||
}
|
||||
local hilbert_levels = 2 -- don't change to 3, the algorithm is broken somewhere
|
||||
local pattern = tier_1
|
||||
local var = 20
|
||||
for i = 1, hilbert_levels do
|
||||
@ -147,11 +166,11 @@ pattern =
|
||||
b.translate(b.rotate(line_1, degrees(90)), 40, 30)
|
||||
}
|
||||
-- Tile map in X direction
|
||||
local function ribbon(x, y)
|
||||
local abs_x = math.abs(x)
|
||||
local function ribbon(y)
|
||||
local abs_y = math.abs(y)
|
||||
return (abs_y < 40)
|
||||
end
|
||||
|
||||
ribbon = b.change_tile(ribbon, true, 'sand-1')
|
||||
ribbon = b.apply_effect(ribbon, no_resources)
|
||||
ribbon = b.apply_effect(ribbon, no_trees)
|
||||
@ -159,9 +178,11 @@ ribbon = b.translate(ribbon, 0, 6)
|
||||
pattern = b.translate(pattern, 0, 5)
|
||||
local hilbert = b.single_x_pattern(pattern, 80)
|
||||
local map = b.any {hilbert, ribbon}
|
||||
map = b.scale(map, 10, 10)
|
||||
--Change this to scale map
|
||||
|
||||
map = b.scale(map, scale_factor, scale_factor)
|
||||
-- make starting area
|
||||
local start_region = b.rectangle(160,60)
|
||||
local start_region = b.rectangle(block_length * scale_factor,block_width * scale_factor)
|
||||
map = b.subtract(map, start_region)
|
||||
start_region = b.change_tile(start_region,true, 'grass-1')
|
||||
start_region = b.apply_effect(start_region, no_resources)
|
||||
@ -174,14 +195,14 @@ local start_ore = b.circle(30)
|
||||
local start_iron = b.resource(start_ore, 'iron-ore', value(1000, 0))
|
||||
local start_copper = b.resource(start_ore, 'copper-ore', value(750, 0))
|
||||
local start_coal = b.resource(start_ore, 'coal', value(500, 0))
|
||||
local start_stone = b.resource(start_ore, 'stone', value(250, 0))
|
||||
local start_stone = b.resource(start_ore, 'stone', value(500, 0))
|
||||
start_ore = b.segment_pattern({start_coal, start_stone, start_copper, start_iron})
|
||||
ore_shape = b.choose(b.circle(30), start_ore, ore_shape)
|
||||
|
||||
--apply starting ores to map
|
||||
map = b.apply_entity(map, ore_shape)
|
||||
--shift spawn so player doesn't die to start water
|
||||
map = b.translate(map, 0, -10)
|
||||
map = b.translate(map, 0, 30)
|
||||
|
||||
-- -- Untested Code for not building on sand. However, this requires plague's entity restriction module
|
||||
-- -- Enable this section when the entity restriction modules is finalized
|
||||
@ -261,7 +282,7 @@ Event.add(
|
||||
Event.add(
|
||||
defines.events.on_player_built_tile,
|
||||
function(event)
|
||||
local player = (require 'utils.game').get_player_by_index(event.player_index)
|
||||
local player = Game.get_player_by_index(event.player_index)
|
||||
if not player or not player.valid then
|
||||
return
|
||||
end
|
||||
@ -279,9 +300,8 @@ Event.add(
|
||||
end
|
||||
if #replace_tiles > 0 then
|
||||
player.surface.set_tiles(replace_tiles, true)
|
||||
player.insert {name = event.item.name, count = refund_count}
|
||||
end
|
||||
player.surface.set_tiles(replace_tiles, true)
|
||||
player.insert {name = event.item.name, count = refund_count}
|
||||
end
|
||||
)
|
||||
return map
|
||||
|
Loading…
Reference in New Issue
Block a user