From b42a860e18f497d06c892cfe2e55cc8d7519dd64 Mon Sep 17 00:00:00 2001 From: MewMew <=> Date: Sat, 15 Dec 2018 14:05:07 +0100 Subject: [PATCH] landfill prevention --- antigrief.lua | 39 ++++++++++++++++++++++++++++----------- control.lua | 6 +++--- maps/biter_battles.lua | 13 +------------ maps/fish_defender.lua | 8 ++++---- 4 files changed, 36 insertions(+), 30 deletions(-) diff --git a/antigrief.lua b/antigrief.lua index 3dcb12ab..7c926e5f 100644 --- a/antigrief.lua +++ b/antigrief.lua @@ -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) diff --git a/control.lua b/control.lua index 19d0bc7c..1418f7ed 100644 --- a/control.lua +++ b/control.lua @@ -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" ----------------------------- diff --git a/maps/biter_battles.lua b/maps/biter_battles.lua index 8aec5045..939d338d 100644 --- a/maps/biter_battles.lua +++ b/maps/biter_battles.lua @@ -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) diff --git a/maps/fish_defender.lua b/maps/fish_defender.lua index 48728e74..55f1b7a7 100644 --- a/maps/fish_defender.lua +++ b/maps/fish_defender.lua @@ -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},