mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-01-06 00:23:49 +02:00
landfill prevention
This commit is contained in:
parent
a33f9f960d
commit
b42a860e18
@ -80,18 +80,35 @@ end
|
||||
|
||||
local function on_player_built_tile(event)
|
||||
local placed_tiles = event.tiles
|
||||
local player = game.players[event.player_index]
|
||||
if placed_tiles[1].old_tile.name ~= "deepwater" and placed_tiles[1].old_tile.name ~= "water" and placed_tiles[1].old_tile.name ~= "water-green" then return end
|
||||
local player = game.players[event.player_index]
|
||||
|
||||
--landfill history--
|
||||
if placed_tiles[1].old_tile.name == "deepwater" or placed_tiles[1].old_tile.name == "water" or placed_tiles[1].old_tile.name == "water-green" then
|
||||
if not global.landfill_history then global.landfill_history = {} end
|
||||
if #global.landfill_history > 999 then global.landfill_history = {} end
|
||||
local str = player.name .. " at X:"
|
||||
str = str .. placed_tiles[1].position.x
|
||||
str = str .. " Y:"
|
||||
str = str .. placed_tiles[1].position.y
|
||||
table.insert(global.landfill_history, str)
|
||||
end
|
||||
if not player.admin then
|
||||
local playtime = player.online_time
|
||||
if global.player_totals then
|
||||
if global.player_totals[player.name] then
|
||||
playtime = player.online_time + global.player_totals[player.name][1]
|
||||
end
|
||||
end
|
||||
if playtime < 648000 then
|
||||
local tiles = {}
|
||||
for _, t in pairs(placed_tiles) do
|
||||
table.insert(tiles, {name = t.old_tile.name, position = t.position})
|
||||
end
|
||||
player.insert({name = "landfill", count = #placed_tiles})
|
||||
player.surface.set_tiles(tiles, true)
|
||||
player.print("You have not grown accustomed to this technology yet.", { r=0.22, g=0.99, b=0.99})
|
||||
end
|
||||
end
|
||||
|
||||
--landfill history--
|
||||
if not global.landfill_history then global.landfill_history = {} end
|
||||
if #global.landfill_history > 999 then global.landfill_history = {} end
|
||||
local str = player.name .. " at X:"
|
||||
str = str .. placed_tiles[1].position.x
|
||||
str = str .. " Y:"
|
||||
str = str .. placed_tiles[1].position.y
|
||||
table.insert(global.landfill_history, str)
|
||||
end
|
||||
|
||||
local function on_built_entity(event)
|
||||
|
@ -10,7 +10,7 @@ require "poll"
|
||||
require "score"
|
||||
|
||||
--require "maps.modules.hunger"
|
||||
--require "maps.tools.cheat_mode"
|
||||
require "maps.tools.cheat_mode"
|
||||
|
||||
---- enable maps here ----
|
||||
--require "maps.biter_battles"
|
||||
@ -20,9 +20,9 @@ require "score"
|
||||
--require "maps.labyrinth"
|
||||
--require "maps.spaghettorio"
|
||||
--require "maps.spiral_troopers"
|
||||
--require "maps.fish_defender"
|
||||
require "maps.fish_defender"
|
||||
--require "maps.crossing"
|
||||
require "maps.spooky_forest"
|
||||
--require "maps.spooky_forest"
|
||||
--require "maps.atoll"
|
||||
--require "maps.empty_map"
|
||||
-----------------------------
|
||||
|
@ -1429,18 +1429,7 @@ local function on_player_built_tile(event)
|
||||
table.insert(tiles, {name = "deepwater", position = t.position})
|
||||
game.surfaces["surface"].set_tiles(tiles,true)
|
||||
end
|
||||
end
|
||||
|
||||
--landfill history to find griefers--
|
||||
if placed_tiles[1].old_tile.name == "deepwater" or placed_tiles[1].old_tile.name == "water" or placed_tiles[1].old_tile.name == "water-green" then
|
||||
if not global.land_fill_history then global.land_fill_history = {} end
|
||||
if #global.land_fill_history > 999 then global.land_fill_history = {} end
|
||||
local str = player.name .. " placed landfill at X:"
|
||||
str = str .. placed_tiles[1].position.x
|
||||
str = str .. " Y:"
|
||||
str = str .. placed_tiles[1].position.y
|
||||
table.insert(global.land_fill_history, str)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function on_player_died(event)
|
||||
|
@ -411,9 +411,9 @@ local function wake_up_idle_biters(surface)
|
||||
target=global.market,
|
||||
distraction=defines.distraction.by_enemy
|
||||
},
|
||||
unit_count = 100,
|
||||
unit_count = 64,
|
||||
force = "enemy",
|
||||
unit_search_distance=64
|
||||
unit_search_distance=96
|
||||
})
|
||||
|
||||
surface.set_multi_command({
|
||||
@ -422,7 +422,7 @@ local function wake_up_idle_biters(surface)
|
||||
target=global.market,
|
||||
distraction=defines.distraction.none
|
||||
},
|
||||
unit_count = 100,
|
||||
unit_count = 96,
|
||||
force = "enemy",
|
||||
unit_search_distance=16
|
||||
})
|
||||
@ -1001,7 +1001,7 @@ local function on_player_joined_game(event)
|
||||
--game.forces.player.set_turret_attack_modifier("flamethrower-turret", -0.5)
|
||||
|
||||
global.entity_limits = {
|
||||
["gun-turret"] = {placed = 1, limit = 1, str = "gun turret", slot_price = 100},
|
||||
["gun-turret"] = {placed = 1, limit = 1, str = "gun turret", slot_price = 75},
|
||||
["laser-turret"] = {placed = 0, limit = 1, str = "laser turret", slot_price = 300},
|
||||
["artillery-turret"] = {placed = 0, limit = 1, str = "artillery turret", slot_price = 500},
|
||||
["flamethrower-turret"] = {placed = 0, limit = 0, str = "flamethrower turret", slot_price = 10000},
|
||||
|
Loading…
Reference in New Issue
Block a user