1
0
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:
James Gillham
2017-08-13 03:57:43 +01:00
parent 6e3a3e9430
commit 6e377a8adb
3 changed files with 18 additions and 1 deletions

View File

@@ -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.

View File

@@ -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

View File

@@ -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"