mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-01-26 03:52:00 +02:00
added spawn_fish
This commit is contained in:
parent
5108a4fe93
commit
bf89e69132
@ -537,6 +537,27 @@ function change_map_gen_collision_tile(builder, collides, new_tile)
|
||||
end
|
||||
end
|
||||
|
||||
function spawn_fish(builder, spawn_rate)
|
||||
return function (local_x, local_y, world_x, world_y )
|
||||
local tile, entity = builder(local_x, local_y, world_x, world_y)
|
||||
if type(tile) == "string" then
|
||||
if tile == "water" or tile == "deepwater" or tile == "water-green" or tile == "deepwater-green" then
|
||||
if spawn_rate >= math.random() then
|
||||
entity = {name = "fish", position = {world_x, world_y}}
|
||||
end
|
||||
end
|
||||
elseif tile then
|
||||
local gen_tile = MAP_GEN_SURFACE.get_tile(world_x, world_y)
|
||||
if gen_tile == "water" or gen_tile == "deep-water" or gen_tile == "water-green" or gen_tile == "deepwater-green" then
|
||||
if spawn_rate >= math.random() then
|
||||
entity = {name = "fish", position = {world_x, world_y}}
|
||||
end
|
||||
end
|
||||
end
|
||||
return tile, entity
|
||||
end
|
||||
end
|
||||
|
||||
function apply_effect(builder, func)
|
||||
return function(local_x, local_y, world_x, world_y)
|
||||
local tile, entity = builder(local_x, local_y, world_x, world_y)
|
||||
|
Loading…
x
Reference in New Issue
Block a user