Added Modules to be converted

This commit is contained in:
Cooldude2606
2018-06-24 19:14:28 +01:00
parent 593d484f37
commit f73f1011d4
39 changed files with 3853 additions and 0 deletions

View File

@@ -0,0 +1,81 @@
--[[
Explosive Gaming
This file can be used with permission but this and the credit below must remain in the file.
Contact a member of management on our discord to seek permission to use our code.
Any changes that you may make to the code are yours but that does not make the script yours.
Discord: https://discord.gg/r6dC2uK
]]
--Please Only Edit Below This Line-----------------------------------------------------------
commands.add_command('report', 'Reports a player', {'player','reason',true}, function(event,args)
local _player = Game.get_player(event)
local player = Game.get_player(args.player)
local reason = args.reason
if not player then player_return({'commands.invalid-player',args.player}) return commands.error end
if Admin.is_banned(player) then player_return({'reports.cant-report-ban',args.player}) return commands.error end
if Ranking.get_rank(player):allowed('no-report') then player_return({'reports.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({'reports.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({'reports.cant-report',args.player}) return commands.error end end
Admin.report(player,event.player_index,reason)
end)
commands.add_command('warn', 'Gives a player a warning', {'player','reason',true}, function(event,args)
local player = Game.get_player(args.player)
local reason = args.reason
if not player then player_return({'commands.invalid-player',args.player}) return commands.error end
if Admin.is_banned(player) then player_return({'reports.cant-report-ban',args.player}) return commands.error end
if Ranking.get_rank(player):allowed('no-report') then player_return({'reports.cant-report',args.player}) return commands.error end
Admin.give_warning(player,event.player_index,reason)
end)
commands.add_command('jail', 'Jails a player', {'player','reason',true}, function(event,args)
local player = Game.get_player(args.player)
local reason = args.reason
if not player then player_return({'commands.invalid-player',args.player}) return commands.error end
if Ranking.get_rank(player):allowed('no-report') then player_return({'reports.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)
commands.add_command('unjail', 'Returns a player\'s old rank', {'player',true}, function(event,args)
local player = Game.get_player(args.player)
if not player then player_return({'commands.invalid-player',args.player}) return commands.error end
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)
commands.add_command('temp-ban', 'Temporarily ban a player', {'player','reason',true}, function(event,args)
local player = Game.get_player(args.player)
local reason = args.reason
if not player then player_return({'commands.invalid-player',args.player}) return commands.error end
if Admin.is_banned(player) then player_return({'reports.cant-report-ban',args.player}) return commands.error end
Admin.temp_ban(player,event.player_index,reason)
end)
commands.add_command('clear-inv', 'Clears a player\'s invetory', {'player'}, function(event,args)
local player = Game.get_player(args.player)
if not player then player_return({'commands.invalid-player',args.player}) return commands.error end
if Admin.is_banned(player) then player_return({'reports.cant-report-ban',args.player}) return commands.error end
Admin.move_inventory(player)
end)
commands.add_command('clear-warnings', 'Clears a player\'s warnings', {'player'}, function(event,args)
local player = Game.get_player(args.player)
if not player then player_return({'commands.invalid-player',args.player}) return commands.error end
if Admin.is_banned(player) then player_return({'reports.cant-report-ban',args.player}) return commands.error end
Admin.clear_warings(player,event.player_index)
end)
commands.add_command('clear-reports', 'Clears a player\'s reports', {'player'}, function(event,args)
local player = Game.get_player(args.player)
if not player then player_return({'commands.invalid-player',args.player}) return commands.error end
if Admin.is_banned(player) then player_return({'reports.cant-report-ban',args.player}) return commands.error end
Admin.clear_reports(player,event.player_index)
end)
commands.add_command('clear-all', 'Clears a player of any temp-ban, reports or warnings', {'player'}, function(event,args)
local player = Game.get_player(args.player)
if not player then player_return({'commands.invalid-player',args.player}) return commands.error end
Admin.clear_player(player,event.player_index)
end)

View File

@@ -0,0 +1,66 @@
--[[
Explosive Gaming
This file can be used with permission but this and the credit below must remain in the file.
Contact a member of management on our discord to seek permission to use our code.
Any changes that you may make to the code are yours but that does not make the script yours.
Discord: https://discord.gg/r6dC2uK
]]
--Please Only Edit Below This Line-----------------------------------------------------------
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}
}
local function _bonus(reset)
global.addons = not reset and global.addons or {}
global.addons.bonus = not reset and global.addons.bonus or {}
return global.addons.bonus
end
commands.add_command('bonus', 'Set your player bonus (default is 20, guest has 0)', {'bonus'}, function(event,args)
local player = Game.get_player(event)
local bonus = tonumber(args.bonus)
if not bonus or bonus < 0 or bonus > 50 then player_return{'commands.invalid-range',0,50} return commands.error end
for _,setting in pairs(settings) do player[setting.key] = setting.scale*math.floor(bonus)*0.01 end
_bonus()[player.index]=bonus
player_return('Bonus set to: '..math.floor(bonus)..'%')
end)
Event.register(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
_bonus()[player.index]=20
else
for _,setting in pairs(settings) do player[setting.key] = 0 end
_bonus()[player.index]=nil
end
end)
Event.register(defines.events.on_player_respawned,function(event)
local player = Game.get_player(event)
local bonus = _bonus()[player.index]
if bonus then
for _,setting in pairs(settings) do player[setting.key] = setting.scale*math.floor(bonus)*0.01 end
end
end)
Event.register(defines.events.on_pre_player_died,function(event)
local player = Game.get_player(event)
if Ranking.get_rank(player):allowed('bonus-respawn') then
player.ticks_to_respawn = 120
-- manually dispatch death event because it is not fired when ticks_to_respawn is set pre death
Event.dispatch{
name=defines.events.on_player_died,
tick=event.tick,
player_index=event.player_index,
cause = event.cause
}
end
end)

View File

@@ -0,0 +1,15 @@
--[[
Explosive Gaming
This file can be used with permission but this and the credit below must remain in the file.
Contact a member of management on our discord to seek permission to use our code.
Any changes that you may make to the code are yours but that does not make the script yours.
Discord: https://discord.gg/r6dC2uK
]]
--Please Only Edit Below This Line-----------------------------------------------------------
commands.add_command('cheat-mode', 'Toggles cheat mode for a player', {'player'}, function(event,args)
local player = Game.get_player(args.player)
if not player then player_return({'commands.invalid-player',args.player}) return commands.error end
if player.cheat_mode == true then player.cheat_mode = false else player.cheat_mode = true end
end)

View File

@@ -0,0 +1,37 @@
--[[
Explosive Gaming
This file can be used with permission but this and the credit below must remain in the file.
Contact a member of management on our discord to seek permission to use our code.
Any changes that you may make to the code are yours but that does not make the script yours.
Discord: https://discord.gg/r6dC2uK
]]
--Please Only Edit Below This Line-----------------------------------------------------------
local function _homes(reset)
global.addons = not reset and global.addons or {}
global.addons.homes = not reset and global.addons.homes or {}
return global.addons.homes
end
commands.add_command('set-home', 'Set your home position', {}, function(event,args)
local player = Game.get_player(event)
if not _homes()[player.index] then _homes()[player.index] = {player.force.get_spawn_position(player.surface),player.force.get_spawn_position(player.surface)} end
_homes()[player.index][1] = {math.floor(player.position.x),math.floor(player.position.y)}
player_return('Home set at: ('..math.floor(player.position.x)..','..math.floor(player.position.y)..')')
end)
commands.add_command('home', 'Go to you home position', {}, function(event,args)
local player = Game.get_player(event)
if not _homes()[player.index] then _homes()[player.index] = {player.force.get_spawn_position(player.surface),player.force.get_spawn_position(player.surface)} end
_homes()[player.index][2] = {math.floor(player.position.x),math.floor(player.position.y)}
player.teleport(player.surface.find_non_colliding_position('player',_homes()[player.index][1],32,1),player.surface)
end)
commands.add_command('return', 'Return to your previous position after using /home', {}, function(event,args)
local player = Game.get_player(event)
if not _homes()[player.index] then _homes()[player.index] = {player.force.get_spawn_position(player.surface),player.force.get_spawn_position(player.surface)} end
local _temp = {math.floor(player.position.x),math.floor(player.position.y)}
player.teleport(player.surface.find_non_colliding_position('player',_homes()[player.index][2],32,1),player.surface)
_homes()[player.index][2] = _temp
end)

View File

@@ -0,0 +1,21 @@
--[[
Explosive Gaming
This file can be used with permission but this and the credit below must remain in the file.
Contact a member of management on our discord to seek permission to use our code.
Any changes that you may make to the code are yours but that does not make the script yours.
Discord: https://discord.gg/r6dC2uK
]]
--Please Only Edit Below This Line-----------------------------------------------------------
commands.add_command('kill', 'Kills a player. Must be either yourself (/kill self) or a person of a lower rank', {'player'}, function(event,args)
local _player = Game.get_player(event)
local player = Game.get_player(args.player)
if args.player ~= 'self' and not player then player_return({'commands.invalid-player',args.player}) return commands.error end
if args.player == 'self' or _player.name == player.name then
if _player.character then _player.character.die() else player_return({'commands.dead-player'}) return commands.error end
elseif Ranking.get_rank(player).power > Ranking.get_rank(_player).power then
if player.connected then else player_return({'commands.offline-player'}) return commands.error end
if player.character then player.character.die() else player_return({'commands.dead-player'}) return commands.error end
else player_return({'commands.unauthorized'}) return commands.error end
end)

View File

@@ -0,0 +1,47 @@
--[[
Explosive Gaming
This file can be used with permission but this and the credit below must remain in the file.
Contact a member of management on our discord to seek permission to use our code.
Any changes that you may make to the code are yours but that does not make the script yours.
Discord: https://discord.gg/r6dC2uK
]]
--Please Only Edit Below This Line-----------------------------------------------------------
-- Set an item to true to disallow it from being repaired
local disallow = {
['loader']=true,
['fast-loader']=true,
['express-loader']=true,
['electric-energy-interface']=true,
['infinity-chest']=true
}
local const = 100
-- Given const = 100: admin+ has unlimited, admin has const (100), mod has const / 2 (50), member has const / 5 (20)
commands.add_command('repair', 'Repairs all destoryed and damaged entites in an area.', {'range'}, function(event,args)
local range = tonumber(args.range)
local player = Game.get_player(event)
local rank = Ranking.get_rank(player)
local highest_admin_power = Ranking.get_group('Admin').highest.power-1
local max_range = rank.power-highest_admin_power > 0 and const/(rank.power-highest_admin_power) or nil
local center = player and player.position or {x=0,y=0}
if not range or max_range and range > max_range then player_return({'commands.invalid-range',0,math.floor(max_range)}) return commands.error end
local area = {{center.x-range,center.y-range},{center.x+range,center.y+range}}
local max_time_to_live = 2^32 - 1
local sq_range = range^2
for key, entity in pairs(player.surface.find_entities_filtered({area=area,type='entity-ghost'})) do
if entity.force == player.force and (entity.position.x-center.x)^2+(entity.position.y-center.y)^2 < sq_range then
if disallow[entity.ghost_prototype.name] then
player_return('You have repaired: '..entity.name..' this item is not allowed.',defines.text_color.crit,player)
Admin.temp_ban(player,'<server>','Attempt To Repair A Banned Item')
entity.destroy()
elseif entity.time_to_live ~= max_time_to_live then
entity.revive() end
end
end
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)

View File

@@ -0,0 +1,30 @@
--[[
Explosive Gaming
This file can be used with permission but this and the credit below must remain in the file.
Contact a member of management on our discord to seek permission to use our code.
Any changes that you may make to the code are yours but that does not make the script yours.
Discord: https://discord.gg/r6dC2uK
]]
--Please Only Edit Below This Line-----------------------------------------------------------
local const = 20
-- this is the max lenth of a tag
commands.add_command('tag', 'Give yourself a custom tag. Use /tag-clear self to remove tag', {'tag',true}, function(event,args)
local player = Game.get_player(event)
local rank = Ranking.get_rank(player)
if string.len(args.tag) > const then player_return({'commands.invalid-length',const}) return commands.error end
player.tag = rank.tag..' - '..args.tag
end)
commands.add_command('tag-clear', 'Removes a custom tag. Player can be self (/tag-clear self)', {'player'}, function(event,args)
local _player = Game.get_player(event)
local _rank = Ranking.get_rank(_player)
local player = Game.get_player(args.player)
local rank = Ranking.get_rank(player)
if args.player ~= 'self' and not player then player_return({'commands.invalid-player',args.player}) return commands.error end
if args.player == 'self' or _player.name == player.name then _player.tag = _rank.tag
elseif _rank.power < rank.power then player.tag = rank.tag
else player_return({'commands.unauthorized'}) return commands.error end
end)

View File

@@ -0,0 +1,31 @@
--[[
Explosive Gaming
This file can be used with permission but this and the credit below must remain in the file.
Contact a member of management on our discord to seek permission to use our code.
Any changes that you may make to the code are yours but that does not make the script yours.
Discord: https://discord.gg/r6dC2uK
]]
--Please Only Edit Below This Line-----------------------------------------------------------
commands.add_command('go-to', 'Go to a player\'s location', {'player'}, function(event,args)
local player = Game.get_player(args.player)
if not player then player_return({'commands.invalid-player',args.player}) return commands.error end
Admin.go_to(player,event)
end)
commands.add_command('bring', 'Bring a player to your location', {'player'}, function(event,args)
local player = Game.get_player(args.player)
if not player then player_return({'commands.invalid-player',args.player}) return commands.error end
Admin.bring(player,event)
end)
commands.add_command('tp', 'Teleport a player to another player\'s location', {'from', 'to'}, function(event,args)
local from_player = Game.get_player(args.from)
if not from_player then player_return({'commands.invalid-player',args.from_player}) return commands.error end
local to_player = Game.get_player(args.to)
if not to_player then player_return({'commands.invalid-player',args.to_player}) return commands.error end
Admin.tp(from_player, to_player)
end)