mirror of
https://github.com/Refactorio/RedMew.git
synced 2024-12-12 10:04:40 +02:00
First iteration of pacman grid, uses a 0,1 array of pixel data to create an overlay, reuable for other ideas
This commit is contained in:
parent
6363a77637
commit
ad36782c78
80
locale/gen_shape/pacman.lua
Normal file
80
locale/gen_shape/pacman.lua
Normal file
@ -0,0 +1,80 @@
|
||||
--Pacman void script by TWLTriston
|
||||
|
||||
local grid_width = 40
|
||||
local grid_height = 40
|
||||
local grid_scale = 32 -- 4/8/16/32 are good values here
|
||||
|
||||
local image_grid = {
|
||||
-- { 1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0 },
|
||||
|
||||
|
||||
{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
|
||||
{ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 },
|
||||
{ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 },
|
||||
{ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 },
|
||||
{ 0,1,1,1,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,0,0,1,1,1,0,0,0,0,0,1,1,1,0,0,0,0,1,1,1,0 },
|
||||
{ 0,1,1,1,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,0,0,1,1,1,0,0,0,0,0,1,1,1,0,0,0,0,1,1,1,0 },
|
||||
{ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 },
|
||||
{ 0,1,1,1,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1,0 },
|
||||
{ 0,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0 },
|
||||
{ 0,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0 },
|
||||
{ 0,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,0 },
|
||||
{ 0,0,0,1,1,1,0,1,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,1,0,1,1,1,0,0,0 },
|
||||
{ 0,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,0 },
|
||||
{ 0,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,0 },
|
||||
{ 0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0 },
|
||||
{ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 },
|
||||
{ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 },
|
||||
{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }
|
||||
}
|
||||
|
||||
function run_shape_module(event)
|
||||
local area = event.area
|
||||
local surface = event.surface
|
||||
local tiles = {}
|
||||
|
||||
local top_left_x = area.left_top.x --make a more direct reference
|
||||
local top_left_y = area.left_top.y --make a more direct reference
|
||||
-- chunk_region = top_left_x / grid_scale
|
||||
|
||||
for x = top_left_x, top_left_x + 32, grid_scale do
|
||||
image_grid_position_x = ( ( x / grid_scale ) + 20 ) % grid_width + 1
|
||||
for y = top_left_y, top_left_y + 32, grid_scale do
|
||||
image_grid_position_y = ( ( y / grid_scale ) + 19 ) % grid_height + 1
|
||||
if image_grid[image_grid_position_y][image_grid_position_x] ~= nil then
|
||||
if image_grid[image_grid_position_y][image_grid_position_x] == 0 then
|
||||
for x_1 = x, x + grid_scale do
|
||||
for y_1 = y, y + grid_scale do
|
||||
table.insert(tiles, {name = "out-of-map", position = {x_1,y_1}})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
surface.set_tiles(tiles)
|
||||
return true
|
||||
end
|
BIN
locale/gen_shape/pacman_ref.png
Normal file
BIN
locale/gen_shape/pacman_ref.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 351 B |
@ -30,6 +30,7 @@ in this file and your run_*type*_module(event) function will be called.
|
||||
--require "locale.gen_shape.lattice"
|
||||
--require "locale.gen_shape.infinite_mazes"
|
||||
--require "locale.gen_shape.x_shape"
|
||||
--require "locale.gen_shape.pacman"
|
||||
|
||||
--terrain--
|
||||
--require "locale.gen_terrain.neko_bridged_rivers"
|
||||
|
Loading…
Reference in New Issue
Block a user