mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-01-01 05:01:40 +09:00
Fixed Existing Lua Check Errors
This commit is contained in:
@@ -70,6 +70,14 @@ do -- Assume Factorio Control Stage as Default
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
do -- RedMew and ExpGaming overrides
|
||||||
|
globals = {
|
||||||
|
'math', 'table',
|
||||||
|
'print', 'require', 'unpack', 'inspect', 'loadstring', 'ServerCommands', 'Debug',
|
||||||
|
'_C', '_DEBUG', '_CHEATS', '_DUMP_ENV', '_LIFECYCLE', '_STAGE',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
do -- Set default prototype files
|
do -- Set default prototype files
|
||||||
files['**/data.lua'].std = STD_DATA
|
files['**/data.lua'].std = STD_DATA
|
||||||
files['**/data-updates.lua'].std = STD_DATA
|
files['**/data-updates.lua'].std = STD_DATA
|
||||||
|
|||||||
@@ -5,8 +5,10 @@
|
|||||||
-- use these as a simple methods of adding new items
|
-- use these as a simple methods of adding new items
|
||||||
-- they will do most of the work for you
|
-- they will do most of the work for you
|
||||||
-- ['item-name'] = factory(params)
|
-- ['item-name'] = factory(params)
|
||||||
|
-- luacheck:ignore 212/amount_made 212/items_made 212/player
|
||||||
|
|
||||||
-- Use these to adjust for ticks ie game.tick < 5*minutes
|
-- Use these to adjust for ticks ie game.tick < 5*minutes
|
||||||
|
-- luacheck:ignore 211/seconds 211/minutes 211/hours
|
||||||
local seconds, minutes, hours = 60, 3600, 216000
|
local seconds, minutes, hours = 60, 3600, 216000
|
||||||
|
|
||||||
--- Use to make a split point for the number of items given based on time
|
--- Use to make a split point for the number of items given based on time
|
||||||
@@ -65,7 +67,7 @@ return {
|
|||||||
skip_intro=true, --- @setting skip_intro skips the intro given in the default factorio free play scenario
|
skip_intro=true, --- @setting skip_intro skips the intro given in the default factorio free play scenario
|
||||||
skip_victory=true, --- @setting skip_victory will skip the victory screen when a rocket is launched
|
skip_victory=true, --- @setting skip_victory will skip the victory screen when a rocket is launched
|
||||||
disable_base_game_silo_script=true, --- @setting disable_base_game_silo_script will not load the silo script at all
|
disable_base_game_silo_script=true, --- @setting disable_base_game_silo_script will not load the silo script at all
|
||||||
research_queue_from_start=true, --- @setting research_queue_from_start when true the research queue is useible from the start
|
research_queue_from_start=true, --- @setting research_queue_from_start when true the research queue is useable from the start
|
||||||
friendly_fire=false, --- @setting friendly_fire weather players will be able to attack each other on the same force
|
friendly_fire=false, --- @setting friendly_fire weather players will be able to attack each other on the same force
|
||||||
enemy_expansion=false, --- @setting enemy_expansion a catch all for in case the map settings file fails to load
|
enemy_expansion=false, --- @setting enemy_expansion a catch all for in case the map settings file fails to load
|
||||||
chart_radius=10*32, --- @setting chart_radius the number of tiles that will be charted when the map starts
|
chart_radius=10*32, --- @setting chart_radius the number of tiles that will be charted when the map starts
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
--- This is a very simple config file which adds a admin only auth functio;
|
--- This is a very simple config file which adds a admin only auth function;
|
||||||
-- not much to change here its more so it can be enabled and disabled from ./config/file_loader.lua;
|
-- not much to change here its more so it can be enabled and disabled from ./config/file_loader.lua;
|
||||||
-- either way you can change the requirements to be "admin" if you wanted to
|
-- either way you can change the requirements to be "admin" if you wanted to
|
||||||
-- @config Commands-Auth-Admin
|
-- @config Commands-Auth-Admin
|
||||||
|
|
||||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||||
|
|
||||||
|
-- luacheck:ignore 212/command
|
||||||
Commands.add_authenticator(function(player, command, tags, reject)
|
Commands.add_authenticator(function(player, command, tags, reject)
|
||||||
if tags.admin_only then
|
if tags.admin_only then
|
||||||
if player.admin then
|
if player.admin then
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||||
|
|
||||||
|
-- luacheck:ignore 212/tags
|
||||||
Commands.add_authenticator(function(player, command, tags, reject)
|
Commands.add_authenticator(function(player, command, tags, reject)
|
||||||
if Roles.player_allowed(player,'command/'..command) then
|
if Roles.player_allowed(player,'command/'..command) then
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -22,9 +22,8 @@ see ./expcore/commands.lua for more details
|
|||||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||||
local Game = require 'utils.game' --- @dep utils.game
|
local Game = require 'utils.game' --- @dep utils.game
|
||||||
|
|
||||||
|
-- luacheck:ignore 212/player
|
||||||
|
Commands.add_parse('boolean',function(input, player)
|
||||||
Commands.add_parse('boolean',function(input,player,reject)
|
|
||||||
if not input then return end -- nil check
|
if not input then return end -- nil check
|
||||||
input = input:lower()
|
input = input:lower()
|
||||||
if input == 'yes'
|
if input == 'yes'
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ local Roles = require 'expcore.roles' --- @dep expcore.roles
|
|||||||
local auto_complete = _C.auto_complete --- @dep expcore.common
|
local auto_complete = _C.auto_complete --- @dep expcore.common
|
||||||
require 'config.expcore.command_general_parse'
|
require 'config.expcore.command_general_parse'
|
||||||
|
|
||||||
|
-- luacheck:ignore 212/player
|
||||||
Commands.add_parse('role',function(input, player, reject)
|
Commands.add_parse('role',function(input, player, reject)
|
||||||
if not input then return end
|
if not input then return end
|
||||||
local roles = Roles.config.order
|
local roles = Roles.config.order
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ function Commands.enable(command_name)
|
|||||||
disabled_commands[command_name] = nil
|
disabled_commands[command_name] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- luacheck:ignore 212/player 212/tags
|
||||||
Commands.add_authenticator(function(player, command, tags, reject)
|
Commands.add_authenticator(function(player, command, tags, reject)
|
||||||
if disabled_commands[command] then
|
if disabled_commands[command] then
|
||||||
return reject{'command-auth.command-disabled'}
|
return reject{'command-auth.command-disabled'}
|
||||||
|
|||||||
@@ -307,7 +307,6 @@ local key = auto_complete(tbl, "foo", true, true)
|
|||||||
|
|
||||||
]]
|
]]
|
||||||
function Common.auto_complete(options, input, use_key, rtn_key)
|
function Common.auto_complete(options, input, use_key, rtn_key)
|
||||||
local rtn = {}
|
|
||||||
if type(input) ~= 'string' then return end
|
if type(input) ~= 'string' then return end
|
||||||
input = input:lower()
|
input = input:lower()
|
||||||
for key, value in pairs(options) do
|
for key, value in pairs(options) do
|
||||||
@@ -318,8 +317,8 @@ function Common.auto_complete(options,input,use_key,rtn_key)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Formating.
|
--- Formatting.
|
||||||
-- @section formating
|
-- @section formatting
|
||||||
|
|
||||||
--[[-- Returns a valid string with the name of the actor of a command.
|
--[[-- Returns a valid string with the name of the actor of a command.
|
||||||
@tparam string player_name the name of the player to use rather than server, used only if game.player is nil
|
@tparam string player_name the name of the player to use rather than server, used only if game.player is nil
|
||||||
@@ -589,7 +588,7 @@ function Common.move_items(items,surface,position,radius,chest_type)
|
|||||||
local last_chest
|
local last_chest
|
||||||
for item_name, item_count in pairs(items) do
|
for item_name, item_count in pairs(items) do
|
||||||
local chest = next_chest{name=item_name, count=item_count}
|
local chest = next_chest{name=item_name, count=item_count}
|
||||||
if not chest then return error(string.format('Cant move item %s to %s{%s, %s} no valid chest in radius',item.name,surface.name,p.x,p.y)) end
|
if not chest then return error(string.format('Cant move item %s to %s{%s, %s} no valid chest in radius', item_name, surface.name, p.x, p.y)) end
|
||||||
Util.insert_safe(chest, {[item_name]=item_count})
|
Util.insert_safe(chest, {[item_name]=item_count})
|
||||||
last_chest = chest
|
last_chest = chest
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ Event.on_nth_tick(config.message_cycle, circle_messages)
|
|||||||
|
|
||||||
--- This will add a compilatron to the global and start his message cycle
|
--- This will add a compilatron to the global and start his message cycle
|
||||||
-- @tparam LuaEntity entity the compilatron entity that moves around
|
-- @tparam LuaEntity entity the compilatron entity that moves around
|
||||||
-- @tparam string name the name of the location that the complitron is at
|
-- @tparam string name the name of the location that the compilatron is at
|
||||||
function Public.add_compilatron(entity, name)
|
function Public.add_compilatron(entity, name)
|
||||||
if not entity and not entity.valid then
|
if not entity and not entity.valid then
|
||||||
return
|
return
|
||||||
@@ -96,7 +96,7 @@ end
|
|||||||
Event.add(defines.events.on_player_created, function(event)
|
Event.add(defines.events.on_player_created, function(event)
|
||||||
if event.player_index ~= 1 then return end
|
if event.player_index ~= 1 then return end
|
||||||
local player = Game.get_player_by_index(event.player_index)
|
local player = Game.get_player_by_index(event.player_index)
|
||||||
for location,pos in pairs(locations) do
|
for location in pairs(locations) do
|
||||||
Public.spawn_compilatron(player.surface, location)
|
Public.spawn_compilatron(player.surface, location)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ end)
|
|||||||
-- every 5 min all bodies are checked for valid map tags
|
-- every 5 min all bodies are checked for valid map tags
|
||||||
if config.show_map_markers then
|
if config.show_map_markers then
|
||||||
local check_period = 60*60*5 -- five minutes
|
local check_period = 60*60*5 -- five minutes
|
||||||
Event.on_nth_tick(check_period,function(event)
|
Event.on_nth_tick(check_period, function()
|
||||||
check_map_tags()
|
check_map_tags()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,53 +1,6 @@
|
|||||||
---LuaPlayerBuiltEntityEventFilters
|
---LuaPlayerBuiltEntityEventFilters
|
||||||
---Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name = "fast-inserter"}})
|
---Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name = "fast-inserter"}})
|
||||||
local Event = require 'utils.event' --- @dep utils.event
|
local Event = require 'utils.event' --- @dep utils.event
|
||||||
local station_name_changer =
|
|
||||||
function(event)
|
|
||||||
local enetety = event.created_entity
|
|
||||||
local name = enetety.name
|
|
||||||
|
|
||||||
if name == "train-stop" then --only do the event if its a trainstop
|
|
||||||
local boundingbox = enetety.bounding_box
|
|
||||||
-- expanded box for recourse search:
|
|
||||||
local bounding2 = { {boundingbox.left_top.x -100 ,boundingbox.left_top.y -100} , {boundingbox.right_bottom.x +100,boundingbox.right_bottom.y +100 } }
|
|
||||||
--gets all resources in bounding_box2:
|
|
||||||
local recoursec = game.surfaces[1].find_entities_filtered{area = bounding2, type = "resource"}
|
|
||||||
|
|
||||||
if #recoursec > 0 then -- save cpu time if their are no recourses in bounding_box2
|
|
||||||
local closest_distance
|
|
||||||
local px,py = boundingbox.left_top.x,boundingbox.left_top.y
|
|
||||||
local recourse_closed
|
|
||||||
|
|
||||||
--Check which recource is closest
|
|
||||||
for i, item in ipairs(recoursec) do
|
|
||||||
local dx, dy = px - item.bounding_box.left_top.x, py - item.bounding_box.left_top.y
|
|
||||||
local distance = (dx*dx)+(dy*dy)
|
|
||||||
if not closest_distance or distance < closest_distance then
|
|
||||||
recourse_closed = item
|
|
||||||
closest_distance = distance
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
local item_name = recourse_closed.name
|
|
||||||
if item_name then -- prevent errors if something went wrong
|
|
||||||
local item_name2 = item_name:gsub("^%l", string.upper):gsub('-',' ') -- removing the - and making first letter capital
|
|
||||||
|
|
||||||
local Item_ore_fluid = "item"
|
|
||||||
if item_name == "crude-oil" then
|
|
||||||
Item_ore_fluid = "fluid"
|
|
||||||
end
|
|
||||||
--Final string:
|
|
||||||
enetety.backer_name = string.format("[L] [img=%s.%s] %s %s (%s)",Item_ore_fluid,item_name,item_name2,enetety.backer_name,Angle( enetety ))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
--add func to robot and player build entities
|
|
||||||
Event.add(defines.events.on_built_entity,station_name_changer)
|
|
||||||
Event.add(defines.events.on_robot_built_entity,station_name_changer)
|
|
||||||
|
|
||||||
|
|
||||||
--Credit to Cooldude2606 for using his lua magic to make this function.
|
--Credit to Cooldude2606 for using his lua magic to make this function.
|
||||||
local directions = {
|
local directions = {
|
||||||
@@ -60,8 +13,9 @@ local directions = {
|
|||||||
['S'] = 0.625,
|
['S'] = 0.625,
|
||||||
['SW'] = 0.875
|
['SW'] = 0.875
|
||||||
}
|
}
|
||||||
function Angle( enetety )
|
|
||||||
local angle = math.atan2(enetety.position.y,enetety.position.x)/math.pi
|
local function Angle(entity)
|
||||||
|
local angle = math.atan2(entity.position.y, entity.position.x)/math.pi
|
||||||
for direction, requiredAngle in pairs(directions) do
|
for direction, requiredAngle in pairs(directions) do
|
||||||
if angle < requiredAngle then
|
if angle < requiredAngle then
|
||||||
return direction
|
return direction
|
||||||
@@ -69,3 +23,48 @@ function Angle( enetety )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function station_name_changer(event)
|
||||||
|
local entity = event.created_entity
|
||||||
|
local name = entity.name
|
||||||
|
|
||||||
|
if name == "train-stop" then --only do the event if its a train stop
|
||||||
|
local boundingBox = entity.bounding_box
|
||||||
|
-- expanded box for recourse search:
|
||||||
|
local bounding2 = { {boundingBox.left_top.x -100 ,boundingBox.left_top.y -100} , {boundingBox.right_bottom.x +100, boundingBox.right_bottom.y +100 } }
|
||||||
|
-- gets all resources in bounding_box2:
|
||||||
|
local recourses = game.surfaces[1].find_entities_filtered{area = bounding2, type = "resource"}
|
||||||
|
|
||||||
|
if #recourses > 0 then -- save cpu time if their are no recourses in bounding_box2
|
||||||
|
local closest_distance
|
||||||
|
local px, py = boundingBox.left_top.x, boundingBox.left_top.y
|
||||||
|
local recourse_closed
|
||||||
|
|
||||||
|
--Check which recourse is closest
|
||||||
|
for i, item in ipairs(recourses) do
|
||||||
|
local dx, dy = px - item.bounding_box.left_top.x, py - item.bounding_box.left_top.y
|
||||||
|
local distance = (dx*dx)+(dy*dy)
|
||||||
|
if not closest_distance or distance < closest_distance then
|
||||||
|
recourse_closed = item
|
||||||
|
closest_distance = distance
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
local item_name = recourse_closed.name
|
||||||
|
if item_name then -- prevent errors if something went wrong
|
||||||
|
local item_name2 = item_name:gsub("^%l", string.upper):gsub('-', ' ') -- removing the - and making first letter capital
|
||||||
|
|
||||||
|
local Item_ore_fluid = "item"
|
||||||
|
if item_name == "crude-oil" then
|
||||||
|
Item_ore_fluid = "fluid"
|
||||||
|
end
|
||||||
|
--Final string:
|
||||||
|
entity.backer_name = string.format("[L] [img=%s.%s] %s %s (%s)", Item_ore_fluid, item_name, item_name2, entity.backer_name, Angle( entity ))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Add handler to robot and player build entities
|
||||||
|
Event.add(defines.events.on_built_entity, station_name_changer)
|
||||||
|
Event.add(defines.events.on_robot_built_entity, station_name_changer)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ Commands.new_command('admin-chat','Sends a message in chat that only admins can
|
|||||||
:enable_auto_concat()
|
:enable_auto_concat()
|
||||||
:set_flag('admin_only')
|
:set_flag('admin_only')
|
||||||
:add_alias('ac')
|
:add_alias('ac')
|
||||||
:register(function(player,message,raw)
|
:register(function(player, message)
|
||||||
local player_name_colour = format_chat_player_name(player)
|
local player_name_colour = format_chat_player_name(player)
|
||||||
for _, return_player in pairs(game.connected_players) do
|
for _, return_player in pairs(game.connected_players) do
|
||||||
if return_player.admin then
|
if return_player.admin then
|
||||||
|
|||||||
@@ -15,6 +15,6 @@ Commands.new_command('toggle-cheat-mode','Toggles cheat mode for your player, or
|
|||||||
return player -- default is the user using the command
|
return player -- default is the user using the command
|
||||||
end}
|
end}
|
||||||
:set_flag('admin_only')
|
:set_flag('admin_only')
|
||||||
:register(function(player,action_player,raw)
|
:register(function(_, player)
|
||||||
action_player.cheat_mode = not action_player.cheat_mode
|
player.cheat_mode = not player.cheat_mode
|
||||||
end)
|
end)
|
||||||
@@ -13,8 +13,8 @@ require 'config.expcore.command_role_parse'
|
|||||||
Commands.new_command('clear-inventory', 'Clears a players inventory')
|
Commands.new_command('clear-inventory', 'Clears a players inventory')
|
||||||
:add_param('player', false, 'player-role-alive')
|
:add_param('player', false, 'player-role-alive')
|
||||||
:add_alias('clear-inv', 'move-inventory', 'move-inv')
|
:add_alias('clear-inv', 'move-inventory', 'move-inv')
|
||||||
:register(function(player,action_player)
|
:register(function(_, player)
|
||||||
local inv = action_player.get_main_inventory()
|
local inv = player.get_main_inventory()
|
||||||
move_items(inv.get_contents())
|
move_items(inv.get_contents())
|
||||||
inv.clear()
|
inv.clear()
|
||||||
end)
|
end)
|
||||||
@@ -12,7 +12,7 @@ require 'config.expcore.command_general_parse'
|
|||||||
Commands.new_command('find-on-map', 'Find a player on your map.')
|
Commands.new_command('find-on-map', 'Find a player on your map.')
|
||||||
:add_param('player', false, 'player-online')
|
:add_param('player', false, 'player-online')
|
||||||
:add_alias('find', 'zoom-to')
|
:add_alias('find', 'zoom-to')
|
||||||
:register(function(player,action_player,raw)
|
:register(function(player, action_player)
|
||||||
local position = action_player.position
|
local position = action_player.position
|
||||||
player.zoom_to_world(position, 1.75)
|
player.zoom_to_world(position, 1.75)
|
||||||
return Commands.success -- prevents command complete message from showing
|
return Commands.success -- prevents command complete message from showing
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ Commands.new_command('search-help','Searches for a keyword in all commands you a
|
|||||||
:add_param('keyword', true)
|
:add_param('keyword', true)
|
||||||
:add_param('page', true, 'integer')
|
:add_param('page', true, 'integer')
|
||||||
:set_defaults{keyword='', page=1}
|
:set_defaults{keyword='', page=1}
|
||||||
:register(function(player,keyword,page,raw)
|
:register(function(player, keyword, page)
|
||||||
local player_index = player and player.index or 0
|
local player_index = player and player.index or 0
|
||||||
-- if keyword is a number then treat it as page number
|
-- if keyword is a number then treat it as page number
|
||||||
if tonumber(keyword) then
|
if tonumber(keyword) then
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ end
|
|||||||
--- Teleports you to your home location
|
--- Teleports you to your home location
|
||||||
-- @command home
|
-- @command home
|
||||||
Commands.new_command('home', 'Teleports you to your home location')
|
Commands.new_command('home', 'Teleports you to your home location')
|
||||||
:register(function(player,raw)
|
:register(function(player)
|
||||||
local home = homes[player.index]
|
local home = homes[player.index]
|
||||||
if not home or not home[1] then
|
if not home or not home[1] then
|
||||||
return Commands.error{'expcom-home.no-home'}
|
return Commands.error{'expcom-home.no-home'}
|
||||||
@@ -45,7 +45,7 @@ end)
|
|||||||
--- Sets your home location to your current position
|
--- Sets your home location to your current position
|
||||||
-- @command home-set
|
-- @command home-set
|
||||||
Commands.new_command('home-set', 'Sets your home location to your current position')
|
Commands.new_command('home-set', 'Sets your home location to your current position')
|
||||||
:register(function(player,raw)
|
:register(function(player)
|
||||||
local home = homes[player.index]
|
local home = homes[player.index]
|
||||||
if not home then
|
if not home then
|
||||||
home = {}
|
home = {}
|
||||||
@@ -59,7 +59,7 @@ end)
|
|||||||
--- Returns your current home location
|
--- Returns your current home location
|
||||||
-- @command home-get
|
-- @command home-get
|
||||||
Commands.new_command('home-get', 'Returns your current home location')
|
Commands.new_command('home-get', 'Returns your current home location')
|
||||||
:register(function(player,raw)
|
:register(function(player)
|
||||||
local home = homes[player.index]
|
local home = homes[player.index]
|
||||||
if not home or not home[1] then
|
if not home or not home[1] then
|
||||||
return Commands.error{'expcom-home.no-home'}
|
return Commands.error{'expcom-home.no-home'}
|
||||||
@@ -71,7 +71,7 @@ end)
|
|||||||
--- Teleports you to previous location
|
--- Teleports you to previous location
|
||||||
-- @command return
|
-- @command return
|
||||||
Commands.new_command('return', 'Teleports you to previous location')
|
Commands.new_command('return', 'Teleports you to previous location')
|
||||||
:register(function(player,raw)
|
:register(function(player)
|
||||||
local home = homes[player.index]
|
local home = homes[player.index]
|
||||||
if not home or not home[2] then
|
if not home or not home[2] then
|
||||||
return Commands.error{'expcom-home.no-return'}
|
return Commands.error{'expcom-home.no-return'}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ local function add_interface_callback(name,callback)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- this is a meta function for __index when self[key] is nil
|
-- this is a meta function for __index when self[key] is nil
|
||||||
local function get_index(self,key)
|
local function get_index(_, key)
|
||||||
if interface_env[key] then
|
if interface_env[key] then
|
||||||
return interface_env[key]
|
return interface_env[key]
|
||||||
elseif interface_modules[key] then
|
elseif interface_modules[key] then
|
||||||
@@ -60,7 +60,7 @@ Commands.new_command('interface','Sends an innovation to be ran and returns the
|
|||||||
:add_param('innovation', false)
|
:add_param('innovation', false)
|
||||||
:enable_auto_concat()
|
:enable_auto_concat()
|
||||||
:set_flag('admin_only')
|
:set_flag('admin_only')
|
||||||
:register(function(player,innovation,raw)
|
:register(function(player, innovation)
|
||||||
if not innovation:find('%s') and not innovation:find('return') then
|
if not innovation:find('%s') and not innovation:find('return') then
|
||||||
-- if there are no spaces and return is not present then return is appended to the start
|
-- if there are no spaces and return is not present then return is appended to the start
|
||||||
innovation='return '..innovation
|
innovation='return '..innovation
|
||||||
@@ -70,12 +70,12 @@ Commands.new_command('interface','Sends an innovation to be ran and returns the
|
|||||||
if player then -- player can be nil when it is the server
|
if player then -- player can be nil when it is the server
|
||||||
for name, callback in pairs(interface_callbacks) do
|
for name, callback in pairs(interface_callbacks) do
|
||||||
-- loops over callbacks and loads the values returned
|
-- loops over callbacks and loads the values returned
|
||||||
local success, rtn = pcall(callback,player)
|
local _, rtn = pcall(callback, player)
|
||||||
temp_env[name]=rtn
|
temp_env[name]=rtn
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- sets the global metatable to prevent new values being made
|
-- sets the global metatable to prevent new values being made
|
||||||
-- global will index to temp_env and new indexs saved to interface_sandbox
|
-- global will index to temp_env and new indexes saved to interface_sandbox
|
||||||
local old_mt = getmetatable(_G)
|
local old_mt = getmetatable(_G)
|
||||||
setmetatable(_G, {__index=temp_env, __newindex=interface_env})
|
setmetatable(_G, {__index=temp_env, __newindex=interface_env})
|
||||||
-- runs the innovation and returns values to the player
|
-- runs the innovation and returns values to the player
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ Commands.new_command('jail','Puts a player into jail and removes all other roles
|
|||||||
:add_param('player', false, 'player-role')
|
:add_param('player', false, 'player-role')
|
||||||
:add_param('reason', true)
|
:add_param('reason', true)
|
||||||
:enable_auto_concat()
|
:enable_auto_concat()
|
||||||
:register(function(player,action_player,reason,raw)
|
:register(function(player, action_player, reason)
|
||||||
reason = reason or 'Non Given.'
|
reason = reason or 'Non Given.'
|
||||||
local action_player_name_color = format_chat_player_name(action_player)
|
local action_player_name_color = format_chat_player_name(action_player)
|
||||||
local by_player_name_color = format_chat_player_name(player)
|
local by_player_name_color = format_chat_player_name(player)
|
||||||
@@ -35,7 +35,7 @@ Commands.new_command('unjail','Removes a player from jail.')
|
|||||||
:add_param('player', false, 'player-role')
|
:add_param('player', false, 'player-role')
|
||||||
:add_alias('clear-jail', 'remove-jail')
|
:add_alias('clear-jail', 'remove-jail')
|
||||||
:enable_auto_concat()
|
:enable_auto_concat()
|
||||||
:register(function(player,action_player,raw)
|
:register(function(player, action_player)
|
||||||
local action_player_name_color = format_chat_player_name(action_player)
|
local action_player_name_color = format_chat_player_name(action_player)
|
||||||
local by_player_name_color = format_chat_player_name(player)
|
local by_player_name_color = format_chat_player_name(player)
|
||||||
local player_name = player and player.name or '<server>'
|
local player_name = player and player.name or '<server>'
|
||||||
@@ -54,7 +54,7 @@ Commands.new_command('temp-ban','Temp bans a player until the next reset; this r
|
|||||||
:add_param('player', false, 'player-role')
|
:add_param('player', false, 'player-role')
|
||||||
:add_param('reason', false)
|
:add_param('reason', false)
|
||||||
:enable_auto_concat()
|
:enable_auto_concat()
|
||||||
:register(function(player,action_player,reason,raw)
|
:register(function(player, action_player, reason)
|
||||||
local action_player_name_color = format_chat_player_name(action_player)
|
local action_player_name_color = format_chat_player_name(action_player)
|
||||||
local by_player_name_color = format_chat_player_name(player)
|
local by_player_name_color = format_chat_player_name(player)
|
||||||
if Jail.temp_ban_player(action_player, player.name, reason) then
|
if Jail.temp_ban_player(action_player, player.name, reason) then
|
||||||
@@ -71,7 +71,7 @@ Commands.new_command('clear-temp-ban','Removes temp ban from a player; this will
|
|||||||
:add_param('player', false, 'player-role')
|
:add_param('player', false, 'player-role')
|
||||||
:add_alias('untemp-ban', 'remove-temp-ban')
|
:add_alias('untemp-ban', 'remove-temp-ban')
|
||||||
:enable_auto_concat()
|
:enable_auto_concat()
|
||||||
:register(function(player,action_player,raw)
|
:register(function(player, action_player)
|
||||||
local action_player_name_color = format_chat_player_name(action_player)
|
local action_player_name_color = format_chat_player_name(action_player)
|
||||||
local by_player_name_color = format_chat_player_name(player)
|
local by_player_name_color = format_chat_player_name(player)
|
||||||
if Jail.untemp_ban_player(action_player, player.name) then
|
if Jail.untemp_ban_player(action_player, player.name) then
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ Commands.new_command('kill','Kills yourself or another player.')
|
|||||||
return player
|
return player
|
||||||
end
|
end
|
||||||
end}
|
end}
|
||||||
:register(function(player,action_player,raw)
|
:register(function(player, action_player)
|
||||||
if not action_player then
|
if not action_player then
|
||||||
-- can only be nil if no player given and the user is dead
|
-- can only be nil if no player given and the user is dead
|
||||||
return Commands.error{'expcom-kill.already-dead'}
|
return Commands.error{'expcom-kill.already-dead'}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ local Commands = require 'expcore.commands' --- @dep expcore.commands
|
|||||||
Commands.new_command('me', 'Sends an action message in the chat')
|
Commands.new_command('me', 'Sends an action message in the chat')
|
||||||
:add_param('action', false)
|
:add_param('action', false)
|
||||||
:enable_auto_concat()
|
:enable_auto_concat()
|
||||||
:register(function(player,action,raw)
|
:register(function(player, action)
|
||||||
local player_name = player and player.name or '<Server>'
|
local player_name = player and player.name or '<Server>'
|
||||||
game.print(string.format('* %s %s *', player_name, action), player.chat_color)
|
game.print(string.format('* %s %s *', player_name, action), player.chat_color)
|
||||||
end)
|
end)
|
||||||
@@ -4,11 +4,8 @@
|
|||||||
]]
|
]]
|
||||||
|
|
||||||
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
local Commands = require 'expcore.commands' --- @dep expcore.commands
|
||||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
|
||||||
local Game = require 'utils.game' --- @dep utils.game
|
|
||||||
local config = require 'config.preset_player_quickbar' --- @dep config.preset_player_quickbar
|
local config = require 'config.preset_player_quickbar' --- @dep config.preset_player_quickbar
|
||||||
|
|
||||||
|
|
||||||
--- Loads your quickbar preset
|
--- Loads your quickbar preset
|
||||||
-- @command load-quickbar
|
-- @command load-quickbar
|
||||||
Commands.new_command('load-quickbar', 'Loads your preset Quickbar items')
|
Commands.new_command('load-quickbar', 'Loads your preset Quickbar items')
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ end
|
|||||||
Commands.new_command('rainbow', 'Sends an rainbow message in the chat')
|
Commands.new_command('rainbow', 'Sends an rainbow message in the chat')
|
||||||
:add_param('message', false)
|
:add_param('message', false)
|
||||||
:enable_auto_concat()
|
:enable_auto_concat()
|
||||||
:register(function(player,message,raw)
|
:register(function(player, message)
|
||||||
local player_name = player and player.name or '<Server>'
|
local player_name = player and player.name or '<Server>'
|
||||||
local player_color = player and player.color or nil
|
local player_color = player and player.color or nil
|
||||||
local color_step = 3/message:len()
|
local color_step = 3/message:len()
|
||||||
|
|||||||
@@ -2,11 +2,24 @@
|
|||||||
|
|
||||||
local Commands = require 'expcore.commands'
|
local Commands = require 'expcore.commands'
|
||||||
|
|
||||||
|
local function Modules(moduleInventory) -- returns the multiplier of the modules
|
||||||
|
local effect1 = moduleInventory.get_item_count("productivity-module") -- type 1
|
||||||
|
local effect2 = moduleInventory.get_item_count("productivity-module-2")-- type 2
|
||||||
|
local effect3 = moduleInventory.get_item_count("productivity-module-3") -- type 3
|
||||||
|
|
||||||
Commands.new_command('ratio','This command will give the input and ouput ratios of the selected machine. Use the parameter for calcualting the machines needed for that amount of items per second.')
|
local multi = effect1*4+effect2*6+effect3*10
|
||||||
|
return multi/100+1
|
||||||
|
end
|
||||||
|
|
||||||
|
local function AmountOfMachines(itemsPerSecond, output)
|
||||||
|
if(itemsPerSecond) then
|
||||||
|
return itemsPerSecond/output
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Commands.new_command('ratio', 'This command will give the input and output ratios of the selected machine. Use the parameter for calculating the machines needed for that amount of items per second.')
|
||||||
:add_param('itemsPerSecond', true, 'number')
|
:add_param('itemsPerSecond', true, 'number')
|
||||||
:register(function(player,itemsPerSecond,raw)
|
:register(function(player, itemsPerSecond)
|
||||||
|
|
||||||
local machine = player.selected -- selected machine
|
local machine = player.selected -- selected machine
|
||||||
if not machine then --nil check
|
if not machine then --nil check
|
||||||
return Commands.error{'expcom-ratio.notSelecting'}
|
return Commands.error{'expcom-ratio.notSelecting'}
|
||||||
@@ -15,20 +28,20 @@ Commands.new_command('ratio','This command will give the input and ouput ratios
|
|||||||
if machine.type ~= "assembling-machine" and machine.type ~= "furnace" then
|
if machine.type ~= "assembling-machine" and machine.type ~= "furnace" then
|
||||||
return Commands.error{'expcom-ratio.notSelecting'}
|
return Commands.error{'expcom-ratio.notSelecting'}
|
||||||
end
|
end
|
||||||
local recpie = machine.get_recipe() -- recpie
|
local recipe = machine.get_recipe() -- recipe
|
||||||
|
|
||||||
if not recpie then --nil check
|
if not recipe then --nil check
|
||||||
return Commands.error{'expcom-ratio.notSelecting'}
|
return Commands.error{'expcom-ratio.notSelecting'}
|
||||||
end
|
end
|
||||||
|
|
||||||
local items = recpie.ingredients -- items in that recpie
|
local items = recipe.ingredients -- items in that recipe
|
||||||
local product = recpie.products -- output items
|
local products = recipe.products -- output items
|
||||||
local amountOfMachines
|
local amountOfMachines
|
||||||
local moduleInvetory = machine.get_module_inventory()--the module Invetory of the machine
|
local moduleInventory = machine.get_module_inventory()--the module Inventory of the machine
|
||||||
local mult = Modules(moduleInvetory) --function for the productivety moduals
|
local multi = Modules(moduleInventory) --function for the productively modals
|
||||||
|
|
||||||
if itemsPerSecond then
|
if itemsPerSecond then
|
||||||
amountOfMachines = math.ceil( AmountOfMachines(itemsPerSecond,1/recpie.energy*machine.crafting_speed*product[1].amount*mult)) -- amount of machines
|
amountOfMachines = math.ceil( AmountOfMachines(itemsPerSecond, 1/recipe.energy*machine.crafting_speed*products[1].amount*multi)) -- amount of machines
|
||||||
end
|
end
|
||||||
if not amountOfMachines then
|
if not amountOfMachines then
|
||||||
amountOfMachines = 1 --set to 1 to make it not nil
|
amountOfMachines = 1 --set to 1 to make it not nil
|
||||||
@@ -43,13 +56,12 @@ Commands.new_command('ratio','This command will give the input and ouput ratios
|
|||||||
sprite = 'expcom-ratio.fluid-in'
|
sprite = 'expcom-ratio.fluid-in'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local ips = item.amount/recipe.energy*machine.crafting_speed*amountOfMachines --math on the items/fluids per second
|
||||||
local ips = item.amount/recpie.energy*machine.crafting_speed*amountOfMachines --math on the items/fluids per second
|
|
||||||
Commands.print {sprite, math.round(ips, 3), item.name}-- full string
|
Commands.print {sprite, math.round(ips, 3), item.name}-- full string
|
||||||
end
|
end
|
||||||
----------------------------products----------------------------
|
----------------------------products----------------------------
|
||||||
|
|
||||||
for i, product in ipairs(product) do
|
for i, product in ipairs(products) do
|
||||||
local sprite -- string to make the icon work either fluid ore item
|
local sprite -- string to make the icon work either fluid ore item
|
||||||
|
|
||||||
if product.type == "item" then
|
if product.type == "item" then
|
||||||
@@ -58,7 +70,7 @@ Commands.new_command('ratio','This command will give the input and ouput ratios
|
|||||||
sprite = 'expcom-ratio.fluid-out'
|
sprite = 'expcom-ratio.fluid-out'
|
||||||
end
|
end
|
||||||
|
|
||||||
local output = 1/recpie.energy*machine.crafting_speed*product.amount*mult --math on the outputs per second
|
local output = 1/recipe.energy*machine.crafting_speed*product.amount*multi --math on the outputs per second
|
||||||
Commands.print {sprite, math.round(output*amountOfMachines, 3), product.name} -- full string
|
Commands.print {sprite, math.round(output*amountOfMachines, 3), product.name} -- full string
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -68,18 +80,3 @@ Commands.new_command('ratio','This command will give the input and ouput ratios
|
|||||||
end
|
end
|
||||||
|
|
||||||
end)
|
end)
|
||||||
function Modules(moduleInvetory) -- returns the multeplier of the modules
|
|
||||||
local effect1 = moduleInvetory.get_item_count("productivity-module") -- type 1
|
|
||||||
local effect2 = moduleInvetory.get_item_count("productivity-module-2")-- type 2
|
|
||||||
local effect3 = moduleInvetory.get_item_count("productivity-module-3") -- type 3
|
|
||||||
|
|
||||||
local mult = effect1*4+effect2*6+effect3*10
|
|
||||||
return mult/100+1
|
|
||||||
end
|
|
||||||
|
|
||||||
function AmountOfMachines(itemsPerSecond,output)
|
|
||||||
if(itemsPerSecond) then
|
|
||||||
return itemsPerSecond/output
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ local max_time_to_live = 4294967295 -- unit32 max
|
|||||||
-- @tparam number range the range to repair stuff in, there is a max limit to this
|
-- @tparam number range the range to repair stuff in, there is a max limit to this
|
||||||
Commands.new_command('repair', 'Repairs entities on your force around you')
|
Commands.new_command('repair', 'Repairs entities on your force around you')
|
||||||
:add_param('range', false, 'integer-range', 1,config.max_range)
|
:add_param('range', false, 'integer-range', 1,config.max_range)
|
||||||
:register(function(player,range,raw)
|
:register(function(player, range)
|
||||||
local revive_count = 0
|
local revive_count = 0
|
||||||
local heal_count = 0
|
local heal_count = 0
|
||||||
local range2 = range^2
|
local range2 = range^2
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ end)
|
|||||||
:add_param('reason', false)
|
:add_param('reason', false)
|
||||||
:add_alias('report-player')
|
:add_alias('report-player')
|
||||||
:enable_auto_concat()
|
:enable_auto_concat()
|
||||||
:register(function(player,action_player,reason,raw)
|
:register(function(player, action_player, reason)
|
||||||
local action_player_name_color = format_chat_player_name(action_player)
|
local action_player_name_color = format_chat_player_name(action_player)
|
||||||
local by_player_name_color = format_chat_player_name(player)
|
local by_player_name_color = format_chat_player_name(player)
|
||||||
if Reports.report_player(action_player, player.name, reason) then
|
if Reports.report_player(action_player, player.name, reason) then
|
||||||
@@ -43,11 +43,11 @@ end)
|
|||||||
Commands.new_command('get-reports', 'Gets a list of all reports that a player has on them. If no player then lists all players and the number of reports on them.')
|
Commands.new_command('get-reports', 'Gets a list of all reports that a player has on them. If no player then lists all players and the number of reports on them.')
|
||||||
:add_param('player', true, 'player')
|
:add_param('player', true, 'player')
|
||||||
:add_alias('reports', 'list-reports')
|
:add_alias('reports', 'list-reports')
|
||||||
:register(function(player,action_player,raw)
|
:register(function(_, player)
|
||||||
if action_player then
|
if player then
|
||||||
local reports = Reports.get_reports(action_player)
|
local reports = Reports.get_reports(player)
|
||||||
local action_player_name_color = format_chat_player_name(action_player)
|
local player_name_color = format_chat_player_name(player)
|
||||||
Commands.print{'expcom-report.player-report-title',action_player_name_color}
|
Commands.print{'expcom-report.player-report-title', player_name_color}
|
||||||
for player_name, reason in pairs(reports) do
|
for player_name, reason in pairs(reports) do
|
||||||
local by_player_name_color = format_chat_player_name(player_name)
|
local by_player_name_color = format_chat_player_name(player_name)
|
||||||
Commands.print{'expcom-report.list', by_player_name_color, reason}
|
Commands.print{'expcom-report.list', by_player_name_color, reason}
|
||||||
@@ -55,7 +55,7 @@ Commands.new_command('get-reports','Gets a list of all reports that a player has
|
|||||||
else
|
else
|
||||||
local user_reports = Reports.user_reports
|
local user_reports = Reports.user_reports
|
||||||
Commands.print{'expcom-report.player-count-title'}
|
Commands.print{'expcom-report.player-count-title'}
|
||||||
for player_name,reports in pairs(user_reports) do
|
for player_name in pairs(user_reports) do
|
||||||
local player_name_color = format_chat_player_name(player_name)
|
local player_name_color = format_chat_player_name(player_name)
|
||||||
local report_count = Reports.count_reports(player_name)
|
local report_count = Reports.count_reports(player_name)
|
||||||
Commands.print{'expcom-report.list', player_name_color, report_count}
|
Commands.print{'expcom-report.list', player_name_color, report_count}
|
||||||
@@ -70,7 +70,7 @@ end)
|
|||||||
Commands.new_command('clear-reports', 'Clears all reports from a player or just the report from one player.')
|
Commands.new_command('clear-reports', 'Clears all reports from a player or just the report from one player.')
|
||||||
:add_param('player', false, 'player')
|
:add_param('player', false, 'player')
|
||||||
:add_param('from-player', true, 'player')
|
:add_param('from-player', true, 'player')
|
||||||
:register(function(player,action_player,from_player,raw)
|
:register(function(player, action_player, from_player)
|
||||||
if from_player then
|
if from_player then
|
||||||
if not Reports.remove_report(action_player, from_player.name, player.name) then
|
if not Reports.remove_report(action_player, from_player.name, player.name) then
|
||||||
return Commands.error{'expcom-report.not-reported'}
|
return Commands.error{'expcom-report.not-reported'}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ Commands.new_command('assign-role','Assigns a role to a player')
|
|||||||
:add_param('role', false, 'role')
|
:add_param('role', false, 'role')
|
||||||
:set_flag('admin-only')
|
:set_flag('admin-only')
|
||||||
:add_alias('rpromote', 'assign', 'role', 'add-role')
|
:add_alias('rpromote', 'assign', 'role', 'add-role')
|
||||||
:register(function(player,action_player,role,raw)
|
:register(function(player, action_player, role)
|
||||||
local player_highest = Roles.get_player_highest_role(player)
|
local player_highest = Roles.get_player_highest_role(player)
|
||||||
if player_highest.index < role.index then
|
if player_highest.index < role.index then
|
||||||
Roles.assign_player(action_player, role, player.name)
|
Roles.assign_player(action_player, role, player.name)
|
||||||
@@ -35,7 +35,7 @@ Commands.new_command('unassign-role','Unassigns a role from a player')
|
|||||||
:add_param('role', false, 'role')
|
:add_param('role', false, 'role')
|
||||||
:set_flag('admin-only')
|
:set_flag('admin-only')
|
||||||
:add_alias('rdemote', 'unassign', 'rerole', 'remove-role')
|
:add_alias('rdemote', 'unassign', 'rerole', 'remove-role')
|
||||||
:register(function(player,action_player,role,raw)
|
:register(function(player, action_player, role)
|
||||||
local player_highest = Roles.get_player_highest_role(player)
|
local player_highest = Roles.get_player_highest_role(player)
|
||||||
if player_highest.index < role.index then
|
if player_highest.index < role.index then
|
||||||
Roles.unassign_player(action_player, role, player.name)
|
Roles.unassign_player(action_player, role, player.name)
|
||||||
@@ -50,11 +50,11 @@ end)
|
|||||||
Commands.new_command('list-roles', 'Lists all roles in they correct order')
|
Commands.new_command('list-roles', 'Lists all roles in they correct order')
|
||||||
:add_param('player', true, 'player')
|
:add_param('player', true, 'player')
|
||||||
:add_alias('lsroles', 'roles')
|
:add_alias('lsroles', 'roles')
|
||||||
:register(function(player,action_player,raw)
|
:register(function(_, player)
|
||||||
local roles = Roles.config.order
|
local roles = Roles.config.order
|
||||||
local message = {'expcom-roles.list'}
|
local message = {'expcom-roles.list'}
|
||||||
if action_player then
|
if player then
|
||||||
roles = Roles.get_player_roles(action_player)
|
roles = Roles.get_player_roles(player)
|
||||||
end
|
end
|
||||||
for index, role in pairs(roles) do
|
for index, role in pairs(roles) do
|
||||||
role = Roles.get_role_from_any(role)
|
role = Roles.get_role_from_any(role)
|
||||||
@@ -62,8 +62,8 @@ Commands.new_command('list-roles','Lists all roles in they correct order')
|
|||||||
local role_name = format_chat_colour_localized(role.name, colour)
|
local role_name = format_chat_colour_localized(role.name, colour)
|
||||||
if index == 1 then
|
if index == 1 then
|
||||||
message = {'expcom-roles.list', role_name}
|
message = {'expcom-roles.list', role_name}
|
||||||
if action_player then
|
if player then
|
||||||
local player_name_colour = format_chat_player_name(action_player)
|
local player_name_colour = format_chat_player_name(player)
|
||||||
message = {'expcom-roles.list-player', player_name_colour, role_name}
|
message = {'expcom-roles.list-player', player_name_colour, role_name}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ require 'config.expcore.command_role_parse'
|
|||||||
Commands.new_command('tag', 'Sets your player tag.')
|
Commands.new_command('tag', 'Sets your player tag.')
|
||||||
:add_param('tag', false, 'string-max-length', 20)
|
:add_param('tag', false, 'string-max-length', 20)
|
||||||
:enable_auto_concat()
|
:enable_auto_concat()
|
||||||
:register(function(player,tag,raw)
|
:register(function(player, tag)
|
||||||
player.tag = '- '..tag
|
player.tag = '- '..tag
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ Commands.new_command('tag-clear','Clears your tag. Or another player if you are
|
|||||||
:set_defaults{player=function(player)
|
:set_defaults{player=function(player)
|
||||||
return player -- default is the user using the command
|
return player -- default is the user using the command
|
||||||
end}
|
end}
|
||||||
:register(function(player,action_player,raw)
|
:register(function(player, action_player)
|
||||||
if action_player.index == player.index then
|
if action_player.index == player.index then
|
||||||
-- no player given so removes your tag
|
-- no player given so removes your tag
|
||||||
action_player.tag = ''
|
action_player.tag = ''
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ Commands.new_command('teleport','Teleports a player to another player.')
|
|||||||
:add_param('to_player', false, 'player-online')
|
:add_param('to_player', false, 'player-online')
|
||||||
:add_alias('tp')
|
:add_alias('tp')
|
||||||
:set_flag('admin_only')
|
:set_flag('admin_only')
|
||||||
:register(function(player,from_player,to_player,raw)
|
:register(function(_, from_player, to_player)
|
||||||
if from_player.index == to_player.index then
|
if from_player.index == to_player.index then
|
||||||
-- return if attempting to teleport to self
|
-- return if attempting to teleport to self
|
||||||
return Commands.error{'expcom-tp.to-self'}
|
return Commands.error{'expcom-tp.to-self'}
|
||||||
@@ -41,7 +41,7 @@ end)
|
|||||||
Commands.new_command('bring', 'Teleports a player to you.')
|
Commands.new_command('bring', 'Teleports a player to you.')
|
||||||
:add_param('player', false, 'player-alive')
|
:add_param('player', false, 'player-alive')
|
||||||
:set_flag('admin_only')
|
:set_flag('admin_only')
|
||||||
:register(function(player,from_player,raw)
|
:register(function(player, from_player)
|
||||||
if from_player.index == player.index then
|
if from_player.index == player.index then
|
||||||
-- return if attempting to teleport to self
|
-- return if attempting to teleport to self
|
||||||
return Commands.error{'expcom-tp.to-self'}
|
return Commands.error{'expcom-tp.to-self'}
|
||||||
@@ -59,7 +59,7 @@ Commands.new_command('goto','Teleports you to a player.')
|
|||||||
:add_param('player', false, 'player-online')
|
:add_param('player', false, 'player-online')
|
||||||
:add_alias('tp-me', 'tpme')
|
:add_alias('tp-me', 'tpme')
|
||||||
:set_flag('admin_only')
|
:set_flag('admin_only')
|
||||||
:register(function(player,to_player,raw)
|
:register(function(player, to_player)
|
||||||
if to_player.index == player.index then
|
if to_player.index == player.index then
|
||||||
-- return if attempting to teleport to self
|
-- return if attempting to teleport to self
|
||||||
return Commands.error{'expcom-tp.to-self'}
|
return Commands.error{'expcom-tp.to-self'}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ Commands.new_command('give-warning','Gives a warning to a player; may lead to au
|
|||||||
:add_param('reason', false)
|
:add_param('reason', false)
|
||||||
:add_alias('warn')
|
:add_alias('warn')
|
||||||
:enable_auto_concat()
|
:enable_auto_concat()
|
||||||
:register(function(player,action_player,reason,raw)
|
:register(function(player, action_player, reason)
|
||||||
Warnings.add_warning(action_player, player.name, reason)
|
Warnings.add_warning(action_player, player.name, reason)
|
||||||
local action_player_name_color = format_chat_player_name(action_player)
|
local action_player_name_color = format_chat_player_name(action_player)
|
||||||
local by_player_name_color = format_chat_player_name(player)
|
local by_player_name_color = format_chat_player_name(player)
|
||||||
@@ -31,12 +31,12 @@ 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.')
|
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.')
|
||||||
:add_param('player', true, 'player')
|
:add_param('player', true, 'player')
|
||||||
:add_alias('warnings', 'list-warnings')
|
:add_alias('warnings', 'list-warnings')
|
||||||
:register(function(player,action_player,raw)
|
:register(function(_, player)
|
||||||
if action_player then
|
if player then
|
||||||
local warnings = Warnings.get_warnings(action_player)
|
local warnings = Warnings.get_warnings(player)
|
||||||
local script_warnings = Warnings.get_script_warnings(action_player)
|
local script_warnings = Warnings.get_script_warnings(player)
|
||||||
local action_player_name_color = format_chat_player_name(action_player)
|
local player_name_color = format_chat_player_name(player)
|
||||||
Commands.print{'expcom-warnings.player',action_player_name_color,warnings,script_warnings,config.temp_warning_limit}
|
Commands.print{'expcom-warnings.player', player_name_color, warnings, script_warnings, config.temp_warning_limit}
|
||||||
else
|
else
|
||||||
local rtn = {}
|
local rtn = {}
|
||||||
local user_warnings = Warnings.user_warnings
|
local user_warnings = Warnings.user_warnings
|
||||||
@@ -63,7 +63,7 @@ end)
|
|||||||
-- @tparam LuaPlayer player the player to clear the warnings from
|
-- @tparam LuaPlayer player the player to clear the warnings from
|
||||||
Commands.new_command('clear-warnings', 'Clears all warnings (and script warnings) from a player')
|
Commands.new_command('clear-warnings', 'Clears all warnings (and script warnings) from a player')
|
||||||
:add_param('player', false, 'player')
|
:add_param('player', false, 'player')
|
||||||
:register(function(player,action_player,raw)
|
:register(function(player, action_player)
|
||||||
Warnings.clear_warnings(action_player, player.name)
|
Warnings.clear_warnings(action_player, player.name)
|
||||||
Warnings.clear_script_warnings(action_player, player.name)
|
Warnings.clear_script_warnings(action_player, player.name)
|
||||||
local action_player_name_color = format_chat_player_name(action_player)
|
local action_player_name_color = format_chat_player_name(action_player)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
@alias player_list
|
@alias player_list
|
||||||
]]
|
]]
|
||||||
|
|
||||||
|
-- luacheck:ignore 211/Colors
|
||||||
local Gui = require 'expcore.gui' --- @dep expcore.gui
|
local Gui = require 'expcore.gui' --- @dep expcore.gui
|
||||||
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
local Roles = require 'expcore.roles' --- @dep expcore.roles
|
||||||
local Store = require 'expcore.store' --- @dep expcore.store
|
local Store = require 'expcore.store' --- @dep expcore.store
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
--luacheck:ignore global require
|
|
||||||
local loaded = package.loaded
|
local loaded = package.loaded
|
||||||
local raw_require = require
|
local raw_require = require
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user