diff --git a/modules/AdvancedStartingItems/starting-items.lua b/modules/AdvancedStartingItems/control.lua similarity index 67% rename from modules/AdvancedStartingItems/starting-items.lua rename to modules/AdvancedStartingItems/control.lua index 5a3db04f..5b55ee9e 100644 --- a/modules/AdvancedStartingItems/starting-items.lua +++ b/modules/AdvancedStartingItems/control.lua @@ -1,6 +1,10 @@ +--- Adds a better method of player starting items based on production levels. +-- @module AdvancedStartingItems@4.0.0 +-- @author Cooldude2606 +-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE +-- @alais ThisModule --- made by cooldude - this just allows condidtions on stating items and custom ammounts to be added, ie more iron made means more starting iron - +-- Local Varibles local items = { ['iron-plate']=function(player,made) if tick_to_min(game.tick) < 5 then return 8 else return (made*10)/math.pow(tick_to_min(game.tick),2) end end, ['copper-plate']=function(player,made) if tick_to_min(game.tick) < 5 then return 0 else return (made*8)/math.pow(tick_to_min(game.tick),2) end end, @@ -18,15 +22,24 @@ local items = { ['iron-axe']=function(player,made) if made > 5 and player.force.item_production_statistics.get_input_count('steel-axe') <= 5 then return 1 else return 0 end end, ['steel-axe']=function(player,made) if made > 5 then return 1 else return 0 end end } + +-- Module Define +local module_verbose = false +local ThisModule = {} + +-- Event Handlers Define Event.register(defines.events.on_player_created, function(event) - local player = game.players[event.player_index] - if event.player_index == 1 then - player.force.friendly_fire = false - game.map_settings.enemy_expansion.enabled = false - player.force.chart(player.surface, {{player.position.x - 400, player.position.y - 400}, {player.position.x + 400, player.position.y + 400}}) - end - for item,count in pairs(items) do - if type(count) == 'function' then count = math.floor(count(player,player.force.item_production_statistics.get_input_count(item))) end - if count > 0 then player.insert{name=item, count=count} end - end -end) \ No newline at end of file + local player = game.players[event.player_index] + if event.player_index == 1 then + player.force.friendly_fire = false + game.map_settings.enemy_expansion.enabled = false + player.force.chart(player.surface, {{player.position.x - 400, player.position.y - 400}, {player.position.x + 400, player.position.y + 400}}) + end + for item,count in pairs(items) do + if type(count) == 'function' then count = math.floor(count(player,player.force.item_production_statistics.get_input_count(item))) end + if count > 0 then player.insert{name=item, count=count} end + end +end) + +-- Module Return +return ThisModule \ No newline at end of file diff --git a/modules/AdvancedStartingItems/softmod.json b/modules/AdvancedStartingItems/softmod.json new file mode 100644 index 00000000..4a888080 --- /dev/null +++ b/modules/AdvancedStartingItems/softmod.json @@ -0,0 +1,20 @@ +{ + "name": "AdvancedStartingItems", + "version": "4.0.0", + "type": "Module", + "description": "Adds a better method of player starting items based on production levels.", + "location": "", + "keywords": [ + "Inventory", + "Start", + "Items", + "Player", + "Advanced", + "Useful", + "Balaced" + ], + "author": "Cooldude2606", + "contact": "Discord: Cooldude2606#5241", + "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", + "dependencies": {} +} \ No newline at end of file diff --git a/modules/DeathMarkers/body-marker.lua b/modules/DeathMarkers/control.lua similarity index 72% rename from modules/DeathMarkers/body-marker.lua rename to modules/DeathMarkers/control.lua index 92ed9666..3b47970a 100644 --- a/modules/DeathMarkers/body-marker.lua +++ b/modules/DeathMarkers/control.lua @@ -1,5 +1,19 @@ --- made by cooldude - this just adds a marker to the map which is removed when the body is removed +--- Adds markers to the map when a player dies and removes it when the body is removed. +-- @module DeathMarkers@4.0.0 +-- @author Cooldude2606 +-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE +-- @alais ThisModule +-- Module Define +local module_verbose = false +local ThisModule = {} + +-- Global Define +local global = global{ + corpses={} +} + +-- Event Handlers Define Event.register(defines.events.on_player_died, function(event) local player = game.players[event.player_index] local tag = player.force.add_chart_tag(player.surface,{ @@ -25,4 +39,7 @@ Event.register(defines.events.on_tick, function(event) end key=key+1 end -end) \ No newline at end of file +end) + +-- Module Return +return ThisModule \ No newline at end of file diff --git a/modules/DeathMarkers/softmod.json b/modules/DeathMarkers/softmod.json new file mode 100644 index 00000000..7329b46e --- /dev/null +++ b/modules/DeathMarkers/softmod.json @@ -0,0 +1,17 @@ +{ + "name": "DeathMarkers", + "version": "4.0.0", + "type": "Module", + "description": "Adds markers to the map when a player dies and removes it when the body is removed.", + "location": "", + "keywords": [ + "Death", + "Marker", + "Body", + "Map" + ], + "author": "Cooldude2606", + "contact": "Discord: Cooldude2606#5241", + "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", + "dependencies": {} +} \ No newline at end of file diff --git a/modules/DeconControl/tree-decon.lua b/modules/DeconControl/control.lua similarity index 54% rename from modules/DeconControl/tree-decon.lua rename to modules/DeconControl/control.lua index ccfe6074..56260ec0 100644 --- a/modules/DeconControl/tree-decon.lua +++ b/modules/DeconControl/control.lua @@ -1,13 +1,23 @@ ---[[ -Explosive Gaming +--- Allows control over decon rights, if ExpGamingCore.Ranking is not installed it will allow admins to instant remove trees and thats it. +-- @module DeconControl@4.0.0 +-- @author Cooldude2606 +-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE +-- @alais ThisModule -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----------------------------------------------------------- +-- Module Require +local Game = require('FactorioStdLib.Game@^0.8.0') +local Server = require('ExpGamingCore.Server@^4.0.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 + end +} + +-- Event Handlers Define Event.register(-1,function(event) Server.new_thread{ name='tree-decon', @@ -25,10 +35,15 @@ Event.register(-1,function(event) if not chache then local player = Game.get_player(event) if not player then return end - local rank = Ranking.get_rank(player) - if rank:allowed('tree-decon') then self.data.chache[event.player_index] = {'tree-decon',false} - elseif not rank:allowed('decon') then self.data.chache[event.player_index] = {'no-decon',false} - else self.data.chache[event.player_index] = {'decon',false} end + if not Ranking then + if player.admin then self.data.chache[event.player_index] = {'tree-decon',false} + else self.data.chache[event.player_index] = {'decon',false} end + else + local rank = Ranking.get_rank(player) + if rank:allowed('tree-decon') then self.data.chache[event.player_index] = {'tree-decon',false} + elseif not rank:allowed('decon') then self.data.chache[event.player_index] = {'no-decon',false} + else self.data.chache[event.player_index] = {'decon',false} end + end chache = self.data.chache[event.player_index] end if not event.entity.last_user or event.entity.name == 'entity-ghost' then @@ -45,10 +60,13 @@ Event.register(-1,function(event) player_return({'tree-decon.player-print'},defines.textcolor.crit,player) local rank = Ranking.get_group('Admin').lowest Ranking.print(rank,{'tree-decon.rank-print',player.name},defines.textcolor.info) - Admin.give_warning(player,'','Trying To Decon The Base') + if Admin then Admin.give_warning(player,'','Trying To Decon The Base') end end self.data.clear = game.tick + 10 end end end):open() -end) \ No newline at end of file +end) + +-- Module Return +return ThisModule \ No newline at end of file diff --git a/modules/DeconControl/softmod.json b/modules/DeconControl/softmod.json new file mode 100644 index 00000000..36f67ed9 --- /dev/null +++ b/modules/DeconControl/softmod.json @@ -0,0 +1,25 @@ +{ + "name": "DeconControl", + "version": "4.0.0", + "type": "Module", + "description": "Allows control over decon rights, if ExpGamingCore.Ranking is not installed it will allow admins to instant remove trees and thats it.", + "location": "", + "keywords": [ + "Trees", + "Decon", + "Protection", + "Admin", + "Tool", + "Report" + ], + "author": "Cooldude2606", + "contact": "Discord: Cooldude2606#5241", + "license": "https://github.com/explosivegaming/scenario/blob/master/LICENSE", + "dependencies": { + "ExpGamingCore.Server": "^4.0.0", + "FactorioStdLib.Game": "^0.8.0", + "ExpGamingLib": "^4.0.0", + "ExpGamingAdmin.Warnings": "?^4.0.0", + "ExpGamingCore.Ranking": "?^4.0.0" + } +} \ No newline at end of file diff --git a/modules/ExpGamingAdmin/AdminLib/control.lua b/modules/ExpGamingAdmin/AdminLib/control.lua index f55a220f..176c51eb 100644 --- a/modules/ExpGamingAdmin/AdminLib/control.lua +++ b/modules/ExpGamingAdmin/AdminLib/control.lua @@ -1,7 +1,7 @@ ---- Desction +--- The base functions required to make the others work. -- @module ExpGamingAdmin.AdminLib@4.0.0 --- @author --- @license +-- @author Cooldude2606 +-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE -- @alais Admin -- Module Require diff --git a/modules/ExpGamingAdmin/Ban/control.lua b/modules/ExpGamingAdmin/Ban/control.lua index e9d73064..01bb8031 100644 --- a/modules/ExpGamingAdmin/Ban/control.lua +++ b/modules/ExpGamingAdmin/Ban/control.lua @@ -1,7 +1,7 @@ ---- Desction +--- Adds a custom ban function to the admin command set. -- @module ExpGamingAdmin.Ban@4.0.0 --- @author --- @license +-- @author Cooldude2606 +-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE -- @alais ThisModule -- Module Require diff --git a/modules/ExpGamingAdmin/ClearInventory/control.lua b/modules/ExpGamingAdmin/ClearInventory/control.lua index 885d629a..5a5ae497 100644 --- a/modules/ExpGamingAdmin/ClearInventory/control.lua +++ b/modules/ExpGamingAdmin/ClearInventory/control.lua @@ -1,7 +1,7 @@ ---- Desction +--- Adds a function to clear a players inventoy and move the items to spawn. -- @module ExpGamingAdmin.ClearInventory@4.0.0 --- @author --- @license +-- @author Cooldude2606 +-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE -- @alais ThisModule -- Module Require diff --git a/modules/ExpGamingAdmin/Gui/control.lua b/modules/ExpGamingAdmin/Gui/control.lua index f0fd1d00..912e49b3 100644 --- a/modules/ExpGamingAdmin/Gui/control.lua +++ b/modules/ExpGamingAdmin/Gui/control.lua @@ -1,7 +1,7 @@ ---- Desction +--- Adds a gui that can be used to access all the admin commands. -- @module ExpGamingAdmin.Gui@4.0.0 --- @author --- @license +-- @author Cooldude2606 +-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE -- @alais AdminGui -- Module Require diff --git a/modules/ExpGamingAdmin/Jail/control.lua b/modules/ExpGamingAdmin/Jail/control.lua index 2594cc05..5792926d 100644 --- a/modules/ExpGamingAdmin/Jail/control.lua +++ b/modules/ExpGamingAdmin/Jail/control.lua @@ -1,7 +1,7 @@ ---- Desction +--- Adds a jail function to the admin set, require ExpGamingRanking to work. -- @module ExpGamingAdmin.Jail@4.0.0 --- @author --- @license +-- @author Cooldude2606 +-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE -- @alais ThisModule -- Module Require diff --git a/modules/ExpGamingAdmin/Kick/control.lua b/modules/ExpGamingAdmin/Kick/control.lua index 62d0615e..ad191a75 100644 --- a/modules/ExpGamingAdmin/Kick/control.lua +++ b/modules/ExpGamingAdmin/Kick/control.lua @@ -1,7 +1,7 @@ ---- Desction +--- Adds a kick function to the admin function set. -- @module ExpGamingAdmin.Kick@4.0.0 --- @author --- @license +-- @author Cooldude2606 +-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE -- @alais ThisModule -- Module Require diff --git a/modules/ExpGamingAdmin/Reports/control.lua b/modules/ExpGamingAdmin/Reports/control.lua index 359f0821..00f14bb0 100644 --- a/modules/ExpGamingAdmin/Reports/control.lua +++ b/modules/ExpGamingAdmin/Reports/control.lua @@ -1,7 +1,7 @@ ---- Desction --- @module ThisModule@X.Y.Z --- @author --- @license +--- 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 -- @alais ThisModule -- Module Require diff --git a/modules/ExpGamingAdmin/Teleport/control.lua b/modules/ExpGamingAdmin/Teleport/control.lua index aa95c455..43c2df7e 100644 --- a/modules/ExpGamingAdmin/Teleport/control.lua +++ b/modules/ExpGamingAdmin/Teleport/control.lua @@ -1,7 +1,7 @@ ---- Desction --- @module ExpGamingAdmin.Jail@4.0.0 --- @author --- @license +--- 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 -- @alais ThisModule -- Module Require diff --git a/modules/ExpGamingAdmin/TempBan/control.lua b/modules/ExpGamingAdmin/TempBan/control.lua index 9158a02c..4d9f9bc5 100644 --- a/modules/ExpGamingAdmin/TempBan/control.lua +++ b/modules/ExpGamingAdmin/TempBan/control.lua @@ -1,7 +1,7 @@ ---- Desction --- @module ExpGamingAdmin.Kick@4.0.0 --- @author --- @license +--- Adds a temp ban function to the admin set, requires ExpGamingCore.Ranking to work. +-- @module ExpGamingAdmin.KicTempBan@4.0.0 +-- @author Cooldude2606 +-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE -- @alais ThisModule -- Module Require diff --git a/modules/ExpGamingAdmin/Warnings/control.lua b/modules/ExpGamingAdmin/Warnings/control.lua index 59319d78..df1d3af1 100644 --- a/modules/ExpGamingAdmin/Warnings/control.lua +++ b/modules/ExpGamingAdmin/Warnings/control.lua @@ -1,7 +1,7 @@ ---- Desction --- @module ThisModule@X.Y.Z --- @author --- @license +--- 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 -- @alais ThisModule -- Module Require diff --git a/modules/ExpGamingBot/autoChat/control.lua b/modules/ExpGamingBot/autoChat/control.lua index 5c030fed..be2f73f2 100644 --- a/modules/ExpGamingBot/autoChat/control.lua +++ b/modules/ExpGamingBot/autoChat/control.lua @@ -2,110 +2,122 @@ -- @module ExpGamingBot.autoChat -- @author Cooldude2606 -- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE +-- @alais ThisModule -local Game = require('FactorioStdLib.Game') -local Ranking +-- Module Require +local Game = require('FactorioStdLib.Game@^0.8.0') +local Ranking -- ExpGamingCore.Ranking@^4.0.0 +-- Local Varibles -- lots of these are jokes, but some have uses -- white spaces removed and made into lower -- these messages are sent only to the player local messages = { - ['discord']={'chat-bot.discord'}, - ['expgaming']={'chat-bot.website'}, - ['website']={'chat-bot.website'}, - ['command']={'chat-bot.custom-commands'}, - ['commands']={'chat-bot.custom-commands'}, - ['softmod']={'chat-bot.softmod'}, - ['script']={'chat-bot.softmod'}, - ['link']={'chat-bot.links'}, - ['links']={'chat-bot.links'}, - ['loop']={'chat-bot.loops'}, - ['loops']={'chat-bot.loops'}, - ['rhd']={'chat-bot.lhd'}, - ['roundabout']={'chat-bot.loops'}, - ['roundabouts']={'chat-bot.loops'}, - ['redmew']={'chat-bot.redmew'}, - ['afk']=function(_player) local max=_player for _,player in pairs(game.connected_players) do if max.afk_time < player.afk_time then max=player end end return {'chat-bot.afk',max.name,tick_to_display_format(max.afk_time)} end + ['discord']={'ExpGamingBot-autoChat.discord'}, + ['expgaming']={'ExpGamingBot-autoChat.website'}, + ['website']={'ExpGamingBot-autoChat.website'}, + ['command']={'ExpGamingBot-autoChat.custom-commands'}, + ['commands']={'ExpGamingBot-autoChat.custom-commands'}, + ['softmod']={'ExpGamingBot-autoChat.softmod'}, + ['script']={'ExpGamingBot-autoChat.softmod'}, + ['link']={'ExpGamingBot-autoChat.links'}, + ['links']={'ExpGamingBot-autoChat.links'}, + ['loop']={'ExpGamingBot-autoChat.loops'}, + ['loops']={'ExpGamingBot-autoChat.loops'}, + ['rhd']={'ExpGamingBot-autoChat.lhd'}, + ['roundabout']={'ExpGamingBot-autoChat.loops'}, + ['roundabouts']={'ExpGamingBot-autoChat.loops'}, + ['redmew']={'ExpGamingBot-autoChat.redmew'}, + ['afk']=function(_player) local max=_player for _,player in pairs(game.connected_players) do if max.afk_time < player.afk_time then max=player end end return {'ExpGamingBot-autoChat.afk',max.name,tick_to_display_format(max.afk_time)} end } -- white spaces removed and made into lower -- these are global chat commands that can be used -- comands start with ! (all messages are also commands) local command_syntax = '!' local commands = { - ['online']=function(player) return {'chat-bot.players-online',#game.connected_players} end, - ['playtime']=function(player) return {'chat-bot.map-time',tick_to_display_format(game.tick)} end, - ['players']=function(player) return {'chat-bot.players',#game.players} end, - ['dev']={'chat-bot.not-real-dev'}, - ['blame']=function(player) local names = {'Cooldude2606','arty714','badgamernl',player.name} return {'chat-bot.blame',names[math.random(#names)]} end, - ['readme']={'chat-bot.read-readme'}, - ['magic']={'chat-bot.magic'}, - ['aids']={'chat-bot.aids'}, - ['riot']={'chat-bot.riot'}, - ['lenny']={'chat-bot.lenny'}, - ['wiki']={'chat-bot.wiki'}, - ['evolution']=function(player) return {'chat-bot.current-evolution',string.format('%.2f',game.forces['enemy'].evolution_factor)} end, + ['online']=function(player) return {'ExpGamingBot-autoChat.players-online',#game.connected_players} end, + ['playtime']=function(player) return {'ExpGamingBot-autoChat.map-time',tick_to_display_format(game.tick)} end, + ['players']=function(player) return {'ExpGamingBot-autoChat.players',#game.players} end, + ['dev']={'ExpGamingBot-autoChat.not-real-dev'}, + ['blame']=function(player) local names = {'Cooldude2606','arty714','badgamernl',player.name} return {'ExpGamingBot-autoChat.blame',names[math.random(#names)]} end, + ['readme']={'ExpGamingBot-autoChat.read-readme'}, + ['magic']={'ExpGamingBot-autoChat.magic'}, + ['aids']={'ExpGamingBot-autoChat.aids'}, + ['riot']={'ExpGamingBot-autoChat.riot'}, + ['lenny']={'ExpGamingBot-autoChat.lenny'}, + ['wiki']={'ExpGamingBot-autoChat.wiki'}, + ['evolution']=function(player) return {'ExpGamingBot-autoChat.current-evolution',string.format('%.2f',game.forces['enemy'].evolution_factor)} end, --Jokes about food and drink - ['whattoeat']={'chat-bot.food'}, + ['whattoeat']={'ExpGamingBot-autoChat.food'}, ['makepopcorn']=function(player) Server.new_thread{ timeout=math.floor(180*(math.random()+0.5)),data=player.name }:on_event('timeout',function(self) - if self.data then game.print{'chat-bot.message',{'chat-bot.get-popcorn-2',self.data}} end - end):open() return {'chat-bot.get-popcorn-1'} end, + if self.data then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-popcorn-2',self.data}} end + end):open() return {'ExpGamingBot-autoChat.get-popcorn-1'} end, ['orderpizza']=function(player) Server.new_thread{ timeout=math.floor(180*(math.random()+0.5)),data={player.name,0}, reopen=true }:on_event('timeout',function(self) - if self.data[2]==0 then game.print{'chat-bot.message',{'chat-bot.order-pizza-2',self.data[1]}} - elseif self.data[2]==1 then game.print{'chat-bot.message',{'chat-bot.order-pizza-3',self.data[1]}} self.reopen = false + if self.data[2]==0 then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.order-pizza-2',self.data[1]}} + elseif self.data[2]==1 then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.order-pizza-3',self.data[1]}} self.reopen = false end self.data[2]=self.data[2]+1 - end):open() return {'chat-bot.order-pizza-1'} end, + end):open() return {'ExpGamingBot-autoChat.order-pizza-1'} end, ['passsomesnaps']=function(player) Server.new_thread{ timeout=math.floor(180*(math.random()+0.5)),data={player.name,0}, reopen=true }:on_event('timeout',function(self) - if self.data[2]==0 then game.print{'chat-bot.message',{'chat-bot.get-snaps-2',self.data[1]}} - elseif self.data[2]==1 then game.print{'chat-bot.message',{'chat-bot.get-snaps-3',self.data[1]}} self.reopen = false + if self.data[2]==0 then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-snaps-2',self.data[1]}} + elseif self.data[2]==1 then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-snaps-3',self.data[1]}} self.reopen = false end self.data[2]=self.data[2]+1 - end):open() return {'chat-bot.get-snaps-1'} end, + end):open() return {'ExpGamingBot-autoChat.get-snaps-1'} end, ['makecocktail']=function(player) Server.new_thread{ timeout=math.floor(180*(math.random()+0.5)),data={player.name,0}, reopen=true }:on_event('timeout',function(self) - if self.data[2]==0 then game.print{'chat-bot.message',{'chat-bot.get-cocktail-2',self.data[1]}} - elseif self.data[2]==1 then game.print{'chat-bot.message',{'chat-bot.get-cocktail-3',self.data[1]}} self.reopen = false + if self.data[2]==0 then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-cocktail-2',self.data[1]}} + elseif self.data[2]==1 then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-cocktail-3',self.data[1]}} self.reopen = false end self.data[2]=self.data[2]+1 - end):open() return {'chat-bot.get-cocktail-1'} end, + end):open() return {'ExpGamingBot-autoChat.get-cocktail-1'} end, ['makecoffee']=function(player) Server.new_thread{ timeout=math.floor(180*(math.random()+0.5)),data=player.name }:on_event('timeout',function(self) - if self.data then game.print{'chat-bot.message',{'chat-bot.make-coffee-2',self.data}} end - end):open() return {'chat-bot.make-coffee-1'} end, + if self.data then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.make-coffee-2',self.data}} end + end):open() return {'ExpGamingBot-autoChat.make-coffee-1'} end, ['orderpizza']=function(player) Server.new_thread{ timeout=math.floor(180*(math.random()+0.5)),data={player.name,0}, reopen=true }:on_event('timeout',function(self) - if self.data[2]==0 then game.print{'chat-bot.message',{'chat-bot.order-pizza-2',self.data[1]}} - elseif self.data[2]==1 then game.print{'chat-bot.message',{'chat-bot.order-pizza-3',self.data[1]}} self.reopen = false + if self.data[2]==0 then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.order-pizza-2',self.data[1]}} + elseif self.data[2]==1 then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.order-pizza-3',self.data[1]}} self.reopen = false end self.data[2]=self.data[2] + 1 - end):open() return {'chat-bot.order-pizza-1'} end, + end):open() return {'ExpGamingBot-autoChat.order-pizza-1'} end, ['maketea']=function(player) Server.new_thread{ timeout=math.floor(180*(math.random()+0.5)),data=player.name }:on_event('timeout',function(self) - if self.data then game.print{'chat-bot.message',{'chat-bot.make-tea-2',self.data}} end - end):open() return {'chat-bot.make-tea-1'} end, + if self.data then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.make-tea-2',self.data}} end + end):open() return {'ExpGamingBot-autoChat.make-tea-1'} end, ['meadplease']=function(player) Server.new_thread{ timeout=math.floor(180*(math.random()+0.5)),data=player.name }:on_event('timeout',function(self) - if self.data then game.print{'chat-bot.message',{'chat-bot.get-mead-2',self.data}} end - end):open() return {'chat-bot.get-mead-1'} end, + if self.data then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-mead-2',self.data}} end + end):open() return {'ExpGamingBot-autoChat.get-mead-1'} end, ['passabeer']=function(player) Server.new_thread{ timeout=math.floor(180*(math.random()+0.5)),data=player.name }:on_event('timeout',function(self) - if self.data then game.print{'chat-bot.message',{'chat-bot.get-beer-2',self.data}} end - end):open() return {'chat-bot.get-beer-1'} end + if self.data then game.print{'ExpGamingBot-autoChat.message',{'ExpGamingBot-autoChat.get-beer-2',self.data}} end + end):open() return {'ExpGamingBot-autoChat.get-beer-1'} end } +-- 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 + end +} + +-- Event Handlers Define script.on_event(defines.events.on_console_chat,function(event) local player = Game.get_player(event) if not player then return end @@ -115,25 +127,22 @@ script.on_event(defines.events.on_console_chat,function(event) if player_message:match(command_syntax..to_find) then if allowed then if is_type(message,'function') then message=message(player) end - game.print{'chat-bot.message',message} - else player_return({'chat-bot.rank-error'},nil,player) end + game.print{'ExpGamingBot-autoChat.message',message} + else player_return({'ExpGamingBot-autoChat.rank-error'},nil,player) end elseif player_message:match(to_find) then if is_type(message,'function') then message=message(player) end - player_return({'chat-bot.message',message},nil,player) + player_return({'ExpGamingBot-autoChat.message',message},nil,player) end end for to_find,message in pairs(commands) do if player_message:match(command_syntax..to_find) then if allowed then if is_type(message,'function') then message=message(player) end - game.print{'chat-bot.message',message} - else player_return({'chat-bot.rank-error'},nil,player) end + game.print{'ExpGamingBot-autoChat.message',message} + else player_return({'ExpGamingBot-autoChat.rank-error'},nil,player) end end end end) -return { - on_init = function(self) - if loaded_modules['ExpGamingCore.Ranking'] then Ranking = require('ExpGamingCore.Ranking') end - end -} \ No newline at end of file +-- Module Return +return ThisModule \ No newline at end of file diff --git a/modules/ExpGamingBot/autoChat/locale/de.cfg b/modules/ExpGamingBot/autoChat/locale/de.cfg index e4bbbe31..32fea59f 100644 --- a/modules/ExpGamingBot/autoChat/locale/de.cfg +++ b/modules/ExpGamingBot/autoChat/locale/de.cfg @@ -1,4 +1,4 @@ -[chat-bot] +[ExpGamingBot-autoChat] message=[Chat Bot]: __1__ rank-error=You cant use global chat commands players-online=There are __1__ players online diff --git a/modules/ExpGamingBot/autoChat/locale/en.cfg b/modules/ExpGamingBot/autoChat/locale/en.cfg index 6aa7502d..936cec57 100644 --- a/modules/ExpGamingBot/autoChat/locale/en.cfg +++ b/modules/ExpGamingBot/autoChat/locale/en.cfg @@ -1,4 +1,4 @@ -[chat-bot] +[ExpGamingBot-autoChat] message=[Chat Bot]: __1__ rank-error=You can't use global chat commands players-online=There are __1__ players online diff --git a/modules/ExpGamingBot/autoChat/locale/fr.cfg b/modules/ExpGamingBot/autoChat/locale/fr.cfg index e4bbbe31..32fea59f 100644 --- a/modules/ExpGamingBot/autoChat/locale/fr.cfg +++ b/modules/ExpGamingBot/autoChat/locale/fr.cfg @@ -1,4 +1,4 @@ -[chat-bot] +[ExpGamingBot-autoChat] message=[Chat Bot]: __1__ rank-error=You cant use global chat commands players-online=There are __1__ players online diff --git a/modules/ExpGamingBot/autoChat/locale/nl.cfg b/modules/ExpGamingBot/autoChat/locale/nl.cfg index e4bbbe31..32fea59f 100644 --- a/modules/ExpGamingBot/autoChat/locale/nl.cfg +++ b/modules/ExpGamingBot/autoChat/locale/nl.cfg @@ -1,4 +1,4 @@ -[chat-bot] +[ExpGamingBot-autoChat] message=[Chat Bot]: __1__ rank-error=You cant use global chat commands players-online=There are __1__ players online diff --git a/modules/ExpGamingBot/autoChat/locale/sv-SE.cfg b/modules/ExpGamingBot/autoChat/locale/sv-SE.cfg index 68e0663e..98f81ad7 100644 --- a/modules/ExpGamingBot/autoChat/locale/sv-SE.cfg +++ b/modules/ExpGamingBot/autoChat/locale/sv-SE.cfg @@ -1,5 +1,5 @@ -[chat-bot] +[ExpGamingBot-autoChat] message=[Chat Bot]: __1__ rank-error=Du kan inte utföra globala chat-kommandon. players-online=Det är __1__ spelare online diff --git a/modules/ExpGamingBot/autoMessage/control.lua b/modules/ExpGamingBot/autoMessage/control.lua index 3146c686..598292bb 100644 --- a/modules/ExpGamingBot/autoMessage/control.lua +++ b/modules/ExpGamingBot/autoMessage/control.lua @@ -1,13 +1,30 @@ ---- Sends messages in chat in resposce to other messages --- @module ExpGamingBot.autoChat +--- Prints a message every 15 minutes to chat. +-- @module ExpGamingBot.autoMessage -- @author Cooldude2606 -- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE +-- @alais ThisModule +-- Module Require local Server = require('ExpGamingCore.Server') local Game = require('FactorioStdLib.Game') -local Ranking -local Sync +local Ranking -- ExpGamingCore.Ranking@4.0.0 +local Sync -- ExpGamingCore.Sync@4.0.0 +-- Local Varibles + +-- 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 + if loaded_modules['ExpGamingCore.Sync@^4.0.0'] then Sync = require('ExpGamingCore.Sync@^4.0.0') end + end, + on_post=function() + --code + end +} + +-- Event Handlers Define script.on_init(function(event) Server.new_thread{ name='auto-message', @@ -17,19 +34,19 @@ script.on_init(function(event) high_rank= 'Owner', low_rank= 'Regular', low={ - {'chat-bot.join-us'}, - {'chat-bot.discord'}, - {'chat-bot.website'}, - {'chat-bot.custom-commands'}, - {'chat-bot.read-readme'} + {'ExpGamingBot-autoMessage.join-us'}, + {'ExpGamingBot-autoMessage.discord'}, + {'ExpGamingBot-autoMessage.website'}, + {'ExpGamingBot-autoMessage.custom-commands'}, + {'ExpGamingBot-autoMessage.read-readme'} } } }:on_event('timeout',function(self) local data = self.data if not data.high_rank or not data.low_rank or not data.low then self.reopen = false return end - game.print{'chat-bot.message',{'chat-bot.players-online',#game.connected_players}} - game.print{'chat-bot.message',{'chat-bot.map-time',tick_to_display_format(game.tick)}} + game.print{'ExpGamingBot-autoMessage.message',{'ExpGamingBot-autoMessage.players-online',#game.connected_players}} + game.print{'ExpGamingBot-autoMessage.message',{'ExpGamingBot-autoMessage.map-time',tick_to_display_format(game.tick)}} self.reopen = true end):on_event(defines.events.on_player_joined_game,function(self,event) local player = Game.get_player(event) @@ -40,7 +57,7 @@ script.on_init(function(event) -- idk but this stoped working for no appent reason so i added more checks for nil values if Ranking and Ranking.get_rank(player).power <= Ranking.get_rank(data.low_rank).power or player.admin then return end for _,message in pairs(data.low) do - player_return({'chat-bot.message',message},nil,player) + player_return({'ExpGamingBot-autoMessage.message',message},nil,player) end end):on_event('error',function(self,err) if Sync then Sync.emit_embeded{ @@ -54,9 +71,5 @@ script.on_init(function(event) end):open() end) -return { - on_init = function(self) - if loaded_modules['ExpGamingCore.Ranking'] then Ranking = require('ExpGamingCore.Ranking') end - if loaded_modules['ExpGamingCore.Sync'] then Sync = require('ExpGamingCore.Sync') end - end -} \ No newline at end of file +-- Module Return +return ThisModule \ No newline at end of file diff --git a/modules/ExpGamingBot/autoMessage/locale/de.cfg b/modules/ExpGamingBot/autoMessage/locale/de.cfg index 4cae5418..49d19ede 100644 --- a/modules/ExpGamingBot/autoMessage/locale/de.cfg +++ b/modules/ExpGamingBot/autoMessage/locale/de.cfg @@ -1,4 +1,4 @@ -[chat-bot] +[ExpGamingBot-autoMessage] message=[Chat Bot]: __1__ players-online=There are __1__ players online map-time=This map has been on for __1__ diff --git a/modules/ExpGamingBot/autoMessage/locale/en.cfg b/modules/ExpGamingBot/autoMessage/locale/en.cfg index c167ed50..c67078a9 100644 --- a/modules/ExpGamingBot/autoMessage/locale/en.cfg +++ b/modules/ExpGamingBot/autoMessage/locale/en.cfg @@ -1,4 +1,4 @@ -[chat-bot] +[ExpGamingBot-autoMessage] message=[Chat Bot]: __1__ players-online=There are __1__ players online map-time=This map has been on for __1__ diff --git a/modules/ExpGamingBot/autoMessage/locale/fr.cfg b/modules/ExpGamingBot/autoMessage/locale/fr.cfg index 4cae5418..49d19ede 100644 --- a/modules/ExpGamingBot/autoMessage/locale/fr.cfg +++ b/modules/ExpGamingBot/autoMessage/locale/fr.cfg @@ -1,4 +1,4 @@ -[chat-bot] +[ExpGamingBot-autoMessage] message=[Chat Bot]: __1__ players-online=There are __1__ players online map-time=This map has been on for __1__ diff --git a/modules/ExpGamingBot/autoMessage/locale/nl.cfg b/modules/ExpGamingBot/autoMessage/locale/nl.cfg index 4cae5418..49d19ede 100644 --- a/modules/ExpGamingBot/autoMessage/locale/nl.cfg +++ b/modules/ExpGamingBot/autoMessage/locale/nl.cfg @@ -1,4 +1,4 @@ -[chat-bot] +[ExpGamingBot-autoMessage] message=[Chat Bot]: __1__ players-online=There are __1__ players online map-time=This map has been on for __1__ diff --git a/modules/ExpGamingBot/autoMessage/locale/sv-SE.cfg b/modules/ExpGamingBot/autoMessage/locale/sv-SE.cfg index b4dab959..f037d9df 100644 --- a/modules/ExpGamingBot/autoMessage/locale/sv-SE.cfg +++ b/modules/ExpGamingBot/autoMessage/locale/sv-SE.cfg @@ -1,5 +1,5 @@ -[chat-bot] +[ExpGamingBot-autoMessage] message=[Chat Bot]: __1__ players-online=Det är __1__ spelare online map-time=Den här kartan har varit igång under __1__ diff --git a/modules/ExpGamingBot/discordAlerts/control.lua b/modules/ExpGamingBot/discordAlerts/control.lua index 35506554..1cbeab2a 100644 --- a/modules/ExpGamingBot/discordAlerts/control.lua +++ b/modules/ExpGamingBot/discordAlerts/control.lua @@ -1,14 +1,20 @@ ---- Desction +--- Sends alerts to discord once there is a bot set up to read the alerts. -- @module ExpGamingBot.discordAlerts@4.0.0 -- @author Cooldude2606 -- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE -- @alais ThisModule -local Sync = require('ExpGamingCore.Sync') -local Color = require('FactorioStdLib.Color') -local Game = require('FactorioStdLib.Game') +-- Module Require +local Sync = require('ExpGamingCore.Sync@^4.0.0') +local Color = require('FactorioStdLib.Color@^0.8.0') +local Game = require('FactorioStdLib.Game@^0.8.0') -Event.register(defines.events.on_console_command,function(event) +-- Module Define +local module_verbose = false +local ThisModule = {} + +-- Event Handlers Define +script.on_event(defines.events.on_console_command,function(event) local command = event.command local args = {} if event.parameters then for word in event.parameters:gmatch('%S+') do table.insert(args,word) end end @@ -51,4 +57,7 @@ Event.register(defines.events.on_console_command,function(event) ['Reason:']=data.reason } end -end) \ No newline at end of file +end) + +-- Module Return +return ThisModule \ No newline at end of file