mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-09-16 09:16:22 +02:00
Added choose function to builders
This commit is contained in:
@@ -172,6 +172,16 @@ function throttle_xy(builder, x_in, x_size, y_in, y_size)
|
||||
end
|
||||
end
|
||||
|
||||
function choose(condition, true_shape, false_shape)
|
||||
return function(local_x, local_y, world_x, world_y)
|
||||
if condition(local_x, local_y, world_x, world_y) then
|
||||
return true_shape(local_x, local_y, world_x, world_y)
|
||||
else
|
||||
return false_shape(local_x, local_y, world_x, world_y)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- ore generation.
|
||||
|
||||
-- builder is the shape of the ore patch.
|
||||
|
@@ -18,6 +18,12 @@ local pattern =
|
||||
local map = grid_pattern_builder(pattern, 2, 2, 64, 64)
|
||||
map = rotate(map, degrees(45))
|
||||
|
||||
local start = rectangle_builder(48,48)
|
||||
|
||||
map = choose(start, start, map)
|
||||
|
||||
map = scale(map, 4, 4)
|
||||
|
||||
map = change_map_gen_collision_tile(map, "water-tile", "grass")
|
||||
|
||||
return map
|
@@ -10,8 +10,9 @@ in this file and your run_*type*_module(event) function will be called.
|
||||
--require "locale.gen_combined.island_resort"
|
||||
|
||||
--grilledham's maps
|
||||
--MAP_GEN = require "locale.gen_combined.grilledham_map_gen.presets.test"
|
||||
MAP_GEN = require "locale.gen_combined.grilledham_map_gen.presets.test"
|
||||
--MAP_GEN = require "locale.gen_combined.grilledham_map_gen.presets.picture_test"
|
||||
--MAP_GEN = require "locale.gen_combined.grilledham_map_gen.presets.creation_of_adam"
|
||||
|
||||
--shapes--
|
||||
--require "locale.gen_shape.right"
|
||||
|
Reference in New Issue
Block a user