1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-24 03:47:58 +02:00

bug fix for construction drone anti cheese

This commit is contained in:
MewMew 2019-07-13 16:17:17 +02:00
parent ec44e88790
commit 09c7b1417e
3 changed files with 16 additions and 13 deletions

View File

@ -24,7 +24,7 @@ local function init_surface()
["uranium-ore"] = {frequency = "2", size = "1", richness = "1"},
["crude-oil"] = {frequency = "3", size = "1.2", richness = "1.5"},
["trees"] = {frequency = "1.25", size = "0.5", richness = "0.65"},
["enemy-base"] = {frequency = "5", size = "1.5", richness = "1.5"}
["enemy-base"] = {frequency = "6", size = "1.5", richness = "1.5"}
}
game.create_surface("biter_battles", map_gen_settings)

View File

@ -36,9 +36,9 @@ local function draw_gui()
caption = caption,
name = "map_pregen"
})
frame.style.font_color = {r = 150, g = 100, b = 255}
frame.style.font_color = {r = 150, g = 0, b = 255}
frame.style.font = "heading-1"
frame.style.maximal_height = 36
frame.style.maximal_height = 42
end
end
end

View File

@ -286,20 +286,23 @@ local function on_robot_built_tile(event)
end
--Construction Robot Restriction
local function on_robot_built_entity(event)
local deny_building = false
local force_name = event.robot.force.name
if force_name == "north" then
if event.created_entity.position.y >= -10 then deny_building = true end
local robot_build_restriction = {
["north"] = function(y)
if y >= -10 then return true end
end,
["south"] = function(y)
if y <= 10 then return true end
end
if force_name == "player" then
if event.created_entity.position.y <= 10 then deny_building = true end
end
if not deny_building then return end
}
local function on_robot_built_entity(event)
if not robot_build_restriction[event.robot.force.name] then return end
if not robot_build_restriction[event.robot.force.name](event.created_entity.position.y) then return end
local inventory = event.robot.get_inventory(defines.inventory.robot_cargo)
inventory.insert({name = event.created_entity.name, count = 1})
event.robot.surface.create_entity({name = "explosion", position = event.created_entity.position})
event.created_entity.destroy()
game.print("Team " .. event.robot.force.name .. "'s construction drone had an accident.", {r = 200, g = 50, b = 100})
event.created_entity.destroy()
end
local function on_marked_for_deconstruction(event)