mirror of
https://github.com/Refactorio/RedMew.git
synced 2024-12-12 10:04:40 +02:00
142 lines
3.6 KiB
Lua
142 lines
3.6 KiB
Lua
require 'config'
|
|
require 'utils.utils'
|
|
require 'utils.list_utils'
|
|
require 'user_groups'
|
|
require 'custom_commands'
|
|
require 'base_data'
|
|
require 'train_station_names'
|
|
require 'nuke_control'
|
|
require 'walk_distance'
|
|
require 'follow'
|
|
require 'autodeconstruct'
|
|
require 'corpse_util'
|
|
require 'fish_market'
|
|
require 'reactor_meltdown'
|
|
require 'map_layout'
|
|
require 'bot'
|
|
|
|
-- GUIs the order determines the order they appear at the top.
|
|
require 'info'
|
|
require 'player_list'
|
|
require 'poll'
|
|
require 'band'
|
|
require 'tasklist'
|
|
require 'blueprint_helper'
|
|
require 'score'
|
|
require 'popup'
|
|
|
|
local Event = require 'utils.event'
|
|
|
|
local function player_joined(event)
|
|
local player = game.players[event.player_index]
|
|
player.insert {name = 'raw-fish', count = 4}
|
|
player.insert {name = 'iron-gear-wheel', count = 8}
|
|
player.insert {name = 'iron-plate', count = 16}
|
|
player.print('Welcome to our Server. You can join our Discord at: redmew.com/discord')
|
|
player.print('And remember.. Keep Calm And Spaghetti!')
|
|
end
|
|
|
|
function walkabout(player_name, distance)
|
|
game.player.print('This command moved to /walkabout.')
|
|
end
|
|
|
|
local hodor_messages = {
|
|
{'Hodor.', 16},
|
|
{'Hodor?', 16},
|
|
{'Hodor!', 16},
|
|
{'Hodor! Hodor! Hodor! Hodor!', 4},
|
|
{'Hodor :(', 4},
|
|
{'Hodor :)', 4},
|
|
{'HOOOODOOOR!', 4},
|
|
{'( ͡° ͜ʖ ͡°)', 1},
|
|
{'☉ ‿ ⚆', 1}
|
|
}
|
|
local message_weight_sum = 0
|
|
for _, w in pairs(hodor_messages) do
|
|
message_weight_sum = message_weight_sum + w[2]
|
|
end
|
|
|
|
global.naughty_words_enabled = true
|
|
global.naughty_words = {
|
|
['ass'] = true,
|
|
['bugger'] = true,
|
|
['christ'] = true,
|
|
['crikey'] = true,
|
|
['darn'] = true,
|
|
['dam'] = true,
|
|
['damn'] = true,
|
|
['dang'] = true,
|
|
['dagnabit'] = true,
|
|
['dagnabbit'] = true,
|
|
['drat'] = true,
|
|
['feck'] = true,
|
|
['frack'] = true,
|
|
['frick'] = true,
|
|
['gee'] = true,
|
|
['geez'] = true,
|
|
['git'] = true,
|
|
['god'] = true,
|
|
['golly'] = true,
|
|
['gosh'] = true,
|
|
['heavens'] = true,
|
|
['heck'] = true,
|
|
['hell'] = true,
|
|
['holy'] = true,
|
|
['jerk'] = true,
|
|
['jesus'] = true,
|
|
['petes'] = true,
|
|
["pete's"] = true,
|
|
['poo'] = true,
|
|
['willy'] = true,
|
|
['wee'] = true,
|
|
['yikes'] = true
|
|
}
|
|
|
|
local function hodor(event)
|
|
local message = event.message:lower()
|
|
if message:match('hodor') then
|
|
local index = math.random(1, message_weight_sum)
|
|
local message_weight_sum = 0
|
|
for _, m in pairs(hodor_messages) do
|
|
message_weight_sum = message_weight_sum + m[2]
|
|
if message_weight_sum >= index then
|
|
game.print('Hodor: ' .. m[1])
|
|
break
|
|
end
|
|
end
|
|
end
|
|
|
|
local player = game.players[event.player_index]
|
|
if not player or not player.valid then
|
|
return
|
|
end
|
|
|
|
if message:match('discord') then
|
|
player.print('Did you ask about our discord server?')
|
|
player.print('You can find it here: redmew/discord')
|
|
end
|
|
|
|
if global.naughty_words_enabled then
|
|
local naughty_words = global.naughty_words
|
|
for word in message:gmatch('%S+') do
|
|
if naughty_words[word] then
|
|
game.print(player.name .. ' this is a Christian Factorio server, no swearing please!')
|
|
break
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
Event.add(defines.events.on_player_created, player_joined)
|
|
Event.add(defines.events.on_console_chat, hodor)
|
|
|
|
Event.add(
|
|
defines.events.on_player_joined_game,
|
|
function(event)
|
|
local gui = game.players[event.player_index].gui
|
|
|
|
gui.top.style = 'slot_table_spacing_horizontal_flow'
|
|
gui.left.style = 'slot_table_spacing_vertical_flow'
|
|
end
|
|
)
|