1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-09-16 09:16:22 +02:00

Merge pull request #470 from iltar/performance-fixes

Fixed a bunch of performance issues and bugs in Diggy
This commit is contained in:
Matthew
2018-11-27 16:05:01 -05:00
committed by GitHub
12 changed files with 160 additions and 147 deletions

View File

@@ -1,4 +1,5 @@
-- dependencies
local abs = math.abs
-- this
local Config = {
@@ -146,13 +147,13 @@ local Config = {
alien_coin_modifiers = {
['small-biter'] = 2,
['small-spitter'] = 2,
['small-worm'] = 2,
['small-worm-turret'] = 2,
['medium-biter'] = 3,
['medium-spitter'] = 3,
['medium-worm'] = 3,
['medium-worm-turret'] = 3,
['big-biter'] = 5,
['big-spitter'] = 5,
['big-worm'] = 5,
['big-worm-turret'] = 5,
['behemoth-biter'] = 7,
['behemoth-spitter'] = 7,
},
@@ -209,7 +210,7 @@ local Config = {
enabled = true,
-- determines how distance is measured
distance = function (x, y) return math.abs(x) + math.abs(y) end,
distance = function (x, y) return abs(x) + abs(y) end,
--distance = function (x, y) return math.sqrt(x * x + y * y) end,
-- defines the weights of which resource_richness_value to spawn
@@ -370,7 +371,7 @@ local Config = {
['production-science-pack'] = 25,
['high-tech-science-pack'] = 50,
['space-science-pack'] = 10,
['enemy_killed'] = 10, -- Base XP for killing biters and spitters. This value is multiplied by the alien_coin_modifiers from ArtefactHunting
['enemy_killed'] = 10, -- Base XP for killing biters and spitters.
['death-penalty'] = 0.002, -- XP deduct in percentage of total experience when a player dies (Diggy default: 0.002 which equals 0.2%)
},
@@ -416,8 +417,21 @@ local Config = {
{level = 73, price = 2000, name = 'satellite'},
{level = 100, price = 1, name = 'iron-stick'},
},
-- modifies the experience per alien type, higher is more xp
alien_experience_modifiers = {
['small-biter'] = 2,
['small-spitter'] = 2,
['small-worm-turret'] = 2,
['medium-biter'] = 3,
['medium-spitter'] = 3,
['medium-worm-turret'] = 3,
['big-biter'] = 5,
['big-spitter'] = 5,
['big-worm-turret'] = 5,
['behemoth-biter'] = 7,
['behemoth-spitter'] = 7,
},
},
},
}

View File

@@ -7,6 +7,9 @@ local abs = math.abs
-- this
local Debug = {}
local default_base_color = {r = 1, g = 1, b = 1}
local default_delta_color = {r = 0, g = 0, b = 0}
-- private state
local debug = false
local cheats = false
@@ -91,8 +94,8 @@ end
]]
function Debug.print_grid_value(value, surface, position, scale, offset, immutable)
local is_string = type(value) == 'string'
local color = {r = 1, g = 1, b = 1}
text = value
local color = default_base_color
local text = value
if type(immutable) ~= 'boolean' then
immutable = false
@@ -170,8 +173,8 @@ function Debug.print_colored_grid_value(value, surface, position, scale, offset,
color_value, base_color, delta_color, under_bound, over_bound)
local is_string = type(value) == 'string'
-- default values:
local color = base_color or {r = 1, g = 1, b = 1}
local d_color = delta_color or {r = 0, g = 0, b = 0}
local color = base_color or default_base_color
local d_color = delta_color or default_delta_color
local u_color = under_bound or color
local o_color = over_bound or color
@@ -185,7 +188,7 @@ function Debug.print_colored_grid_value(value, surface, position, scale, offset,
b = color.b + color_value * d_color.b }
end
text = value
local text = value
if type(immutable) ~= 'boolean' then
immutable = false

View File

@@ -21,6 +21,12 @@ local raise_event = script.raise_event
local AlienSpawner = {}
local alien_size_chart = {}
local locations_to_scan = {
{x = 0, y = -1.5}, -- up
{x = 1.5, y = 0}, -- right
{x = 0, y = 1.5}, -- bottom
{x = -1.5, y = 0}, -- left
}
Global.register_init({
alien_size_chart = alien_size_chart,
@@ -37,37 +43,43 @@ end, function(tbl)
alien_size_chart = tbl.alien_size_chart
end)
local rocks_to_find = {'sand-rock-big', 'rock-huge'}
---Triggers mining at the collision_box of the alien, to free it
local do_alien_mining = Token.register(function(params)
local surface = params.surface
local create_entity = surface.create_entity
local find_non_colliding_position = surface.find_non_colliding_position
local find_entities_filtered = surface.find_entities_filtered
for _, area in ipairs(params.positions_to_mine) do
local rocks = find_entities_filtered({area = area, name = {'sand-rock-big', 'rock-huge'}})
local rocks = surface.find_entities_filtered({area = params.clear_area, name = rocks_to_find})
if (0 == #rocks) then
break
local rock_count = #rocks
if rock_count > 0 then
-- with multiple rocks opening at once, it will spawn less particles in total per rock
local particle_count
if rock_count == 1 then
particle_count = 15
elseif rock_count == 2 then
particle_count = 10
else
particle_count = 5
end
-- with multiple rocks opening at once, it will spawn less particles in total per rock
local particle_count = 16 - ((#rocks - 1) * 5)
for _, rock in pairs(rocks) do
for rock_index = rock_count, 1, -1 do
local rock = rocks[rock_index]
raise_event(defines.events.on_entity_died, {entity = rock})
CreateParticles.destroy_rock(create_entity, particle_count, rock.position)
rock.destroy()
end
end
for _, prototype in ipairs(params.locations_to_spawn) do
-- amount is not used for aliens prototypes, it just carries along in the params
local amount = prototype.amount
while amount > 0 do
prototype.position = find_non_colliding_position(prototype.name, prototype.position, 2, 0.4) or prototype.position
create_entity(prototype)
amount = amount - 1
end
local spawn_location = params.spawn_location
-- amount is not used for aliens prototypes, it just carries along in the params
local amount = spawn_location.amount
while amount > 0 do
spawn_location.position = find_non_colliding_position(spawn_location.name, spawn_location.position, 2, 0.4) or spawn_location.position
create_entity(spawn_location)
amount = amount - 1
end
end)
@@ -80,9 +92,8 @@ end)
local function spawn_aliens(aliens, force, surface, x, y)
local position = {x = x, y = y}
local count_tiles_filtered = surface.count_tiles_filtered
local areas_to_mine = {}
local locations_to_spawn = {}
local spawn_count = 0
for name, amount in pairs(aliens) do
local size_data = alien_size_chart[name]
if not size_data then
@@ -90,20 +101,14 @@ local function spawn_aliens(aliens, force, surface, x, y)
break
end
local locations_to_scan = {
{x = 0, y = -1.5}, -- up
{x = 1.5, y = 0}, -- right
{x = 0, y = 1.5}, -- bottom
{x = -1.5, y = 0}, -- left
}
local collision_box = size_data.collision_box
local left_top_x = collision_box.left_top.x * 1.6
local left_top_y = collision_box.left_top.y * 1.6
local right_bottom_x = collision_box.right_bottom.x * 1.6
local right_bottom_y = collision_box.right_bottom.y * 1.6
for _, direction in ipairs(locations_to_scan) do
for i = #locations_to_scan, 1, -1 do
local direction = locations_to_scan[i]
local x_center = direction.x + x
local y_center = direction.y + y
@@ -122,22 +127,21 @@ local function spawn_aliens(aliens, force, surface, x, y)
-- can't spawn properly if void is present
if count_tiles_filtered({area = offset_area, name = 'out-of-map'}) == 0 then
insert(areas_to_mine, offset_area)
insert(locations_to_spawn, {name = name, position = {x = x_center, y = y_center}, force = force, amount = amount})
spawn_count = spawn_count + 1
Task.set_timeout_in_ticks(spawn_count, do_alien_mining, {
surface = surface,
clear_area = offset_area,
spawn_location = {
name = name,
position = {x = x_center, y = y_center},
force = force,
amount = amount
},
})
break
end
end
end
-- can't do mining in the same tick as it would invalidate the rock just mined and there
-- is no way to distinguish them as multiple can occupy the same position
if #locations_to_spawn > 0 then
Task.set_timeout_in_ticks(1, do_alien_mining, {
surface = surface,
positions_to_mine = areas_to_mine,
locations_to_spawn = locations_to_spawn,
})
end
end
--[[--
@@ -176,8 +180,11 @@ function AlienSpawner.register(config)
position = position or entity.position
surface = surface or entity.surface
create_entity = create_entity or surface.create_entity
find_non_colliding_position = find_non_colliding_position or surface.find_non_colliding_position
position = find_non_colliding_position(hydra_spawn, position, 2, 0.4) or position
-- always spawn worms on their designated position
if not hydra_spawn:match('worm-turret') then
find_non_colliding_position = find_non_colliding_position or surface.find_non_colliding_position
position = find_non_colliding_position(hydra_spawn, position, 2, 0.4) or position
end
create_entity({name = hydra_spawn, force = force, position = position})
amount = amount - 1
end

View File

@@ -17,6 +17,8 @@ local utils = require 'utils.utils'
-- this
local ArtefactHunting = {}
local coin_color = {r = 255, g = 215, b = 0}
-- some GUI stuff
local function redraw_table(data)
local list = data.list
@@ -81,7 +83,7 @@ Gui.on_custom_close('Diggy.ArtefactHunting.Frame', function (event)
end)
function ArtefactHunting.update_gui()
for _, p in ipairs(game.connected_players) do
for _, p in pairs(game.connected_players) do
local frame = p.gui.left['Diggy.ArtefactHunting.Frame']
if frame and frame.valid then
@@ -137,9 +139,10 @@ function ArtefactHunting.register(config)
return
end
local insert = chest.insert
for name, prototype in pairs(config.treasure_chest_raffle) do
if random() <= prototype.chance then
chest.insert({name = name, count = random(prototype.min, prototype.max)})
insert({name = name, count = random(prototype.min, prototype.max)})
end
end
end)
@@ -156,7 +159,7 @@ function ArtefactHunting.register(config)
ScoreTable.add('Collected coins', count)
end
Game.print_player_floating_text(player_index, text, {r = 255, g = 215, b = 0})
Game.print_player_floating_text(player_index, text, coin_color)
end
ScoreTable.reset('Collected coins')
@@ -166,7 +169,6 @@ function ArtefactHunting.register(config)
Event.add(defines.events.on_entity_died, function (event)
local entity = event.entity
local force = entity.force
if force.name ~= 'enemy' or random() > alien_coin_drop_chance then
return
end

View File

@@ -124,7 +124,6 @@ local function collapse(args)
local surface = args.surface
local positions = {}
local strength = config.collapse_threshold_total_strength
local player_index = args.player_index
create_collapse_alert(surface, position)
mask_disc_blur(
position.x, position.y,
@@ -240,12 +239,13 @@ local function on_mined_entity(event)
end
end
local no_player_cause = {index = 0}
local function on_entity_died(event)
local entity = event.entity
local name = entity.name
local strength = support_beam_entities[name]
if strength then
local cause = event.cause or {}
local cause = event.cause or no_player_cause
stress_map_add(entity.surface, entity.position, strength, false, (not (name == "sand-rock-big" or name == "rock-huge")) and cause.index)
end
end
@@ -350,13 +350,14 @@ function DiggyCaveCollapse.register(cfg)
Event.add(defines.events.on_surface_created, on_surface_created)
Event.add(defines.events.on_marked_for_deconstruction, function (event)
local name = event.entity.name
local entity = event.entity
local name = entity.name
if name == 'sand-rock-big' or name == 'rock-huge' then
return
end
if name == 'deconstructible-tile-proxy' or nil ~= support_beam_entities[name] then
event.entity.cancel_deconstruction(Game.get_player_by_index(event.player_index).force)
entity.cancel_deconstruction(Game.get_player_by_index(event.player_index).force)
end
end)

View File

@@ -6,12 +6,10 @@
-- dependencies
local Event = require 'utils.event'
local Global = require 'utils.global'
local Scanner = require 'map_gen.Diggy.Scanner'
local Template = require 'map_gen.Diggy.Template'
local ScoreTable = require 'map_gen.Diggy.ScoreTable'
local Debug = require 'map_gen.Diggy.Debug'
local CreateParticles = require 'features.create_particles'
local insert = table.insert
local random = math.random
local raise_event = script.raise_event
@@ -56,15 +54,38 @@ local function diggy_hole(entity)
local rocks = {}
local surface = entity.surface
local position = entity.position
local x = position.x
local y = position.y
local get_tile = surface.get_tile
local out_of_map_found = {}
local count = 0
local out_of_map_found = Scanner.scan_around_position(surface, position, 'out-of-map');
if (get_tile(x, y - 1).name == 'out-of-map') then
count = count + 1
out_of_map_found[count] = {x = x, y = y - 1}
end
for _, void_position in ipairs(out_of_map_found) do
insert(tiles, {name = 'dirt-' .. random(1, 7), position = void_position })
if (get_tile(x + 1, y).name == 'out-of-map') then
count = count + 1
out_of_map_found[count] = {x = x + 1, y = y}
end
if (get_tile(x, y + 1).name == 'out-of-map') then
count = count + 1
out_of_map_found[count] = {x = x, y = y + 1}
end
if (get_tile(x - 1, y).name == 'out-of-map') then
out_of_map_found[count + 1] = {x = x - 1, y = y}
end
for i = #out_of_map_found, 1, -1 do
local void_position = out_of_map_found[i]
tiles[i] = {name = 'dirt-' .. random(1, 7), position = void_position}
if random() < 0.35 then
insert(rocks, {name = 'rock-huge', position = void_position })
rocks[i] = {name = 'rock-huge', position = void_position}
else
insert(rocks, {name = 'sand-rock-big', position = void_position })
rocks[i] = {name = 'sand-rock-big', position = void_position}
end
end
@@ -84,10 +105,11 @@ local artificial_tiles = {
local function on_mined_tile(surface, tiles)
local new_tiles = {}
local count = 0
for _, tile in pairs(tiles) do
if (artificial_tiles[tile.old_tile.name]) then
insert(new_tiles, { name = 'dirt-' .. random(1, 7), position = tile.position})
count = count + 1
new_tiles[count] = {name = 'dirt-' .. random(1, 7), position = tile.position}
end
end
@@ -100,7 +122,7 @@ end
function DiggyHole.register(config)
robot_mining.damage = config.robot_initial_mining_damage
ScoreTable.set('Robot mining damage', robot_mining.damage)
ScoreTable.reset('Void removed')
ScoreTable.reset('Mine size')
Event.add(defines.events.on_entity_died, function (event)
local entity = event.entity
@@ -184,7 +206,7 @@ function DiggyHole.register(config)
end)
Event.add(Template.events.on_void_removed, function ()
ScoreTable.increment('Void removed')
ScoreTable.increment('Mine size')
end)
Event.add(defines.events.on_research_finished, function (event)
@@ -218,17 +240,16 @@ function DiggyHole.register(config)
local height = tonumber(params[4])
local surface_index = params[5]
local tiles = {}
local entities = {}
local count = 0
for x = 0, width do
for y = 0, height do
insert(tiles, {name = 'dirt-' .. random(1, 7), position = {x = x + left_top_x, y = y + left_top_y}})
count = count + 1
tiles[count] = {name = 'dirt-' .. random(1, 7), position = {x = x + left_top_x, y = y + left_top_y}}
end
end
Template.insert(game.surfaces[surface_index], tiles, entities)
end
)
Template.insert(game.surfaces[surface_index], tiles, {})
end)
end
end

View File

@@ -14,9 +14,6 @@ local floor = math.floor
local log = math.log
local insert = table.insert
-- hack
local alien_coin_modifiers = require 'map_gen.Diggy.Config'.features.ArtefactHunting.alien_coin_modifiers
-- this
local Experience = {}
@@ -85,7 +82,7 @@ end)
function Experience.update_market_contents(force)
local current_level = ForceControl.get_force_data(force).current_level
local force_name = force.name
for _, prototype in ipairs(config.unlockables) do
for _, prototype in pairs(config.unlockables) do
if (current_level >= prototype.level) then
Retailer.set_item(force_name, prototype.name, {coin = prototype.price})
end
@@ -244,7 +241,7 @@ local function on_entity_died (event)
local exp
if force and force.name == 'player' then
if cause and (cause.name == 'artillery-turret' or cause.name == 'gun-turret' or cause.name == 'laser-turret' or cause.name == 'flamethrower-turret') then
exp = config.XP['enemy_killed'] * alien_coin_modifiers[entity.name]
exp = config.XP['enemy_killed'] * config.alien_experience_modifiers[entity.name]
local text = string_format('+ %d XP', exp)
Game.print_floating_text(cause.surface, cause.position, text, gain_xp_color)
ForceControl.add_experience(force, exp)
@@ -271,7 +268,7 @@ local function on_entity_died (event)
if entity.force.name ~= 'enemy' then
return
end
local exp = config.XP['enemy_killed'] * alien_coin_modifiers[entity.name]
local exp = config.XP['enemy_killed'] * config.alien_experience_modifiers[entity.name]
local text = string_format('+ %d XP', exp)
local player_index = cause.player.index
Game.print_player_floating_text_position(player_index, text, gain_xp_color,-1, -0.5)
@@ -324,7 +321,7 @@ local function redraw_heading(data, header)
Gui.clear(frame)
local heading_table = frame.add({type = 'table', column_count = 2})
apply_heading_style(heading_table.add({ type = 'label', caption = 'Requirement'}).style, 100)
apply_heading_style(heading_table.add({type = 'label', caption = 'Requirement'}).style, 100)
apply_heading_style(heading_table.add({type = 'label', caption = header_caption}).style, 220)
end
@@ -349,7 +346,7 @@ local function redraw_table(data)
local last_level = 0
local current_force_level = force_control.get_force_data('player').current_level
for _, prototype in ipairs(config.unlockables) do
for _, prototype in pairs(config.unlockables) do
local current_item_level = prototype.level
local first_item_for_level = current_item_level ~= last_level
local color
@@ -417,7 +414,7 @@ local function redraw_buff(data)
buff_caption = format('+ %d %s', effect_value, name)
end
local buffs_label = list.add({ type = 'label', caption = buff_caption})
local buffs_label = list.add({type = 'label', caption = buff_caption})
buffs_label.style.minimal_width = 220
buffs_label.style.font_color = unlocked_color
end
@@ -441,10 +438,10 @@ local function toggle(event)
frame = left.add({name = 'Diggy.Experience.Frame', type = 'frame', direction = 'vertical'})
local experience_progressbars = frame.add({ type = 'flow', direction = 'vertical'})
local experience_progressbars = frame.add({type = 'flow', direction = 'vertical'})
local experience_list_heading = frame.add({type = 'flow', direction = 'horizontal'})
local experience_scroll_pane = frame.add({ type = 'scroll-pane'})
local experience_scroll_pane = frame.add({type = 'scroll-pane'})
experience_scroll_pane.style.maximal_height = 300
local buff_list_heading = frame.add({type = 'flow', direction = 'horizontal'})
@@ -487,7 +484,9 @@ end)
---Updates the experience progress gui for every player that has it open
local function update_gui()
for _, p in ipairs(game.connected_players) do
local players = game.connected_players
for i = #players, 1, -1 do
local p = players[i]
local frame = p.gui.left['Diggy.Experience.Frame']
if frame and frame.valid then

View File

@@ -4,7 +4,6 @@
-- dependencies
local Event = require 'utils.event'
local insert = table.insert
-- this
local RefreshMap = {}
@@ -16,20 +15,26 @@ function RefreshMap.register(config)
Event.add(defines.events.on_chunk_generated, function (event)
local tiles = {}
local left_top = event.area.left_top
local left_top_x = left_top.x
local left_top_y = left_top.y
local count = 0
for x = 0, 31, 1 do
for y = 0, 31, 1 do
local target_x = event.area.left_top.x + x
local target_y = event.area.left_top.y + y
local target_x = left_top_x + x
local target_y = left_top_y + y
local tile = 'out-of-map'
if (target_x < 1 and target_y < 1 and target_x > -2 and target_y > -2) then
if target_x > -2 and target_x < 1 and target_y > -2 and target_y < 1 then
tile = 'lab-dark-1'
end
insert(tiles, {
count = count + 1
tiles[count] = {
name = tile,
position = {x = target_x, y = target_y}
})
}
end
end

View File

@@ -11,7 +11,6 @@ local Simplex = require 'map_gen.shared.simplex_noise'
local random = math.random
local sqrt = math.sqrt
local ceil = math.ceil
local floor = math.floor
-- this
local ScatteredResources = {}
@@ -44,7 +43,7 @@ function ScatteredResources.register(config)
local function seeded_noise(surface, x, y, index, sources)
base_seed = base_seed or surface.map_gen_settings.seed + surface.index + 4000
local noise = 0
for _, settings in ipairs(sources) do
for _, settings in pairs(sources) do
settings.type = settings.type or 'perlin'
settings.offset = settings.offset or 0
if settings.type == 'zero' then
@@ -101,7 +100,7 @@ function ScatteredResources.register(config)
error('ore_pattern invalid')
end
local c_count = 0
for _, cluster in ipairs(c_clusters) do
for _, cluster in pairs(c_clusters) do
c_count = c_count + 1
cluster.weights_sum = 0
-- ensure the cluster colors are valid otherwise it fails silently
@@ -154,7 +153,7 @@ function ScatteredResources.register(config)
local distance = config.distance(x, y)
if c_mode then
for index,cluster in ipairs(c_clusters) do
for index,cluster in pairs(c_clusters) do
if distance >= cluster.min_distance and cluster.noise_settings.type ~= 'skip' then
if cluster.noise_settings.type == "connected_tendril" then
local noise = seeded_noise(surface, x, y, index, cluster.noise_settings.sources)
@@ -224,7 +223,7 @@ function ScatteredResources.register(config)
for x = area.left_top.x, area.left_top.x + 31 do
for y = area.left_top.y, area.left_top.y + 31 do
for index,cluster in ipairs(c_clusters) do
for index,cluster in pairs(c_clusters) do
if cluster.noise_settings.type == "connected_tendril" then
local noise = seeded_noise(surface, x, y, index, cluster.noise_settings.sources)
if -1 * cluster.noise_settings.threshold < noise and noise < cluster.noise_settings.threshold then

View File

@@ -25,7 +25,7 @@ function SetupPlayer.register(config)
local position = {0, 0}
local surface = player.surface
for _, item in ipairs(config.starting_items) do
for _, item in pairs(config.starting_items) do
player_insert(item)
end
@@ -50,7 +50,7 @@ function SetupPlayer.register(config)
force.research_all_technologies()
end
for _, item in ipairs(cheats.starting_items) do
for _, item in pairs(cheats.starting_items) do
player_insert(item)
end
end)

View File

@@ -18,16 +18,20 @@ local do_spawn_tile = Token.register(function(params)
Template.insert(params.surface, {params.tile}, {})
end)
local rocks_lookup = {'sand-rock-big', 'rock-huge'}
local do_mine = Token.register(function(params)
local surface = params.surface
local position = params.position
local rocks = surface.find_entities_filtered({ position = position, name = { 'sand-rock-big', 'rock-huge'}})
local rocks = surface.find_entities_filtered({position = position, name = rocks_lookup})
if (0 == #rocks) then
local rock_count = #rocks
if rock_count == 0 then
return
end
for _, rock in pairs(rocks) do
for i = rock_count, 1, -1 do
local rock = rocks[i]
raise_event(defines.events.on_entity_died, {entity = rock})
rock.destroy()
end
@@ -38,7 +42,7 @@ local function handle_noise(name, surface, position)
if ('water' == name) then
-- water is slower because for some odd reason it doesn't always want to mine it properly
Task.set_timeout_in_ticks(4, do_spawn_tile, { surface = surface, tile = { name = 'deepwater-green', position = position}})
Task.set_timeout_in_ticks(4, do_spawn_tile, { surface = surface, tile = {name = 'deepwater-green', position = position}})
return
end

View File

@@ -1,42 +0,0 @@
-- dependencies
local insert = table.insert
-- this
local Scanner = {}
--[[--
returns a list with all direct positions that contain tile_search.
@param surface LuaSurface
@param position Position
@param tile_search string name of the tile to search for
@return table with 0~4 directions of which have the tile searched for adjacent
]]
function Scanner.scan_around_position(surface, position, tile_search)
local tile_found = {}
local get_tile = surface.get_tile
-- north
if (tile_search == get_tile(position.x, position.y - 1).name) then
insert(tile_found, {x = position.x, y = position.y - 1})
end
-- east
if (tile_search == get_tile(position.x + 1, position.y).name) then
insert(tile_found, {x = position.x + 1, y = position.y})
end
-- south
if (tile_search == get_tile(position.x, position.y + 1).name) then
insert(tile_found, {x = position.x, y = position.y + 1})
end
-- west
if (tile_search == get_tile(position.x - 1, position.y).name) then
insert(tile_found, {x = position.x - 1, y = position.y})
end
return tile_found;
end
return Scanner