1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-01-30 04:30:58 +02:00

Chaaaaaaange places

This commit is contained in:
Matthew Heguy 2019-01-23 23:37:11 -05:00
parent b9c985e386
commit d5be21a990
3 changed files with 12 additions and 10 deletions

View File

@ -118,7 +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]') Utils.action_warning('[Corpse]', message)
end end
end end
@ -140,7 +140,7 @@ local function on_gui_opened(event)
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]') Utils.action_warning('[Corpse]', message)
end end
end end

View File

@ -4,6 +4,9 @@ local Utils = require 'utils.core'
local Game = require 'utils.game' local Game = require 'utils.game'
local Server = require 'features.server' local Server = require 'features.server'
local format = string.format
local match = string.match
local function allowed_to_nuke(player) local function allowed_to_nuke(player)
return player.admin or UserGroups.is_regular(player.name) or ((player.online_time / 216000) > global.config.nuke_control.nuke_min_time_hours) return player.admin or UserGroups.is_regular(player.name) or ((player.online_time / 216000) > global.config.nuke_control.nuke_min_time_hours)
end end
@ -15,7 +18,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
Utils.action_warning(player.name .. ' tried to use a nuke, but instead dropped it on his foot.', '[Nuke]') Utils.action_warning('[Nuke]', player.name .. ' tried to use a nuke, but instead dropped it on his foot.')
local character = player.character local character = player.character
if character and character.valid then if character and character.valid then
@ -37,7 +40,7 @@ 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.silent_action_warning(player.name .. ' tried to deconstruct something, but instead deconstructed themself.', '[Deconstruct]', player) Utils.silent_action_warning('[Deconstruct]', player.name .. ' tried to deconstruct something, but instead deconstructed themself.', player)
player.print('Only regulars can mark things for deconstruction, if you want to deconstruct something you may ask an admin to promote you.') player.print('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
@ -142,12 +145,12 @@ 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(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>') Server.ban_sync(player.name, 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
if nuke_control.enable_autokick then if nuke_control.enable_autokick then
game.kick_player(player, string.format('Damaged %i entities with %s -Antigrief', count, item.name)) game.kick_player(player, format('Damaged %i entities with %s -Antigrief', count, item.name))
end end
end end
end end
@ -156,7 +159,7 @@ end
local function on_player_joined(event) local function on_player_joined(event)
local player = game.players[event.player_index] local player = game.players[event.player_index]
if string.match(player.name, '^[Ili1|]+$') then if match(player.name, '^[Ili1|]+$') then
Server.ban_sync(player.name, '', '<script>') --No reason given, to not give them any hints to change their name Server.ban_sync(player.name, '', '<script>') --No reason given, to not give them any hints to change their name
end end
end end

View File

@ -204,7 +204,7 @@ end
--- Takes msg and prints it to all players. Also prints to the log and discord --- Takes msg and prints it to all players. Also prints to the log and discord
-- @param msg <string> The message to print -- @param msg <string> The message to print
-- @param warning_prefix <string> The name of the module/warning -- @param warning_prefix <string> The name of the module/warning
function Module.action_warning(msg, warning_prefix) function Module.action_warning(warning_prefix, msg)
game.print(prefix .. msg, Color.yellow) game.print(prefix .. msg, Color.yellow)
msg = format('%s %s', warning_prefix, msg) msg = format('%s %s', warning_prefix, msg)
log(msg) log(msg)
@ -215,7 +215,7 @@ end
-- @param msg <string> The message to print -- @param msg <string> The message to print
-- @param warning_prefix <string> The name of the module/warning -- @param warning_prefix <string> The name of the module/warning
-- @param player <LuaPlayer> the player not to send the message to -- @param player <LuaPlayer> the player not to send the message to
function Module.silent_action_warning(msg, warning_prefix, player) function Module.silent_action_warning(warning_prefix, msg, player)
Module.print_except(prefix .. msg, Color.yellow, player) Module.print_except(prefix .. msg, Color.yellow, player)
msg = format('%s %s', warning_prefix, msg) msg = format('%s %s', warning_prefix, msg)
log(msg) log(msg)
@ -233,7 +233,6 @@ require 'util'
-- @return <table> modified position -- @return <table> modified position
Module.move_position = util.moveposition Module.move_position = util.moveposition
--- Takes a direction and gives you the opposite --- Takes a direction and gives you the opposite
-- @param direction <defines.direction> north, east, south, west, northeast, northwest, southeast, southwest -- @param direction <defines.direction> north, east, south, west, northeast, northwest, southeast, southwest
-- @return <number> representing the direction -- @return <number> representing the direction