mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-29 20:16:38 +09:00
Minor bug fixes
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
--- Adds a better method of player starting items based on production levels.
|
||||
local Event = require 'utils.event'
|
||||
local Game = require 'utils.game'
|
||||
local config = require 'config.advanced_starting_items'
|
||||
local config = require 'config.advanced_start'
|
||||
local items = config.items
|
||||
|
||||
Event.add(defines.events.on_player_created, function(event)
|
||||
@@ -9,15 +9,13 @@ Global.register(config,function(tbl)
|
||||
config = tbl
|
||||
end)
|
||||
|
||||
local white = Colours.white
|
||||
local black = Colours.black
|
||||
Event.add(defines.events.on_player_created,function(event)
|
||||
local player = Game.get_player_by_index(event.player_index)
|
||||
local color = 'white'
|
||||
if config.players[player.name] then
|
||||
color = config.players[player.name]
|
||||
else
|
||||
while not config.disallow[color] do
|
||||
while config.disallow[color] do
|
||||
color = table.get_random_dictionary_entry(Colours,true)
|
||||
end
|
||||
color = Colours[color]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local Commands = require 'expcore.commands'
|
||||
local format_chat_player_name = ext_require('expcore.common','format_chat_player_name')
|
||||
require 'config.command_parse_general'
|
||||
require 'config.expcore-commands.parse_general'
|
||||
|
||||
Commands.new_command('admin-chat','Sends a message in chat that only admins can see.')
|
||||
:add_param('message',false) -- the message to send in the admin chat
|
||||
@@ -11,7 +11,7 @@ Commands.new_command('admin-chat','Sends a message in chat that only admins can
|
||||
local player_name_colour = format_chat_player_name(player)
|
||||
for _,return_player in pairs(game.connected_players) do
|
||||
if return_player.admin then
|
||||
return_player.print{'exp-commands.admin-chat-format',player_name_colour,message}
|
||||
return_player.print{'expcom-admin-chat.format',player_name_colour,message}
|
||||
end
|
||||
end
|
||||
return Commands.success -- prevents command complete message from showing
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
local Commands = require 'expcore.commands'
|
||||
require 'config.command_parse_general'
|
||||
require 'config.expcore-commands.parse_general'
|
||||
|
||||
Commands.new_command('toggle-cheat-mode','Toggles cheat mode for your player, or another player.')
|
||||
:add_param('player',true,'player') -- player to toggle chest mode of, can be nil for self
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local Commands = require 'expcore.commands'
|
||||
local move_items = ext_require('expcore.common','move_items')
|
||||
require 'config.command_parse_roles'
|
||||
require 'config.expcore-commands.parse_roles'
|
||||
|
||||
Commands.new_command('clear-inventory','Clears a players inventory')
|
||||
:add_param('player',false,'player-role-alive')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local Commands = require 'expcore.commands'
|
||||
local Global = require 'utils.global'
|
||||
require 'config.command_parse_general'
|
||||
require 'config.expcore-commands.parse_general'
|
||||
|
||||
local results_per_page = 5
|
||||
|
||||
@@ -42,9 +42,9 @@ Commands.new_command('chelp','Searches for a keyword in all commands you are all
|
||||
-- adds the new command to the page
|
||||
page_count = page_count + 1
|
||||
found = found + 1
|
||||
local alias_format = #command_data.aliases > 0 and {'exp-commands.chelp-alias',table.concat(command_data.aliases,', ')} or ''
|
||||
local alias_format = #command_data.aliases > 0 and {'expcom-chelp.alias',table.concat(command_data.aliases,', ')} or ''
|
||||
table.insert(pages[current_page],{
|
||||
'exp-commands.chelp-format',
|
||||
'expcom-chelp.format',
|
||||
command_data.name,
|
||||
command_data.description,
|
||||
command_data.help,
|
||||
@@ -60,15 +60,15 @@ Commands.new_command('chelp','Searches for a keyword in all commands you are all
|
||||
end
|
||||
-- print the requested page
|
||||
keyword = keyword == '' and '<all>' or keyword
|
||||
Commands.print({'exp-commands.chelp-title',keyword},'cyan')
|
||||
Commands.print({'expcom-chelp.title',keyword},'cyan')
|
||||
if pages[page] then
|
||||
for _,command in pairs(pages[page]) do
|
||||
Commands.print(command)
|
||||
end
|
||||
Commands.print({'exp-commands.chelp-footer',found,page,#pages},'cyan')
|
||||
Commands.print({'expcom-chelp.footer',found,page,#pages},'cyan')
|
||||
else
|
||||
Commands.print({'exp-commands.chelp-footer',found,page,#pages},'cyan')
|
||||
return Commands.error{'exp-commands.chelp-out-of-range',page}
|
||||
Commands.print({'expcom-chelp.footer',found,page,#pages},'cyan')
|
||||
return Commands.error{'expcom-chelp.out-of-range',page}
|
||||
end
|
||||
-- blocks command complete message
|
||||
return Commands.success
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local Commands = require 'expcore.commands'
|
||||
local JailControl = require 'modules.addons.jail-control'
|
||||
local format_chat_player_name = ext_require('expcore.common','format_chat_player_name')
|
||||
require 'config.command_parse_roles'
|
||||
require 'config.expcore-commands.parse_roles'
|
||||
|
||||
Commands.new_command('jail','Puts a player into jail and removes all other roles.')
|
||||
:add_param('player',false,'player-role')
|
||||
@@ -12,9 +12,9 @@ Commands.new_command('jail','Puts a player into jail and removes all other roles
|
||||
local action_player_name_color = format_chat_player_name(action_player)
|
||||
local by_player_name_color = format_chat_player_name(player)
|
||||
if JailControl.jail_player(action_player,player.name) then
|
||||
game.print{'exp-commands.jail-give',action_player_name_color,by_player_name_color,reason}
|
||||
game.print{'expcom-jail.give',action_player_name_color,by_player_name_color,reason}
|
||||
else
|
||||
return Commands.error{'exp-commands.jail-already-jailed',action_player_name_color}
|
||||
return Commands.error{'expcom-jail.already-jailed',action_player_name_color}
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -26,9 +26,9 @@ Commands.new_command('unjail','Puts a player into jail and removes all other rol
|
||||
local action_player_name_color = format_chat_player_name(action_player)
|
||||
local by_player_name_color = format_chat_player_name(player)
|
||||
if JailControl.unjail_player(action_player,player.name) then
|
||||
game.print{'exp-commands.jail-remove',action_player_name_color,by_player_name_color}
|
||||
game.print{'expcom-jail.remove',action_player_name_color,by_player_name_color}
|
||||
else
|
||||
return Commands.error{'exp-commands.jail-not-jailed',action_player_name_color}
|
||||
return Commands.error{'expcom-jail.not-jailed',action_player_name_color}
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -40,9 +40,9 @@ Commands.new_command('temp-ban','Temp bans a player until the next reset; this r
|
||||
local action_player_name_color = format_chat_player_name(action_player)
|
||||
local by_player_name_color = format_chat_player_name(player)
|
||||
if JailControl.temp_ban_player(action_player,player.name,reason) then
|
||||
game.print{'exp-commands.jail-temp-ban',action_player_name_color,by_player_name_color,reason}
|
||||
game.print{'expcom-jail.temp-ban',action_player_name_color,by_player_name_color,reason}
|
||||
else
|
||||
return Commands.error{'exp-commands.jail-already-banned',action_player_name_color}
|
||||
return Commands.error{'expcom-jail.already-banned',action_player_name_color}
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -54,8 +54,8 @@ Commands.new_command('clear-temp-ban','Removes temp ban from a player; this will
|
||||
local action_player_name_color = format_chat_player_name(action_player)
|
||||
local by_player_name_color = format_chat_player_name(player)
|
||||
if JailControl.clear_temp_ban_player(action_player,player.name) then
|
||||
game.print{'exp-commands.jail-temp-ban-clear',action_player_name_color,by_player_name_color}
|
||||
game.print{'expcom-jail.temp-ban-clear',action_player_name_color,by_player_name_color}
|
||||
else
|
||||
return Commands.error{'exp-commands.jail-not-temp-banned',action_player_name_color}
|
||||
return Commands.error{'expcom-jail.not-temp-banned',action_player_name_color}
|
||||
end
|
||||
end)
|
||||
@@ -1,7 +1,7 @@
|
||||
local Commands = require 'expcore.commands'
|
||||
local Roles = require 'expcore.roles'
|
||||
require 'config.command_parse_general'
|
||||
require 'config.command_parse_roles'
|
||||
require 'config.expcore-commands.parse_general'
|
||||
require 'config.expcore-commands.parse_roles'
|
||||
|
||||
Commands.new_command('kill','Kills yourself or another player.')
|
||||
:add_param('player',true,'player-role-alive') -- the player to kill, must be alive to be valid
|
||||
@@ -14,7 +14,7 @@ end}
|
||||
:register(function(player,action_player,raw)
|
||||
if not action_player then
|
||||
-- can only be nil if no player given and the user is dead
|
||||
return Commands.error{'exp-commands.kill-already-dead'}
|
||||
return Commands.error{'expcom-kill.already-dead'}
|
||||
end
|
||||
if player == action_player then
|
||||
action_player.character.die()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local Commands = require 'expcore.commands'
|
||||
local config = require 'config.repair'
|
||||
require 'config.command_parse_general'
|
||||
require 'config.expcore-commands.parse_general'
|
||||
|
||||
local max_time_to_live = 4294967295 -- unit32 max
|
||||
Commands.new_command('repair','Repairs entities on your force around you')
|
||||
@@ -40,5 +40,5 @@ Commands.new_command('repair','Repairs entities on your force around you')
|
||||
end
|
||||
end
|
||||
end
|
||||
return Commands.success{'exp-commands.repair-result',revive_count,heal_count}
|
||||
return Commands.success{'expcom-repair.result',revive_count,heal_count}
|
||||
end)
|
||||
@@ -2,14 +2,14 @@ local Roles = require 'expcore.roles'
|
||||
local Commands = require 'expcore.commands'
|
||||
local ReportsControl = require 'modules.addons.reports-control'
|
||||
local format_chat_player_name = ext_require('expcore.common','format_chat_player_name')
|
||||
require 'config.command_parse_general'
|
||||
require 'config.expcore-commands.parse_general'
|
||||
|
||||
Commands.new_command('report','Reports a player and notifies moderators')
|
||||
:add_param('player',false,function(input,player,reject)
|
||||
input = Commands.parse('player',input,player,reject)
|
||||
if not input then return end
|
||||
if Roles.player_has_flag(input,'report-immune') then
|
||||
return reject{'exp-commands.report-player-immune'}
|
||||
return reject{'expcom-report.player-immune'}
|
||||
else
|
||||
return input
|
||||
end
|
||||
@@ -21,10 +21,10 @@ end)
|
||||
local action_player_name_color = format_chat_player_name(action_player)
|
||||
local by_player_name_color = format_chat_player_name(player)
|
||||
if ReportsControl.report_player(action_player,reason,player.name) then
|
||||
game.print{'exp-commands.report-non-admin',action_player_name_color,reason}
|
||||
Roles.print_to_roles_higher('Trainee',{'exp-commands.report-admin',action_player_name_color,by_player_name_color,reason})
|
||||
game.print{'expcom-report.non-admin',action_player_name_color,reason}
|
||||
Roles.print_to_roles_higher('Trainee',{'expcom-report.admin',action_player_name_color,by_player_name_color,reason})
|
||||
else
|
||||
return Commands.error{'exp-commands.report-already-reported'}
|
||||
return Commands.error{'expcom-report.already-reported'}
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -35,18 +35,18 @@ Commands.new_command('get-reports','Gets a list of all reports that a player has
|
||||
if action_player then
|
||||
local reports = ReportsControl.get_player_reports(action_player)
|
||||
local action_player_name_color = format_chat_player_name(action_player)
|
||||
Commands.print{'exp-commands.report-player-report-title',action_player_name_color}
|
||||
Commands.print{'expcom-report.player-report-title',action_player_name_color}
|
||||
for player_name,reason in pairs(reports) do
|
||||
local by_player_name_color = format_chat_player_name(player_name)
|
||||
Commands.print{'exp-commands.report-list',by_player_name_color,reason}
|
||||
Commands.print{'expcom-report.list',by_player_name_color,reason}
|
||||
end
|
||||
else
|
||||
local user_reports = ReportsControl.user_reports
|
||||
Commands.print{'exp-commands.report-player-count-title'}
|
||||
Commands.print{'expcom-report.player-count-title'}
|
||||
for player_name,reports in pairs(user_reports) do
|
||||
local player_name_color = format_chat_player_name(player_name)
|
||||
local report_count = ReportsControl.count_player_reports(player_name)
|
||||
Commands.print{'exp-commands.report-list',player_name_color,report_count}
|
||||
Commands.print{'expcom-report.list',player_name_color,report_count}
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -57,14 +57,14 @@ Commands.new_command('clear-reports','Clears all reports from a player or just t
|
||||
:register(function(player,action_player,from_player,raw)
|
||||
if from_player then
|
||||
if not ReportsControl.remove_player_report(action_player,from_player.name) then
|
||||
return Commands.error{'exp-commands.report-not-reported'}
|
||||
return Commands.error{'expcom-report.not-reported'}
|
||||
end
|
||||
else
|
||||
if not ReportsControl.clear_player_reports(action_player) then
|
||||
return Commands.error{'exp-commands.report-not-reported'}
|
||||
return Commands.error{'expcom-report.not-reported'}
|
||||
end
|
||||
end
|
||||
local action_player_name_color = format_chat_player_name(action_player)
|
||||
local by_player_name_color = format_chat_player_name(player)
|
||||
game.print{'exp-commands.report-removed',action_player_name_color,by_player_name_color}
|
||||
game.print{'expcom-report.removed',action_player_name_color,by_player_name_color}
|
||||
end)
|
||||
@@ -16,7 +16,7 @@ Commands.new_command('assign-role','Assigns a role to a player')
|
||||
if player_highest.index < role.index then
|
||||
Roles.assign_player(action_player,role,player.name)
|
||||
else
|
||||
return Commands.error{'exp-commands.roles-higher-role'}
|
||||
return Commands.error{'expcom-roles.higher-role'}
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -30,7 +30,7 @@ Commands.new_command('unassign-role','Unassigns a role from a player')
|
||||
if player_highest.index < role.index then
|
||||
Roles.unassign_player(action_player,role,player.name)
|
||||
else
|
||||
return Commands.error{'exp-commands.roles-higher-role'}
|
||||
return Commands.error{'expcom-roles.higher-role'}
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -39,7 +39,7 @@ Commands.new_command('list-roles','Lists all roles in they correct order')
|
||||
:add_alias('lsroles','roles')
|
||||
:register(function(player,action_player,raw)
|
||||
local roles = Roles.config.order
|
||||
local message = {'exp-commands.roles-list'}
|
||||
local message = {'expcom-roles.list'}
|
||||
if action_player then
|
||||
roles = Roles.get_player_roles(action_player)
|
||||
end
|
||||
@@ -48,13 +48,13 @@ Commands.new_command('list-roles','Lists all roles in they correct order')
|
||||
local colour = role.custom_color or Colours.white
|
||||
local role_name = format_chat_colour_localized(role.name,colour)
|
||||
if index == 1 then
|
||||
message = {'exp-commands.roles-list',role_name}
|
||||
message = {'expcom-roles.list',role_name}
|
||||
if action_player then
|
||||
local player_name_colour = format_chat_player_name(action_player)
|
||||
message = {'exp-commands.roles-list-player',player_name_colour,role_name}
|
||||
message = {'expcom-roles.list-player',player_name_colour,role_name}
|
||||
end
|
||||
else
|
||||
message = {'exp-commands.roles-list-element',message,role_name}
|
||||
message = {'expcom-roles.list-element',message,role_name}
|
||||
end
|
||||
end
|
||||
return Commands.success(message)
|
||||
|
||||
@@ -23,14 +23,14 @@ Commands.new_command('go-to-spawn','Teleport to spawn')
|
||||
:add_alias('spawn','tp-spawn')
|
||||
:register(function(player,action_player)
|
||||
if not action_player then
|
||||
return Commands.error{'exp-commands.spawn-unavailable'}
|
||||
return Commands.error{'expcom-spawn.unavailable'}
|
||||
elseif action_player == player then
|
||||
if not teleport(player) then
|
||||
return Commands.error{'exp-commands.spawn-unavailable'}
|
||||
return Commands.error{'expcom-spawn.unavailable'}
|
||||
end
|
||||
elseif Roles.player_allowed(player,'command/go-to-spawn/always') then
|
||||
if not teleport(action_player) then
|
||||
return Commands.error{'exp-commands.spawn-unavailable'}
|
||||
return Commands.error{'expcom-spawn.unavailable'}
|
||||
end
|
||||
else
|
||||
return Commands.error{'expcore-commands.unauthorized'}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local Commands = require 'expcore.commands'
|
||||
local Roles = require 'expcore.roles'
|
||||
require 'config.command_parse_general'
|
||||
require 'config.command_parse_roles'
|
||||
require 'config.expcore-commands.parse_general'
|
||||
require 'config.expcore-commands.parse_roles'
|
||||
|
||||
Commands.new_command('tag','Sets your player tag.')
|
||||
:add_param('tag',false,'string-max-length',20) -- new tag for your player max 20 char
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
local Commands = require 'expcore.commands'
|
||||
require 'config.command_parse_general'
|
||||
require 'config.expcore-commands.parse_general'
|
||||
|
||||
local function teleport(from_player,to_player)
|
||||
local surface = to_player.surface
|
||||
@@ -18,11 +18,11 @@ Commands.new_command('teleport','Teleports a player to another player.')
|
||||
:register(function(player,from_player,to_player,raw)
|
||||
if from_player.index == to_player.index then
|
||||
-- return if attempting to teleport to self
|
||||
return Commands.error{'exp-commands.tp-to-self'}
|
||||
return Commands.error{'expcom-tp.to-self'}
|
||||
end
|
||||
if not teleport(from_player,to_player) then
|
||||
-- return if the teleport failed
|
||||
return Commands.error{'exp-commands.tp-no-position-found'}
|
||||
return Commands.error{'expcom-tp.no-position-found'}
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -32,11 +32,11 @@ Commands.new_command('bring','Teleports a player to you.')
|
||||
:register(function(player,from_player,raw)
|
||||
if from_player.index == player.index then
|
||||
-- return if attempting to teleport to self
|
||||
return Commands.error{'exp-commands.tp-to-self'}
|
||||
return Commands.error{'expcom-tp.to-self'}
|
||||
end
|
||||
if not teleport(from_player,player) then
|
||||
-- return if the teleport failed
|
||||
return Commands.error{'exp-commands.tp-no-position-found'}
|
||||
return Commands.error{'expcom-tp.no-position-found'}
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -47,10 +47,10 @@ Commands.new_command('goto','Teleports you to a player.')
|
||||
:register(function(player,to_player,raw)
|
||||
if to_player.index == player.index then
|
||||
-- return if attempting to teleport to self
|
||||
return Commands.error{'exp-commands.tp-to-self'}
|
||||
return Commands.error{'expcom-tp.to-self'}
|
||||
end
|
||||
if not teleport(player,to_player) then
|
||||
-- return if the teleport failed
|
||||
return Commands.error{'exp-commands.tp-no-position-found'}
|
||||
return Commands.error{'expcom-tp.no-position-found'}
|
||||
end
|
||||
end)
|
||||
@@ -2,7 +2,7 @@ local Commands = require 'expcore.commands'
|
||||
local WarningsControl = require 'modules.addons.warnings-control'
|
||||
local format_chat_player_name = ext_require('expcore.common','format_chat_player_name')
|
||||
local config = require 'config.warnings'
|
||||
require 'config.command_parse_roles'
|
||||
require 'config.expcore-commands.parse_roles'
|
||||
|
||||
Commands.new_command('give-warning','Gives a warning to a player; may lead to automatic script action.')
|
||||
:add_param('player',false,'player-role')
|
||||
@@ -13,7 +13,7 @@ Commands.new_command('give-warning','Gives a warning to a player; may lead to au
|
||||
WarningsControl.add_warnings(action_player,player.name)
|
||||
local action_player_name_color = format_chat_player_name(action_player)
|
||||
local by_player_name_color = format_chat_player_name(player)
|
||||
game.print{'exp-commands.warnings-received',action_player_name_color,by_player_name_color,reason}
|
||||
game.print{'expcom-warnings.received',action_player_name_color,by_player_name_color,reason}
|
||||
end)
|
||||
|
||||
Commands.new_command('get-warnings','Gets the number of warnings a player has. If no player then lists all players and the number of warnings they have.')
|
||||
@@ -24,7 +24,7 @@ Commands.new_command('get-warnings','Gets the number of warnings a player has. I
|
||||
local warnings = WarningsControl.get_warnings(action_player)
|
||||
local script_warnings = WarningsControl.get_temp_warnings(action_player)
|
||||
local action_player_name_color = format_chat_player_name(action_player)
|
||||
Commands.print{'exp-commands.warnings-player',action_player_name_color,warnings,script_warnings,config.temp_warning_limit}
|
||||
Commands.print{'expcom-warnings.player',action_player_name_color,warnings,script_warnings,config.temp_warning_limit}
|
||||
else
|
||||
local rtn = {}
|
||||
local user_warnings = WarningsControl.user_warnings
|
||||
@@ -38,10 +38,10 @@ Commands.new_command('get-warnings','Gets the number of warnings a player has. I
|
||||
end
|
||||
rtn[player_name][2] = #warnings
|
||||
end
|
||||
Commands.print{'exp-commands.warnings-list-tilte'}
|
||||
Commands.print{'expcom-warnings.list-tilte'}
|
||||
for player_name,warnings in pairs(rtn) do
|
||||
local player_name_color = format_chat_player_name(player_name)
|
||||
Commands.print{'exp-commands.warnings-list',player_name_color,warnings[1],warnings[2],config.temp_warning_limit}
|
||||
Commands.print{'expcom-warnings.list',player_name_color,warnings[1],warnings[2],config.temp_warning_limit}
|
||||
end
|
||||
end
|
||||
end)
|
||||
@@ -53,5 +53,5 @@ Commands.new_command('clear-warnings','Clears all warnings (and script warnings)
|
||||
WarningsControl.clear_temp_warnings(action_player,player.name)
|
||||
local action_player_name_color = format_chat_player_name(action_player)
|
||||
local by_player_name_color = format_chat_player_name(player)
|
||||
game.print{'exp-commands.warnings-cleared',action_player_name_color,by_player_name_color}
|
||||
game.print{'expcom-warnings.cleared',action_player_name_color,by_player_name_color}
|
||||
end)
|
||||
Reference in New Issue
Block a user