Formated upto ExpGamingCore.Commands

This commit is contained in:
Cooldude2606
2018-09-17 21:36:29 +01:00
parent 4392671ce2
commit fcba578e83
23 changed files with 181 additions and 127 deletions

View File

@@ -1,27 +0,0 @@
--- A full ranking system for factorio.
-- @module ExpGamingCommands.kill
-- @author Cooldude2606
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
-- this file should be replaced with a collection but idk if fsm can hanndle collections in a collection
local Admin = require('ExpGamingAdmin.AdminLib')
--- Used to clear all parts of a player, removing warnings, reports, jail and temp ban
-- @command clear-all
-- @param player the player to clear
commands.add_command('clear-all', 'Clears a player of any temp-ban, reports or warnings', {
['player']={true,'player'}
}, function(event,args)
Admin.clear_player(args.player,event.player_index)
end)
return {
on_init = function(self)
if loaded_modules['ExpGamingAdmin.TempBan'] then verbose('ExpGamingAdmin.TempBan is installed; Loading tempban src') require(module_path..'/src/tempban',{Admin=Admin}) end
if loaded_modules['ExpGamingAdmin.Jail'] then verbose('ExpGamingAdmin.Jail is installed; Loading tempban src') require(module_path..'/src/jail',{Admin=Admin}) end
if loaded_modules['ExpGamingAdmin.Warnings'] then verbose('ExpGamingAdmin.Warnings is installed; Loading tempban src') require(module_path..'/src/warnings',{Admin=Admin}) end
if loaded_modules['ExpGamingAdmin.Reports'] then verbose('ExpGamingAdmin.Reports is installed; Loading tempban src') require(module_path..'/src/reports',{Admin=Admin}) end
if loaded_modules['ExpGamingAdmin.ClearInventory'] then verbose('ExpGamingAdmin.ClearInventory is installed; Loading tempban src') require(module_path..'/src/clear',{Admin=Admin}) end
end
}

View File

@@ -1,28 +0,0 @@
{
"name": "admin",
"version": "4.0.0",
"type": "Submodule",
"description": "Admins many of the admin featues which the script can use as in game commands.",
"location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCommands.admin_4.0.0.zip",
"keywords": [
"ExpGaming",
"Admin",
"Tools",
"Commands",
"Temp ban",
"Jail",
"Clear Inventory",
"Report",
"Warnings"
],
"dependencies": {
"ExpGamingLib": "^4.0.0",
"ExpGamingCore.Commands": "^4.0.0",
"ExpGamingAdmin.TempBan": "?^4.0.0",
"ExpGamingAdmin.Jail": "?^4.0.0",
"ExpGamingAdmin.Warnings": "?^4.0.0",
"ExpGamingAdmin.Reports": "^?4.0.0",
"ExpGamingAdmin.ClearInventory": "?^4.0.0"
},
"collection": "ExpGamingCommands_4.0.0"
}

View File

@@ -1,12 +0,0 @@
local Admin = Admin
--- Clears a players inventory and moves it to chests in spawn
-- @command clear-inv
-- @param player the player to clear the inventory of
commands.add_command('clear-inv', 'Clears a player\'s invetory', {
['player'] = {true,'player-rank'}
}, function(event,args)
local player = args.player
if Admin.is_banned(player) then player_return({'ExpGamingAdmin.cant-report-ban',args.player}) return commands.error end
Admin.move_inventory(player)
end)

View File

@@ -1,28 +0,0 @@
local Admin = Admin
local Ranking = require('ExpGamingCore.Ranking')
--- Used to jail a player which stops them from moving
-- @command jail
-- @param player the player to be jailed
-- @param[opt] reason the reason the player was jailed
commands.add_command('jail', 'Jails a player', {
['player']={true,'player-rank'},
['reason']={false,'string-inf'}
}, function(event,args)
local player = args.player
local reason = args.reason
if Ranking.get_rank(player):allowed('no-report') then player_return({'ExpGamingAdmin.cant-report',args.player}) return commands.error end
if Admin.is_banned(player) then player_return({'commands.cant-report-ban',args.player}) return commands.error end
Admin.jail(player,event.player_index,reason)
end)
--- Used to unjail a player
-- @command unjail
-- @param player the player to unjail
commands.add_command('unjail', 'Returns a player\'s old rank', {
['player']={true,'player'}
}, function(event,args)
local player = args.player
if Admin.is_banned(player) then player_return({'commands.cant-report-ban',args.player}) return commands.error end
Server.interface(Ranking.revert,true,player,event.player_index)
end)

View File

@@ -1,29 +0,0 @@
local Admin = Admin
local Ranking = require('ExpGamingCore.Ranking')
--- Reports a player
-- @command report
-- @param player the player to report
-- @param[opt] reason the reason why the player was reported
commands.add_command('report', 'Reports a player', {
['player']={true,'player-rank'},
['reason']={false,'string-inf'}
}, function(event,args)
local _player = Game.get_player(event)
local player = args.player
local reason = args.reason
if Admin.is_banned(player) then player_return({'ExpGamingAdmin.cant-report-ban',args.player}) return commands.error end
if Ranking.get_rank(player):allowed('no-report') then player_return({'ExpGamingAdmin.cant-report',args.player}) return commands.error end
for _,report in pairs(global.addons.reports.reports) do if report[1] == _player.name then player_return({'ExpGamingAdmin.cant-report',args.player}) return commands.error end end
for _,report in pairs(global.addons.reports.varified) do if report[1] == _player.name then player_return({'ExpGamingAdmin.cant-report',args.player}) return commands.error end end
Admin.report(player,event.player_index,reason)
end)
--- Clears the reports of the player
-- @command clear-reports
-- @param player the player to clear the reports of
commands.add_command('clear-reports', 'Clears a player\'s reports', {
['player'] = {true,Admin.is_not_banned}
}, function(event,args)
Admin.clear_reports(args.player,event.player_index)
end)

View File

@@ -1,15 +0,0 @@
local Admin = Admin
--- Used to temp ban a player and give a reason
-- @command temp-ban
-- @param player the player to temp ban
-- @param[opt] reason the reason for the ban
commands.add_command('temp-ban', 'Temporarily ban a player', {
['player']={true,'player-rank'},
['reason']={false,'string-inf'}
}, function(event,args)
local player = args.player
local reason = args.reason
if Admin.is_banned(player) then player_return({'ExpGamingAdmin.cant-report-ban',args.player}) return commands.error end
Admin.temp_ban(player,event.player_index,reason)
end)

View File

@@ -1,28 +0,0 @@
local Admin = Admin
local Ranking = require('ExpGamingCore.Ranking')
--- Gives a warning to a player
-- @command warn
-- @param player the player to give a warning to
-- @param[opt] reason the reason the player was given a warning
commands.add_command('warn', 'Gives a player a warning', {
['player']={true,'player-rank'},
['reason']={false,'string-inf'}
}, function(event,args)
local player = args.player
local reason = args.reason
if Admin.is_banned(player) then player_return({'ExpGamingAdmin.cant-report-ban',args.player}) return commands.error end
if Ranking.get_rank(player):allowed('no-report') then player_return({'ExpGamingAdmin.cant-report',args.player}) return commands.error end
Admin.give_warning(player,event.player_index,reason)
end)
--- Clears the warning of a player
-- @command clear-warnings
-- @param player the player to clear the warning of
commands.add_command('clear-warnings', 'Clears a player\'s warnings', {
['player'] = {true,'player'}
}, function(event,args)
local player = args.player
if Admin.is_banned(player) then player_return({'ExpGamingAdmin.cant-report-ban',args.player}) return commands.error end
Admin.clear_warings(player,event.player_index)
end)

View File

@@ -1,39 +1,39 @@
--- A full ranking system for factorio.
-- @module ExpGamingCommands.kill
-- @module ExpGamingCommands.bonus@^4.0.0
-- @author Cooldude2606
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
local global = global{}
local Game = require('FactorioStdLib.Game@^0.8.0')
-- these are the settings which are changed with scale being as +100%
local settings = {
{key='character_mining_speed_modifier',scale=3},
{key='character_crafting_speed_modifier',scale=3},
{key='character_running_speed_modifier',scale=3},
{key='character_build_distance_bonus',scale=20},
{key='character_reach_distance_bonus',scale=20},
{key='character_inventory_slots_bonus',scale=200}
character_mining_speed_modifier=3,
character_crafting_speed_modifier=3,
character_running_speed_modifier=3,
character_build_distance_bonus=20,
character_reach_distance_bonus=20,
character_inventory_slots_bonus=200
}
local global = global{}
local Game = require('FactorioStdLib.Game')
--- Allows a player to set there bonus
-- @command bonus
-- @param bonus the amount of bonus there will get
commands.add_command('bonus', 'Set your player bonus (default is 20, guest has 0)', {
['bonus'] = {true,'number-range',-1,50} -- -1 < math.floor(bonus) <= 50
['bonus'] = {true,'number-range-int',-1,50} -- -1 < math.floor(bonus) <= 50
}, function(event,args)
local player = Game.get_player(event)
local bonus = args.bonus
for _,setting in pairs(settings) do player[setting.key] = setting.scale*math.floor(bonus)*0.01 end
for key,setting in pairs(settings) do player[key] = setting*math.floor(bonus)*0.01 end
global[player.index]=bonus
player_return('Bonus set to: '..math.floor(bonus)..'%')
end)
end).default_admin_only = true
script.on_event(defines.events.on_player_respawned,function(event)
local player = Game.get_player(event)
local bonus = global[player.index]
if bonus then
for _,setting in pairs(settings) do player[setting.key] = setting.scale*math.floor(bonus)*0.01 end
for _,setting in pairs(settings) do player[key] = setting*math.floor(bonus)*0.01 end
end
end)
@@ -54,8 +54,8 @@ end)
return {
on_init= function(self)
if loaded_modules['ExpGamingCore.Ranking'] then
local Ranking = require('ExpGamingCore.Ranking')
if loaded_modules['ExpGamingCore.Ranking@^4.0.0'] then
local Ranking = require('ExpGamingCore.Ranking@^4.0.0')
-- instant respawn
script.on_event(defines.events.on_pre_player_died,function(event)
local player = Game.get_player(event)
@@ -74,10 +74,10 @@ return {
script.on_event(defines.events.rank_change,function(event)
local player = Game.get_player(event)
if event.new_rank:allowed('bonus') then
for _,setting in pairs(settings) do player[setting.key] = setting.scale*0.2 end
for _,setting in pairs(settings) do player[key] = setting*0.2 end
global[player.index]=20
else
for _,setting in pairs(settings) do player[setting.key] = 0 end
for _,setting in pairs(settings) do player[key] = 0 end
global[player.index]=nil
end
end)

View File

@@ -1,5 +1,5 @@
--- A full ranking system for factorio.
-- @module ExpGamingCommands.kill
-- @module ExpGamingCommands.cheatMode@4.0.0
-- @author Cooldude2606
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
@@ -11,4 +11,4 @@ commands.add_command('cheat-mode', 'Toggles cheat mode for a player', {
}, function(event,args)
local player = args.player or game.player
if player.cheat_mode == true then player.cheat_mode = false else player.cheat_mode = true end
end)
end).default_admin_only = true

View File

@@ -1,9 +1,9 @@
--- A full ranking system for factorio.
-- @module ExpGamingCommands.kill
-- @module ExpGamingCommands.home@4.0.0
-- @author Cooldude2606
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
local Game = require('FactorioStdLib.Game')
local Game = require('FactorioStdLib.Game@^0.8.0')
local global = global{}
--- Sets the home for a player

View File

@@ -1,9 +1,9 @@
--- A full ranking system for factorio.
-- @module ExpGamingCommands.kill
-- @module ExpGamingCommands.kill@4.0.0
-- @author Cooldude2606
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
local Game = require('FactorioStdLib.Game')
local Game = require('FactorioStdLib.Game@^4.0.0')
--- Kills a player of a lower rank
-- @command kill
@@ -15,4 +15,4 @@ commands.add_command('kill', 'Kills a player. No player name kills yourself.', {
local player = args.player
if player then player.character.die()
else _player.character.die() end
end)
end).default_admin_only = true

View File

@@ -3,7 +3,7 @@
"version": "4.0.0",
"type": "Submodule",
"description": "Adds a command which can be used to kill a player or yourself.",
"location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCommands.kill_4.0.0.zip",
"location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingAdmin.Commands_4.0.0.zip",
"keywords": [
"Command",
"ExpGaming",

View File

@@ -1,11 +1,11 @@
--- A full ranking system for factorio.
-- @module ExpGamingCommands.kill
-- @module ExpGamingCommands.repair@4.0.0
-- @author Cooldude2606
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
local Game = require('FactorioStdLib.Game')
local Ranking = require('ExpGamingCore.Ranking')
local Game = require('FactorioStdLib.Game@^0.8.0')
local Ranking = require('ExpGamingCore.Ranking@^4.0.0')
-- Set an item to true to disallow it from being repaired
local disallow = {
@@ -18,13 +18,22 @@ local disallow = {
-- Given const = 100: admin+ has unlimited, admin has const (100), mod has const / 2 (50), member has const / 5 (20)
local const = 100
local repairDisallow
-- Module Define
local module_verbose = false
local ThisModule = {
on_init = function(self)
if loaded_modules['ExpGamingAdmin.TempBan@^4.0.0'] then verbose('ExpGamingAdmin.TempBan is installed; Loading tempban src') repairDisallow = require(module_path..'/src/tempban') end
end
}
--- Used so that the value can be overriden if tempban is present
-- @local
-- @function repairDisallow
-- @param player the player who called the command
-- @param entity the entity which was repaired
local repairDisallow = function(player,entity)
repairDisallow = function(player,entity)
player_return('You have repaired: '..entity.name..' this item is not allowed.',defines.textcolor.crit,player)
entity.destroy()
end
@@ -54,10 +63,6 @@ commands.add_command('repair', 'Repairs all destoryed and damaged entites in an
for key, entity in pairs(player.surface.find_entities(area)) do
if entity.force == player.force and (entity.position.x-center.x)^2+(entity.position.y-center.y)^2 < sq_range and entity.health then entity.health = 10000 end
end
end)
end).default_admin_only = true
return {
on_init = function(self)
if loaded_modules['ExpGamingAdmin.TempBan'] then verbose('ExpGamingAdmin.TempBan is installed; Loading tempban src') repairDisallow = require(module_path..'/src/tempban') end
end
}
return ThisModule

View File

@@ -14,34 +14,6 @@
"contact": "Discord: Cooldude2606#5241",
"license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE",
"submodules": {
"admin": {
"name": "admin",
"version": "4.0.0",
"type": "Submodule",
"description": "Admins many of the admin featues which the script can use as in game commands.",
"location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCommands.admin_4.0.0.zip",
"keywords": [
"ExpGaming",
"Admin",
"Tools",
"Commands",
"Temp ban",
"Jail",
"Clear Inventory",
"Report",
"Warnings"
],
"dependencies": {
"ExpGamingLib": "^4.0.0",
"ExpGamingCore.Commands": "^4.0.0",
"ExpGamingAdmin.TempBan": "?^4.0.0",
"ExpGamingAdmin.Jail": "?^4.0.0",
"ExpGamingAdmin.Warnings": "?^4.0.0",
"ExpGamingAdmin.Reports": "^?4.0.0",
"ExpGamingAdmin.ClearInventory": "?^4.0.0"
},
"collection": "ExpGamingCommands_4.0.0"
},
"bonus": {
"name": "bonus",
"version": "4.0.0",
@@ -108,7 +80,7 @@
"version": "4.0.0",
"type": "Submodule",
"description": "Adds a command which can be used to kill a player or yourself.",
"location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingCommands.kill_4.0.0.zip",
"location": "https://github.com/explosivegaming/scenario/releases/download/v4.0-core/ExpGamingAdmin.Commands_4.0.0.zip",
"keywords": [
"Command",
"ExpGaming",
@@ -160,7 +132,7 @@
],
"dependencies": {
"ExpGamingLib": "^4.0.0",
"ExpGamingCore.Ranking": "^4.0.0",
"ExpGamingCore.Ranking": "?^4.0.0",
"ExpGamingCore.Commands": "^4.0.0",
"FactorioStdLib.Game": "^0.8.0"
},

View File

@@ -1,10 +1,19 @@
--- A full ranking system for factorio.
-- @module ExpGamingCommands.kill
-- @module ExpGamingCommands@4.0.0
-- @author Cooldude2606
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
local Game = require('FactorioStdLib.Game')
local Ranking = require('ExpGamingCore.Ranking')
local Game = require('FactorioStdLib.Game@^0.8.0')
local Ranking -- ExpGamingCore.Ranking@^4.0.0
-- Module Define
local module_verbose = false
local ThisModule = {
on_init=function()
if loaded_modules['ExpGamingCore.Ranking@^4.0.0'] then Ranking = require('ExpGamingCore.Ranking@^4.0.0') end
--code
end
}
--- Gives you a tag
-- @command tag
@@ -13,8 +22,10 @@ commands.add_command('tag', 'Give yourself a custom tag. Use "" to have more tha
['tag'] = {true,'string-len',20}
}, function(event,args)
local player = Game.get_player(event)
local rank = Ranking.get_rank(player)
player.tag = rank.tag..' - '..args.tag
if Ranking then
local rank = Ranking.get_rank(player)
player.tag = rank.tag..' - '..args.tag
else player.tag = args.tag end
player_return('Your tag has been set. Use /tag-clear to remove your tag')
end)
@@ -25,7 +36,10 @@ commands.add_command('tag-clear', 'Removes a custom tag. Player can be self (/ta
['player'] = {true,'player-rank'}
}, function(event,args)
local player = args.player
local rank = Ranking.get_rank(player)
player.tag = rank.tag
if Ranking then
local rank = Ranking.get_rank(player)
player.tag = rank.tag
else player.tag = '' end
player_return('Your tag has been removed.')
end)

View File

@@ -12,7 +12,7 @@
],
"dependencies": {
"ExpGamingLib": "^4.0.0",
"ExpGamingCore.Ranking": "^4.0.0",
"ExpGamingCore.Ranking": "?^4.0.0",
"ExpGamingCore.Commands": "^4.0.0",
"FactorioStdLib.Game": "^0.8.0"
},

View File

@@ -1,9 +1,9 @@
--- A full ranking system for factorio.
-- @module ExpGamingCommands.kill
-- @module ExpGamingCommands.teleport@4.0.0
-- @author Cooldude2606
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
local Admin = require('ExpGamingAdmin.Teleport')
local Admin = require('ExpGamingAdmin.Teleport@^4.0.0')
--- Teleports the user to the player given
-- @command go-to