Moved Files Around

This commit is contained in:
Cooldude2606
2019-04-18 22:24:10 +01:00
parent f6221ee68e
commit 89d52fc73b
57 changed files with 7 additions and 71 deletions

View File

@@ -1,49 +0,0 @@
--- Adds a custom ban function to the admin command set.
-- @module ExpGamingAdmin.Ban@4.0.0
-- @author Cooldude2606
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
-- @alias ThisModule
-- Module Require
local Admin = require('ExpGamingAdmin')
local AdminGui = require('ExpGamingAdmin.Gui')
local Server = require('ExpGamingCore.Server')
local Game = require('FactorioStdLib.Game')
local Color -- FactorioStdLib.Color@^0.8.0
local Sync -- ExpGamingCore.Sync@^4.0.0
-- Module Define
local module_verbose = false
local ThisModule = {
on_init=function()
if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end
if loaded_modules['FactorioStdLib.Color'] then Color = require('FactorioStdLib.Color') end
end
}
-- Function Define
AdminGui.add_button('Ban','utility/danger_icon',{'ExpGamingAdmin.tooltip-ban'},function(player,byPlayer)
Admin.open(byPlayer,player,'Ban')
end)
function Admin.ban(player,by_player,reason)
player = Game.get_player(player)
local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '<server>'
reason = Admin.create_reason(reason,by_player_name)
Admin.set_banned(player,true)
if Sync then Sync.emit_embedded{
title='Player Ban',
color=Color.to_hex(defines.textcolor.crit),
description='There was a player banned.',
['Player:']='<<inline>>'..player.name,
['By:']='<<inline>>'..by_player_name,
['Reason:']=reason
} end
if Admin.move_inventory then Admin.move_inventory(player) end
Server.interface(game.ban_player,true,player,reason)
end
Admin.add_action('Ban',Admin.ban)
-- Module Return
return setmetatable(ThisModule,{__call=Admin.ban})

View File

@@ -1,23 +0,0 @@
{
"name": "ExpGamingAdmin.Ban",
"version": "4.0.0",
"description": "Adds a custom ban function to the admin command set.",
"location": "FSM_ARCHIVE",
"keywords": [
"Ban",
"Admin",
"Set",
"ExpGaming"
],
"dependencies": {
"ExpGamingAdmin.Gui": "^4.0.0",
"ExpGamingCore.Server": "^4.0.0",
"FactorioStdLib.Game": "^0.8.0",
"FactorioStdLib.Color": "?^0.8.0",
"ExpGamingCore.Sync": "?^4.0.0",
"ExpGamingAdmin.ClearInventory": "?^4.0.0",
"ExpGamingAdmin": "^4.0.0"
},
"collection": "ExpGamingAdmin@4.0.0",
"submodules": {}
}

View File

@@ -1,25 +0,0 @@
--- A full ranking system for factorio.
-- @module ExpGamingAdmin.Commands@4.0.0
-- @author Cooldude2606
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
local Admin = require('ExpGamingAdmin')
--- 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',{self=Admin}) end
if loaded_modules['ExpGamingAdmin.Jail'] then verbose('ExpGamingAdmin.Jail is installed; Loading tempban src') require(module_path..'/src/jail',{self=Admin}) end
if loaded_modules['ExpGamingAdmin.Warnings'] then verbose('ExpGamingAdmin.Warnings is installed; Loading tempban src') require(module_path..'/src/warnings',{self=Admin}) end
if loaded_modules['ExpGamingAdmin.Reports'] then verbose('ExpGamingAdmin.Reports is installed; Loading tempban src') require(module_path..'/src/reports',{self=Admin}) end
if loaded_modules['ExpGamingAdmin.ClearInventory'] then verbose('ExpGamingAdmin.ClearInventory is installed; Loading tempban src') require(module_path..'/src/clear',{self=Admin}) end
end
}

View File

@@ -1,29 +0,0 @@
{
"name": "ExpGamingAdmin.Commands",
"version": "4.0.0",
"description": "Admins many of the admin featues which the script can use as in game commands.",
"location": "FSM_ARCHIVE",
"keywords": [
"ExpGaming",
"Admin",
"Tools",
"Commands",
"Temp ban",
"Jail",
"Clear Inventory",
"Report",
"Warnings"
],
"dependencies": {
"ExpGamingLib": "^4.0.0",
"ExpGamingCore.Command": "^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",
"ExpGamingAdmin": "^4.0.0"
},
"collection": "ExpGamingAdmin@4.0.0",
"submodules": {}
}

View File

@@ -1,12 +0,0 @@
local Admin = self
--- 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.name}) return commands.error end
Admin.move_inventory(player)
end)

View File

@@ -1,30 +0,0 @@
local Admin = self
local Role = require('ExpGamingCore.Role')
local Server = require('ExpGamingCore.Server')
--- 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 Role.has_flag(player,'not_reportable') then player_return{'ExpGamingAdmin.cant-report',args.player.name} return commands.error end
if Admin.is_banned(player) then player_return{'ExpGamingAdmin.cant-report-ban',args.player.name} 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,true) ~= 'jail' then player_return({'ExpGamingAdmin.cant-report-ban',args.player.name}) return commands.error end
Admin.set_banned(player,false)
Server.interface(Role.revert,true,player,event.player_index,2)
end)

View File

@@ -1,35 +0,0 @@
local Admin = self
local Role = require('ExpGamingCore.Role')
local Game = require('FactorioStdLib.Game')
--- 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.name}) return commands.error end
if Role.has_flag(player,'not_reportable') then player_return({'ExpGamingAdmin.cant-report',args.player.name}) 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.name}) return commands.error end end
for _,report in pairs(global.addons.reports.verified) do if report[1] == _player.name then player_return({'ExpGamingAdmin.cant-report',args.player.name}) 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,function(value)
local player,err = commands.validate['player'](value)
if err then return commands.error(err) end
local rtn = not Admin.is_banned(player) and player
if not rtn then return commands.error{'ExpGamingAdmin.cant-report-ban',value} end return rtn
end}
}, function(event,args)
Admin.clear_reports(args.player,event.player_index)
end)

View File

@@ -1,15 +0,0 @@
local Admin = self
--- 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) and Admin.is_banned(player,true) ~= 'jail' then player_return({'ExpGamingAdmin.cant-report-ban',args.player.name}) return commands.error end
Admin.temp_ban(player,event.player_index,reason)
end)

View File

@@ -1,28 +0,0 @@
local Admin = self
local Role = require('ExpGamingCore.Role')
--- 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.name} return commands.error end
if Role.has_flag(player,'not_reportable') then player_return{'ExpGamingAdmin.cant-report',args.player.name} 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.name}) return commands.error end
Admin.clear_warnings(player,event.player_index)
end)

View File

@@ -1,51 +0,0 @@
--- Adds a jail function to the admin set, require ExpGamingRole to work.
-- @module ExpGamingAdmin.Jail@4.0.0
-- @author Cooldude2606
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
-- @alias ThisModule
-- Module Require
local Admin = require('ExpGamingAdmin')
local AdminGui = require('ExpGamingAdmin.Gui')
local Server = require('ExpGamingCore.Server')
local Role = require('ExpGamingCore.Role')
local Color -- FactorioStdLib.Color@^0.8.0
local Sync -- ExpGamingCore.Sync@^4.0.0
-- Module Define
local module_verbose = false
local ThisModule = {
on_init=function()
if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end
if loaded_modules['FactorioStdLib.Color'] then Color = require('FactorioStdLib.Color') end
end
}
-- Function Define
AdminGui.add_button('jail','utility/clock',{'ExpGamingAdmin.tooltip-jail'},function(player,byPlayer)
Admin.open(byPlayer,player,'Jail')
end)
function Admin.jail(player,by_player,reason)
player, by_player = Admin.valid_players(player,by_player)
if not player then return end
reason = Admin.create_reason(reason,by_player.name)
Admin.set_banned(player,'jail')
if Sync then Sync.emit_embedded{
title='Player Jail',
color=Color.to_hex(defines.textcolor.med),
description='There was a player jailed.',
['Player:']='<<inline>>'..player.name,
['By:']='<<inline>>'..by_player.name,
['Reason:']=reason
} end
Role.meta.last_jail = player.name
player.driving = false
Server.interface(Role.assign,true,player,'Jail',by_player.name)
Server.interface(Role.unassign,true,player,Role.get(player),by_player.name)
end
Admin.add_action('Jail',Admin.jail)
-- Module Return
return setmetatable(ThisModule,{__call=Admin.jail})

View File

@@ -1,24 +0,0 @@
{
"name": "ExpGamingAdmin.Jail",
"version": "4.0.0",
"description": "Adds a jail function to the admin set, require ExpGamingRole to work.",
"location": "FSM_ARCHIVE",
"keywords": [
"Jail",
"Roles",
"Admin",
"ExpGaming"
],
"dependencies": {
"ExpGamingAdmin.Gui": "^4.0.0",
"ExpGamingCore.Server": "^4.0.0",
"ExpGamingCore.Role": "^4.0.0",
"FactorioStdLib.Game": "^0.8.0",
"FactorioStdLib.Color": "?^0.8.0",
"ExpGamingCore.Sync": "?^4.0.0",
"ExpGamingAdmin.ClearInventory": "?^4.0.0",
"ExpGamingAdmin": "^4.0.0"
},
"collection": "ExpGamingAdmin@4.0.0",
"submodules": {}
}

View File

@@ -1,47 +0,0 @@
--- Adds a kick function to the admin function set.
-- @module ExpGamingAdmin.Kick@4.0.0
-- @author Cooldude2606
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
-- @alias ThisModule
-- Module Require
local Admin = require('ExpGamingAdmin')
local AdminGui = require('ExpGamingAdmin.Gui')
local Server = require('ExpGamingCore.Server')
local Game = require('FactorioStdLib.Game')
local Color -- FactorioStdLib.Color@^0.8.0
local Sync -- ExpGamingCore.Sync@^4.0.0
-- Module Define
local module_verbose = false
local ThisModule = {
on_init=function()
if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end
if loaded_modules['FactorioStdLib.Color'] then Color = require('FactorioStdLib.Color') end
end
}
-- Function Define
AdminGui.add_button('Kick','utility/warning_icon',{'ExpGamingAdmin.tooltip-kick'},function(player,byPlayer)
Admin.open(byPlayer,player,'Kick')
end)
function Admin.kick(player,by_player,reason)
player = Game.get_player(player)
local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '<server>'
reason = Admin.create_reason(reason,by_player_name)
if Sync then Sync.emit_embedded{
title='Player Kick',
color=Color.to_hex(defines.textcolor.high),
description='There was a player kicked.',
['Player:']='<<inline>>'..player.name,
['By:']='<<inline>>'..by_player_name,
['Reason:']=reason
} end
if Admin.move_inventory then Admin.move_inventory(player) end
Server.interface(game.kick_player,true,player,reason)
end
Admin.add_action('Kick',Admin.kick)
-- Module Return
return setmetatable(ThisModule,{__call=Admin.kick})

View File

@@ -1,23 +0,0 @@
{
"name": "ExpGamingAdmin.Kick",
"version": "4.0.0",
"description": "Adds a kick function to the admin function set.",
"location": "FSM_ARCHIVE",
"keywords": [
"Admin",
"ExpGaming",
"Kick",
"Commands"
],
"dependencies": {
"ExpGamingAdmin.Gui": "^4.0.0",
"ExpGamingCore.Server": "^4.0.0",
"FactorioStdLib.Game": "^0.8.0",
"FactorioStdLib.Color": "?^0.8.0",
"ExpGamingCore.Sync": "?^4.0.0",
"ExpGamingAdmin.ClearInventory": "?^4.0.0",
"ExpGamingAdmin": "^4.0.0"
},
"collection": "ExpGamingAdmin@4.0.0",
"submodules": {}
}

View File

@@ -1,163 +0,0 @@
--- Adds a report system into the game that can also push notifactions to discord.
-- @module ExpGamingAdmin.Reports@4.0.0
-- @author Cooldude2606
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
-- @alias ThisModule
-- Module Require
local Admin = require('ExpGamingAdmin')
local Role = require('ExpGamingCore.Role')
local Gui = require('ExpGamingCore.Gui')
local Game = require('FactorioStdLib.Game')
local Color -- FactorioStdLib.Color@^0.8.0
local Sync -- ExpGamingCore.Sync@^4.0.0
-- Module Define
local module_verbose = false
local ThisModule = {
on_init=function()
if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end
if loaded_modules['FactorioStdLib.Color'] then Color = require('FactorioStdLib.Color') end
end
}
-- Global Define
local global = {
reports={},
verified={}
}
Global.register(global,function(tbl) global = tbl end)
-- Local Variables
local report_to_warnings = 1 -- used in count_reports
local verified_to_warnings = 3 -- used in count_reports
local reports_needed_for_jail = 6
-- Function Define
local function report_message(player,by_player,reason)
player, by_player = Admin.valid_players(player,by_player)
if not player then return end
if Admin.is_banned(player,true) == 'report' then return end
Role.print(Role.meta.groups.User.lowest,{'ExpGamingAdmin.low-print',player.name,reason},defines.textcolor.info,true)
Role.print(Role.meta.groups.Admin.lowest,{'ExpGamingAdmin.high-print',player.name,by_player.name,reason},defines.textcolor.med)
if Sync then Sync.emit_embedded{
title='Player Report',
color=Color.to_hex(defines.textcolor.med),
description='A player was reported.',
['Player:']='<<inline>>'..player.name,
['By:']='<<inline>>'..by_player.name,
['Reason:']=reason
} end
end
local function cheak_reports(player)
player = Game.get_player(player)
if not player then return end
local reports = Admin.count_reports(player)
if reports >= reports_needed_for_jail and Role.get_highest(player).group.name ~= 'Jail' then
Admin.jail(player,'<server>','Too many user reports. Contact an Admin to be unjailed.')
end
end
function Admin.count_reports(player)
player = Game.get_player(player)
if not player then return 0 end
local _count = 0
if global.reports[player.name] then
for _ in pairs(global.reports[player.name]) do
_count=_count+report_to_warnings
end
end
if global.verified[player.name] then
for _ in pairs(global.verified[player.name]) do
_count=_count+verified_to_warnings
end
end
return _count
end
function Admin.report(player,by_player,reason)
player, by_player = Admin.valid_players(player,by_player)
if not player or Role.has_flag(player,'not_reportable') then return end
if Admin.is_banned(by_player) or Role.has_flag(by_player,'is_jail') then return end
if Role.has_flag(by_player,'is_verified') then
global.verified[player.name] = global.verified[player.name] or {}
local reports = global.verified[player.name]
for _,value in pairs(reports) do
if value[1] == by_player.name then return end
end
table.insert(reports,{by_player.name,reason})
else
global.reports[player.name] = global.reports[player.name] or {}
local reports = global.reports[player.name]
for _,value in pairs(reports) do
if value[1] == by_player.name then return end
end
table.insert(reports,{by_player.name,reason})
end
report_message(player,by_player,reason)
cheak_reports(player)
end
function Admin.clear_reports(player,by_player,no_emit)
player, by_player = Admin.valid_players(player,by_player)
if not player then return end
global.reports[player.name]={}
global.verified[player.name]={}
if not no_emit and Sync then
Sync.emit_embedded{
title='Player Clear',
color=Color.to_hex(defines.textcolor.low),
description='A player had their reports cleared.',
['Player:']='<<inline>>'..player.name,
['By:']='<<inline>>'..by_player.name,
}
end
end
local confirm_report = Gui.inputs{
type='button',
name='admin-report-confirm',
caption='utility/spawn_flag',
tooltip={'ExpGamingAdmin.report'}
}:on_event('click',function(event)
local parent = event.element.parent
local player = Game.get_player(parent.player.caption)
local reason = parent.reason.text
Admin.report(player,event.player_index,reason)
Gui.center.clear(event.player_index)
end)
Admin.report_btn = Gui.inputs{
type='button',
name='admin-report',
caption='utility/spawn_flag',
tooltip={'ExpGamingAdmin.report'}
}:on_event('click',function(event)
local parent = event.element.parent
local player = Game.get_player(parent.children[1].name)
if not player then return end
local _player = Game.get_player(event)
Gui.center.clear(_player)
local frame = Gui.center.get_flow(_player).add{
type='frame',
name='report-gui'
}
_player.opened=frame
frame.caption={'ExpGamingAdmin.report'}
frame.add{
type='textfield',
name='reason'
}.style.width = 300
local btn = confirm_report:draw(frame)
btn.style.height = 30
btn.style.width = 30
frame.add{
type='label',
name='player',
caption=player.name
}.style.visible = false
end)
-- Module Return
return ThisModule

View File

@@ -1,25 +0,0 @@
{
"name": "ExpGamingAdmin.Reports",
"version": "4.0.0",
"description": "Adds a report system into the game that can also push notifactions to discord.",
"location": "FSM_ARCHIVE",
"keywords": [
"Report",
"Player",
"Admin",
"ExpGaming",
"Player List",
"Commands"
],
"dependencies": {
"ExpGamingCore.Server": "^4.0.0",
"ExpGamingCore.Role": "^4.0.0",
"FactorioStdLib.Game": "^0.8.0",
"FactorioStdLib.Color": "?^0.8.0",
"ExpGamingCore.Sync": "?^4.0.0",
"ExpGamingCore.Gui": "^4.0.0",
"ExpGamingAdmin": "^4.0.0"
},
"collection": "ExpGamingAdmin@4.0.0",
"submodules": {}
}

View File

@@ -1,43 +0,0 @@
--- Adds three function to admin: tp, bring and go to, these all move the player
-- @module ExpGamingAdmin.Teleport@4.0.0
-- @author Cooldude2606
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
-- @alias ThisModule
-- Module Require
local Admin = require('ExpGamingAdmin')
local AdminGui = require('ExpGamingAdmin.Gui')
local Game = require('FactorioStdLib.Game')
-- Module Define
local module_verbose = false
local ThisModule = {}
-- Function Define
AdminGui.add_button('Go To','utility/export_slot',{'ExpGamingAdmin.tooltip-go-to'},function(player,byPlayer)
Admin.go_to(player,byPlayer)
end)
AdminGui.add_button('Bring','utility/import_slot',{'ExpGamingAdmin.tooltip-bring'},function(player,byPlayer)
Admin.bring(player,byPlayer)
end)
function Admin.tp(from_player, to_player)
local _from_player = Game.get_player(from_player)
local _to_player = Game.get_player(to_player)
if not _from_player or not _to_player then return end
_from_player.teleport(_to_player.surface.find_non_colliding_position('player',_to_player.position,32,1),_to_player.surface)
end
function Admin.go_to(player,by_player)
Admin.tp(by_player, player)
end
function Admin.bring(player,by_player)
Admin.tp(player, by_player)
end
Admin.add_action('Go To',Admin.go_to)
Admin.add_action('Bring',Admin.bring)
-- Module Return
return setmetatable(ThisModule,{__call=Admin.tp})

View File

@@ -1,22 +0,0 @@
{
"name": "ExpGamingAdmin.Teleport",
"version": "4.0.0",
"description": "Adds three function to admin: tp, bring and go to, these all move the player.",
"location": "FSM_ARCHIVE",
"keywords": [
"Tp",
"Bring",
"Go To",
"Admin",
"ExpGaming",
"Teleport",
"Commands"
],
"dependencies": {
"ExpGamingAdmin.Gui": "^4.0.0",
"FactorioStdLib.Game": "^0.8.0",
"ExpGamingAdmin": "^4.0.0"
},
"collection": "ExpGamingAdmin@4.0.0",
"submodules": {}
}

View File

@@ -1,48 +0,0 @@
--- Adds a temp ban function to the admin set, requires ExpGamingCore.Role to work.
-- @module ExpGamingAdmin.KicTempBan@4.0.0
-- @author Cooldude2606
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
-- @alias ThisModule
-- Module Require
local Admin = require('ExpGamingAdmin')
local Server = require('ExpGamingCore.Server')
local Role = require('ExpGamingCore.Role')
local Game = require('FactorioStdLib.Game')
local Color -- FactorioStdLib.Color@^0.8.0
local Sync -- ExpGamingCore.Sync@^4.0.0
-- Module Define
local module_verbose = false
local ThisModule = {
on_init=function()
if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end
if loaded_modules['FactorioStdLib.Color'] then Color = require('FactorioStdLib.Color') end
end
}
-- Function Define
function Admin.temp_ban(player,by_player,reason)
local player = Game.get_player(player)
local by_player_name = Game.get_player(by_player) and Game.get_player(by_player).name or '<server>'
if not player or Admin.is_banned(player) then return end
Admin.set_banned(player,'temp')
if Sync then Sync.emit_embedded{
title='Player Temp-Ban',
color=Color.to_hex(defines.textcolor.high),
description='A player was jailed.',
['Player:']='<<inline>>'..player.name,
['By:']='<<inline>>'..by_player_name,
['Reason:']=Admin.create_reason(reason,by_player_name)
} end
game.print({'ExpGamingAdmin.temp-ban',player.name,by_player_name,reason},defines.textcolor.info)
if Admin.move_inventory then Admin.move_inventory(player) end
Role.meta.last_jail = player.name
Server.interface(Role.unassign,true,player,Role.get(player),by_player_name)
Server.interface(Role.assign,true,player,'Jail',by_player_name)
end
Admin.add_action('Temp Ban',Admin.temp_ban)
-- Module Return
return setmetatable(ThisModule,{__call=Admin.temp_ban})

View File

@@ -1,24 +0,0 @@
{
"name": "ExpGamingAdmin.TempBan",
"version": "4.0.0",
"description": "Adds a temp ban function to the admin set, requires ExpGamingCore.Role to work.",
"location": "FSM_ARCHIVE",
"keywords": [
"Jail",
"Temp Ban",
"Admin",
"ExpGaming",
"Roles"
],
"dependencies": {
"ExpGamingCore.Server": "^4.0.0",
"ExpGamingCore.Role": "^4.0.0",
"FactorioStdLib.Game": "^0.8.0",
"FactorioStdLib.Color": "?^0.8.0",
"ExpGamingCore.Sync": "?^4.0.0",
"ExpGamingAdmin.ClearInventory": "?^4.0.0",
"ExpGamingAdmin": "^4.0.0"
},
"collection": "ExpGamingAdmin@4.0.0",
"submodules": {}
}

View File

@@ -1,142 +0,0 @@
--- Adds a warning system into the admin set which can be used by admins and the script.
-- @module ExpGamingAdmin.Warnings@4.0.0
-- @author Cooldude2606
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
-- @alias ThisModule
-- Module Require
local Admin = require('ExpGamingAdmin')
local Server = require('ExpGamingCore.Server')
local Role = require('ExpGamingCore.Role')
local Game = require('FactorioStdLib.Game')
local Color -- FactorioStdLib.Color@^0.8.0
local Sync -- ExpGamingCore.Sync@^4.0.0
-- Local Variables
local take_action = 8 -- the first admin given warning jumps to this number, this case kick-warn is giving
local remove_warnings_time = {}
local min_time_to_remove_warning = 18000 -- this is in ticks
local punishments = {
{'nothing'},
{'nothing'},
{'nothing'},
{'nothing'},
{'nothing'},
{'message',{'ExpGamingAdmin-Warnings.message'},defines.textcolor.info},
{'message',{'ExpGamingAdmin-Warnings.message'},defines.textcolor.info},
{'message',{'ExpGamingAdmin-Warnings.kick-warn'},defines.textcolor.med},
{'kick'},
{'message',{'ExpGamingAdmin-Warnings.temp-warn'},defines.textcolor.high},
{'temp-ban'},
{'message',{'ExpGamingAdmin-Warnings.ban-warn'},defines.textcolor.high},
{'message',{'ExpGamingAdmin-Warnings.last-warn'},defines.textcolor.crit},
{'ban'}
}
-- Module Define
local module_verbose = false
local ThisModule = {
on_init=function()
if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end
if loaded_modules['FactorioStdLib.Color'] then Color = require('FactorioStdLib.Color') end
if loaded_modules['ExpGamingAdmin.Reports'] then
take_action = take_action + 1
table.insert(punishments,take_action,{'report',{'ExpGamingAdmin-Warnings.reported'},defines.textcolor.med})
end
end,
on_post=function()
local highest = nil
for _,role in pairs(Role.roles) do
local power = role.index
if not highest and not role.not_reportable then highest = power-1 end
local _power = power; if highest then _power = power-highest end
if role.not_reportable then remove_warnings_time[power] = 0
else remove_warnings_time[power] = min_time_to_remove_warning*_power end
end
end
}
-- Global Define
local global = {}
Global.register(global,function(tbl) global = tbl end)
-- Function Define
local function give_punishment(player,by_player,reason)
player, by_player = Admin.valid_players(player,by_player)
reason = reason or 'No Other Reason'
local warnings = Admin.get_warnings(player)
local punishment = punishments[warnings]
if not punishment or punishment[1] == 'nothing' then return
elseif punishment[1] == 'message' then
local message = punishment[2]
local colour = punishment[3]
player_return(message,colour,player)
elseif punishment[1] == 'report' then
local message = punishment[2]
local colour = punishment[3]
player_return(message,colour,player)
Admin.report(player,'<server>',reason)
elseif punishment[1] == 'kick' then
Admin.kick(player,by_player,'Too Many Warnings: '..warnings-(take_action-1)..' Also: '..reason)
elseif punishment[1] == 'temp-ban' then
Admin.temp_ban(player,by_player,'Too Many Warnings: '..warnings-(take_action-1)..' Also: '..reason)
elseif punishment[1] == 'ban' then
Admin.ban(player,by_player,'Too Many Warnings: '..warnings-(take_action-1)..' Also: '..reason)
end
end
function Admin.get_warnings(player)
player = Game.get_player(player)
return global[player.name] or 0
end
function Admin.give_warning(player,by_player,reason,min)
player, by_player = Admin.valid_players(player,by_player)
if not player then return end
min = Game.get_player(by_player) and Game.get_player(by_player) ~= SERVER and take_action or min or 0
local warnings = Admin.get_warnings(player)
if warnings < min then warnings = min-1 end
warnings = warnings+1
global[player.name] = warnings
if warnings > take_action then
player_return({'ExpGamingAdmin-Warnings.warning-given-by',by_player.name},defines.textcolor.info,player)
game.print({'ExpGamingAdmin-Warnings.player-warning',player.name,by_player.name,reason})
end
give_punishment(player,by_player,reason)
end
function Admin.clear_warnings(player,by_player,no_emit)
player, by_player = Admin.valid_players(player,by_player)
if not player then return end
global[player.name]=nil
if not no_emit and Sync then
Sync.emit_embedded{
title='Player Clear',
color=Color.to_hex(defines.textcolor.low),
description='A player had their warnings cleared.',
['Player:']='<<inline>>'..player.name,
['By:']='<<inline>>'..by_player.name,
}
end
end
-- Event Handlers Define
Event.add(defines.events.on_tick,function(event)
if (game.tick % min_time_to_remove_warning) == 0 then
for name,warnings in pairs(global) do
if warnings > 0 then
local role = Role.get_highest(name)
local time_to_remove = remove_warnings_time[role.index]
if (game.tick % time_to_remove) == 0 then
global[name]=warnings-1
if global[name] > 5 then
player_return({'ExpGamingAdmin-Warnings.remove-warn',global[name],tick_to_display_format(time_to_remove)},defines.textcolor.low,name)
end
end
end
end
end
end)
-- Module Return
return ThisModule

View File

@@ -1,11 +0,0 @@
[ExpGamingAdmin-Warnings]
warning-given-by=This Warnings Was Given By: __1__
player-warning=__1__ was given a warning by __2__ reason: __3__
temp-ban=__1__ was temp-ban by __2__ and will remain in jail untill next reset
remove-warn=You are had a warning Removed, you have __1__ warnings, next removed in __2__
message=You Are Currently Reciving Warnings From The Script, This Will Continue Unless You Cease And Desist
reported=You Have Been Reported To The Admins By The Script, Further Acction May Be Taken If You Do Not Cease And Desist.
kick-warn=You Are On A Warning To Be KICKED, The Script Will Auto Kick If You Do Not Cease And Desist.
temp-warn=You Are On A Warning To Be TEMP BANNED, The Script Will Auto Ban If You Do Not Cease And Desist.
ban-warn=You Are On A Warning To Be BANNED, The Script Will Auto Ban If You Do Not Cease And Desist.
last-warn=YOU ARE ON A LAST WARNING TO BE BANNED, THE SCRIPT WILL AUTO BAN IF YOU DO NOT CEASE AND DESIST.

View File

@@ -1,10 +0,0 @@
[ExpGamingAdmin-Warnings]
warning-given-by=This warning was given by: __1__
player-warning=__1__ was given a warning by __2__ for: __3__
remove-warn=One of your warnings expired. You have __1__ warnings left, next warning will be removed in __2__
message=You are currently being warned by the system. These will continue until you cease and desist.
reported=You have been reported to the admins by the system. Further action may be taken if you do not cease and desist.
kick-warn=This is your last warning before you get kicked. The system will automatically kick you if you do not cease and desist.
temp-warn=This is your last warning before you get temporary banned. The system will automatically ban you if you do not cease and desist.
ban-warn=WARNING: This is your last warning before you get BANNED. The system will automatically BAN you if you do not cease and desist.
last-warn=WARNING: This is your last warning before you get PERMANENTLY BANNED. The system will automatically PERMANENTLY BAN you if you do not cease and desist.

View File

@@ -1,11 +0,0 @@
[ExpGamingAdmin-Warnings]
warning-given-by=This Warnings Was Given By: __1__
player-warning=__1__ was given a warning by __2__ reason: __3__
temp-ban=__1__ was temp-ban by __2__ and will remain in jail untill next reset
remove-warn=You are had a warning Removed, you have __1__ warnings, next removed in __2__
message=You Are Currently Reciving Warnings From The Script, This Will Continue Unless You Cease And Desist
reported=You Have Been Reported To The Admins By The Script, Further Acction May Be Taken If You Do Not Cease And Desist.
kick-warn=You Are On A Warning To Be KICKED, The Script Will Auto Kick If You Do Not Cease And Desist.
temp-warn=You Are On A Warning To Be TEMP BANNED, The Script Will Auto Ban If You Do Not Cease And Desist.
ban-warn=You Are On A Warning To Be BANNED, The Script Will Auto Ban If You Do Not Cease And Desist.
last-warn=YOU ARE ON A LAST WARNING TO BE BANNED, THE SCRIPT WILL AUTO BAN IF YOU DO NOT CEASE AND DESIST.

View File

@@ -1,11 +0,0 @@
[ExpGamingAdmin-Warnings]
warning-given-by=Deze waarschuwing is gegeven door: __1__
player-warning=__1__ is gewaarschuwd door __2__ met de reden: __3__
temp-ban=__1__ is verbannen door __2__ en is gejailed tot de volgende reset.
remove-warn=Een waarschuwing is verlopen. Je hebt nu nog maar __1__ waarschuwing, volgende waarschuwing verloopt in __2__
message=Je ontvangt waarschuwingen door het systeem. Deze waarschuwingen stoppen niet tot je stopt met wat je verkeerd doet.
reported=Je bent gerapporteerd aan de administrators door het systeem. Je zal bestraft worden als je niet stopt met wat je verkeerd doet.
kick-warn=WAARSCHUWING: Dit is je laatste waarschuwing voordat je gekickt wordt.
temp-warn=WAARSCHUWING: Dit is je laatste waarschuwing voordat je tijdelijk verbannen wordt.
ban-warn=WAARSCHUWING: Dit is je laatste waarschuwing voordat je permanent verbannen wordt.
last-warn=DIT IS JE LAATSTE WAARSCHUWING. Het systeem zal je automatisch VERBANNEN als je niet stopt met wat je verkeerd doet.

View File

@@ -1,10 +0,0 @@
[ExpGamingAdmin-Warnings]
warning-given-by=Den här varningen gavs av: __1__
player-warning=__1__ var tillfälligt bannlyst av __2__ och kommer att förbli i fängelset tills nästa återställning (reset)
remove-warn=En av dina varningar har gått ut. Du har __1__ varning kvar, nästa varning kommer at tas bort om __2__
message=Du får för nuvarande varningar av systemet. De kommer fortsätta tills du upphör med överträdelsen.
reported= Du har blivit rapporterad till administrationen av systemet. Mer påföljd kan komma att tas om du inte upphör med överträdelsen.
kick-warn=Det här är din sista varning innan du blir sparkad. Systemet kommer att automatisk sparka dig om du inte upphör med överträdelsen
temp-warn=Det här är din sista varning innan du blir tillfälligt bannlyst. Systemet kommer att automatiskt bannlysa dig om du inte upphör överträdelsen
ban-warn=VARNING: Det här är din sista varning innan du blir bannlyst. Systemet kommer att automatisk bannlysa dig om du inte upphör med överträdelsen.
last-warn=VARNING: Det här är din sista varning innan du blir permanent bannlyst. Systemet kommer att automatiskt permanent bannlysa dig om du inte upphör med överträdelsen.

View File

@@ -1,26 +0,0 @@
{
"name": "ExpGamingAdmin.Warnings",
"version": "4.0.0",
"description": "Adds a warning system into the admin set which can be used by admins and the script.",
"location": "FSM_ARCHIVE",
"keywords": [
"Warning",
"Admin",
"ExpGaming",
"Report",
"Kick",
"Punishments",
"Ban"
],
"dependencies": {
"ExpGamingCore.Server": "^4.0.0",
"ExpGamingCore.Role": "^4.0.0",
"FactorioStdLib.Game": "^0.8.0",
"FactorioStdLib.Color": "?^0.8.0",
"ExpGamingAdmin.Reports": "?^4.0.0",
"ExpGamingCore.Sync": "?^4.0.0",
"ExpGamingAdmin": "^4.0.0"
},
"collection": "ExpGamingAdmin@4.0.0",
"submodules": {}
}