mirror of
https://github.com/Refactorio/RedMew.git
synced 2024-12-12 10:04:40 +02:00
Use action_warning
This commit is contained in:
parent
31266f60d4
commit
b9c985e386
@ -3,8 +3,7 @@ local Global = require 'utils.global'
|
|||||||
local Task = require 'utils.task'
|
local Task = require 'utils.task'
|
||||||
local Token = require 'utils.token'
|
local Token = require 'utils.token'
|
||||||
local Game = require 'utils.game'
|
local Game = require 'utils.game'
|
||||||
local Server = require 'features.server'
|
local Utils = require 'utils.core'
|
||||||
local Color = require 'resources.color_presets'
|
|
||||||
|
|
||||||
local player_corpses = {}
|
local player_corpses = {}
|
||||||
|
|
||||||
@ -119,10 +118,7 @@ local function mined_entity(event)
|
|||||||
|
|
||||||
if player and corpse_owner then
|
if player and corpse_owner then
|
||||||
local message = table.concat {'## - ', player.name, ' has looted ', corpse_owner.name, "'s corpse"}
|
local message = table.concat {'## - ', player.name, ' has looted ', corpse_owner.name, "'s corpse"}
|
||||||
|
Utils.action_warning(message, '[Corpse]')
|
||||||
game.print(message, Color.yellow)
|
|
||||||
log('[Corpse] ' .. message)
|
|
||||||
Server.to_discord_bold(message)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -143,11 +139,8 @@ local function on_gui_opened(event)
|
|||||||
local corpse_owner = Game.get_player_by_index(corpse_owner_index)
|
local corpse_owner = Game.get_player_by_index(corpse_owner_index)
|
||||||
|
|
||||||
if player and corpse_owner then
|
if player and corpse_owner then
|
||||||
local message = table.concat {'## - ', player.name, ' is looting ', corpse_owner.name, "'s corpse"}
|
local message = table.concat {player.name, ' is looting ', corpse_owner.name, "'s corpse"}
|
||||||
|
Utils.action_warning(message, '[Corpse]')
|
||||||
game.print(message, Color.yellow)
|
|
||||||
log('[Corpse] ' .. message)
|
|
||||||
Server.to_discord_bold(message)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -5,8 +5,7 @@ local Game = require 'utils.game'
|
|||||||
local Server = require 'features.server'
|
local Server = require 'features.server'
|
||||||
|
|
||||||
local function allowed_to_nuke(player)
|
local function allowed_to_nuke(player)
|
||||||
return player.admin or UserGroups.is_regular(player.name) or
|
return player.admin or UserGroups.is_regular(player.name) or ((player.online_time / 216000) > global.config.nuke_control.nuke_min_time_hours)
|
||||||
((player.online_time / 216000) > global.config.nuke_control.nuke_min_time_hours)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function ammo_changed(event)
|
local function ammo_changed(event)
|
||||||
@ -16,7 +15,7 @@ local function ammo_changed(event)
|
|||||||
end
|
end
|
||||||
local nukes = player.remove_item({name = 'atomic-bomb', count = 1000})
|
local nukes = player.remove_item({name = 'atomic-bomb', count = 1000})
|
||||||
if nukes > 0 then
|
if nukes > 0 then
|
||||||
game.print(player.name .. ' tried to use a nuke, but instead dropped it on his foot.')
|
Utils.action_warning(player.name .. ' tried to use a nuke, but instead dropped it on his foot.', '[Nuke]')
|
||||||
|
|
||||||
local character = player.character
|
local character = player.character
|
||||||
if character and character.valid then
|
if character and character.valid then
|
||||||
@ -38,10 +37,8 @@ local function on_player_deconstructed_area(event)
|
|||||||
player.remove_item({name = 'deconstruction-planner', count = 1000})
|
player.remove_item({name = 'deconstruction-planner', count = 1000})
|
||||||
|
|
||||||
--Make them think they arent noticed
|
--Make them think they arent noticed
|
||||||
Utils.print_except(player.name .. ' tried to deconstruct something, but instead deconstructed themself.', nil, player)
|
Utils.silent_action_warning(player.name .. ' tried to deconstruct something, but instead deconstructed themself.', '[Deconstruct]', player)
|
||||||
player.print(
|
player.print('Only regulars can mark things for deconstruction, if you want to deconstruct something you may ask an admin to promote you.')
|
||||||
'Only regulars can mark things for deconstruction, if you want to deconstruct something you may ask an admin to promote you.'
|
|
||||||
)
|
|
||||||
|
|
||||||
local character = player.character
|
local character = player.character
|
||||||
if character and character.valid then
|
if character and character.valid then
|
||||||
@ -61,10 +58,7 @@ local function on_player_deconstructed_area(event)
|
|||||||
|
|
||||||
local entities = player.surface.find_entities_filtered {area = area, force = player.force}
|
local entities = player.surface.find_entities_filtered {area = area, force = player.force}
|
||||||
if #entities > 1000 then
|
if #entities > 1000 then
|
||||||
Utils.print_admins(
|
Utils.print_admins('Warning! ' .. player.name .. ' just tried to deconstruct ' .. tostring(#entities) .. ' entities!', nil)
|
||||||
'Warning! ' .. player.name .. ' just tried to deconstruct ' .. tostring(#entities) .. ' entities!',
|
|
||||||
nil
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
for _, entity in pairs(entities) do
|
for _, entity in pairs(entities) do
|
||||||
if entity.valid and entity.to_be_deconstructed(Game.get_player_by_index(event.player_index).force) then
|
if entity.valid and entity.to_be_deconstructed(Game.get_player_by_index(event.player_index).force) then
|
||||||
@ -75,8 +69,7 @@ end
|
|||||||
|
|
||||||
local function item_not_sanctioned(item)
|
local function item_not_sanctioned(item)
|
||||||
local name = item.name
|
local name = item.name
|
||||||
return (name:find('capsule') or name == 'cliff-explosives' or name == 'raw-fish' or
|
return (name:find('capsule') or name == 'cliff-explosives' or name == 'raw-fish' or name == 'discharge-defense-remote')
|
||||||
name == 'discharge-defense-remote')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
global.entities_allowed_to_bomb = {
|
global.entities_allowed_to_bomb = {
|
||||||
@ -149,15 +142,7 @@ local function on_capsule_used(event)
|
|||||||
if count > 8 then
|
if count > 8 then
|
||||||
if global.players_warned[event.player_index] then
|
if global.players_warned[event.player_index] then
|
||||||
if nuke_control.enable_autoban then
|
if nuke_control.enable_autoban then
|
||||||
Server.ban_sync(
|
Server.ban_sync(player.name, string.format('Damaged %i entities with %s. This action was performed automatically. If you want to contest this ban please visit redmew.com/discord.', count, item.name), '<script>')
|
||||||
player.name,
|
|
||||||
string.format(
|
|
||||||
'Damaged %i entities with %s. This action was performed automatically. If you want to contest this ban please visit redmew.com/discord.',
|
|
||||||
count,
|
|
||||||
item.name
|
|
||||||
),
|
|
||||||
'<script>'
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
global.players_warned[event.player_index] = true
|
global.players_warned[event.player_index] = true
|
||||||
|
Loading…
Reference in New Issue
Block a user