From 0aea9c28b4d1820283a5c86e436269723030ed92 Mon Sep 17 00:00:00 2001 From: Gerkiz Date: Sat, 11 Jul 2020 17:04:53 +0200 Subject: [PATCH] tweaks and fixes --- antigrief.lua | 153 +++++++---- comfy_panel/player_list.lua | 6 +- .../resource_generator.lua | 2 +- utils/jail_data.lua | 256 ++++++++++-------- 4 files changed, 257 insertions(+), 160 deletions(-) diff --git a/antigrief.lua b/antigrief.lua index 08a02351..2596cbe9 100644 --- a/antigrief.lua +++ b/antigrief.lua @@ -143,12 +143,14 @@ local function get_entities(item_name, entities) return table.concat(list) end -local function damage_player(player, kill) +local function damage_player(player, kill, print_to_all) local msg = ' tried to destroy our base, but it backfired!' if player.character then if kill then player.character.die('enemy') - game.print(player.name .. msg, Color.yellow) + if print_to_all then + game.print(player.name .. msg, Color.yellow) + end return end player.character.health = player.character.health - math.random(50, 100) @@ -167,6 +169,29 @@ local function damage_player(player, kill) end end +local function do_action(player, prefix, msg, ban_msg, kill) + if not prefix or not msg or not ban_msg then + return + end + kill = kill or false + + damage_player(player, kill) + Utils.action_warning(prefix, msg) + + if this.players_warned[player.index] == 2 then + if this.enable_autoban then + Server.ban_sync(player.name, ban_msg, '