From 46f6215d94963b5a4cf70b3967483b1aa242d678 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Wed, 16 Aug 2023 02:47:34 +0900 Subject: [PATCH] Feature Update (#237) See PR for details, there are too many to be included here. --- config/_file_loader.lua | 20 +- config/advanced_start.lua | 72 +- config/bonus.lua | 223 ++++ config/bonuses.lua | 11 - config/discord_alerts.lua | 2 +- config/expcore/roles.lua | 135 ++- config/gui/science.lua | 3 +- config/gui/warps.lua | 36 +- config/personal_logistic.lua | 1641 ++++++++++++++++++++++++++ config/preset_player_colours.lua | 1 + config/research.lua | 300 +++++ config/scorched_earth.lua | 6 +- config/spawn_area.lua | 132 ++- config/station_auto_name.lua | 11 + config/statistics.lua | 2 +- config/vlayer.lua | 167 +++ locale/en/commands.cfg | 31 + locale/en/data.cfg | 20 +- locale/en/gui.cfg | 6 +- locale/zh-CN/addons.cfg | 3 + locale/zh-CN/commands.cfg | 31 + locale/zh-CN/data.cfg | 20 +- locale/zh-CN/gui.cfg | 6 +- locale/zh-TW/addons.cfg | 3 + locale/zh-TW/commands.cfg | 31 + locale/zh-TW/data.cfg | 20 +- locale/zh-TW/gui.cfg | 6 +- modules/addons/advanced-start.lua | 8 + modules/addons/compilatron.lua | 3 + modules/addons/deconlog.lua | 80 +- modules/addons/discord-alerts.lua | 87 +- modules/addons/inserter.lua | 23 + modules/addons/miner.lua | 64 + modules/addons/protection-jail.lua | 5 +- modules/addons/report-jail.lua | 19 +- modules/addons/spawn-area.lua | 96 +- modules/addons/station-auto-name.lua | 19 +- modules/addons/tree-decon.lua | 2 +- modules/commands/bot-queue.lua | 24 + modules/commands/cheat-mode.lua | 25 +- modules/commands/enemy.lua | 30 + modules/commands/friendly-fire.lua | 18 + modules/commands/lawnmower.lua | 31 + modules/commands/pollution.lua | 32 + modules/commands/protection.lua | 5 +- modules/commands/repair.lua | 2 +- modules/commands/research.lua | 94 ++ modules/commands/spawn.lua | 26 +- modules/commands/speed.lua | 15 + modules/commands/teleport.lua | 32 +- modules/commands/train.lua | 22 + modules/commands/vlayer.lua | 28 + modules/commands/waterfill.lua | 64 + modules/control/vlayer.lua | 223 ++++ modules/control/warps.lua | 14 +- modules/data/bonus.lua | 92 +- modules/data/personal-logistic.lua | 76 ++ modules/data/statistics.lua | 2 +- modules/gui/debug/main_view.lua | 8 + modules/gui/player-list.lua | 2 +- modules/gui/research.lua | 207 ++++ modules/gui/server-ups.lua | 7 +- modules/gui/vlayer.lua | 276 +++++ modules/gui/warp-list.lua | 6 +- 64 files changed, 4417 insertions(+), 289 deletions(-) create mode 100644 config/bonus.lua delete mode 100644 config/bonuses.lua create mode 100644 config/personal_logistic.lua create mode 100644 config/research.lua create mode 100644 config/station_auto_name.lua create mode 100644 config/vlayer.lua create mode 100644 modules/addons/inserter.lua create mode 100644 modules/addons/miner.lua create mode 100644 modules/commands/bot-queue.lua create mode 100644 modules/commands/enemy.lua create mode 100644 modules/commands/friendly-fire.lua create mode 100644 modules/commands/lawnmower.lua create mode 100644 modules/commands/pollution.lua create mode 100644 modules/commands/research.lua create mode 100644 modules/commands/speed.lua create mode 100644 modules/commands/train.lua create mode 100644 modules/commands/vlayer.lua create mode 100644 modules/commands/waterfill.lua create mode 100644 modules/control/vlayer.lua create mode 100644 modules/data/personal-logistic.lua create mode 100644 modules/gui/research.lua create mode 100644 modules/gui/vlayer.lua diff --git a/config/_file_loader.lua b/config/_file_loader.lua index e468afc2..c69b04b6 100644 --- a/config/_file_loader.lua +++ b/config/_file_loader.lua @@ -9,6 +9,7 @@ return { 'expcore.player_data', --- Game Commands + 'modules.commands.debug', 'modules.commands.me', 'modules.commands.kill', 'modules.commands.admin-chat', @@ -33,6 +34,16 @@ return { 'modules.commands.protection', 'modules.commands.spectate', 'modules.commands.search', + 'modules.commands.bot-queue', + 'modules.commands.speed', + 'modules.commands.pollution', + 'modules.commands.train', + 'modules.commands.friendly-fire', + 'modules.commands.lawnmower', + 'modules.commands.research', + 'modules.commands.vlayer', + 'modules.commands.enemy', + 'modules.commands.waterfill', --- Addons 'modules.addons.chat-popups', @@ -52,6 +63,11 @@ return { 'modules.addons.protection-jail', 'modules.addons.deconlog', 'modules.addons.nukeprotect', + 'modules.addons.inserter', + 'modules.addons.miner', + + -- Control + 'modules.control.vlayer', --- Data 'modules.data.statistics', @@ -61,6 +77,7 @@ return { 'modules.data.alt-view', 'modules.data.tag', 'modules.data.bonus', + 'modules.data.personal-logistic', --- GUI 'modules.gui.readme', @@ -71,7 +88,8 @@ return { 'modules.gui.task-list', 'modules.gui.player-list', 'modules.gui.server-ups', - 'modules.commands.debug', + 'modules.gui.vlayer', + 'modules.gui.research', 'modules.graftorio.require', -- graftorio diff --git a/config/advanced_start.lua b/config/advanced_start.lua index ef827f1c..78b2d2bd 100644 --- a/config/advanced_start.lua +++ b/config/advanced_start.lua @@ -15,8 +15,10 @@ local seconds, minutes, hours = 60, 3600, 216000 -- ['stone-furnace']=cutoff_time(5*minutes, 4,0) -- before 5 minutes give four items after 5 minutes give none local function cutoff_time(time, before, after) return function(amount_made, items_made, player) - if game.tick < time then return before - else return after + if game.tick < time then + return before + else + return after end end end @@ -25,8 +27,10 @@ end -- ['firearm-magazine']=cutoff_amount_made(100, 10, 0) -- give 10 items until 100 items have been made local function cutoff_amount_made(amount, before, after) return function(amount_made, items_made, player) - if amount_made < amount then return before - else return after + if amount_made < amount then + return before + else + return after end end end @@ -36,10 +40,13 @@ end local function cutoff_amount_made_unless(amount, before, after, second_item, second_amount) return function(amount_made, items_made, player) if items_made(second_item) < second_amount then - if amount_made < amount then return before - else return after + if amount_made < amount then + return before + else + return after end - else return 0 + else + return 0 end end end @@ -48,8 +55,10 @@ end -- ['iron-plate']=scale_amount_made(5*minutes, 10, 10) -- for first 5 minutes give 10 items then after apply a factor of 10 local function scale_amount_made(amount, before, scalar) return function(amount_made, items_made, player) - if amount_made < amount then return before - else return (amount_made*scalar)/math.pow(game.tick/minutes, 2) + if amount_made < amount then + return before + else + return (amount_made * scalar) / ((game.tick / minutes) ^ 2) end end end @@ -75,22 +84,47 @@ return { -- ['item-name'] = function(amount_made, production_stats, player) return end -- 0 means no items given -- Plates ['iron-plate']=scale_amount_made(100, 10, 10), - ['copper-plate']=scale_amount_made(100, 0,8), - ['steel-plate']=scale_amount_made(100, 0,4), + ['copper-plate']=scale_amount_made(100, 0, 8), + ['steel-plate']=scale_amount_made(100, 0, 4), -- Secondary Items - ['electronic-circuit']=scale_amount_made(1000, 0,6), - ['iron-gear-wheel']=scale_amount_made(1000, 0,6), + ['electronic-circuit']=scale_amount_made(1000, 0, 6), + ['iron-gear-wheel']=scale_amount_made(1000, 0, 6), -- Starting Items - ['burner-mining-drill']=cutoff_time(10*minutes, 4,0), - ['stone-furnace']=cutoff_time(10*minutes, 4,0), + ['burner-mining-drill']=cutoff_time(10*minutes, 4, 0), + ['stone-furnace']=cutoff_time(10*minutes, 4, 0), -- Armor ['light-armor']=cutoff_amount_made_unless(5, 0,1,'heavy-armor',5), ['heavy-armor']=cutoff_amount_made(5, 0,1), -- Weapon - ['pistol']=cutoff_amount_made_unless(0, 1,1,'submachine-gun',5), - ['submachine-gun']=cutoff_amount_made(5, 0,1), + ['pistol']=cutoff_amount_made_unless(0, 1, 1,'submachine-gun',5), + ['submachine-gun']=cutoff_amount_made(5, 0, 1), -- Ammo - ['firearm-magazine']=cutoff_amount_made_unless(100, 10, 0,'piercing-rounds-magazine',100), - ['piercing-rounds-magazine']=cutoff_amount_made(100, 0,10), + ['firearm-magazine']=cutoff_amount_made_unless(100, 10, 0,'piercing-rounds-magazine', 100), + ['piercing-rounds-magazine']=cutoff_amount_made(100, 0, 10), + --[[ + ['construction-robot']=scale_amount_made(1, 10, 1) + ]] + }, + armor = { + enable=false, + main = 'modular-armor', + item = { + { + equipment='solar-panel-equipment', + count=16 + }, + { + equipment='belt-immunity-equipment', + count=1 + }, + { + equipment='battery-equipment', + count=2 + }, + { + equipment='personal-roboport-equipment', + count=1 + }, + } } } diff --git a/config/bonus.lua b/config/bonus.lua new file mode 100644 index 00000000..ecedb25d --- /dev/null +++ b/config/bonus.lua @@ -0,0 +1,223 @@ +--- Lists all bonuses which can be used, name followed by min max +-- @config Bonuses + +return { + -- level of player bonus for lower roles, 1 level is 10 % + player_bonus_level = 1, + player_bonus = { + { + name = 'character_mining_speed_modifier', + enabled = true, + min = 0, + max = 2 + }, + { + name = 'character_running_speed_modifier', + enabled = true, + min = 0, + max = 1.5 + }, + { + name = 'character_crafting_speed_modifier', + enabled = true, + min = 0, + max = 5 + }, + { + name = 'character_reach_distance_bonus', + enabled = true, + min = 0, + max = 10 + }, + { + name = 'character_resource_reach_distance_bonus', + enabled = true, + min = 0, + max = 10 + }, + { + name = 'character_build_distance_bonus', + enabled = true, + min = 0, + max = 10 + }, + { + name = 'character_item_pickup_distance_bonus', + enabled = false, + min = 0, + max = 0 + }, + { + name = 'character_loot_pickup_distance_bonus', + enabled = false, + min = 0, + max = 0 + }, + { + name = 'character_item_drop_distance_bonus', + enabled = false, + min = 0, + max = 5 + }, + { + name = 'character_inventory_slots_bonus', + enabled = true, + min = 0, + max = 100 + }, + { + name = 'character_health_bonus', + enabled = true, + min = 0, + max = 200 + } + }, + force_bonus = { + { + name = 'manual_mining_speed_modifier', + enabled = false, + min = 0, + max = 2 + }, + { + name = 'character_running_speed_modifier', + enabled = false, + min = 0, + max = 1 + }, + { + name = 'character_crafting_speed_modifier', + enabled = false, + min = 0, + max = 5 + }, + { + name = 'character_reach_distance_bonus', + enabled = false, + min = 0, + max = 10 + }, + { + name = 'character_resource_reach_distance_bonus', + enabled = false, + min = 0, + max = 10 + }, + { + name = 'character_build_distance_bonus', + enabled = false, + min = 0, + max = 10 + }, + { + name = 'character_item_pickup_distance_bonus', + enabled = false, + min = 0, + max = 0 + }, + { + name = 'character_loot_pickup_distance_bonus', + enabled = false, + min = 0, + max = 0 + }, + { + name = 'character_item_drop_distance_bonus', + enabled = false, + min = 0, + max = 5 + }, + { + name = 'character_inventory_slots_bonus', + enabled = false, + min = 0, + max = 100 + }, + { + name = 'character_health_bonus', + enabled = false, + min = 0, + max = 200 + }, + { + name = 'worker_robots_speed_modifier', + enabled = false, + min = 0, + max = 1.3 + }, + { + name = 'worker_robots_battery_modifier', + enabled = true, + min = 0, + max = 1 + }, + { + name = 'worker_robots_storage_bonus', + enabled = true, + min = 0, + max = 1 + }, + { + name = 'following_robots_lifetime_modifier', + enabled = true, + min = 0, + max = 1 + }, + { + name = 'character_trash_slot_count', + enabled = false, + min = 0, + max = 20 + }, + { + name = 'mining_drill_productivity_bonus', + enabled = false, + min = 0, + max = 0 + }, + { + name = 'train_braking_force_bonus', + enabled = false, + min = 0, + max = 0 + }, + { + name = 'laboratory_speed_modifier', + enabled = false, + min = 0, + max = 0 + }, + { + name = 'laboratory_productivity_bonus', + enabled = false, + min = 0, + max = 0 + }, + { + name = 'inserter_stack_size_bonus', + enabled = false, + min = 0, + max = 0 + }, + { + name = 'stack_inserter_capacity_bonus', + enabled = false, + min = 0, + max = 0 + }, + { + name = 'artillery_range_modifier', + enabled = false, + min = 0, + max = 0 + } + }, + surface_bonus = { + { + name = 'solar_power_multiplier', + enabled = false, + min = 0, + max = 0 + } + } +} \ No newline at end of file diff --git a/config/bonuses.lua b/config/bonuses.lua deleted file mode 100644 index b96b48a2..00000000 --- a/config/bonuses.lua +++ /dev/null @@ -1,11 +0,0 @@ ---- Lists all bonuses which can be used, name followed by min max --- @config Bonuses - -return { - character_mining_speed_modifier={0,3}, - character_crafting_speed_modifier={0,3}, - character_running_speed_modifier={0,3}, - character_build_distance_bonus={0,20}, - character_reach_distance_bonus={0,20}, - character_inventory_slots_bonus={0,200} -} \ No newline at end of file diff --git a/config/discord_alerts.lua b/config/discord_alerts.lua index b19f80d3..2a5a7537 100644 --- a/config/discord_alerts.lua +++ b/config/discord_alerts.lua @@ -21,5 +21,5 @@ return { ['permissions']=true, ['editor']=true, ['cheat']=true, - ['open']=false, + ['open']=false } \ No newline at end of file diff --git a/config/expcore/roles.lua b/config/expcore/roles.lua index 20feeb14..cc942655 100644 --- a/config/expcore/roles.lua +++ b/config/expcore/roles.lua @@ -24,20 +24,22 @@ Roles.new_role('System','SYS') :set_flag('is_admin') :set_flag('is_spectator') :set_flag('report-immune') -:set_flag('instance-respawn') +:set_flag('instant-respawn') :set_allow_all() Roles.new_role('Senior Administrator','SAdmin') :set_permission_group('Admin') +:set_custom_color{r=233,g=63,b=233} :set_flag('is_admin') :set_flag('is_spectator') :set_flag('report-immune') -:set_flag('instance-respawn') +:set_flag('instant-respawn') :set_parent('Administrator') :allow{ 'command/interface', 'command/debug', - 'command/toggle-cheat-mode' + 'command/toggle-cheat-mode', + 'command/research-all', } Roles.new_role('Administrator','Admin') @@ -46,13 +48,13 @@ Roles.new_role('Administrator','Admin') :set_flag('is_admin') :set_flag('is_spectator') :set_flag('report-immune') -:set_flag('instance-respawn') +:set_flag('instant-respawn') :set_parent('Moderator') :allow{ - 'gui/warp-list/bypass-cooldown', 'gui/warp-list/bypass-proximity', + 'gui/warp-list/bypass-cooldown', 'command/connect-all', - 'command/collectdata' + 'command/collectdata', } Roles.new_role('Moderator','Mod') @@ -61,7 +63,7 @@ Roles.new_role('Moderator','Mod') :set_flag('is_admin') :set_flag('is_spectator') :set_flag('report-immune') -:set_flag('instance-respawn') +:set_flag('instant-respawn') :set_parent('Trainee') :allow{ 'command/assign-role', @@ -74,6 +76,7 @@ Roles.new_role('Moderator','Mod') 'command/clear-warnings', 'command/clear-inventory', 'command/bonus', + 'command/bonus/2', 'command/home', 'command/home-set', 'command/home-get', @@ -81,7 +84,9 @@ Roles.new_role('Moderator','Mod') 'command/connect-player', 'gui/rocket-info/toggle-active', 'gui/rocket-info/remote_launch', - 'fast-tree-decon', + 'command/toggle-friendly-fire', + 'command/toggle-always-day', + 'fast-tree-decon' } Roles.new_role('Trainee','TrMod') @@ -96,7 +101,6 @@ Roles.new_role('Trainee','TrMod') 'command/admin-marker', 'command/teleport', 'command/bring', - 'command/goto', 'command/give-warning', 'command/get-warnings', 'command/get-reports', @@ -112,6 +116,15 @@ Roles.new_role('Trainee','TrMod') 'command/search-amount', 'command/search-recent', 'command/search-online', + 'command/personal-battery-recharge', + 'command/waterfill', + 'command/pollution-off', + 'command/pollution-clear', + 'command/bot-queue-get', + 'command/bot-queue-set', + 'command/game-speed', + 'command/kill-biters', + 'command/remove-biters' } --- Trusted Roles @@ -120,13 +133,15 @@ Roles.new_role('Board Member','Board') :set_custom_color{r=247,g=246,b=54} :set_flag('is_spectator') :set_flag('report-immune') -:set_flag('instance-respawn') +:set_flag('instant-respawn') :set_parent('Sponsor') :allow{ 'command/goto', 'command/repair', 'command/spectate', 'command/follow', + 'command/personal-battery-recharge', + 'command/waterfill' } Roles.new_role('Senior Backer','Backer') @@ -134,7 +149,7 @@ Roles.new_role('Senior Backer','Backer') :set_custom_color{r=238,g=172,b=44} :set_flag('is_spectator') :set_flag('report-immune') -:set_flag('instance-respawn') +:set_flag('instant-respawn') :set_parent('Sponsor') :allow{ } @@ -144,12 +159,13 @@ Roles.new_role('Sponsor','Spon') :set_custom_color{r=238,g=172,b=44} :set_flag('is_spectator') :set_flag('report-immune') -:set_flag('instance-respawn') +:set_flag('instant-respawn') :set_parent('Supporter') :allow{ 'gui/rocket-info/toggle-active', 'gui/rocket-info/remote_launch', 'command/bonus', + 'command/bonus/2', 'command/home', 'command/home-set', 'command/home-get', @@ -203,14 +219,19 @@ end) Roles.new_role('Member','Mem') :set_permission_group('Standard') :set_custom_color{r=24,g=172,b=188} -:set_flag("deconlog-bypass") +:set_flag('deconlog-bypass') :set_parent('Regular') :allow{ 'gui/task-list/add', 'gui/task-list/edit', 'gui/warp-list/add', 'gui/warp-list/edit', - 'command/save-quickbar' + 'command/save-quickbar', + 'gui/vlayer-edit', + 'command/personal-logistic', + 'command/auto-research', + 'command/manual-train', + 'command/lawnmower' } local hours3, hours15 = 3*216000, 15*60 @@ -225,7 +246,7 @@ Roles.new_role('Regular','Reg') 'command/me', 'standard-decon', 'bypass-entity-protection', - 'bypass-nukeprotect' + 'bypass-nukeprotect' } :set_auto_assign_condition(function(player) if player.online_time >= hours3 then @@ -259,7 +280,9 @@ local default = Roles.new_role('Guest','') 'gui/science-info', 'gui/task-list', 'gui/warp-list', - 'gui/readme' + 'gui/readme', + 'gui/vlayer', + 'gui/research' } --- Jail role @@ -267,7 +290,7 @@ Roles.new_role('Jail') :set_permission_group('Restricted') :set_custom_color{r=50,g=50,b=50} :set_block_auto_assign(true) -:set_flag("defer_role_changes") +:set_flag('defer_role_changes') :disallow(default.allowed) --- System defaults which are required to be set @@ -293,44 +316,42 @@ Roles.define_role_order{ } Roles.override_player_roles{ - ["Cooldude2606"]={"Senior Administrator","Moderator","Senior Backer","Supporter"}, - ["arty714"]={"Senior Administrator","Senior Backer","Supporter"}, - ["Drahc_pro"]={"Administrator","Moderator","Veteran","Member"}, - ["mark9064"]={"Administrator","Moderator","Member"}, - ["aldldl"]={"Administrator","Moderator","Senior Backer","Sponsor","Supporter","Member"}, - - ["ookl"]={"Moderator","Senior Backer","Sponsor","Supporter","Partner","Member"}, - ["hamsterbryan"]={"Moderator","Senior Backer","Supporter","Member"}, - ["M74132"]={"Moderator","Senior Backer","Sponsor","Supporter","Member"}, - ["LoicB"]={"Moderator","Senior Backer","Supporter","Veteran","Member"}, - ["UUBlueFire"]={"Moderator","Senior Backer","Supporter","Member"}, - - ["thadius856"]={"Moderator","Supporter","Member"}, - ["XenoCyber"]={"Moderator","Supporter","Partner","Member"}, - ["cydes"]={"Moderator","Supporter","Member"}, - ["darklich14"]={"Moderator","Supporter","Member"}, - ["SilentLog"]={"Moderator","Supporter","Member"}, - ["freek18"]={"Moderator","Supporter","Member"}, - ["porelos"]={"Moderator","Supporter","Member"}, - - ["7h3w1z4rd"]={"Moderator","Member"}, - ["Windbomb"]={"Moderator","Member"}, - ["Phoenix27833"]={"Moderator","Member"}, - ["banakeg"]={"Moderator","Member"}, - ["maplesyrup01"]={"Moderator","Member"}, - ["FlipHalfling90"]={"Moderator","Member"}, - ["Ruuyji"]={"Moderator","Member"}, - ["Gizan"]={"Moderator"}, - ["samy115"]={"Moderator","Member"}, - ["Hobbitkicker"]={"Moderator","Member"}, - ["facere"]={"Moderator","Member"}, - ["whoami32"]={"Moderator","Member"}, - ["NextIdea"]={"Moderator","Member"}, - ["mafisch3"]={"Moderator","Member"}, - ["Tcheko"]={"Moderator","Member"}, - ["AssemblyStorm"]={"Moderator","Veteran","Member"}, - ["connormkii"]={"Moderator","Veteran","Member"}, - ["Koroto"]={"Moderator","Veteran","Member"}, - ["scarbvis"]={"Moderator","Member"}, - ["CmonMate497"]={"Moderator","Member"} + ['PHIDIAS0303']={'Moderator', 'Board Member', 'Member'}, + ['aldldl']={'Administrator', 'Moderator','Member'}, + ['arty714']={'Senior Administrator', 'Moderator', 'Member'}, + ['Cooldude2606']={'Senior Administrator', 'Moderator', 'Member'}, + ['Drahc_pro']={'Administrator', 'Moderator', 'Member'}, + ['mark9064']={'Administrator', 'Moderator','Member'}, + ['7h3w1z4rd']={'Moderator','Member'}, + ['FlipHalfling90']={'Moderator','Member'}, + ['hamsterbryan']={'Moderator','Member'}, + ['HunterOfGames']={'Moderator','Member'}, + ['NextIdea']={'Moderator','Member'}, + ['TheKernel32']={'Moderator','Member'}, + ['TheKernel64']={'Moderator','Member'}, + ['tovernaar123']={'Moderator','Member'}, + ['UUBlueFire']={'Moderator','Member'}, + ['AssemblyStorm']={'Moderator', 'Member'}, + ['banakeg']={'Moderator','Member'}, + ['connormkii']={'Moderator', 'Member'}, + ['cydes']={'Moderator','Member'}, + ['darklich14']={'Moderator','Member'}, + ['facere']={'Moderator','Member'}, + ['freek18']={'Moderator','Member'}, + ['Gizan']={'Moderator','Member'}, + ['LoicB']={'Moderator','Member'}, + ['M74132']={'Moderator','Member'}, + ['mafisch3']={'Moderator','Member'}, + ['maplesyrup01']={'Moderator','Member'}, + ['ookl']={'Moderator','Member'}, + ['Phoenix27833']={'Moderator','Member'}, + ['porelos']={'Moderator','Member'}, + ['Ruuyji']={'Moderator','Member'}, + ['samy115']={'Moderator','Member'}, + ['SilentLog']={'Moderator','Member'}, + ['Tcheko']={'Moderator','Member'}, + ['thadius856']={'Moderator','Member'}, + ['whoami32']={'Moderator','Member'}, + ['Windbomb']={'Moderator','Member'}, + ['XenoCyber']={'Moderator','Member'} } diff --git a/config/gui/science.lua b/config/gui/science.lua index c895e88f..6c5ce3cb 100644 --- a/config/gui/science.lua +++ b/config/gui/science.lua @@ -1,7 +1,8 @@ --- Config file for the science info gui -- @config Science -return { -- list of all science packs to be shown in the gui +return { + -- list of all science packs to be shown in the gui show_eta = true, --- @setting show_eta when true the eta for research completion will be shown color_cutoff = 0.8, --- @setting color_cutoff the amount that production can fall before the text changes color color_flux = 0.1, --- @setting color_flux the amount of fluctuation allowed in production before the icon changes color diff --git a/config/gui/warps.lua b/config/gui/warps.lua index 29e8075d..21bd770b 100644 --- a/config/gui/warps.lua +++ b/config/gui/warps.lua @@ -5,7 +5,7 @@ return { -- General config update_smoothing = 10, --- @setting update_smoothing the amount of smoothing applied to updates to the cooldown timer, higher is better, max is 60 minimum_distance = 100, --- @setting minimum_distance the minimum distance that is allowed between warps on the same force - default_icon = { type = 'item', name = 'discharge-defense-equipment' }, --- @setting default_icon the default icon that will be used for warps + default_icon = {type = 'item', name = 'discharge-defense-equipment'}, --- @setting default_icon the default icon that will be used for warps -- Warp cooldowns bypass_warp_cooldown = 'expcore.roles', --- @setting bypass_warp_cooldown dictates who the warp cooldown is applied to; values: all, admin, expcore.roles, none @@ -29,24 +29,24 @@ return { -- Warp area generation entities = { --- @setting entities The entities which are created for warp areas - {'small-lamp', -4, -2}, {'small-lamp', -2, -4}, {'small-electric-pole',-3,-3}, -- Top left corner - {'small-lamp', 3, -2}, {'small-lamp', 1, -4}, {'small-electric-pole',2,-3}, -- Top right corner - {'small-lamp', 3, 1}, {'small-lamp', 1, 3}, {'small-electric-pole',2,2}, -- Bottom right corner - {'small-lamp', -4, 1}, {'small-lamp', -2, 3}, {'small-electric-pole',-3,2}, -- Bottom left corner + {'small-lamp', -4, -2}, {'small-lamp', -2, -4}, {'medium-electric-pole',-3,-3}, -- Top left corner + {'small-lamp', 3, -2}, {'small-lamp', 1, -4}, {'medium-electric-pole',2,-3}, -- Top right corner + {'small-lamp', 3, 1}, {'small-lamp', 1, 3}, {'medium-electric-pole',2,2}, -- Bottom right corner + {'small-lamp', -4, 1}, {'small-lamp', -2, 3}, {'medium-electric-pole',-3,2}, -- Bottom left corner }, tiles = { --- @setting tiles The tiles which are created for warp areas - {"black-refined-concrete",-4,-2},{"black-refined-concrete",-4,-1},{"black-refined-concrete",-4,0},{"black-refined-concrete",-4,1}, - {"black-refined-concrete",-3,-3},{"purple-refined-concrete",-3,-2},{"purple-refined-concrete",-3,-1},{"purple-refined-concrete",-3,0}, - {"purple-refined-concrete",-3,1},{"black-refined-concrete",-3,2},{"black-refined-concrete",-2,-4},{"purple-refined-concrete",-2,-3}, - {"purple-refined-concrete",-2,-2},{"purple-refined-concrete",-2,-1},{"purple-refined-concrete",-2,0},{"purple-refined-concrete",-2,1}, - {"purple-refined-concrete",-2,2},{"black-refined-concrete",-2,3},{"black-refined-concrete",-1,-4},{"purple-refined-concrete",-1,-3}, - {"purple-refined-concrete",-1,-2},{"purple-refined-concrete",-1,-1},{"purple-refined-concrete",-1,0},{"purple-refined-concrete",-1,1}, - {"purple-refined-concrete",-1,2},{"black-refined-concrete",-1,3},{"black-refined-concrete",0,-4},{"purple-refined-concrete",0,-3}, - {"purple-refined-concrete",0,-2},{"purple-refined-concrete",0,-1},{"purple-refined-concrete",0,0},{"purple-refined-concrete",0,1}, - {"purple-refined-concrete",0,2},{"black-refined-concrete",0,3},{"black-refined-concrete",1,-4},{"purple-refined-concrete",1,-3}, - {"purple-refined-concrete",1,-2},{"purple-refined-concrete",1,-1},{"purple-refined-concrete",1,0},{"purple-refined-concrete",1,1}, - {"purple-refined-concrete",1,2},{"black-refined-concrete",1,3},{"black-refined-concrete",2,-3},{"purple-refined-concrete",2,-2}, - {"purple-refined-concrete",2,-1},{"purple-refined-concrete",2,0},{"purple-refined-concrete",2,1},{"black-refined-concrete",2,2}, - {"black-refined-concrete",3,-2},{"black-refined-concrete",3,-1},{"black-refined-concrete",3,0},{"black-refined-concrete",3,1} + {'black-refined-concrete',-4,-2}, {'black-refined-concrete',-4,-1}, {'black-refined-concrete',-4,0}, {'black-refined-concrete',-4,1}, + {'black-refined-concrete',-3,-3}, {'purple-refined-concrete',-3,-2}, {'purple-refined-concrete',-3,-1}, {'purple-refined-concrete',-3,0}, + {'purple-refined-concrete',-3,1}, {'black-refined-concrete',-3,2}, {'black-refined-concrete',-2,-4}, {'purple-refined-concrete',-2,-3}, + {'purple-refined-concrete',-2,-2}, {'purple-refined-concrete',-2,-1}, {'purple-refined-concrete',-2,0}, {'purple-refined-concrete',-2,1}, + {'purple-refined-concrete',-2,2}, {'black-refined-concrete',-2,3}, {'black-refined-concrete',-1,-4}, {'purple-refined-concrete',-1,-3}, + {'purple-refined-concrete',-1,-2}, {'purple-refined-concrete',-1,-1}, {'purple-refined-concrete',-1,0}, {'purple-refined-concrete',-1,1}, + {'purple-refined-concrete',-1,2}, {'black-refined-concrete',-1,3}, {'black-refined-concrete',0,-4}, {'purple-refined-concrete',0,-3}, + {'purple-refined-concrete',0,-2}, {'purple-refined-concrete',0,-1}, {'purple-refined-concrete',0,0}, {'purple-refined-concrete',0,1}, + {'purple-refined-concrete',0,2}, {'black-refined-concrete',0,3}, {'black-refined-concrete',1,-4}, {'purple-refined-concrete',1,-3}, + {'purple-refined-concrete',1,-2}, {'purple-refined-concrete',1,-1}, {'purple-refined-concrete',1,0}, {'purple-refined-concrete',1,1}, + {'purple-refined-concrete',1,2}, {'black-refined-concrete',1,3}, {'black-refined-concrete',2,-3}, {'purple-refined-concrete',2,-2}, + {'purple-refined-concrete',2,-1}, {'purple-refined-concrete',2,0}, {'purple-refined-concrete',2,1}, {'black-refined-concrete',2,2}, + {'black-refined-concrete',3,-2}, {'black-refined-concrete',3,-1}, {'black-refined-concrete',3,0}, {'black-refined-concrete',3,1} } } diff --git a/config/personal_logistic.lua b/config/personal_logistic.lua new file mode 100644 index 00000000..1f4bf0b8 --- /dev/null +++ b/config/personal_logistic.lua @@ -0,0 +1,1641 @@ +--- PL Settings +-- @config Personal Logistic + +return { + start = 0, + production_required = { + ['belt'] = 100, + ['power'] = 20, + ['miner'] = 20, + ['furnace'] = 20, + ['machine'] = 20, + ['pole'] = 20, + ['bot'] = 20, + ['inserter'] = 20, + ['chest'] = 20, + ['rail'] = 100, + ['module'] = 20, + ['defense'] = 20, + ['rocket'] = 20, + ['ammo'] = 20, + ['armor'] = 3, + ['armor_equipment'] = 4, + ['weapon'] = 0 + }, + request = { + -- belt + ['transport-belt'] = { + key = 1, + upgrade_of = nil, + type = 'belt', + stack = 100, + min = 500, + max = 500 + }, + ['underground-belt'] = { + key = 2, + upgrade_of = nil, + type = 'belt', + stack = 50, + min = 150, + max = 150 + }, + ['splitter'] = { + key = 3, + upgrade_of = nil, + type = 'belt', + stack = 50, + min = 100, + max = 100 + }, + ['fast-transport-belt'] = { + key = 11, + upgrade_of = 'transport-belt', + type = 'belt', + stack = 100, + min = 500, + max = 500 + }, + ['fast-underground-belt'] = { + key = 12, + upgrade_of = 'underground-belt', + type = 'belt', + stack = 50, + min = 150, + max = 150 + }, + ['fast-splitter'] = { + key = 13, + upgrade_of = 'splitter', + type = 'belt', + stack = 50, + min = 100, + max = 100 + }, + ['express-transport-belt'] = { + key = 21, + upgrade_of = 'fast-transport-belt', + type = 'belt', + stack = 100, + min = 500, + max = 500 + }, + ['express-underground-belt'] = { + key = 22, + upgrade_of = 'fast-underground-belt', + type = 'belt', + stack = 50, + min = 150, + max = 150 + }, + ['express-splitter'] = { + key = 23, + upgrade_of = 'fast-splitter', + type = 'belt', + stack = 50, + min = 100, + max = 100 + }, + -- power + ['solar-panel'] = { + key = 4, + upgrade_of = nil, + type = 'power', + stack = 50, + min = 50, + max = 50 + }, + ['accumulator'] = { + key = 5, + upgrade_of = nil, + type = 'power', + stack = 50, + min = 50, + max = 50 + }, + ['boiler'] = { + key = 6, + upgrade_of = nil, + type = nil, + stack = 50, + min = 0, + max = 0 + }, + ['steam-engine'] = { + key = 7, + upgrade_of = nil, + type = nil, + stack = 10, + min = 0, + max = 0 + }, + -- miner + ['burner-mining-drill'] = { + key = 8, + upgrade_of = nil, + type = 'miner', + stack = 50, + min = 0, + max = 0 + }, + ['electric-mining-drill'] = { + key = 9, + upgrade_of = 'burner-mining-drill', + type = 'miner', + stack = 50, + min = 250, + max = 250 + }, + ['pumpjack'] = { + key = 10, + upgrade_of = nil, + type = 'miner', + stack = 20, + min = 20, + max = 20 + }, + -- furnace + ['stone-furnace'] = { + key = 18, + upgrade_of = nil, + type = 'furnace', + stack = 50, + min = 0, + max = 50 + }, + ['steel-furnace'] = { + key = 19, + upgrade_of = 'stone-furnace', + type = 'furnace', + stack = 50, + min = 0, + max = 50 + }, + ['electric-furnace'] = { + key = 20, + upgrade_of = 'steel-furnace', + type = 'furnace', + stack = 50, + min = 50, + max = 50 + }, + -- machine + ['assembling-machine-1'] = { + key = 28, + upgrade_of = nil, + type = 'machine', + stack = 50, + min = 50, + max = 50 + }, + ['assembling-machine-2'] = { + key = 29, + upgrade_of = 'assembling-machine-1', + type = 'machine', + stack = 50, + min = 50, + max = 50 + }, + ['assembling-machine-3'] = { + key = 30, + upgrade_of = 'assembling-machine-2', + type = 'machine', + stack = 50, + min = 50, + max = 50 + }, + ['oil-refinery'] = { + key = 24, + upgrade_of = nil, + type = 'machine', + stack = 10, + min = 10, + max = 10 + }, + ['chemical-plant'] = { + key = 25, + upgrade_of = nil, + type = 'machine', + stack = 10, + min = 10, + max = 10 + }, + ['centrifuge'] = { + key = 26, + upgrade_of = nil, + type = nil, + stack = 50, + min = 0, + max = 0 + }, + ['lab'] = { + key = 27, + upgrade_of = nil, + type = nil, + stack = 10, + min = 0, + max = 0 + }, + ['nuclear-reactor'] = { + key = 14, + upgrade_of = nil, + type = nil, + stack = 10, + min = 0, + max = 0 + }, + ['heat-pipe'] = { + key = 15, + upgrade_of = nil, + type = nil, + stack = 50, + min = 0, + max = 0 + }, + ['heat-exchanger'] = { + key = 16, + upgrade_of = nil, + type = nil, + stack = 50, + min = 0, + max = 0 + }, + ['steam-turbine'] = { + key = 17, + upgrade_of = nil, + type = nil, + stack = 10, + min = 0, + max = 0 + }, + ['rocket-silo'] = { + key = 80, + upgrade_of = nil, + type = nil, + stack = 1, + min = 0, + max = 0 + }, + -- pole + ['small-electric-pole'] = { + key = 31, + upgrade_of = nil, + type = 'pole', + stack = 50, + min = 100, + max = 100 + }, + ['medium-electric-pole'] = { + key = 32, + upgrade_of = 'small-electric-pole', + type = 'pole', + stack = 50, + min = 100, + max = 100 + }, + ['big-electric-pole'] = { + key = 33, + upgrade_of = nil, + type = 'pole', + stack = 50, + min = 100, + max = 100 + }, + ['substation'] = { + key = 34, + upgrade_of = nil, + type = 'pole', + stack = 50, + min = 50, + max = 50 + }, + -- bot + ['roboport'] = { + key = 35, + upgrade_of = nil, + type = 'bot', + stack = 10, + min = 20, + max = 20 + }, + ['construction-robot'] = { + key = 36, + upgrade_of = nil, + type = 'bot', + stack = 50, + min = 50, + max = 50 + }, + ['logistic-robot'] = { + key = 37, + upgrade_of = nil, + type = 'bot', + stack = 50, + min = 0, + max = 0 + }, + ['cliff-explosives'] = { + key = 38, + upgrade_of = nil, + type = 'bot', + stack = 20, + min = 80, + max = 80 + }, + ['repair-pack'] = { + key = 39, + upgrade_of = nil, + type = 'bot', + stack = 100, + min = 100, + max = 100 + }, + ['landfill'] = { + key = 40, + upgrade_of = nil, + type = 'bot', + stack = 100, + min = 300, + max = 300 + }, + -- ore + ['wood'] = { + key = 151, + upgrade_of = nil, + type = nil, + stack = 100, + min = 0, + max = 0 + }, + ['coal'] = { + key = 152, + upgrade_of = nil, + type = nil, + stack = 50, + min = 0, + max = 0 + }, + ['stone'] = { + key = 153, + upgrade_of = nil, + type = nil, + stack = 50, + min = 0, + max = 0 + }, + ['iron-ore'] = { + key = 154, + upgrade_of = nil, + type = nil, + stack = 50, + min = 0, + max = 0 + }, + ['copper-ore'] = { + key = 155, + upgrade_of = nil, + type = nil, + stack = 50, + min = 0, + max = 0 + }, + ['uranium-ore'] = { + key = 156, + upgrade_of = nil, + type = nil, + stack = 50, + min = 0, + max = 0 + }, + ['raw-fish'] = { + key = 157, + upgrade_of = nil, + type = nil, + stack = 100, + min = 0, + max = 0 + }, + ['iron-stick'] = { + key = 158, + upgrade_of = nil, + type = nil, + stack = 100, + min = 0, + max = 0 + }, + ['iron-gear-wheel'] = { + key = 159, + upgrade_of = nil, + type = nil, + stack = 100, + min = 0, + max = 0 + }, + ['satellite'] = { + key = 160, + upgrade_of = nil, + type = nil, + stack = 1, + min = 0, + max = 0 + }, + -- inserter + ['burner-inserter'] = { + key = 41, + upgrade_of = nil, + type = 'inserter', + stack = 50, + min = 0, + max = 50 + }, + ['inserter'] = { + key = 42, + upgrade_of = 'burner-inserter', + type = 'inserter', + stack = 50, + min = 50, + max = 50 + }, + ['long-handed-inserter'] = { + key = 43, + upgrade_of = nil, + type = 'inserter', + stack = 50, + min = 50, + max = 50 + }, + ['fast-inserter'] = { + key = 44, + upgrade_of = 'inserter', + type = 'inserter', + stack = 50, + min = 50, + max = 50 + }, + ['filter-inserter'] = { + key = 45, + upgrade_of = nil, + type = 'inserter', + stack = 50, + min = 50, + max = 50 + }, + ['stack-inserter'] = { + key = 46, + upgrade_of = 'fast-inserter', + type = 'inserter', + stack = 50, + min = 50, + max = 50 + }, + ['stack-filter-inserter'] = { + key = 47, + upgrade_of = nil, + type = 'inserter', + stack = 50, + min = 50, + max = 50 + }, + -- pipe + ['pipe'] = { + key = 48, + upgrade_of = nil, + type = nil, + stack = 100, + min = 100, + max = 100 + }, + ['pipe-to-ground'] = { + key = 49, + upgrade_of = nil, + type = nil, + stack = 50, + min = 100, + max = 100 + }, + ['pump'] = { + key = 50, + upgrade_of = nil, + type = nil, + stack = 50, + min = 50, + max = 50 + }, + ['storage-tank'] = { + key = 59, + upgrade_of = nil, + type = nil, + stack = 50, + min = 50, + max = 50 + }, + -- chest + ['wooden-chest'] = { + key = 51, + upgrade_of = nil, + type = 'chest', + stack = 50, + min = 0, + max = 50 + }, + ['iron-chest'] = { + key = 52, + upgrade_of = 'wooden-chest', + type = 'chest', + stack = 50, + min = 0, + max = 50 + }, + ['steel-chest'] = { + key = 53, + upgrade_of = 'iron-chest', + type = 'chest', + stack = 50, + min = 50, + max = 50 + }, + ['logistic-chest-passive-provider'] = { + key = 54, + upgrade_of = nil, + type = 'chest', + stack = 50, + min = 50, + max = 50 + }, + ['logistic-chest-storage'] = { + key = 55, + upgrade_of = nil, + type = 'chest', + stack = 50, + min = 50, + max = 50 + }, + ['logistic-chest-requester'] = { + key = 56, + upgrade_of = nil, + type = 'chest', + stack = 50, + min = 50, + max = 50 + }, + ['logistic-chest-buffer'] = { + key = 57, + upgrade_of = nil, + type = 'chest', + stack = 50, + min = 50, + max = 50 + }, + ['logistic-chest-active-provider'] = { + key = 58, + upgrade_of = nil, + type = 'chest', + stack = 50, + min = 50, + max = 50 + }, + -- rail + ['rail'] = { + key = 61, + upgrade_of = nil, + type = 'rail', + stack = 100, + min = 1000, + max = 1000 + }, + ['train-stop'] = { + key = 62, + upgrade_of = nil, + type = 'rail', + stack = 10, + min = 10, + max = 10 + }, + ['rail-signal'] = { + key = 63, + upgrade_of = nil, + type = 'rail', + stack = 50, + min = 100, + max = 100 + }, + ['rail-chain-signal'] = { + key = 64, + upgrade_of = nil, + type = 'rail', + stack = 50, + min = 100, + max = 100 + }, + ['locomotive'] = { + key = 65, + upgrade_of = nil, + type = 'rail', + stack = 5, + min = 5, + max = 5 + }, + ['cargo-wagon'] = { + key = 66, + upgrade_of = nil, + type = 'rail', + stack = 5, + min = 10, + max = 10 + }, + ['fluid-wagon'] = { + key = 67, + upgrade_of = nil, + type = 'rail', + stack = 5, + min = 5, + max = 5 + }, + ['artillery-wagon'] = { + key = 68, + upgrade_of = nil, + type = 'rail', + stack = 5, + min = 0, + max = 0 + }, + -- circuit + ['constant-combinator'] = { + key = 71, + upgrade_of = nil, + type = nil, + stack = 50, + min = 50, + max = 50 + }, + ['arithmetic-combinator'] = { + key = 72, + upgrade_of = nil, + type = nil, + stack = 50, + min = 50, + max = 50 + }, + ['decider-combinator'] = { + key = 73, + upgrade_of = nil, + type = nil, + stack = 50, + min = 50, + max = 50 + }, + ['small-lamp'] = { + key = 74, + upgrade_of = nil, + type = nil, + stack = 50, + min = 100, + max = 100 + }, + ['red-wire'] = { + key = 75, + upgrade_of = nil, + type = nil, + stack = 200, + min = 200, + max = 200 + }, + ['green-wire'] = { + key = 76, + upgrade_of = nil, + type = nil, + stack = 200, + min = 200, + max = 200 + }, + ['copper-cable'] = { + key = 77, + upgrade_of = nil, + type = nil, + stack = 200, + min = 200, + max = 200 + }, + ['power-switch'] = { + key = 78, + upgrade_of = nil, + type = nil, + stack = 50, + min = 50, + max = 50 + }, + ['programmable-speaker'] = { + key = 79, + upgrade_of = nil, + type = nil, + stack = 50, + min = 0, + max = 0 + }, + ['offshore-pump'] = { + key = 60, + upgrade_of = nil, + type = nil, + stack = 20, + min = 20, + max = 20 + }, + -- module + ['beacon'] = { + key = 81, + upgrade_of = nil, + type = 'module', + stack = 10, + min = 20, + max = 20 + }, + ['speed-module'] = { + key = 82, + upgrade_of = nil, + type = 'module', + stack = 50, + min = 150, + max = 150 + }, + ['speed-module-2'] = { + key = 83, + upgrade_of = 'speed-module', + type = 'module', + stack = 50, + min = 0, + max = 0 + }, + ['speed-module-3'] = { + key = 84, + upgrade_of = 'speed-module-2', + type = 'module', + stack = 50, + min = 150, + max = 150 + }, + ['productivity-module'] = { + key = 85, + upgrade_of = nil, + type = 'module', + stack = 50, + min = 0, + max = 0 + }, + ['productivity-module-2'] = { + key = 86, + upgrade_of = 'productivity-module', + type = 'module', + stack = 50, + min = 0, + max = 0 + }, + ['productivity-module-3'] = { + key = 87, + upgrade_of = 'productivity-module-2', + type = 'module', + stack = 50, + min = 0, + max = 0 + }, + ['effectivity-module'] = { + key = 88, + upgrade_of = nil, + type = 'module', + stack = 50, + min = 0, + max = 0 + }, + ['effectivity-module-2'] = { + key = 89, + upgrade_of = 'effectivity-module', + type = 'module', + stack = 50, + min = 0, + max = 0 + }, + ['effectivity-module-3'] = { + key = 90, + upgrade_of = 'effectivity-module-2', + type = 'module', + stack = 50, + min = 0, + max = 0 + }, + -- defense + ['stone-wall'] = { + key = 91, + upgrade_of = nil, + type = 'defense', + stack = 100, + min = 0, + max = 0 + }, + ['gate'] = { + key = 92, + upgrade_of = nil, + type = 'defense', + stack = 50, + min = 0, + max = 0 + }, + ['gun-turret'] = { + key = 93, + upgrade_of = nil, + type = 'defense', + stack = 50, + min = 0, + max = 0 + }, + ['laser-turret'] = { + key = 94, + upgrade_of = nil, + type = 'defense', + stack = 50, + min = 100, + max = 100 + }, + ['flamethrower-turret'] = { + key = 95, + upgrade_of = nil, + type = 'defense', + stack = 50, + min = 0, + max = 0 + }, + ['artillery-turret'] = { + key = 96, + upgrade_of = nil, + type = 'defense', + stack = 10, + min = 0, + max = 0 + }, + -- rocket + ['rocket'] = { + key = 101, + upgrade_of = nil, + type = 'rocket', + stack = 200, + min = 0, + max = 0 + }, + ['explosive-rocket'] = { + key = 102, + upgrade_of = 'rocket', + type = 'rocket', + stack = 200, + min = 1000, + max = 1000 + }, + ['atomic-bomb'] = { + key = 103, + upgrade_of = 'explosive-rocket', + type = 'rocket', + stack = 10, + min = 50, + max = 50 + }, + ['rocket-launcher'] = { + key = 104, + upgrade_of = nil, + type = 'weapon', + stack = 5, + min = 1, + max = 1 + }, + ['flamethrower'] = { + key = 105, + upgrade_of = nil, + type = 'weapon', + stack = 5, + min = 0, + max = 0 + }, + ['pistol'] = { + key = 106, + upgrade_of = nil, + type = 'weapon', + stack = 5, + min = 0, + max = 0 + }, + ['submachine-gun'] = { + key = 107, + upgrade_of = nil, + type = 'weapon', + stack = 5, + min = 0, + max = 0 + }, + ['shotgun'] = { + key = 108, + upgrade_of = nil, + type = 'weapon', + stack = 5, + min = 0, + max = 0 + }, + ['combat-shotgun'] = { + key = 109, + upgrade_of = nil, + type = 'weapon', + stack = 5, + min = 0, + max = 0 + }, + ['land-mine'] = { + key = 110, + upgrade_of = nil, + type = nil, + stack = 100, + min = 0, + max = 0 + }, + -- ammo + ['firearm-magazine'] = { + key = 111, + upgrade_of = nil, + type = 'ammo', + stack = 200, + min = 0, + max = 0 + }, + ['piercing-rounds-magazine'] = { + key = 112, + upgrade_of = 'firearm-magazine', + type = 'ammo', + stack = 200, + min = 0, + max = 0 + }, + ['uranium-rounds-magazine'] = { + key = 113, + upgrade_of = 'piercing-rounds-magazine', + type = 'ammo', + stack = 200, + min = 0, + max = 0 + }, + ['flamethrower-ammo'] = { + key = 114, + upgrade_of = nil, + type = 'ammo', + stack = 100, + min = 0, + max = 0 + }, + ['shotgun-shell'] = { + key = 115, + upgrade_of = nil, + type = 'ammo', + stack = 200, + min = 0, + max = 0 + }, + ['piercing-shotgun-shell'] = { + key = 116, + upgrade_of = nil, + type = 'ammo', + stack = 200, + min = 0, + max = 0 + }, + ['cannon-shell'] = { + key = 117, + upgrade_of = nil, + type = 'ammo', + stack = 200, + min = 0, + max = 0 + }, + ['explosive-cannon-shell'] = { + key = 118, + upgrade_of = nil, + type = 'ammo', + stack = 200, + min = 0, + max = 0 + }, + ['uranium-cannon-shell'] = { + key = 119, + upgrade_of = nil, + type = 'ammo', + stack = 200, + min = 0, + max = 0 + }, + ['explosive-uranium-cannon-shell'] = { + key = 120, + upgrade_of = nil, + type = 'ammo', + stack = 200, + min = 0, + max = 0 + }, + ['grenade'] = { + key = 97, + upgrade_of = nil, + type = 'ammo', + stack = 100, + min = 0, + max = 0 + }, + ['cluster-grenade'] = { + key = 98, + upgrade_of = nil, + type = 'ammo', + stack = 100, + min = 0, + max = 0 + }, + ['artillery-shell'] = { + key = 121, + upgrade_of = nil, + type = nil, + stack = 1, + min = 0, + max = 0 + }, + ['poison-capsule'] = { + key = 122, + upgrade_of = nil, + type = nil, + stack = 100, + min = 0, + max = 0 + }, + ['slowdown-capsule'] = { + key = 123, + upgrade_of = nil, + type = nil, + stack = 100, + min = 0, + max = 0 + }, + ['defender-capsule'] = { + key = 124, + upgrade_of = nil, + type = nil, + stack = 100, + min = 0, + max = 0 + }, + ['distractor-capsule'] = { + key = 125, + upgrade_of = nil, + type = nil, + stack = 100, + min = 0, + max = 0 + }, + ['destroyer-capsule'] = { + key = 126, + upgrade_of = nil, + type = nil, + stack = 100, + min = 0, + max = 0 + }, + ['car'] = { + key = 127, + upgrade_of = nil, + type = nil, + stack = 1, + min = 0, + max = 0 + }, + ['tank'] = { + key = 128, + upgrade_of = nil, + type = nil, + stack = 1, + min = 0, + max = 0 + }, + ['spidertron'] = { + key = 129, + upgrade_of = nil, + type = nil, + stack = 1, + min = 0, + max = 0 + }, + ['spidertron-remote'] = { + key = 130, + upgrade_of = nil, + type = nil, + stack = 1, + min = 0, + max = 0 + }, + ['radar'] = { + key = 99, + upgrade_of = nil, + type = nil, + stack = 50, + min = 50, + max = 50 + }, + -- armor + ['light-armor'] = { + key = 131, + upgrade_of = nil, + type = 'armor', + stack = 1, + min = 0, + max = 1 + }, + ['heavy-armor'] = { + key = 132, + upgrade_of = 'light-armor', + type = 'armor', + stack = 1, + min = 0, + max = 1 + }, + ['modular-armor'] = { + key = 133, + upgrade_of = 'heavy-armor', + type = 'armor', + stack = 1, + min = 0, + max = 1 + }, + ['power-armor'] = { + key = 134, + upgrade_of = 'modular-armor', + type = 'armor', + stack = 1, + min = 0, + max = 1 + }, + ['power-armor-mk2'] = { + key = 135, + upgrade_of = 'power-armor', + type = 'armor', + stack = 1, + min = 0, + max = 1 + }, + -- armor equipment + ['solar-panel-equipment'] = { + key = 136, + upgrade_of = nil, + type = 'armor_equipment', + stack = 20, + min = 0, + max = 0 + }, + ['fusion-reactor-equipment'] = { + key = 137, + upgrade_of = 'solar-panel-equipment', + type = 'armor_equipment', + stack = 20, + min = 0, + max = 0 + }, + ['belt-immunity-equipment'] = { + key = 138, + upgrade_of = nil, + type = 'armor_equipment', + stack = 20, + min = 0, + max = 0 + }, + ['night-vision-equipment'] = { + key = 139, + upgrade_of = nil, + type = 'armor_equipment', + stack = 20, + min = 0, + max = 0 + }, + ['personal-laser-defense-equipment'] = { + key = 140, + upgrade_of = nil, + type = 'armor_equipment', + stack = 20, + min = 0, + max = 0 + }, + ['personal-roboport-equipment'] = { + key = 141, + upgrade_of = nil, + type = 'armor_equipment', + stack = 20, + min = 0, + max = 0 + }, + ['personal-roboport-mk2-equipment'] = { + key = 142, + upgrade_of = 'personal-roboport-equipment', + type = 'armor_equipment', + stack = 20, + min = 0, + max = 0 + }, + ['energy-shield-equipment'] = { + key = 143, + upgrade_of = nil, + type = 'armor_equipment', + stack = 20, + min = 0, + max = 0 + }, + ['energy-shield-mk2-equipment'] = { + key = 144, + upgrade_of = 'energy-shield-equipment', + type = 'armor_equipment', + stack = 20, + min = 0, + max = 0 + }, + ['battery-equipment'] = { + key = 145, + upgrade_of = nil, + type = 'armor_equipment', + stack = 20, + min = 0, + max = 0 + }, + ['battery-mk2-equipment'] = { + key = 146, + upgrade_of = 'battery-equipment', + type = 'armor_equipment', + stack = 20, + min = 0, + max = 0 + }, + ['exoskeleton-equipment'] = { + key = 147, + upgrade_of = nil, + type = 'armor_equipment', + stack = 20, + min = 0, + max = 0 + }, + ['discharge-defense-equipment'] = { + key = 148, + upgrade_of = nil, + type = 'armor_equipment', + stack = 20, + min = 0, + max = 0 + }, + ['discharge-defense-remote'] = { + key = 149, + upgrade_of = nil, + type = nil, + stack = 1, + min = 0, + max = 0 + }, + ['artillery-targeting-remote'] = { + key = 150, + upgrade_of = nil, + type = nil, + stack = 1, + min = 1, + max = 1 + }, + -- path + ['stone-brick'] = { + key = 100, + upgrade_of = nil, + type = nil, + stack = 100, + min = 0, + max = 0 + }, + ['concrete'] = { + key = 69, + upgrade_of = nil, + type = nil, + stack = 100, + min = 0, + max = 0 + }, + ['hazard-concrete'] = { + key = 70, + upgrade_of = nil, + type = nil, + stack = 100, + min = 0, + max = 0 + }, + ['refined-concrete'] = { + key = 188, + upgrade_of = nil, + type = nil, + stack = 100, + min = 0, + max = 0 + }, + ['refined-hazard-concrete'] = { + key = 189, + upgrade_of = nil, + type = nil, + stack = 100, + min = 0, + max = 0 + }, + ['crude-oil-barrel'] = { + key = 161, + upgrade_of = nil, + type = nil, + stack = 10, + min = 0, + max = 0 + }, + ['heavy-oil-barrel'] = { + key = 162, + upgrade_of = nil, + type = nil, + stack = 10, + min = 0, + max = 0 + }, + ['light-oil-barrel'] = { + key = 163, + upgrade_of = nil, + type = nil, + stack = 10, + min = 0, + max = 0 + }, + ['lubricant-barrel'] = { + key = 164, + upgrade_of = nil, + type = nil, + stack = 10, + min = 0, + max = 0 + }, + ['petroleum-gas-barrel'] = { + key = 165, + upgrade_of = nil, + type = nil, + stack = 10, + min = 0, + max = 0 + }, + ['sulfuric-acid-barrel'] = { + key = 166, + upgrade_of = nil, + type = nil, + stack = 10, + min = 0, + max = 0 + }, + ['water-barrel'] = { + key = 167, + upgrade_of = nil, + type = nil, + stack = 10, + min = 0, + max = 0 + }, + ['empty-barrel'] = { + key = 168, + upgrade_of = nil, + type = nil, + stack = 10, + min = 0, + max = 0 + }, + ['uranium-fuel-cell'] = { + key = 169, + upgrade_of = nil, + type = nil, + stack = 50, + min = 0, + max = 0 + }, + ['used-up-uranium-fuel-cell'] = { + key = 170, + upgrade_of = nil, + type = nil, + stack = 50, + min = 0, + max = 0 + }, + -- science and circuit + ['automation-science-pack'] = { + key = 171, + upgrade_of = nil, + type = nil, + stack = 200, + min = 0, + max = 0 + }, + ['logistic-science-pack'] = { + key = 172, + upgrade_of = nil, + type = nil, + stack = 200, + min = 0, + max = 0 + }, + ['military-science-pack'] = { + key = 173, + upgrade_of = nil, + type = nil, + stack = 200, + min = 0, + max = 0 + }, + ['chemical-science-pack'] = { + key = 174, + upgrade_of = nil, + type = nil, + stack = 200, + min = 0, + max = 0 + }, + ['production-science-pack'] = { + key = 175, + upgrade_of = nil, + type = nil, + stack = 200, + min = 0, + max = 0 + }, + ['utility-science-pack'] = { + key = 176, + upgrade_of = nil, + type = nil, + stack = 200, + min = 0, + max = 0 + }, + ['space-science-pack'] = { + key = 177, + upgrade_of = nil, + type = nil, + stack = 2000, + min = 0, + max = 0 + }, + ['electronic-circuit'] = { + key = 178, + upgrade_of = nil, + type = nil, + stack = 200, + min = 0, + max = 0 + }, + ['advanced-circuit'] = { + key = 179, + upgrade_of = nil, + type = nil, + stack = 200, + min = 0, + max = 0 + }, + ['processing-unit'] = { + key = 180, + upgrade_of = nil, + type = nil, + stack = 100, + min = 0, + max = 0 + }, + -- intermediate + ['iron-plate'] = { + key = 181, + upgrade_of = nil, + type = nil, + stack = 100, + min = 0, + max = 0 + }, + ['copper-plate'] = { + key = 182, + upgrade_of = nil, + type = nil, + stack = 100, + min = 0, + max = 0 + }, + ['steel-plate'] = { + key = 183, + upgrade_of = nil, + type = nil, + stack = 100, + min = 0, + max = 0 + }, + ['plastic-bar'] = { + key = 184, + upgrade_of = nil, + type = nil, + stack = 100, + min = 0, + max = 0 + }, + ['sulfur'] = { + key = 185, + upgrade_of = nil, + type = nil, + stack = 50, + min = 0, + max = 0 + }, + ['battery'] = { + key = 186, + upgrade_of = nil, + type = nil, + stack = 200, + min = 0, + max = 0 + }, + ['explosives'] = { + key = 187, + upgrade_of = nil, + type = nil, + stack = 50, + min = 0, + max = 0 + }, + ['engine-unit'] = { + key = 191, + upgrade_of = nil, + type = nil, + stack = 50, + min = 0, + max = 0 + }, + ['electric-engine-unit'] = { + key = 192, + upgrade_of = nil, + type = nil, + stack = 50, + min = 0, + max = 0 + }, + ['flying-robot-frame'] = { + key = 193, + upgrade_of = nil, + type = nil, + stack = 50, + min = 0, + max = 0 + }, + ['rocket-control-unit'] = { + key = 194, + upgrade_of = nil, + type = nil, + stack = 10, + min = 0, + max = 0 + }, + ['low-density-structure'] = { + key = 195, + upgrade_of = nil, + type = nil, + stack = 10, + min = 0, + max = 0 + }, + ['solid-fuel'] = { + key = 196, + upgrade_of = nil, + type = nil, + stack = 50, + min = 0, + max = 0 + }, + ['rocket-fuel'] = { + key = 197, + upgrade_of = nil, + type = nil, + stack = 10, + min = 0, + max = 0 + }, + ['nuclear-fuel'] = { + key = 198, + upgrade_of = nil, + type = nil, + stack = 1, + min = 0, + max = 0 + }, + ['uranium-235'] = { + key = 199, + upgrade_of = nil, + type = nil, + stack = 100, + min = 0, + max = 0 + }, + ['uranium-238'] = { + key = 200, + upgrade_of = nil, + type = nil, + stack = 100, + min = 0, + max = 0 + } + } +} \ No newline at end of file diff --git a/config/preset_player_colours.lua b/config/preset_player_colours.lua index 4d27adc7..b592e26c 100644 --- a/config/preset_player_colours.lua +++ b/config/preset_player_colours.lua @@ -3,6 +3,7 @@ return { players={ --- @setting players list of all players and the colour in rgb256 that they will recive upon joining + PHIDIAS0303={r=255,g=255,b=255}, BADgamerNL={r=255,g=20,b=147}, arty714={r=150,g=68,b=161}, Cooldude2606={r=57,g=192,b=207}, diff --git a/config/research.lua b/config/research.lua new file mode 100644 index 00000000..6aafc1a9 --- /dev/null +++ b/config/research.lua @@ -0,0 +1,300 @@ +--- Res Settings +-- @config Research + +return { + enabled = true, + queue_amount = 3, + bonus = { + enabled = false, + name = 'laboratory_productivity_bonus', + rate = 1 + }, + -- this enable 20 more inventory for each mining productivity level up to 4 + bonus_inventory = { + enabled = true, + name = 'character_inventory_slots_bonus', + rate = 5, + limit = 20 + }, + milestone = { + { + name = 'automation', + time = 600 + }, + { + name = 'logistics', + time = 300 + }, + { + name = 'steel-processing', + time = 300 + }, + { + name = 'logistic-science-pack', + time = 300 + }, + { + name = 'electronics', + time = 300 + }, + { + name = 'fast-inserter', + time = 300 + }, + { + name = 'steel-axe', + time = 300 + }, + { + name = 'automation-2', + time = 300 + }, + { + name = 'advanced-material-processing', + time = 300 + }, + { + name = 'engine', + time = 300 + }, + { + name = 'fluid-handling', + time = 300 + }, + { + name = 'oil-processing', + time = 300 + }, + { + name = 'sulfur-processing', + time = 300 + }, + { + name = 'plastics', + time = 300 + }, + { + name = 'advanced-electronics', + time = 300 + }, + { + name = 'chemical-science-pack', + time = 300 + }, + { + name = 'modules', + time = 300 + }, + { + name = 'logistics-2', + time = 300 + }, + { + name = 'railway', + time = 300 + }, + { + name = 'research-speed-1', + time = 300 + }, + { + name = 'research-speed-2', + time = 300 + }, + { + name = 'battery', + time = 300 + }, + { + name = 'concrete', + time = 300 + }, + { + name = 'flammables', + time = 300 + }, + { + name = 'low-density-structure', + time = 300 + }, + { + name = 'advanced-material-processing-2', + time = 300 + }, + { + name = 'productivity-module', + time = 300 + }, + { + name = 'production-science-pack', + time = 300 + }, + { + name = 'advanced-electronics-2', + time = 300 + }, + { + name = 'advanced-oil-processing', + time = 300 + }, + { + name = 'lubricant', + time = 300 + }, + { + name = 'electric-engine', + time = 300 + }, + { + name = 'robotics', + time = 300 + }, + { + name = 'construction-robotics', + time = 300 + }, + { + name = 'worker-robots-speed-1', + time = 300 + }, + { + name = 'worker-robots-speed-2', + time = 300 + }, + { + name = 'utility-science-pack', + time = 300 + }, + { + name = 'productivity-module-2', + time = 300 + }, + { + name = 'speed-module-2', + time = 300 + }, + { + name = 'rocket-fuel', + time = 300 + }, + { + name = 'effect-transmission', + time = 300 + }, + { + name = 'productivity-module-3', + time = 300 + }, + { + name = 'rocket-control-unit', + time = 300 + }, + { + name = 'speed-module-3', + time = 300 + }, + { + name = 'rocket-silo', + time = 300 + }, + { + name = 'space-science-pack', + time = 300 + } + }, + inf_res = { + { + -- Mining Productivity + name = 'mining-productivity-4', + level = 4 + }, + { + -- Robot Speed + name = 'worker-robots-speed-6', + level = 6 + }, + { + -- Laser Damage + name = 'energy-weapons-damage-7', + level = 7 + }, + { + -- Explosive Damage + name = 'stronger-explosives-7', + level = 7 + }, + { + -- Bullet Damage + name = 'physical-projectile-damage-7', + level = 7 + }, + { + -- Flame Damage + name = 'refined-flammables-7', + level = 7 + }, + { + -- Artillery Range + name = 'artillery-shell-range-1', + level = 1 + }, + { + -- Artillery Speed + name = 'artillery-shell-speed-1', + level = 1 + } + } + --[[ + limit_research = false, + limit_research_list = { + { + -- Mining Productivity + name = 'mining-productivity-4', + enabled = false, + level = 4 + }, + { + -- Robot Speed + name = 'worker-robots-speed-6', + enabled = false, + level = 6 + }, + { + -- Laser Damage + name = 'energy-weapons-damage-7', + enabled = false, + level = 7 + }, + { + -- Explosive Damage + name = 'stronger-explosives-7', + enabled = false, + level = 7 + }, + { + -- Bullet Damage + name = 'physical-projectile-damage-7', + enabled = false, + level = 7 + }, + { + -- Flame Damage + name = 'refined-flammables-7', + enabled = false, + level = 7 + }, + { + -- Artillery Range + name = 'artillery-shell-range-1', + enabled = false, + level = 1 + }, + { + -- Artillery Speed + name = 'artillery-shell-speed-1', + enabled = false, + level = 1 + } + } + ]] +} diff --git a/config/scorched_earth.lua b/config/scorched_earth.lua index 64ab9568..fb3a92c1 100644 --- a/config/scorched_earth.lua +++ b/config/scorched_earth.lua @@ -2,7 +2,7 @@ -- @config Scorched-Earth return { - weakness_value=50, --- @setting weakness_value lower value will make tiles more likely to degrade + weakness_value=70, --- @setting weakness_value lower value will make tiles more likely to degrade strengths={ --- @setting strengths this decides how "strong" a tile is, bigger number means less likely to degrade -- debug: /interface require('modules.addons.worn-paths')(player.name,true) -- note: tiles are effected by the tiles around them, so player paths will not degrade as fast when made wider @@ -40,7 +40,7 @@ return { ["dirt-6"]=40, --["dirt-7"]=0, -- last tile, nothing to degrade to -- land fill chain - ["landfill"]=50, + -- ["landfill"]=50, --["water-shallow"]=90, --["water-mud"]=0, -- last tile, nothing to degrade to }, @@ -77,7 +77,7 @@ return { ["dirt-6"]='dirt-7', --["dirt-7"]=0, -- last tile, nothing to degrade to -- land fill chain - ["landfill"]='grass-2', -- 'water-shallow' + -- ["landfill"]='grass-2', -- 'water-shallow' --["water-shallow"]='water-mud', --["water-mud"]=0, -- last tile, nothing to degrade to }, diff --git a/config/spawn_area.lua b/config/spawn_area.lua index e3d0fb53..335c4876 100644 --- a/config/spawn_area.lua +++ b/config/spawn_area.lua @@ -3,7 +3,9 @@ return { spawn_area = { --- @setting spawn_area Settings relating to the whole spawn area - deconstruction_radius = 20, --- @setting deconstruction_radius All entities within this radius will be removed + -- Enable predefined patches: 128, else: 32 + deconstruction_radius = 20, -- @setting deconstruction_radius All entities within this radius will be removed + tile_radius = 20, deconstruction_tile = 'concrete', --- @setting deconstruction_tile Tile to be placed in the deconstruction radius, use nil for map gen landfill_radius = 50, --- @setting pattern_radius All water within this radius will be land filled }, @@ -11,62 +13,62 @@ return { enabled = true, --- @setting enabled Whether turrets will be added to spawn ammo_type = 'uranium-rounds-magazine', --- @setting ammo_type The ammo type that will be used during refills refill_time = 60*60*5, --- @setting refill_time The time in ticks between each refill of the turrets, only change if having lag issues - offset = { x=0, y=0 }, --- @setting offset The position offset to apply to turrets + offset = {x=0, y=0}, --- @setting offset The position offset to apply to turrets locations = { --- @setting locations The locations of all turrets, this list can change during runtime {surface=1,position={x=-3,y=-3}}, - {surface=1,position={x= 3,y=-3}}, - {surface=1,position={x=-3,y= 3}}, - {surface=1,position={x= 3,y= 3}} + {surface=1,position={x=3,y=-3}}, + {surface=1,position={x=-3,y=3}}, + {surface=1,position={x=3,y=3}} } }, afk_belts = { --- @setting afk_belts Settings relating to adding afk belts to spawn enabled = true, --- @setting enabled Whether afk belts will be added to spawn belt_type = 'transport-belt', --- @setting belt_type The belt to be used as afk belts protected = true, --- @setting protected Whether belts will be protected from player interaction - offset = { x=0, y=0 }, --- @setting offset The position offset to apply to afk belts + offset = {x=0, y=0}, --- @setting offset The position offset to apply to afk belts locations={ --- @setting locations The locations to spawn afk belts at, given as the top left position - {-5, -5}, { 5, -5}, - {-5, 5}, { 5, 5} + {-5,-5}, {5,-5}, + {-5,5}, {5,5} } }, water = { --- @setting water Settings relating to adding water to spawn enabled = true, --- @setting enabled Whether water tiles will be added to spawn water_tile = 'water-mud', --- @setting water_tile The tile to be used as the water tile - offset = { x=0, y=0 }, --- @setting offset The position offset to apply to water tiles + offset = {x=0, y=0}, --- @setting offset The position offset to apply to water tiles locations = { --- @setting locations The location of the water tiles {x,y} -- Each is a 3x3 with the closest tile to 0,0 removed - { 7, 8}, { 7, 9 }, { 8, 7}, { 8, 8}, { 8, 9 }, { 9, 7}, { 9, 8}, { 9, 9 }, -- Bottom Right - { 7, -9}, { 7, -10}, { 8, -8}, { 8, -9}, { 8, -10}, { 9, -8}, { 9, -9}, { 9, -10}, -- Top Right - {-8, -9}, {-8, -10}, {-9, -8}, {-9, -9}, {-9, -10}, {-10, -8}, {-10, -9}, {-10, -10}, -- Top Left - {-8, 8}, {-8, 9 }, {-9, 7}, {-9, 8}, {-9, 9 }, {-10, 7}, {-10, 8}, {-10, 9 }, -- Bottom Left + {7,8}, {7,9}, {8,7}, {8,8}, {8,9}, {9,7}, {9,8}, {9,9}, -- Bottom Right + {7,-9}, {7,-10}, {8,-8}, {8,-9}, {8,-10}, {9,-8}, { 9,-9}, {9,-10}, -- Top Right + {-8,-9}, {-8,-10}, {-9,-8}, {-9,-9}, {-9,-10}, {-10,-8}, {-10,-9}, {-10,-10}, -- Top Left + {-8,8}, {-8,9}, {-9,7}, {-9,8}, {-9,9}, {-10,7}, {-10,8}, {-10,9}, -- Bottom Left } }, entities = { --- @setting entities Settings relating to adding entities to spawn enabled = true, --- @setting enabled Whether entities will be added to spawn protected = true, --- @setting protected Whether entities will be protected from player interaction operable = true, --- @setting operable Whether entities can be opened by players, must be true if chests are used - offset = { x=0, y=-2 }, --- @setting offset The position offset to apply to entities + offset = {x=0, y=-2}, --- @setting offset The position offset to apply to entities locations = { --- @setting locations The location and names of entities {name,x,y} - {"stone-wall",-10,-5},{"stone-wall",-10,-4},{"stone-wall",-10,-3},{"stone-wall",-10,-2},{"stone-wall",-10,-1},{"stone-wall",-10,0},{"stone-wall",-10,3},{"stone-wall",-10,4},{"stone-wall",-10,5}, - {"stone-wall",-10,6},{"stone-wall",-10,7},{"stone-wall",-10,8},{"small-lamp",-8,-4},{"small-lamp",-8,-1},{"iron-chest",-8,0},{"iron-chest",-8,3},{"small-lamp",-8,4}, - {"small-lamp",-8,7},{"stone-wall",-7,-8},{"small-electric-pole",-7,-2},{"iron-chest",-7,0},{"iron-chest",-7,3},{"small-electric-pole",-7,5},{"stone-wall",-7,11},{"stone-wall",-6,-8},{"small-lamp",-6,-6}, - {"iron-chest",-6,0},{"iron-chest",-6,3},{"small-lamp",-6,9},{"stone-wall",-6,11},{"stone-wall",-5,-8},{"small-lamp",-5,-1},{"iron-chest",-5,0},{"iron-chest",-5,3},{"small-lamp",-5,4},{"stone-wall",-5,11}, - {"stone-wall",-4,-8},{"small-electric-pole",-4,-5},{"iron-chest",-4,0},{"iron-chest",-4,3},{"small-electric-pole",-4,8},{"stone-wall",-4,11},{"stone-wall",-3,-8},{"small-lamp",-3,-6},{"small-lamp",-3,-3},{"small-lamp",-3,6}, - {"small-lamp",-3,9},{"stone-wall",-3,11},{"stone-wall",-2,-8},{"iron-chest",-2,-6},{"iron-chest",-2,-5},{"iron-chest",-2,-4},{"iron-chest",-2,-3},{"iron-chest",-2,-2},{"iron-chest",-2,5},{"iron-chest",-2,6}, - {"iron-chest",-2,7},{"iron-chest",-2,8},{"iron-chest",-2,9},{"stone-wall",-2,11},{"stone-wall",1,-8},{"iron-chest",1,-6}, - {"iron-chest",1,-5},{"iron-chest",1,-4},{"iron-chest",1,-3},{"iron-chest",1,-2},{"iron-chest",1,5},{"iron-chest",1,6},{"iron-chest",1,7},{"iron-chest",1,8},{"iron-chest",1,9},{"stone-wall",1,11}, - {"stone-wall",2,-8},{"small-lamp",2,-6},{"small-lamp",2,-3},{"small-lamp",2,6},{"small-lamp",2,9},{"stone-wall",2,11},{"stone-wall",3,-8},{"small-electric-pole",3,-5},{"iron-chest",3,0},{"iron-chest",3,3}, - {"small-electric-pole",3,8},{"stone-wall",3,11},{"stone-wall",4,-8},{"small-lamp",4,-1},{"iron-chest",4,0},{"iron-chest",4,3},{"small-lamp",4,4},{"stone-wall",4,11},{"stone-wall",5,-8},{"small-lamp",5,-6}, - {"iron-chest",5,0},{"iron-chest",5,3},{"small-lamp",5,9},{"stone-wall",5,11},{"stone-wall",6,-8},{"small-electric-pole",6,-2},{"iron-chest",6,0},{"iron-chest",6,3},{"small-electric-pole",6,5},{"stone-wall",6,11}, - {"small-lamp",7,-4},{"small-lamp",7,-1},{"iron-chest",7,0},{"iron-chest",7,3},{"small-lamp",7,4},{"small-lamp",7,7},{"stone-wall",9,-5}, - {"stone-wall",9,-4},{"stone-wall",9,-3},{"stone-wall",9,-2},{"stone-wall",9,-1},{"stone-wall",9,0},{"stone-wall",9,3},{"stone-wall",9,4},{"stone-wall",9,5},{"stone-wall",9,6},{"stone-wall",9,7}, - {"stone-wall",9,8} + {'stone-wall',-10,-5},{'stone-wall',-10,-4},{'stone-wall',-10,-3},{'stone-wall',-10,-2},{'stone-wall',-10,-1},{'stone-wall',-10,0},{'stone-wall',-10,3},{'stone-wall',-10,4},{'stone-wall',-10,5}, + {'stone-wall',-10,6},{'stone-wall',-10,7},{'stone-wall',-10,8},{'small-lamp',-8,-4},{'small-lamp',-8,-1},{'iron-chest',-8,0},{'iron-chest',-8,3},{'small-lamp',-8,4}, + {'small-lamp',-8,7},{'stone-wall',-7,-8},{'small-electric-pole',-7,-2},{'iron-chest',-7,0},{'iron-chest',-7,3},{'small-electric-pole',-7,5},{'stone-wall',-7,11},{'stone-wall',-6,-8},{'small-lamp',-6,-6}, + {'iron-chest',-6,0},{'iron-chest',-6,3},{'small-lamp',-6,9},{'stone-wall',-6,11},{'stone-wall',-5,-8},{'small-lamp',-5,-1},{'iron-chest',-5,0},{'iron-chest',-5,3},{'small-lamp',-5,4},{'stone-wall',-5,11}, + {'stone-wall',-4,-8},{'small-electric-pole',-4,-5},{'iron-chest',-4,0},{'iron-chest',-4,3},{'small-electric-pole',-4,8},{'stone-wall',-4,11},{'stone-wall',-3,-8},{'small-lamp',-3,-6},{'small-lamp',-3,-3},{'small-lamp',-3,6}, + {'small-lamp',-3,9},{'stone-wall',-3,11},{'stone-wall',-2,-8},{'iron-chest',-2,-6},{'iron-chest',-2,-5},{'iron-chest',-2,-4},{'iron-chest',-2,-3},{'iron-chest',-2,-2},{'iron-chest',-2,5},{'iron-chest',-2,6}, + {'iron-chest',-2,7},{'iron-chest',-2,8},{'iron-chest',-2,9},{'stone-wall',-2,11},{'stone-wall',1,-8},{'iron-chest',1,-6}, + {'iron-chest',1,-5},{'iron-chest',1,-4},{'iron-chest',1,-3},{'iron-chest',1,-2},{'iron-chest',1,5},{'iron-chest',1,6},{'iron-chest',1,7},{'iron-chest',1,8},{'iron-chest',1,9},{'stone-wall',1,11}, + {'stone-wall',2,-8},{'small-lamp',2,-6},{'small-lamp',2,-3},{'small-lamp',2,6},{'small-lamp',2,9},{'stone-wall',2,11},{'stone-wall',3,-8},{'small-electric-pole',3,-5},{'iron-chest',3,0},{'iron-chest',3,3}, + {'small-electric-pole',3,8},{'stone-wall',3,11},{'stone-wall',4,-8},{'small-lamp',4,-1},{'iron-chest',4,0},{'iron-chest',4,3},{'small-lamp',4,4},{'stone-wall',4,11},{'stone-wall',5,-8},{'small-lamp',5,-6}, + {'iron-chest',5,0},{'iron-chest',5,3},{'small-lamp',5,9},{'stone-wall',5,11},{'stone-wall',6,-8},{'small-electric-pole',6,-2},{'iron-chest',6,0},{'iron-chest',6,3},{'small-electric-pole',6,5},{'stone-wall',6,11}, + {'small-lamp',7,-4},{'small-lamp',7,-1},{'iron-chest',7,0},{'iron-chest',7,3},{'small-lamp',7,4},{'small-lamp',7,7},{'stone-wall',9,-5}, + {'stone-wall',9,-4},{'stone-wall',9,-3},{'stone-wall',9,-2},{'stone-wall',9,-1},{'stone-wall',9,0},{'stone-wall',9,3},{'stone-wall',9,4},{'stone-wall',9,5},{'stone-wall',9,6},{'stone-wall',9,7}, + {'stone-wall',9,8} } }, pattern = { enabled = true, --- @setting enabled Whether pattern tiles will be added to spawn pattern_tile = 'stone-path', --- @setting pattern_tile The tile to be used for the pattern - offset = { x=0, y=-2 }, --- @setting offset The position offset to apply to pattern tiles + offset = {x=0, y=-2}, --- @setting offset The position offset to apply to pattern tiles locations = { --- @setting locations The location of the pattern tiles {x,y} {-49,-3},{-49,-2},{-49,1},{-49,2},{-49,5},{-49,6},{-48,-4},{-48,-3},{-48,-2},{-48,1},{-48,2},{-48,5},{-48,6},{-48,7},{-47,-7},{-47,-6},{-47,-5},{-47,-4},{-47,-3},{-47,-2},{-47,5},{-47,6},{-47,7},{-47,8},{-47,9},{-47,10},{-46,-8},{-46,-7},{-46,-6},{-46,-5}, {-46,-4},{-46,-3},{-46,-2},{-46,-1},{-46,4},{-46,5},{-46,6},{-46,7},{-46,8},{-46,9},{-46,10},{-46,11},{-45,-17},{-45,-16},{-45,-15},{-45,-14},{-45,-13},{-45,-12},{-45,-9},{-45,-8},{-45,-7},{-45,-2},{-45,-1},{-45,0},{-45,1},{-45,2},{-45,3},{-45,4},{-45,5},{-45,10}, @@ -176,5 +178,77 @@ return { {44,17},{44,18},{44,19},{44,20},{45,-8},{45,-7},{45,-6},{45,-5},{45,-4},{45,-3},{45,-2},{45,-1},{45,4},{45,5},{45,6},{45,7},{45,8},{45,9},{45,10},{45,11},{46,-7},{46,-6},{46,-5},{46,-4},{46,-3},{46,-2},{46,5},{46,6},{46,7},{46,8}, {46,9},{46,10},{47,-4},{47,-3},{47,-2},{47,1},{47,2},{47,5},{47,6},{47,7},{48,-3},{48,-2},{48,1},{48,2},{48,5},{48,6} } + }, + resource_tiles = { + enabled = false, + resources = { + { + enabled = false, + name = 'iron-ore', + amount = 4000, + size = {26, 27}, + -- offset = {-64,-32} + offset = {-64,-64} + }, + { + enabled = false, + name = 'copper-ore', + amount = 4000, + size = {26, 27}, + -- offset = {-64, 0} + offset = {64, -64} + }, + { + enabled = false, + name = 'stone', + amount = 4000, + size = {22, 20}, + -- offset = {-64, 32} + offset = {-64, 64} + }, + { + enabled = false, + name = 'coal', + amount = 4000, + size = {22, 20}, + -- offset = {-64, -64} + offset = {64, 64} + }, + { + enabled = false, + name = 'uranium-ore', + amount = 4000, + size = {22, 20}, + -- offset = {-64, -96} + offset = {0, 64} + } + } + }, + resource_patches = { + enabled = false, + resources = { + { + enabled = false, + name = 'crude-oil', + num_patches = 4, + amount = 4000000, + -- offset = {-80, -12}, + offset = {-12, 64}, + -- offset_next = {0, 6} + offset_next = {6, 0} + } + } + }, + resource_refill_nearby = { + enabled = false, + range = 128, + resources_name = { + 'iron-ore', + 'copper-ore', + 'stone', + 'coal', + 'uranium-ore' + }, + amount = {2500, 4000} } } \ No newline at end of file diff --git a/config/station_auto_name.lua b/config/station_auto_name.lua new file mode 100644 index 00000000..d95cfd97 --- /dev/null +++ b/config/station_auto_name.lua @@ -0,0 +1,11 @@ +return { + --[[ + __icon__ + __item_name__ + __backer_name__ + __direction__ + __x__ + __y__ + ]] + station_name = '[L] __icon__' +} \ No newline at end of file diff --git a/config/statistics.lua b/config/statistics.lua index 8693e486..c766972f 100644 --- a/config/statistics.lua +++ b/config/statistics.lua @@ -41,6 +41,6 @@ return { 'Kills', 'Deaths', 'DamageDealt', 'DistanceTravelled', 'CapsulesUsed', 'EntityRepaired', - 'DeconstructionPlannerUsed', 'MapTagsMade', + 'DeconstructionPlannerUsed', 'MapTagsMade' } } \ No newline at end of file diff --git a/config/vlayer.lua b/config/vlayer.lua new file mode 100644 index 00000000..0d35fe99 --- /dev/null +++ b/config/vlayer.lua @@ -0,0 +1,167 @@ +-- Vlayer Config +-- @config Vlayer + +return { + enabled = true, + update_tick = 10, + -- 10 MJ + energy_base_limit = 10000000, + land = { + enabled = true, + tile = 'landfill', + result = 4, + requirement = { + ['solar-panel'] = 9, + ['accumulator'] = 4 + } + }, + always_day = false, + battery_limit = true, + -- setting to a value greater than 1 will allow for wireless energy transfer + interface_limit = { + storage_input = 1, + energy = 1, + circuit = 1 + }, + print_out = { + ['electric-energy-interface'] = 'energy interface', + ['constant-combinator'] = 'circuit output', + ['logistic-chest-storage'] = 'storage input' + }, + gui = { + style = 'heading_1_label', + type = 'label', + content = { + { + title = 'Storage', + type = nil, + name = nil + }, + { + title = '', + type = nil, + name = nil + }, + { + title = '[img=entity/solar-panel] Solar Panel', + type = nil, + name = nil + }, + { + title = 0, + type = 'item', + name = 'solar-panel' + }, + { + title = '[img=entity/accumulator] Accumulator', + type = nil, + name = nil + }, + { + title = 0, + type = 'item', + name = 'accumulator' + }, + { + title = '[virtual-signal=signal-L] Landfill', + type = nil, + name = nil + }, + { + title = 0, + type = 'signal', + name = 7 + }, + { + title = '[virtual-signal=signal-A] Solar Available', + type = nil, + name = nil + }, + { + title = 0, + type = 'signal', + name = 8 + }, + { + title = '[virtual-signal=signal-B] Acc Available', + type = nil, + name = nil + }, + { + title = 0, + type = 'signal', + name = 9 + }, + { + title = 'Power Production', + type = nil, + name = nil + }, + { + title = 'MW', + type = nil, + name = nil + }, + { + title = '[virtual-signal=signal-P] Peak', + type = nil, + name = nil + }, + { + title = '0', + type = 'signal', + name = 1 + }, + { + title = '[virtual-signal=signal-S] Sustained', + type = nil, + name = nil + }, + { + title = '0', + type = 'signal', + name = 2 + }, + { + title = 'Battery', + type = nil, + name = nil + }, + { + title = 'MJ', + type = nil, + name = nil + }, + { + title = '[virtual-signal=signal-M] Max', + type = nil, + name = nil + }, + { + title = '0', + type = 'signal', + name = 3 + }, + { + title = '[virtual-signal=signal-C] Current', + type = nil, + name = nil + }, + { + title = '0', + type = 'signal', + name = 4 + }, + { + title = 'Convert', + type = nil, + name = nil + }, + { + title = '', + type = nil, + name = nil + } + } + } +} \ No newline at end of file diff --git a/locale/en/commands.cfg b/locale/en/commands.cfg index d90b01e6..f3c8ec2b 100644 --- a/locale/en/commands.cfg +++ b/locale/en/commands.cfg @@ -55,6 +55,7 @@ result=__1__ entites were revived and __2__ were healed to max health. [expcom-bonus] set=Your bonus has been set to __1__. +perm=You dont have enough permission to set more than __1__. wip=This command is temporary and will be replaced at some point in the future. [expcom-ratio] @@ -110,3 +111,33 @@ reject-item=No item was found with internal name __1__; try using rich text sele results-heading=Players found with [item=__1__]: results-item=__1__) __2__ has __3__ items. (__4__) results-none=No players have [item=__1__] + +[expcom-speed] +result=The game speed is now __1__ + +[expcom-bot-queue] +result=The successful attempts are currently __1__ and failed attempts are __2__. + +[expcom-pol] +clr=The server had pollution **REMOVED** by __1__. Please @staff on the discord if this was done by mistake. +off=The server had pollution **DISABLED** by __1__. Please @staff on the discord if this was done by mistake. + +[expcom-train] +manual-result=Set __1__ trains into automatic mode. + +[expcom-cheat] +day=Always day is set to __1__ + +[expcom-ff] +ff=Friendly fire is set to __1__ + +[expcom-res] +res=Auto Research is set to __1__ +msg=[color=255, 255, 255] Research Completed at __1__ - [technology=__2__][/color] +inf=[color=255, 255, 255] Research Completed at __1__ - [technology=__2__] - __3__[/color] +main-tooltip=Research GUI + +[expcom-waterfill] +waterfill-distance=Too close to designated location +waterfill-cliff=Not enough cliff explosive to create water +entered-area-selection=Entered area selection, select areas to convert. diff --git a/locale/en/data.cfg b/locale/en/data.cfg index e98c73da..8881c5c9 100644 --- a/locale/en/data.cfg +++ b/locale/en/data.cfg @@ -10,6 +10,7 @@ saved=Your quickbar filters have been saved. Warnings=Warnings Warnings-tooltip=The total number of warnings you have received from staff Warnings-value-tooltip=The total number of warnings you have received from staff + [exp-settings] Colour=Colour Colour-tooltip=Your player colour @@ -35,6 +36,7 @@ TagColor-value-tooltip=Change by using /tag-color Bonus=Player Bonus Bonus-tooltip=The bonus given to your character Bonus-value-tooltip=Change by using /bonus +HasEnabledDecon=Quick Tree Decon [exp-statistics] MapsPlayed=Maps Played @@ -84,4 +86,20 @@ EntityRepaired-tooltip=The number of machines which you have repaired DeconstructionPlannerUsed=Decon Planner Used DeconstructionPlannerUsed-tooltip=The number of times you have used the deconstruction planner MapTagsMade=Map Tags Created -MapTagsMade-tooltip=The number of map tags you have created \ No newline at end of file +MapTagsMade-tooltip=The number of map tags you have created +DamageDeathRatio=Damage Death Ratio +DamageDeathRatio-tooltip=Damage over Death +KillDeathRatio=Kill Death Ratio +KillDeathRatio-tooltip=Kill over Death +SessionTime=Session Time +SessionTime-tooltip=Session Time +BuildRatio=Build Ratio +BuildRatio-tooltip=Build over Remove +RocketPerHour=Rocket Per Hour +RocketPerHour-tooltip=Rocket Launched Over Play Time in Hour +TreeKillPerMinute=Tree Kill Per Minute +TreeKillPerMinute-tooltip=Tree Destroyed Per Minute +NetPlayTime=Net Play Time +NetPlayTime-tooltip=Net Play Time +AFKTimeRatio=AFK Time Ratio +AFKTimeRatio-tooltip=AFK Time over Play Time diff --git a/locale/en/gui.cfg b/locale/en/gui.cfg index 311c19b5..623fbbbd 100644 --- a/locale/en/gui.cfg +++ b/locale/en/gui.cfg @@ -87,6 +87,7 @@ edit-tooltip-none=Currently being edited by: Nobody create-footer-header=Create task edit-footer-header=Edit task view-footer-header=Task details + [autofill] main-tooltip=Autofill settings toggle-section-caption=__1__ __2__ @@ -206,4 +207,7 @@ data-format=__1____2__ main-tooltip=Toggle fast tree decon enabled=enabled disabled=disabled -toggle-msg=Fast decon has been __1__ \ No newline at end of file +toggle-msg=Fast decon has been __1__ + +[vlayer] +main-tooltip=Enable vlayer GUI diff --git a/locale/zh-CN/addons.cfg b/locale/zh-CN/addons.cfg index 73af5418..5bc1b3b5 100644 --- a/locale/zh-CN/addons.cfg +++ b/locale/zh-CN/addons.cfg @@ -83,3 +83,6 @@ jail=__1__ 因被多次舉報而被送監. 請等候管理員. [protection-jail] jail=__1__ 因被多次拆除受保護物體而被送監. 請等候管理員. + +[nukeprotect] +found=You cannot have __1__ in your inventory, so it was placed into the chests at spawn. diff --git a/locale/zh-CN/commands.cfg b/locale/zh-CN/commands.cfg index 19788810..8b59407b 100644 --- a/locale/zh-CN/commands.cfg +++ b/locale/zh-CN/commands.cfg @@ -55,6 +55,7 @@ result=共 __1__ 個建築恢復其中 __2__ 把 HP 回滿. [expcom-bonus] set=你的附加比例現在為 __1__. +perm=You dont have enough permission to set more than __1__. wip=本指令是暫時的, 將來可能會被更換. [expcom-ratio] @@ -110,3 +111,33 @@ reject-item=沒找到 __1__; 可試用富文本. results-heading=以下用戶有 [item=__1__]: results-item=__1__) __2__ 有 __3__ 個. (__4__) results-none=沒用戶有 [item=__1__] + +[expcom-speed] +result=The game speed is now __1__ + +[expcom-bot-queue] +result=The successful attempts are currently __1__ and failed attempts are __2__ + +[expcom-pol] +clr=The server had pollution **REMOVED** by __1__. Please @staff on the discord if this was done by mistake. +off=The server had pollution **DISABLED** by __1__. Please @staff on the discord if this was done by mistake. + +[expcom-train] +manual-result=Set __1__ train into automatic mode. + +[expcom-cheat] +day=Always day is set to __1__ + +[expcom-ff] +ff=Friendly fire is set to __1__ + +[expcom-res] +res=Auto Research is set to __1__ +msg=[color=255, 255, 255] Research Completed at __1__ - [technology=__2__][/color] +inf=[color=255, 255, 255] Research Completed at __1__ - [technology=__2__] - __3__[/color] +main-tooltip=Research GUI + +[expcom-waterfill] +waterfill-distance=Too close to designated location +waterfill-cliff=Not enough cliff explosive to create water +entered-area-selection=Entered area selection, select areas to convert. diff --git a/locale/zh-CN/data.cfg b/locale/zh-CN/data.cfg index 36bcdce5..a0fe8642 100644 --- a/locale/zh-CN/data.cfg +++ b/locale/zh-CN/data.cfg @@ -10,6 +10,7 @@ saved=你的工具列已儲存 Warnings=警告 Warnings-tooltip=你所有收到的警告 Warnings-value-tooltip=你所有收到的警告 + [exp-settings] Colour=顏色 Colour-tooltip=你的人物顏色 @@ -35,6 +36,7 @@ TagColor-value-tooltip=使用 /tag-color 來更換你的人物標籤顏色 Bonus=人物附加屬性 Bonus-tooltip=你的人物附加屬性 Bonus-value-tooltip=使用 /bonus 來更改 +HasEnabledDecon=Quick Tree Decon [exp-statistics] MapsPlayed=地圖遊玩次數 @@ -84,4 +86,20 @@ EntityRepaired-tooltip=你在本伺服器維修過機器的次數 DeconstructionPlannerUsed=拆除規劃器使用次數 DeconstructionPlannerUsed-tooltip=你在本伺服器使用過拆除規劃器的次數 MapTagsMade=地圖標籤數量 -MapTagsMade-tooltip=你在本伺服器放過的地圖標籤數量 \ No newline at end of file +MapTagsMade-tooltip=你在本伺服器放過的地圖標籤數量 +DamageDeathRatio=Damage Death Ratio +DamageDeathRatio-tooltip=Damage over Death +KillDeathRatio=Kill Death Ratio +KillDeathRatio-tooltip=Kill over Death +SessionTime=Session Time +SessionTime-tooltip=Session Time +BuildRatio=Build Ratio +BuildRatio-tooltip=Build over Remove +RocketPerHour=Rocket Per Hour +RocketPerHour-tooltip=Rocket Launched Over Play Time in Hour +TreeKillPerMinute=Tree Kill Per Minute +TreeKillPerMinute-tooltip=Tree Destroyed Per Minute +NetPlayTime=Net Play Time +NetPlayTime-tooltip=Net Play Time +AFKTimeRatio=AFK Time Ratio +AFKTimeRatio-tooltip=AFK Time over Play Time diff --git a/locale/zh-CN/gui.cfg b/locale/zh-CN/gui.cfg index 86904c88..dc242759 100644 --- a/locale/zh-CN/gui.cfg +++ b/locale/zh-CN/gui.cfg @@ -87,6 +87,7 @@ edit-tooltip-none=現沒有被人修改 create-footer-header=加入工作流程 edit-footer-header=修改工作流程 view-footer-header=工作流程細節 + [autofill] main-tooltip=自動填入設定 toggle-section-caption=__1__ __2__ @@ -206,4 +207,7 @@ data-format=__1____2__ main-tooltip=樹木快速拆除選項 enabled=啟用 disabled=停用 -toggle-msg=樹木快速拆除已 __1__ \ No newline at end of file +toggle-msg=樹木快速拆除已 __1__ + +[vlayer] +main-tooltip=Enable vlayer GUI diff --git a/locale/zh-TW/addons.cfg b/locale/zh-TW/addons.cfg index 73af5418..5bc1b3b5 100644 --- a/locale/zh-TW/addons.cfg +++ b/locale/zh-TW/addons.cfg @@ -83,3 +83,6 @@ jail=__1__ 因被多次舉報而被送監. 請等候管理員. [protection-jail] jail=__1__ 因被多次拆除受保護物體而被送監. 請等候管理員. + +[nukeprotect] +found=You cannot have __1__ in your inventory, so it was placed into the chests at spawn. diff --git a/locale/zh-TW/commands.cfg b/locale/zh-TW/commands.cfg index 19788810..8b59407b 100644 --- a/locale/zh-TW/commands.cfg +++ b/locale/zh-TW/commands.cfg @@ -55,6 +55,7 @@ result=共 __1__ 個建築恢復其中 __2__ 把 HP 回滿. [expcom-bonus] set=你的附加比例現在為 __1__. +perm=You dont have enough permission to set more than __1__. wip=本指令是暫時的, 將來可能會被更換. [expcom-ratio] @@ -110,3 +111,33 @@ reject-item=沒找到 __1__; 可試用富文本. results-heading=以下用戶有 [item=__1__]: results-item=__1__) __2__ 有 __3__ 個. (__4__) results-none=沒用戶有 [item=__1__] + +[expcom-speed] +result=The game speed is now __1__ + +[expcom-bot-queue] +result=The successful attempts are currently __1__ and failed attempts are __2__ + +[expcom-pol] +clr=The server had pollution **REMOVED** by __1__. Please @staff on the discord if this was done by mistake. +off=The server had pollution **DISABLED** by __1__. Please @staff on the discord if this was done by mistake. + +[expcom-train] +manual-result=Set __1__ train into automatic mode. + +[expcom-cheat] +day=Always day is set to __1__ + +[expcom-ff] +ff=Friendly fire is set to __1__ + +[expcom-res] +res=Auto Research is set to __1__ +msg=[color=255, 255, 255] Research Completed at __1__ - [technology=__2__][/color] +inf=[color=255, 255, 255] Research Completed at __1__ - [technology=__2__] - __3__[/color] +main-tooltip=Research GUI + +[expcom-waterfill] +waterfill-distance=Too close to designated location +waterfill-cliff=Not enough cliff explosive to create water +entered-area-selection=Entered area selection, select areas to convert. diff --git a/locale/zh-TW/data.cfg b/locale/zh-TW/data.cfg index 36bcdce5..a0fe8642 100644 --- a/locale/zh-TW/data.cfg +++ b/locale/zh-TW/data.cfg @@ -10,6 +10,7 @@ saved=你的工具列已儲存 Warnings=警告 Warnings-tooltip=你所有收到的警告 Warnings-value-tooltip=你所有收到的警告 + [exp-settings] Colour=顏色 Colour-tooltip=你的人物顏色 @@ -35,6 +36,7 @@ TagColor-value-tooltip=使用 /tag-color 來更換你的人物標籤顏色 Bonus=人物附加屬性 Bonus-tooltip=你的人物附加屬性 Bonus-value-tooltip=使用 /bonus 來更改 +HasEnabledDecon=Quick Tree Decon [exp-statistics] MapsPlayed=地圖遊玩次數 @@ -84,4 +86,20 @@ EntityRepaired-tooltip=你在本伺服器維修過機器的次數 DeconstructionPlannerUsed=拆除規劃器使用次數 DeconstructionPlannerUsed-tooltip=你在本伺服器使用過拆除規劃器的次數 MapTagsMade=地圖標籤數量 -MapTagsMade-tooltip=你在本伺服器放過的地圖標籤數量 \ No newline at end of file +MapTagsMade-tooltip=你在本伺服器放過的地圖標籤數量 +DamageDeathRatio=Damage Death Ratio +DamageDeathRatio-tooltip=Damage over Death +KillDeathRatio=Kill Death Ratio +KillDeathRatio-tooltip=Kill over Death +SessionTime=Session Time +SessionTime-tooltip=Session Time +BuildRatio=Build Ratio +BuildRatio-tooltip=Build over Remove +RocketPerHour=Rocket Per Hour +RocketPerHour-tooltip=Rocket Launched Over Play Time in Hour +TreeKillPerMinute=Tree Kill Per Minute +TreeKillPerMinute-tooltip=Tree Destroyed Per Minute +NetPlayTime=Net Play Time +NetPlayTime-tooltip=Net Play Time +AFKTimeRatio=AFK Time Ratio +AFKTimeRatio-tooltip=AFK Time over Play Time diff --git a/locale/zh-TW/gui.cfg b/locale/zh-TW/gui.cfg index 86904c88..dc242759 100644 --- a/locale/zh-TW/gui.cfg +++ b/locale/zh-TW/gui.cfg @@ -87,6 +87,7 @@ edit-tooltip-none=現沒有被人修改 create-footer-header=加入工作流程 edit-footer-header=修改工作流程 view-footer-header=工作流程細節 + [autofill] main-tooltip=自動填入設定 toggle-section-caption=__1__ __2__ @@ -206,4 +207,7 @@ data-format=__1____2__ main-tooltip=樹木快速拆除選項 enabled=啟用 disabled=停用 -toggle-msg=樹木快速拆除已 __1__ \ No newline at end of file +toggle-msg=樹木快速拆除已 __1__ + +[vlayer] +main-tooltip=Enable vlayer GUI diff --git a/modules/addons/advanced-start.lua b/modules/addons/advanced-start.lua index dad7802b..65795f26 100644 --- a/modules/addons/advanced-start.lua +++ b/modules/addons/advanced-start.lua @@ -27,6 +27,14 @@ Event.add(defines.events.on_player_created, function(event) end end end + + if config.armor.enable then + player.insert{name=config.armor.main, count=1} + + for _, item in pairs(config.armor.item) do + player.insert{name=item.equipment, count=item.count} + end + end end) Event.on_init(function() diff --git a/modules/addons/compilatron.lua b/modules/addons/compilatron.lua index f2932ca7..bc3686f3 100644 --- a/modules/addons/compilatron.lua +++ b/modules/addons/compilatron.lua @@ -70,9 +70,11 @@ function Public.add_compilatron(entity, name) if not entity and not entity.valid then return end + if name == nil then return end + Public.compilatrons[name] = entity local message = entity.surface.create_entity( @@ -95,6 +97,7 @@ end Event.add(defines.events.on_player_created, function(event) if event.player_index ~= 1 then return end local player = game.players[event.player_index] + for location in pairs(locations) do Public.spawn_compilatron(player.surface, location) end diff --git a/modules/addons/deconlog.lua b/modules/addons/deconlog.lua index 52b1914a..b44d5416 100644 --- a/modules/addons/deconlog.lua +++ b/modules/addons/deconlog.lua @@ -11,13 +11,28 @@ local filepath = "log/decon.log" local function add_log(data) game.write_file(filepath, data .. "\n", true, 0) -- write data end -local function get_secs () + +local function get_secs() return format_time(game.tick, { hours = true, minutes = true, seconds = true, string = true }) end -local function pos_tostring (pos) + +local function pos_to_string(pos) return tostring(pos.x) .. "," .. tostring(pos.y) end +local function pos_to_gps_string(pos) + return '[gps=' .. tostring(pos.x) .. ',' .. tostring(pos.y) .. ']' +end + +--- Print a message to all players who match the value of admin +local function print_to_players(admin, message) + for _, player in ipairs(game.connected_players) do + if player.admin == admin then + player.print(message) + end + end +end + Event.on_init(function() game.write_file(filepath, "\n", false, 0) -- write data end) @@ -25,8 +40,17 @@ end) if config.decon_area then Event.add(defines.events.on_player_deconstructed_area, function (e) local player = game.get_player(e.player_index) - if Roles.player_has_flag(player, "deconlog-bypass") then return end - add_log(get_secs() .. "," .. player.name .. ",decon_area," .. pos_tostring(e.area.left_top) .. "," .. pos_tostring(e.area.right_bottom)) + if Roles.player_has_flag(player, "deconlog-bypass") then + return + end + + local items = e.surface.find_entities_filtered{area=e.area, force=player.force} + + if #items > 250 then + print_to_players(true, player.name .. ' tried to deconstruct the area ' .. pos_to_gps_string(e.area.left_top) .. ' to ' .. pos_to_gps_string(e.area.right_bottom) .. ' that have ' .. #items .. ' items, but were not allowed.') + end + + add_log(get_secs() .. "," .. player.name .. ",decon_area," .. pos_to_string(e.area.left_top) .. "," .. pos_to_string(e.area.right_bottom)) end) end @@ -34,30 +58,38 @@ if config.built_entity then Event.add(defines.events.on_built_entity, function (e) if not e.player_index then return end local player = game.get_player(e.player_index) - if Roles.player_has_flag(player, "deconlog-bypass") then return end + if Roles.player_has_flag(player, "deconlog-bypass") then + return + end local ent = e.created_entity - add_log(get_secs() .. "," .. player.name .. ",built_entity," .. ent.name .. "," .. pos_tostring(ent.position) .. "," .. tostring(ent.direction) .. "," .. tostring(ent.orientation)) + add_log(get_secs() .. "," .. player.name .. ",built_entity," .. ent.name .. "," .. pos_to_string(ent.position) .. "," .. tostring(ent.direction) .. "," .. tostring(ent.orientation)) end) end if config.mined_entity then Event.add(defines.events.on_player_mined_entity, function (e) local player = game.get_player(e.player_index) - if Roles.player_has_flag(player, "deconlog-bypass") then return end + if Roles.player_has_flag(player, "deconlog-bypass") then + return + end local ent = e.entity - add_log(get_secs() .. "," .. player.name .. ",mined_entity," .. ent.name .. "," .. pos_tostring(ent.position) .. "," .. tostring(ent.direction) .. "," .. tostring(ent.orientation)) + add_log(get_secs() .. "," .. player.name .. ",mined_entity," .. ent.name .. "," .. pos_to_string(ent.position) .. "," .. tostring(ent.direction) .. "," .. tostring(ent.orientation)) end) end if config.fired_rocket then Event.add(defines.events.on_player_ammo_inventory_changed, function (e) local player = game.get_player(e.player_index) - if Roles.player_has_flag(player, "deconlog-bypass") then return end + if Roles.player_has_flag(player, "deconlog-bypass") then + return + end local ammo_inv = player.get_inventory(defines.inventory.character_ammo) local item = ammo_inv[player.character.selected_gun_index] - if not item or not item.valid or not item.valid_for_read then return end + if not item or not item.valid or not item.valid_for_read then + return + end if item.name == "rocket" then - add_log(get_secs() .. "," .. player.name .. ",shot-rocket," .. pos_tostring(player.position) .. "," .. pos_tostring(player.shooting_state.position)) + add_log(get_secs() .. "," .. player.name .. ",shot-rocket," .. pos_to_string(player.position) .. "," .. pos_to_string(player.shooting_state.position)) end end) end @@ -65,12 +97,18 @@ end if config.fired_explosive_rocket then Event.add(defines.events.on_player_ammo_inventory_changed, function (e) local player = game.get_player(e.player_index) - if Roles.player_has_flag(player, "deconlog-bypass") then return end + + if Roles.player_has_flag(player, "deconlog-bypass") then + return + end local ammo_inv = player.get_inventory(defines.inventory.character_ammo) local item = ammo_inv[player.character.selected_gun_index] - if not item or not item.valid or not item.valid_for_read then return end + + if not item or not item.valid or not item.valid_for_read then + return + end if item.name == "explosive-rocket" then - add_log(get_secs() .. "," .. player.name .. ",shot-explosive-rocket," .. pos_tostring(player.position) .. "," .. pos_tostring(player.shooting_state.position)) + add_log(get_secs() .. "," .. player.name .. ",shot-explosive-rocket," .. pos_to_string(player.position) .. "," .. pos_to_string(player.shooting_state.position)) end end) end @@ -78,12 +116,20 @@ end if config.fired_nuke then Event.add(defines.events.on_player_ammo_inventory_changed, function (e) local player = game.get_player(e.player_index) - if Roles.player_has_flag(player, "deconlog-bypass") then return end + + if Roles.player_has_flag(player, "deconlog-bypass") then + return + end + local ammo_inv = player.get_inventory(defines.inventory.character_ammo) local item = ammo_inv[player.character.selected_gun_index] - if not item or not item.valid or not item.valid_for_read then return end + + if not item or not item.valid or not item.valid_for_read then + return + end + if item.name == "atomic-bomb" then - add_log(get_secs() .. "," .. player.name .. ",shot-nuke," .. pos_tostring(player.position) .. "," .. pos_tostring(player.shooting_state.position)) + add_log(get_secs() .. "," .. player.name .. ",shot-nuke," .. pos_to_string(player.position) .. "," .. pos_to_string(player.shooting_state.position)) end end) end diff --git a/modules/addons/discord-alerts.lua b/modules/addons/discord-alerts.lua index a63d0749..220c7bec 100644 --- a/modules/addons/discord-alerts.lua +++ b/modules/addons/discord-alerts.lua @@ -6,12 +6,20 @@ local Colors = require 'utils.color_presets' --- @dep utils.color_presets local write_json, format_time = _C.write_json, _C.format_time --- @dep expcore.common local config = require 'config.discord_alerts' --- @dep config.discord_alerts -local playtime_format = { short = true, hours = true, minutes = true, string = true } +local playtime_format = {hours = true, minutes = true, short = true, string = true} + local function append_playtime(player_name) - if not config.show_playtime then return player_name end + if not config.show_playtime then + return player_name + end + local player = game.get_player(player_name) - if not player then return player_name end - return player.name..' ('..format_time(player.online_time, playtime_format)..')' + + if not player then + return player_name + end + + return player.name ..' (' .. format_time(player.online_time, playtime_format) .. ')' end local function get_player_name(event) @@ -24,10 +32,10 @@ local function to_hex(color) local function hex(bit) local major, minor = math.modf(bit/16) major, minor = major+1, minor*16+1 - return hex_digits:sub(major, major)..hex_digits:sub(minor, minor) + return hex_digits:sub(major, major) .. hex_digits:sub(minor, minor) end - return '0x'..hex(color.r)..hex(color.g)..hex(color.b) + return '0x' .. hex(color.r) .. hex(color.g) .. hex(color.b) end local function emit_event(args) @@ -40,12 +48,14 @@ local function emit_event(args) end local tick = args.tick or game.tick - local tick_formatted = format_time(tick, {days = true, hours = true, minutes = true, string = true, long = true}) + local tick_formatted = format_time(tick, {days = false, hours = true, minutes = true, short = true, string = true}) local players_online = 0 local admins_online = 0 + for _, player in pairs(game.connected_players) do - players_online = players_online+1 + players_online = players_online + 1 + if player.admin then admins_online = admins_online + 1 end @@ -93,8 +103,9 @@ if config.entity_protection then title='Entity Protection', description='A player removed protected entities', color=Colors.yellow, - ['Player']=''..append_playtime(player_name), - ['Entity']=''..event.entity.name + ['Player']='' .. append_playtime(player_name), + ['Entity']='' .. event.entity.name, + ['Location']=event.entity.position } end) end @@ -108,9 +119,9 @@ if config.player_reports then title='Report', description='A player was reported', color=Colors.yellow, - ['Player']=''..append_playtime(player_name), - ['By']=''..append_playtime(by_player_name), - ['Report Count']=''..Reports.count_reports(player_name), + ['Player']='' .. append_playtime(player_name), + ['By']='' .. append_playtime(by_player_name), + ['Report Count']='' .. Reports.count_reports(player_name), ['Reason']=event.reason } end) @@ -121,9 +132,9 @@ if config.player_reports then title='Reports Removed', description='A player has a report removed', color=Colors.green, - ['Player']=''..player_name, - ['By']=''..event.removed_by_name, - ['Report Count']=''..event.batch_count + ['Player']='' .. player_name, + ['By']='' .. event.removed_by_name, + ['Report Count']='' .. event.batch_count } end) end @@ -138,9 +149,9 @@ if config.player_warnings then title='Warning', description='A player has been given a warning', color=Colors.yellow, - ['Player']=''..player_name, - ['By']=''..by_player_name, - ['Warning Count']=''..Warnings.count_warnings(player), + ['Player']='' .. player_name, + ['By']='' .. by_player_name, + ['Warning Count']='' .. Warnings.count_warnings(player), ['Reason']=event.reason } end) @@ -151,9 +162,9 @@ if config.player_warnings then title='Warnings Removed', description='A player has a warning removed', color=Colors.green, - ['Player']=''..player_name, - ['By']=''..event.removed_by_name, - ['Warning Count']=''..event.batch_count + ['Player']='' .. player_name, + ['By']='' .. event.removed_by_name, + ['Warning Count']='' .. event.batch_count } end) end @@ -167,8 +178,8 @@ if config.player_jail then title='Jail', description='A player has been jailed', color=Colors.yellow, - ['Player']=''..player_name, - ['By']=''..by_player_name, + ['Player']='' .. player_name, + ['By']='' .. by_player_name, ['Reason']=event.reason } end) @@ -178,8 +189,8 @@ if config.player_jail then title='Unjail', description='A player has been unjailed', color=Colors.green, - ['Player']=''..player_name, - ['By']=''..by_player_name + ['Player']='' .. player_name, + ['By']='' .. by_player_name } end) end @@ -193,8 +204,8 @@ if config.player_bans then title='Banned', description='A player has been banned', color=Colors.red, - ['Player']=''..event.player_name, - ['By']=''..by_player.name, + ['Player']='' .. event.player_name, + ['By']='' .. by_player.name, ['Reason']=event.reason } end @@ -206,8 +217,8 @@ if config.player_bans then title='Un-Banned', description='A player has been un-banned', color=Colors.green, - ['Player']=''..event.player_name, - ['By']=''..by_player.name + ['Player']='' .. event.player_name, + ['By']='' .. by_player.name } end end) @@ -221,7 +232,7 @@ if config.player_mutes then title='Muted', description='A player has been muted', color=Colors.yellow, - ['Player']=''..player_name + ['Player']='' .. player_name } end) Event.add(defines.events.on_player_unmuted, function(event) @@ -230,7 +241,7 @@ if config.player_mutes then title='Un-Muted', description='A player has been un-muted', color=Colors.green, - ['Player']=''..player_name + ['Player']='' .. player_name } end) end @@ -245,8 +256,8 @@ if config.player_kicks then title='Kick', description='A player has been kicked', color=Colors.orange, - ['Player']=''..player_name, - ['By']=''..by_player.name, + ['Player']='' .. player_name, + ['By']='' .. by_player.name, ['Reason']=event.reason } end @@ -261,7 +272,7 @@ if config.player_promotes then title='Promote', description='A player has been promoted', color=Colors.green, - ['Player']=''..player_name + ['Player']='' .. player_name } end) Event.add(defines.events.on_player_demoted, function(event) @@ -270,7 +281,7 @@ if config.player_promotes then title='Demote', description='A player has been demoted', color=Colors.yellow, - ['Player']=''..player_name + ['Player']='' .. player_name } end) end @@ -282,9 +293,9 @@ Event.add(defines.events.on_console_command, function(event) if config[event.command] then emit_event{ title=event.command:gsub('^%l', string.upper), - description='/'..event.command..' was used', + description='/' .. event.command .. ' was used', color=Colors.grey, - ['By']=''..player_name, + ['By']='' .. player_name, ['Details'] = event.parameters ~= '' and event.parameters or nil } end diff --git a/modules/addons/inserter.lua b/modules/addons/inserter.lua new file mode 100644 index 00000000..5ddd696f --- /dev/null +++ b/modules/addons/inserter.lua @@ -0,0 +1,23 @@ +local Event = require 'utils.event' + +local controllers_with_inventory = { + [defines.controllers.character] = true, + [defines.controllers.god] = true, + [defines.controllers.editor] = true, +} + +Event.add(defines.events.on_player_mined_entity, function(event) + if (not event.entity.valid) or (event.entity.type ~= 'inserter') or event.entity.drop_target then + return + end + + local item_entity = event.entity.surface.find_entity('item-on-ground', event.entity.drop_position) + + if item_entity then + local player = game.get_player(event.player_index) + + if controllers_with_inventory[player.controller_type] then + player.mine_entity(item_entity) + end + end +end) diff --git a/modules/addons/miner.lua b/modules/addons/miner.lua new file mode 100644 index 00000000..290577ad --- /dev/null +++ b/modules/addons/miner.lua @@ -0,0 +1,64 @@ +local Event = require 'utils.event_core' --- @dep utils.event_core + +local function miner_check(entity, event) + if ((math.abs(entity.position.x - event.entity.position.x) < entity.prototype.mining_drill_radius) and (math.abs(entity.position.y - event.entity.position.y) < entity.prototype.mining_drill_radius)) then + if entity.mining_target ~= nil and entity.mining_target.valid then + if entity.mining_target.amount > 0 then + return + end + + local resources = entity.surface.find_entities_filtered{area={{entity.position.x - entity.prototype.mining_drill_radius, entity.position.y - entity.prototype.mining_drill_radius}, {entity.position.x + entity.prototype.mining_drill_radius, entity.position.y + entity.prototype.mining_drill_radius}}, type='resource'} + + for _, resource in pairs(resources) do + if resource.amount > 0 then + -- if any tile in the radius have resources + return + end + end + + if entity.to_be_deconstructed(entity.force) then + -- if it is already waiting to be deconstruct + return + else + if entity.fluidbox and #entity.fluidbox > 0 then + -- if require fluid to mine + return + end + + if next(entity.circuit_connected_entities.red) ~= nil or next(entity.circuit_connected_entities.green) ~= nil then + -- connected to circuit network + return + end + + if not entity.minable then + -- if it is minable + return + end + + if not entity.prototype.selectable_in_game then + -- if it can select + return + end + + if entity.has_flag('not-deconstructable') then + -- if it can deconstruct + return + end + + entity.order_deconstruction(entity.force) + end + end + end +end + +Event.add(defines.events.on_resource_depleted, function(event) + local entities = event.entity.surface.find_entities_filtered{area={{event.entity.position.x-1, event.entity.position.y-1}, {event.entity.position.x+1, event.entity.position.y+1}}, type='mining-drill'} + + if #entities == 0 then + return + end + + for _, entity in pairs(entities) do + miner_check(entity, event) + end +end) diff --git a/modules/addons/protection-jail.lua b/modules/addons/protection-jail.lua index 6ff07118..e717c67b 100644 --- a/modules/addons/protection-jail.lua +++ b/modules/addons/protection-jail.lua @@ -25,7 +25,10 @@ Event.add(Protection.events.on_repeat_violation, function(event) end -- Jail if needed - if repeat_count[player.index] < 3 then return end + if repeat_count[player.index] < 3 then + return + end + local player_name_color = format_chat_player_name(player) Jail.jail_player(player, '', 'Removed too many protected entities, please wait for a moderator.') game.print{'protection-jail.jail', player_name_color} diff --git a/modules/addons/report-jail.lua b/modules/addons/report-jail.lua index f9211993..275321a3 100644 --- a/modules/addons/report-jail.lua +++ b/modules/addons/report-jail.lua @@ -9,17 +9,20 @@ local format_chat_player_name = _C.format_chat_player_name --- @dep expcore.comm --- Returns the playtime of the reporter. Used when calculating the total playtime of all reporters local function reporter_playtime(_, by_player_name, _) local player = game.get_player(by_player_name) - if player == nil then return 0 end + if player == nil then + return 0 + end return player.online_time end ---- Tests the combined playtime of all reporters against the reported player Event.add(Reports.events.on_player_reported, function(event) local player = game.get_player(event.player_index) local total_playtime = Reports.count_reports(player, reporter_playtime) - if total_playtime < player.online_time*1.5 then return end - -- Combined playtime is greater than 150% of the reported's playtime - local player_name_color = format_chat_player_name(player) - Jail.jail_player(player, '', 'Reported by too many players, please wait for a moderator.') - game.print{'report-jail.jail', player_name_color} -end) \ No newline at end of file + + -- player less than 30 min + if (Reports.count_reports(player) > 1) and (total_playtime > math.max(player.online_time * 2, 108000)) then + local player_name_color = format_chat_player_name(player) + Jail.jail_player(player, '', 'Reported by too many players, please wait for a moderator.') + game.print{'report-jail.jail', player_name_color} + end +end) diff --git a/modules/addons/spawn-area.lua b/modules/addons/spawn-area.lua index 7b711033..84204b57 100644 --- a/modules/addons/spawn-area.lua +++ b/modules/addons/spawn-area.lua @@ -12,7 +12,7 @@ end) -- Apply an offset to a LuaPosition local function apply_offset(position, offset) - return { x = position.x + (offset.x or offset[1]), y = position.y + (offset.y or offset[2]) } + return {x=position.x + (offset.x or offset[1]), y=position.y + (offset.y or offset[2])} end -- Apply the offset to the turrets default position @@ -22,23 +22,33 @@ end -- Get or create the force used for entities in spawn local function get_spawn_force() - local force = game.forces['Spawn'] - if force and force.valid then return force end - force = game.create_force('Spawn') + local force = game.forces['spawn'] + + if force and force.valid then + return force + end + + force = game.create_force('spawn') force.set_cease_fire('player', true) - game.forces['player'].set_cease_fire('Spawn', true) + -- force.set_friend('player', true) + game.forces['player'].set_cease_fire('spawn', true) + -- game.forces['player'].set_friend('spawn', true) + return force end --- Protects an entity and sets its force to the spawn force +-- Protects an entity +-- and sets its force to the spawn force local function protect_entity(entity, set_force) if entity and entity.valid then entity.destructible = false entity.minable = false entity.rotatable = false entity.operable = false - if not set_force then entity.health = 0 end - if set_force then entity.force = get_spawn_force() end + + if set_force then + entity.force = get_spawn_force() + end end end @@ -51,8 +61,8 @@ local function spawn_turrets() -- Makes a new turret if it is not found if not turret or not turret.valid then - turret = surface.create_entity{name='gun-turret', position=pos, force='Spawn'} - protect_entity(turret, true) + turret = surface.create_entity{name='gun-turret', position=pos, force='spawn'} + protect_entity(turret) end -- Adds ammo to the turret @@ -68,12 +78,16 @@ local function spawn_belts(surface, position) position = apply_offset(position, config.afk_belts.offset) local belt_type = config.afk_belts.belt_type local belt_details = {{-0.5, -0.5, 2}, {0.5, -0.5, 4}, {-0.5, 0.5, 0}, {0.5, 0.5, 6}} -- x, y,dir + for _, belt_set in pairs(config.afk_belts.locations) do local set_position = apply_offset(position, belt_set) for _, belt in pairs(belt_details) do local pos = apply_offset(set_position, belt) - local belt_entity = surface.create_entity{name=belt_type, position=pos, force='neutral', direction=belt[3]} - if config.afk_belts.protected then protect_entity(belt_entity) end + local belt_entity = surface.create_entity{name=belt_type, position=pos, force='spawn', direction=belt[3]} + + if config.afk_belts.protected then + protect_entity(belt_entity) + end end end end @@ -83,9 +97,11 @@ local function spawn_pattern(surface, position) position = apply_offset(position, config.pattern.offset) local tiles_to_make = {} local pattern_tile = config.pattern.pattern_tile + for _, tile in pairs(config.pattern.locations) do table.insert(tiles_to_make, {name=pattern_tile, position=apply_offset(position, tile)}) end + surface.set_tiles(tiles_to_make) end @@ -104,9 +120,13 @@ end local function spawn_entities(surface, position) position = apply_offset(position, config.entities.offset) for _, entity in pairs(config.entities.locations) do - local pos = apply_offset(position, { x=entity[2], y=entity[3] }) + local pos = apply_offset(position, {x=entity[2], y=entity[3]}) entity = surface.create_entity{name=entity[1], position=pos, force='neutral'} - if config.entities.protected then protect_entity(entity) end + + if config.entities.protected then + protect_entity(entity) + end + entity.operable = config.entities.operable end end @@ -114,7 +134,8 @@ end -- Generates an area with no water or entities, no water area is larger local function spawn_area(surface, position) local dr = config.spawn_area.deconstruction_radius - local dr2 = dr^2 + local tr = config.spawn_area.tile_radius + local tr2 = tr^2 local decon_tile = config.spawn_area.deconstruction_tile local fr = config.spawn_area.landfill_radius @@ -132,7 +153,7 @@ local function spawn_area(surface, position) local y2 = (y+0.5)^2 local dst = x2+y2 local pos = {x=position.x+x, y=position.y+y} - if dst < dr2 then + if dst < tr2 then -- If it is inside the decon radius always set the tile table.insert(tiles_to_make, {name=decon_tile, position=pos}) elseif dst < fr2 and surface.get_tile(pos).collides_with('player-layer') then @@ -144,10 +165,34 @@ local function spawn_area(surface, position) -- Remove entities then set the tiles local entities_to_remove = surface.find_entities_filtered{position=position, radius=dr, name='character', invert=true} - for _, entity in pairs(entities_to_remove) do entity.destroy() end + for _, entity in pairs(entities_to_remove) do + entity.destroy() + end surface.set_tiles(tiles_to_make) end +local function spawn_resource_tiles(surface) + for _, v in ipairs(config.resource_tiles.resources) do + if v.enabled then + for x=v.offset[1], v.offset[1] + v.size[1] do + for y=v.offset[2], v.offset[2] + v.size[2] do + surface.create_entity({name=v.name, amount=v.amount, position={x, y}}) + end + end + end + end +end + +local function spawn_resource_patches(surface) + for _, v in ipairs(config.resource_patches.resources) do + if v.enabled then + for i=1, v.num_patches do + surface.create_entity({name=v.name, amount=v.amount, position={v.offset[1] + v.offset_next[1] * (i - 1), v.offset[2] + v.offset_next[2] * (i - 1)}}) + end + end + end +end + -- Only add a event handler if the turrets are enabled if config.turrets.enabled then Event.on_nth_tick(config.turrets.refill_time, function() @@ -156,6 +201,19 @@ if config.turrets.enabled then end) end +if config.resource_refill_nearby.enabled then + -- could have a flag in global that early returns if true, and reset it on_tick + Event.on_nth_tick(36000, function() + if game.tick < 10 then + return + end + + for _, ore in pairs(game.players[1].surface.find_entities_filtered{position=game.players[1].force.get_spawn_position(game.players[1].surface), radius=config.resource_refill_nearby.range, name=config.resource_refill_nearby.resources_name}) do + ore.amount = ore.amount + math.random(config.resource_refill_nearby.amount[1], config.resource_refill_nearby.amount[2]) + end + end) +end + -- When the first player joins create the spawn area Event.add(defines.events.on_player_created, function(event) if event.player_index ~= 1 then return end @@ -169,8 +227,10 @@ Event.add(defines.events.on_player_created, function(event) if config.afk_belts.enabled then spawn_belts(s, p) end if config.turrets.enabled then spawn_turrets() end if config.entities.enabled then spawn_entities(s, p) end + if config.resource_tiles.enabled then spawn_resource_tiles(s) end + if config.resource_patches.enabled then spawn_resource_patches(s) end player.teleport(p, s) end) -- Way to access global table -return turrets \ No newline at end of file +return turrets diff --git a/modules/addons/station-auto-name.lua b/modules/addons/station-auto-name.lua index eddd4ed0..fc164743 100644 --- a/modules/addons/station-auto-name.lua +++ b/modules/addons/station-auto-name.lua @@ -1,6 +1,7 @@ ---LuaPlayerBuiltEntityEventFilters ---Events.set_event_filter(defines.events.on_built_entity, {{filter = "name", name = "fast-inserter"}}) local Event = require 'utils.event' --- @dep utils.event +local config = require 'config.station_auto_name' --- @dep config.chat_reply --Credit to Cooldude2606 for using his lua magic to make this function. local directions = { @@ -46,10 +47,9 @@ local function station_name_changer(event) local boundingBox = entity.bounding_box -- expanded box for recourse search: - local bounding2 = { {boundingBox.left_top.x -100 ,boundingBox.left_top.y -100} , {boundingBox.right_bottom.x +100, boundingBox.right_bottom.y +100 } } + local bounding2 = {{boundingBox.left_top.x-100 ,boundingBox.left_top.y-100} , {boundingBox.right_bottom.x+100, boundingBox.right_bottom.y+100 }} -- gets all resources in bounding_box2: local recourses = game.surfaces[1].find_entities_filtered{area = bounding2, type = "resource"} - if #recourses > 0 then -- save cpu time if their are no recourses in bounding_box2 local closest_distance local px, py = boundingBox.left_top.x, boundingBox.left_top.y @@ -70,12 +70,17 @@ local function station_name_changer(event) if item_name then -- prevent errors if something went wrong local item_name2 = item_name:gsub("^%l", string.upper):gsub('-', ' ') -- removing the - and making first letter capital - local Item_ore_fluid = "item" - if item_name == "crude-oil" then - Item_ore_fluid = "fluid" + local item_type = 'item' + if item_name == 'crude-oil' then + item_type = 'fluid' end - --Final string: - entity.backer_name = string.format("[L] [img=%s.%s] %s %s (%s)", Item_ore_fluid, item_name, item_name2, entity.backer_name, Angle( entity )) + + entity.backer_name = config.station_name:gsub('__icon__', '[img=' .. item_type .. '.' .. item_name .. ']') + :gsub('__item_name__', item_name2) + :gsub('__backer_name__', entity.backer_name) + :gsub('__direction__', Angle(entity)) + :gsub('__x__', math.floor(entity.position.x)) + :gsub('__y__', math.floor(entity.position.y)) end end end diff --git a/modules/addons/tree-decon.lua b/modules/addons/tree-decon.lua index 95a34396..d4a2c206 100644 --- a/modules/addons/tree-decon.lua +++ b/modules/addons/tree-decon.lua @@ -10,7 +10,7 @@ local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data -- Global queue used to store trees that need to be removed, also chache for player roles local chache = {} local tree_queue = { _head=0 } -Global.register({ tree_queue, chache }, function(tbl) +Global.register({tree_queue, chache}, function(tbl) tree_queue = tbl[1] chache = tbl[2] end) diff --git a/modules/commands/bot-queue.lua b/modules/commands/bot-queue.lua new file mode 100644 index 00000000..45abfc68 --- /dev/null +++ b/modules/commands/bot-queue.lua @@ -0,0 +1,24 @@ +--[[-- Commands Module - Bot queue + - Adds a command that allows changing bot queue + @commands Bot Queue +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands +require 'config.expcore.command_general_parse' + +Commands.new_command('bot-queue-get', 'Get bot queue') +:set_flag('admin_only') +:register(function(player) + local s = player.force.max_successful_attempts_per_tick_per_construction_queue + local f = player.force.max_failed_attempts_per_tick_per_construction_queue + return Commands.success{'expcom-bot-queue.result', s, f} +end) + +Commands.new_command('bot-queue-set', 'Set bot queue') +:add_param('amount', 'integer-range', 1, 20) +:set_flag('admin_only') +:register(function(player, amount) + player.force.max_successful_attempts_per_tick_per_construction_queue = 3 * amount + player.force.max_failed_attempts_per_tick_per_construction_queue = 1 * amount + return Commands.success{'expcom-bot-queue.result', 3 * amount, 1 * amount} +end) diff --git a/modules/commands/cheat-mode.lua b/modules/commands/cheat-mode.lua index b0214579..1f2ada17 100644 --- a/modules/commands/cheat-mode.lua +++ b/modules/commands/cheat-mode.lua @@ -17,4 +17,27 @@ end} :set_flag('admin_only') :register(function(_, player) player.cheat_mode = not player.cheat_mode -end) \ No newline at end of file + return Commands.success +end) + +Commands.new_command('research-all', 'Set all research for your force.') +:set_flag('admin_only') +:add_param('force', true, 'force') +:set_defaults{force=function(player) + return player.force +end} +:register(function(_, force) + force.research_all_technologies() + return Commands.success +end) + +Commands.new_command('toggle-always-day', 'Toggles always day in surface') +:set_flag('admin_only') +:add_param('surface', true, 'surface') +:set_defaults{surface=function(player) + return player.surface +end} +:register(function(_, surface) + surface.always_day = not surface.always_day + return Commands.success{'expcom-cheat.day', surface.always_day} +end) diff --git a/modules/commands/enemy.lua b/modules/commands/enemy.lua new file mode 100644 index 00000000..897cb95d --- /dev/null +++ b/modules/commands/enemy.lua @@ -0,0 +1,30 @@ +--[[-- Commands Module - Enemy + - Adds a command of handling enemy + @commands Enemy +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands +require 'config.expcore.command_general_parse' + +Commands.new_command('kill-biters', 'Kill all biters (only)') +:set_flag('admin_only') +:register(function(_, _) + game.forces['enemy'].kill_all_units() + return Commands.success +end) + +Commands.new_command('remove-biters', 'Remove biters and prevent generation') +:set_flag('admin_only') +:add_param('surface', true, 'surface') +:set_defaults{surface=function(player) + return player.surface +end} +:register(function(_, surface) + for _, entity in pairs(surface.find_entities_filtered({force='enemy'})) do + entity.destroy() + end + + surface.map_gen_settings.autoplace_controls['enemy-base'].size = 'none' + return Commands.success +end) + diff --git a/modules/commands/friendly-fire.lua b/modules/commands/friendly-fire.lua new file mode 100644 index 00000000..87db2c03 --- /dev/null +++ b/modules/commands/friendly-fire.lua @@ -0,0 +1,18 @@ +--[[-- Commands Module - Toggle Friendly Fire + - Adds a command that toggle all friendly fire + @commands Toggle Friendly Fire +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands +require 'config.expcore.command_general_parse' + +-- For Modded Server Use +Commands.new_command('toggle-friendly-fire', 'Toggle Friendly Fire') +:add_param('force', true, 'force') +:set_defaults{force=function(player) + return player.force +end} +:register(function(_, force) + force.friendly_fire = not force.friendly_fire + return Commands.success{'expcom-ff.ff', force.friendly_fire} +end) diff --git a/modules/commands/lawnmower.lua b/modules/commands/lawnmower.lua new file mode 100644 index 00000000..2f5fca03 --- /dev/null +++ b/modules/commands/lawnmower.lua @@ -0,0 +1,31 @@ +--[[-- Commands Module - Lawnmower + - Adds a command that clean up biter corpse and nuclear hole + @commands Lawnmower +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands +require 'config.expcore.command_general_parse' + +Commands.new_command('lawnmower', 'Clean up biter corpse, decoratives and nuclear hole') +:add_param('range', false, 'integer-range', 1, 200) +:register(function(player, range) + local tile_to_do = {} + + player.surface.destroy_decoratives({position=player.position, radius=range}) + + local entities = player.surface.find_entities_filtered{position=player.position, radius=range, type='corpse', name={'transport-caution-corpse', 'invisible-transport-caution-corpse'}} + + for _, entity in pairs(entities) do + entity.destroy() + end + + local tiles = player.surface.find_tiles_filtered{position=player.position, radius=range, name={'nuclear-ground'}} + + for _, tile in pairs(tiles) do + table.insert(tile_to_do, {name='grass-1', position=tile.position}) + end + + player.surface.set_tiles(tile_to_do) + + return Commands.success +end) diff --git a/modules/commands/pollution.lua b/modules/commands/pollution.lua new file mode 100644 index 00000000..5b3af6aa --- /dev/null +++ b/modules/commands/pollution.lua @@ -0,0 +1,32 @@ +--[[-- Commands Module - Pollution Handle + - Adds a command that allows modifying pollution + @commands Pollution Handle +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands +require 'config.expcore.command_general_parse' + +Commands.new_command('pollution-clear', 'Clear pollution') +:set_flag('admin_only') +:add_alias('pol-clr') +:add_param('surface', true, 'surface') +:set_defaults{surface=function(player) + return player.surface +end} +:register(function(player, surface) + surface.clear_pollution() + return Commands.success{'expcom-pol.clr', player} +end) + +Commands.new_command('pollution-off', 'Disable pollution') +:set_flag('admin_only') +:add_alias('pol-off') +:register(function(player) + game.map_settings.pollution.enabled = false + + for _, v in pairs(game.surfaces) do + v.clear_pollution() + end + + return Commands.success{'expcom-pol.off', player.name} +end) diff --git a/modules/commands/protection.lua b/modules/commands/protection.lua index 01066d35..6dbb83f4 100644 --- a/modules/commands/protection.lua +++ b/modules/commands/protection.lua @@ -36,8 +36,8 @@ end --- Align an aabb to the grid by expanding it local function aabb_align_expand(aabb) return { - left_top = { x = math.floor(aabb.left_top.x), y = math.floor(aabb.left_top.y) }, - right_bottom = { x = math.ceil(aabb.right_bottom.x), y = math.ceil(aabb.right_bottom.y) } + left_top = {x = math.floor(aabb.left_top.x), y = math.floor(aabb.left_top.y)}, + right_bottom = {x = math.ceil(aabb.right_bottom.x), y = math.ceil(aabb.right_bottom.y)} } end @@ -51,7 +51,6 @@ local function get_area_key(area) return string.format('%i,%i', math.floor(area.left_top.x), math.floor(area.left_top.y)) end - --- Show a protected entity to a player local function show_protected_entity(player, entity) local key = get_entity_key(entity) diff --git a/modules/commands/repair.lua b/modules/commands/repair.lua index c8814f3d..cd4723c8 100644 --- a/modules/commands/repair.lua +++ b/modules/commands/repair.lua @@ -12,7 +12,7 @@ local max_time_to_live = 4294967295 -- unit32 max -- @command repair -- @tparam number range the range to repair stuff in, there is a max limit to this Commands.new_command('repair', 'Repairs entities on your force around you') -:add_param('range', false, 'integer-range', 1,config.max_range) +:add_param('range', false, 'integer-range', 1, config.max_range) :register(function(player, range) local revive_count = 0 local heal_count = 0 diff --git a/modules/commands/research.lua b/modules/commands/research.lua new file mode 100644 index 00000000..8f57e2db --- /dev/null +++ b/modules/commands/research.lua @@ -0,0 +1,94 @@ +local Event = require 'utils.event' --- @dep utils.event +local Common = require 'expcore.common' --- @dep utils.event +local Global = require 'utils.global' --- @dep utils.global +local config = require 'config.research' --- @dep config.research +local config_bonus = Common.opt_require 'config.bonus' --- @dep config.bonus +local Commands = require 'expcore.commands' --- @dep expcore.commands +local format_time = _C.format_time --- @dep expcore.common + +local research = {} +Global.register(research, function(tbl) + research = tbl +end) + +local research_time_format = {hours=true, minutes=true, seconds=true, time=true, string=true} +research.res_queue_enable = false +local base_rate = 0 + +if config.bonus.enabled then + for k, _ in pairs(config_bonus.force_bonus) do + if config_bonus.force_bonus[k].name == config.bonus.name then + base_rate = config_bonus.force_bonus[k].max + end + end +end + +local function research_notification(event) + local is_inf_res = false + + for i=1, #config.inf_res do + if (event.research.name == config.inf_res[i].name) and (event.research.level >= config.inf_res[i].level) then + is_inf_res = true + end + end + + if config.bonus_inventory.enabled then + if (event.research.force.mining_drill_productivity_bonus * 10) <= (config.bonus_inventory.limit / config.bonus_inventory.rate) then + if event.research.force.technologies['toolbelt'].researched then + event.research.force[config.bonus_inventory.name] = (math.floor(event.research.force.mining_drill_productivity_bonus * 10) * config.bonus_inventory.rate) + 10 + else + event.research.force[config.bonus_inventory.name] = math.floor(event.research.force.mining_drill_productivity_bonus * 10) * config.bonus_inventory.rate + end + end + end + + if is_inf_res then + if config.bonus.enabled then + if event.research.name == 'mining-productivity-4' and event.research.force.technologies['mining-productivity-4'].level > 4 then + event.research.force[config.bonus.name] = base_rate + event.research.force.technologies['mining-productivity-4'].level * config.bonus.rate + end + end + + if not (event.by_script) then + game.print{'expcom-res.inf', format_time(game.tick, research_time_format), event.research.name, event.research.level} + end + else + if not (event.by_script) then + game.print{'expcom-res.msg', format_time(game.tick, research_time_format), event.research.name} + end + end +end + +local function res_queue(force) + if force.rockets_launched == 0 or force.technologies['mining-productivity-4'].level <= 4 then + return + end + + local res_q = force.research_queue + + if #res_q < config.queue_amount then + for i=1, config.queue_amount - #res_q do + force.add_research(force.technologies['mining-productivity-4']) + end + end +end + +Event.add(defines.events.on_research_finished, function(event) + research_notification(event) + + if research.res_queue_enable then + res_queue(event.research.force) + end +end) + +Commands.new_command('auto-research', 'Automatically queue up research') +:add_alias('ares') +:register(function(player) + research.res_queue_enable = not research.res_queue_enable + + if research.res_queue_enable then + res_queue(player.force) + end + + return Commands.success{'expcom-res.res', research.res_queue_enable} +end) diff --git a/modules/commands/spawn.lua b/modules/commands/spawn.lua index bc718ea3..f88194d9 100644 --- a/modules/commands/spawn.lua +++ b/modules/commands/spawn.lua @@ -10,9 +10,29 @@ local function teleport(player) local surface = player.surface local spawn = player.force.get_spawn_position(surface) local position = surface.find_non_colliding_position('character', spawn, 32, 1) - if not position then return false end - if player.driving then player.driving = false end -- kicks a player out a vehicle if in one - player.teleport(position, surface) + -- return false if no new position + if not position then + return false + end + if player.vehicle then + -- Teleport the entity + local entity = player.vehicle + local goto_position = surface.find_non_colliding_position(entity.name, position, 32, 1) + -- Surface teleport can only be done for players and cars at the moment. (with surface as an peramitor it gives this error) + if entity.type == "car" then + entity.teleport(goto_position, surface) + elseif surface.index == entity.surface.index then + -- Try teleport the entity + if not entity.teleport(goto_position) then + player.driving = false + player.teleport(position, surface) + end + end + else + -- Teleport the player + player.teleport(position, surface) + end + return true end diff --git a/modules/commands/speed.lua b/modules/commands/speed.lua new file mode 100644 index 00000000..0b5dbab8 --- /dev/null +++ b/modules/commands/speed.lua @@ -0,0 +1,15 @@ +--[[-- Commands Module - Set game speed + - Adds a command that allows changing game speed + @commands Set game speed +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands +require 'config.expcore.command_general_parse' + +Commands.new_command('game-speed', 'Set game speed') +:add_param('amount', 'number-range', 0.2, 1) +:set_flag('admin_only') +:register(function(_, amount) + game.speed = math.round(amount, 3) + return Commands.success{'expcom-speed.result', string.format('%.3f', amount)} +end) diff --git a/modules/commands/teleport.lua b/modules/commands/teleport.lua index fb6fbb68..667d63de 100644 --- a/modules/commands/teleport.lua +++ b/modules/commands/teleport.lua @@ -9,9 +9,31 @@ require 'config.expcore.command_general_parse' local function teleport(from_player, to_player) local surface = to_player.surface local position = surface.find_non_colliding_position('character', to_player.position, 32, 1) - if not position then return false end -- return false if no new position - if from_player.driving then from_player.driving = false end -- kicks a player out a vehicle if in one - from_player.teleport(position, surface) + + -- return false if no new position + if not position then + return false + end + + if from_player.vehicle then + -- Teleport the entity + local entity = from_player.vehicle + local goto_position = surface.find_non_colliding_position(entity.name, position, 32, 1) + + -- Surface teleport can only be done for players and cars at the moment. (with surface as an peramitor it gives this error) + if entity.type == "car" then + entity.teleport(goto_position, surface) + elseif surface.index == entity.surface.index then + -- Try teleport the entity + if not entity.teleport(goto_position) then + from_player.driving = false + from_player.teleport(position, surface) + end + end + else + -- Teleport the player + from_player.teleport(position, surface) + end return true end @@ -50,6 +72,7 @@ Commands.new_command('bring', 'Teleports a player to you.') -- return if the teleport failed return Commands.error{'expcom-tp.no-position-found'} end + from_player.print('Come here my friend') end) --- Teleports you to a player. @@ -58,7 +81,6 @@ end) Commands.new_command('goto', 'Teleports you to a player.') :add_param('player', false, 'player-online') :add_alias('tp-me', 'tpme') -:set_flag('admin_only') :register(function(player, to_player) if to_player.index == player.index then -- return if attempting to teleport to self @@ -68,4 +90,4 @@ Commands.new_command('goto', 'Teleports you to a player.') -- return if the teleport failed return Commands.error{'expcom-tp.no-position-found'} end -end) \ No newline at end of file +end) diff --git a/modules/commands/train.lua b/modules/commands/train.lua new file mode 100644 index 00000000..470bd76a --- /dev/null +++ b/modules/commands/train.lua @@ -0,0 +1,22 @@ +--[[-- Commands Module - Set Automatic Train + - Adds a command that set all train back to automatic + @commands Set Automatic Train +]] + +local Commands = require 'expcore.commands' --- @dep expcore.commands +require 'config.expcore.command_general_parse' +local format_number = require('util').format_number + +Commands.new_command('set-trains-to-automatic', 'Set All Trains to Automatic') +:register(function(player) + local count = 0 + + for _, v in pairs(player.force.get_trains()) do + if v.manual_mode then + count = count + 1 + v.manual_mode = false + end + end + + return Commands.success{'expcom-train.manual-result', format_number(count)} +end) diff --git a/modules/commands/vlayer.lua b/modules/commands/vlayer.lua new file mode 100644 index 00000000..240bee0c --- /dev/null +++ b/modules/commands/vlayer.lua @@ -0,0 +1,28 @@ +--- Adds a virtual layer to store power to save space. +-- @addon Virtual Layer + +local Commands = require 'expcore.commands' --- @dep expcore.commands +require 'config.expcore.command_general_parse' +local vlayer = require 'modules.control.vlayer' + +Commands.new_command('personal-battery-recharge', 'Recharge Player Battery upto a portion with vlayer') +:add_param('amount', 'number-range', 0.2, 1) +:register(function(player, amount) + local armor = player.get_inventory(defines.inventory.character_armor)[1].grid + + for i=1, #armor.equipment do + if armor.equipment[i].energy < (armor.equipment[i].max_energy * amount) then + local energy_required = (armor.equipment[i].max_energy * amount) - armor.equipment[i].energy + + if vlayer.power.energy >= energy_required then + armor.equipment[i].energy = armor.equipment[i].max_energy * amount + vlayer.power.energy = vlayer.power.energy - energy_required + else + armor.equipment[i].energy = armor.equipment[i].energy + vlayer.power.energy + vlayer.power.energy = 0 + end + end + end + + return Commands.success +end) diff --git a/modules/commands/waterfill.lua b/modules/commands/waterfill.lua new file mode 100644 index 00000000..68cc7c9c --- /dev/null +++ b/modules/commands/waterfill.lua @@ -0,0 +1,64 @@ +--- Adds a waterfill +-- @addon Virtual Waterfill + +local Commands = require 'expcore.commands' --- @dep expcore.commands +require 'config.expcore.command_general_parse' +local Selection = require 'modules.control.selection' --- @dep modules.control.selection +local SelectionConvertArea = 'ConvertArea' + +--- Align an aabb to the grid by expanding it +local function aabb_align_expand(aabb) + return { + left_top = {x = math.floor(aabb.left_top.x), y = math.floor(aabb.left_top.y)}, + right_bottom = {x = math.ceil(aabb.right_bottom.x), y = math.ceil(aabb.right_bottom.y)} + } +end + +Commands.new_command('waterfill', 'Change tile to water') +:register(function(player) + local inv = player.get_main_inventory() + + if (inv.get_item_count('cliff-explosives')) == 0 then + return player.print{'expcom-waterfill.waterfill-cliff'} + end + + if Selection.is_selecting(player, SelectionConvertArea) then + Selection.stop(player) + else + Selection.start(player, SelectionConvertArea) + return Commands.success{'expcom-waterfill.entered-area-selection'} + end + + return Commands.success +end) + +--- When an area is selected to add protection to the area +Selection.on_selection(SelectionConvertArea, function(event) + local area = aabb_align_expand(event.area) + local player = game.get_player(event.player_index) + + local entities = player.surface.find_entities_filtered{area=area, name='steel-chest'} + local tiles_to_make = {} + local inv = player.get_main_inventory() + local clf_exp = inv.get_item_count('cliff-explosives') + + for _, entity in pairs(entities) do + if clf_exp >= 1 then + if entity.get_inventory(defines.inventory.chest).is_empty() then + if (math.floor(player.position.x) ~= math.floor(entity.position.x)) or (math.floor(player.position.y) ~= math.floor(entity.position.y)) then + table.insert(tiles_to_make, {name='water-mud', position=entity.position}) + entity.destroy() + else + player.print{'expcom-waterfill.waterfill-distance'} + end + end + + clf_exp = clf_exp - 1 + inv.remove({name='cliff-explosives', count=1}) + else + break + end + end + + event.surface.set_tiles(tiles_to_make) +end) diff --git a/modules/control/vlayer.lua b/modules/control/vlayer.lua new file mode 100644 index 00000000..502e82c2 --- /dev/null +++ b/modules/control/vlayer.lua @@ -0,0 +1,223 @@ +--- Adds a virtual layer to store power to save space. +-- @addon Virtual Layer + +local Global = require 'utils.global' --- @dep utils.global +local Event = require 'utils.event' --- @dep utils.event +local config = require 'config.vlayer' --- @dep config.vlayer + +local vlayer = {} +Global.register(vlayer, function(tbl) + vlayer = tbl +end) + +vlayer.storage = {} +vlayer.storage.item = {} +vlayer.storage.input = {} +vlayer.storage.item_m = {} + +vlayer.power = {} +vlayer.power.entity = {} +vlayer.power.energy = 0 +vlayer.power.circuit = {} + +vlayer.circuit = {} +vlayer.circuit.output = {} + +for i=1, 11 do + vlayer.circuit.output[i] = {} + vlayer.circuit.output[i].count = 0 +end + +vlayer.circuit.output[1].signal = {type='virtual', name='signal-P'} +vlayer.circuit.output[2].signal = {type='virtual', name='signal-S'} +vlayer.circuit.output[3].signal = {type='virtual', name='signal-M'} +vlayer.circuit.output[4].signal = {type='virtual', name='signal-C'} +vlayer.circuit.output[5].signal = {type='virtual', name='signal-D'} +vlayer.circuit.output[6].signal = {type='virtual', name='signal-T'} +vlayer.circuit.output[7].signal = {type='virtual', name='signal-L'} +vlayer.circuit.output[8].signal = {type='virtual', name='signal-A'} +vlayer.circuit.output[9].signal = {type='virtual', name='signal-B'} +vlayer.circuit.output[10].signal = {type='item', name='solar-panel'} +vlayer.circuit.output[11].signal = {type='item', name='accumulator'} + +vlayer.storage.item['solar-panel'] = 0 +vlayer.storage.item['accumulator'] = 0 + +if config.land.enabled then + vlayer.storage.item[config.land.tile] = 0 + vlayer.storage.item_a = {} + vlayer.storage.item_a['solar-panel'] = 0 + vlayer.storage.item_a['accumulator'] = 0 +end + +local vlayer_storage_item = {} + +for i=2, 8 do + vlayer_storage_item['solar-panel-' .. i] = {name='solar-panel', multiplier=4 ^ (i - 1)} + vlayer_storage_item['accumulator-' .. i] = {name='accumulator', multiplier=4 ^ (i - 1)} +end + +--[[ + 25,000 / 416 s + 昼 208秒 ソーラー効率100% + 夕方 83秒 1秒ごとにソーラー発電量が約1.2%ずつ下がり、やがて0%になる + 夜 41秒 ソーラー発電量が0%になる + 朝方 83秒 1秒ごとにソーラー発電量が約1.2%ずつ上がり、やがて100%になる + 0.75 Day 12,500 208s + 0.25 Sunset 5,000 83s + 0.45 Night 2,500 41s + 0.55 Sunrise 5,000 83s +]] + +Event.on_nth_tick(config.update_tick, function() + -- storage handle + for k, v in pairs(vlayer.storage.input) do + if ((v == nil) or (not v.valid)) then + vlayer.input[k] = nil + + else + local chest = v.get_inventory(defines.inventory.chest) + local chest_content = chest.get_contents() + + if config.land.enabled then + for item_name, count in pairs(chest_content) do + if (vlayer.storage.item[item_name] ~= nil) then + if item_name == config.land.tile then + vlayer.storage.item[item_name] = vlayer.storage.item[item_name] + count + else + vlayer.storage.item_a[item_name] = vlayer.storage.item_a[item_name] + count + end + chest.remove({name=item_name, count=count}) + + elseif (vlayer_storage_item[item_name] ~= nil) then + vlayer.storage.item_a[vlayer_storage_item[item_name].name] = vlayer.storage.item_a[vlayer_storage_item[item_name].name] + (count * vlayer_storage_item[item_name].multiplier) + chest.remove({name=item_name, count=count}) + end + end + + local land_req = (vlayer.storage.item['solar-panel'] * config.land.requirement['solar-panel']) + (vlayer.storage.item['accumulator'] * config.land.requirement['accumulator']) + local land_surplus = (vlayer.storage.item[config.land.tile] * config.land.result) - land_req + + if (vlayer.storage.item_a['solar-panel'] > 0 and vlayer.storage.item_a['accumulator'] > 0) then + local land_allocation = math.floor(land_surplus / (config.land.requirement['solar-panel'] + config.land.requirement['accumulator'])) + vlayer.storage.item['solar-panel'] = vlayer.storage.item['solar-panel'] + math.min(vlayer.storage.item_a['solar-panel'], land_allocation) + vlayer.storage.item_a['solar-panel'] = vlayer.storage.item_a['solar-panel'] - math.min(vlayer.storage.item_a['solar-panel'], land_allocation) + vlayer.storage.item['accumulator'] = vlayer.storage.item['accumulator'] + math.min(vlayer.storage.item_a['accumulator'], land_allocation) + vlayer.storage.item_a['accumulator'] = vlayer.storage.item_a['accumulator'] - math.min(vlayer.storage.item_a['accumulator'], land_allocation) + + elseif (vlayer.storage.item_a['solar-panel'] > 0 and vlayer.storage.item_a['accumulator'] == 0) then + local land_allocation = math.floor(land_surplus / config.land.requirement['solar-panel']) + vlayer.storage.item['solar-panel'] = vlayer.storage.item['solar-panel'] + math.min(vlayer.storage.item_a['solar-panel'], land_allocation) + vlayer.storage.item_a['solar-panel'] = vlayer.storage.item_a['solar-panel'] - math.min(vlayer.storage.item_a['solar-panel'], land_allocation) + + else + local land_allocation = math.floor(land_surplus / config.land.requirement['accumulator']) + vlayer.storage.item['accumulator'] = vlayer.storage.item['accumulator'] + math.min(vlayer.storage.item_a['accumulator'], land_allocation) + vlayer.storage.item_a['accumulator'] = vlayer.storage.item_a['accumulator'] - math.min(vlayer.storage.item_a['accumulator'], land_allocation) + end + + vlayer.circuit.output[1].count = math.floor(vlayer.storage.item['solar-panel'] * 0.06 * game.surfaces['nauvis'].solar_power_multiplier) + vlayer.circuit.output[2].count = math.floor(vlayer.storage.item['solar-panel'] * 873 * game.surfaces['nauvis'].solar_power_multiplier / 20800) + vlayer.circuit.output[3].count = vlayer.storage.item['accumulator'] * 5 + vlayer.circuit.output[7].count = (vlayer.storage.item[config.land.tile] * config.land.result) - (vlayer.storage.item['solar-panel'] * config.land.requirement['solar-panel']) - (vlayer.storage.item['accumulator'] * config.land.requirement['accumulator']) + vlayer.circuit.output[8].count = vlayer.storage.item_a['solar-panel'] + vlayer.circuit.output[9].count = vlayer.storage.item_a['accumulator'] + vlayer.circuit.output[10].count = vlayer.storage.item['solar-panel'] + vlayer.circuit.output[11].count = vlayer.storage.item['accumulator'] + + else + for item_name, count in pairs(chest_content) do + if (vlayer.storage.item[item_name] ~= nil) then + vlayer.storage.item[item_name] = vlayer.storage.item[item_name] + count + chest.remove({name=item_name, count=count}) + + elseif (vlayer_storage_item[item_name] ~= nil) then + vlayer.storage.item[vlayer_storage_item[item_name].name] = vlayer.storage.item[vlayer_storage_item[item_name].name] + (count * vlayer_storage_item[item_name].multiplier) + chest.remove({name=item_name, count=count}) + end + end + + vlayer.circuit.output[1].count = math.floor(vlayer.storage.item['solar-panel'] * 0.06 * game.surfaces['nauvis'].solar_power_multiplier) + vlayer.circuit.output[2].count = math.floor(vlayer.storage.item['solar-panel'] * 873 * game.surfaces['nauvis'].solar_power_multiplier / 20800) + vlayer.circuit.output[3].count = (vlayer.storage.item['accumulator'] * 5) + (config.energy_base_limit / 1000000) + vlayer.circuit.output[10].count = vlayer.storage.item['solar-panel'] + vlayer.circuit.output[11].count = vlayer.storage.item['accumulator'] + end + end + end + + -- power handle + local vlayer_power_capacity_total = math.floor(((vlayer.storage.item['accumulator'] * 5000000) + (config.energy_base_limit * #vlayer.power.entity)) / 2) + local vlayer_power_capacity = math.floor(vlayer_power_capacity_total / #vlayer.power.entity) + + if config.always_day or game.surfaces['nauvis'].always_day then + vlayer.power.energy = vlayer.power.energy + math.floor(vlayer.storage.item['solar-panel'] * 60000 * game.surfaces['nauvis'].solar_power_multiplier / config.update_tick) + + else + local tick = game.tick % 25000 + + if tick <= 5000 or tick > 17500 then + vlayer.power.energy = vlayer.power.energy + math.floor(vlayer.storage.item['solar-panel'] * 60000 * game.surfaces['nauvis'].solar_power_multiplier / config.update_tick) + + elseif tick <= 10000 then + vlayer.power.energy = vlayer.power.energy + math.floor(vlayer.storage.item['solar-panel'] * 60000 * game.surfaces['nauvis'].solar_power_multiplier / config.update_tick * (1 - ((tick - 5000) / 5000))) + + elseif (tick > 12500) and (tick <= 17500) then + vlayer.power.energy = vlayer.power.energy + math.floor(vlayer.storage.item['solar-panel'] * 60000 * game.surfaces['nauvis'].solar_power_multiplier / config.update_tick * ((tick - 5000) / 5000)) + end + end + + if config.battery_limit then + if vlayer.power.energy > vlayer_power_capacity_total then + vlayer.power.energy = vlayer_power_capacity_total + end + end + + for k, v in pairs(vlayer.power.entity) do + if (v == nil) or (not v.valid)then + vlayer.power.entity[k] = nil + + else + v.electric_buffer_size = vlayer_power_capacity + v.power_production = math.floor(vlayer_power_capacity / 60) + v.power_usage = math.floor(vlayer_power_capacity / 60) + + if vlayer.power.energy < vlayer_power_capacity then + v.energy = math.floor((v.energy + vlayer.power.energy) / 2) + vlayer.power.energy = v.energy + + elseif v.energy < vlayer_power_capacity then + local energy_change = vlayer_power_capacity - v.energy + + if energy_change < vlayer.power.energy then + v.energy = v.energy + energy_change + vlayer.power.energy = vlayer.power.energy - energy_change + + else + v.energy = v.energy + vlayer.power.energy + vlayer.power.energy = 0 + end + end + end + end + + -- circuit handle + vlayer.circuit.output[4].count = math.floor(vlayer.power.energy / 1000000) + vlayer.circuit.output[5].count = math.floor(game.tick / 25000) + vlayer.circuit.output[6].count = game.tick % 25000 + + for k, v in pairs(vlayer.power.circuit) do + if (v == nil) or (not v.valid) then + vlayer.power.circuit[k] = nil + + else + local circuit_o = v.get_or_create_control_behavior() + + for i=1, #vlayer.circuit.output do + circuit_o.set_signal(i, {signal=vlayer.circuit.output[i].signal, count=vlayer.circuit.output[i].count}) + end + end + end +end) + +return vlayer diff --git a/modules/control/warps.lua b/modules/control/warps.lua index 16b232a6..4c8cfbc8 100644 --- a/modules/control/warps.lua +++ b/modules/control/warps.lua @@ -95,8 +95,9 @@ function Warps.make_warp_tag(warp_id) -- Edit the existing tag if it is present local tag = warp.tag + if tag and tag.valid then - tag.text = 'Warp: '..name + tag.text = 'Warp: ' .. name tag.icon = icon return false end @@ -108,7 +109,7 @@ function Warps.make_warp_tag(warp_id) tag = force.add_chart_tag(surface, { position = {position.x+0.5, position.y+0.5}, - text = 'Warp: '..name, + text = 'Warp: ' .. name, icon = icon }) @@ -205,9 +206,11 @@ function Warps.remove_warp_area(warp_id) -- Restore the original tiles before the creation of the warp local tiles = {} + for _, tile in pairs(config.tiles) do table.insert(tiles, {name=old_tile, position={tile[2]+position.x, tile[3]+position.y}}) end + surface.set_tiles(tiles) local area = { @@ -224,7 +227,6 @@ function Warps.remove_warp_area(warp_id) entity.die(entity.force) end end - -- Rechart map area, useful if warp is not covered by a radar game.forces[warp.force_name].chart(surface, area) end @@ -240,8 +242,9 @@ Warps.set_spawn_warp(warp_id, game.player.force) function Warps.set_spawn_warp(warp_id, force) -- Check the force owns this warp local warp = WrapData:get(warp_id) - if warp.force_name ~= force.name then return end - + if warp.force_name ~= force.name then + return + end -- Set this warp as the spawn local warp_ids = force_warps[warp.force_name] if not warp_ids then @@ -249,7 +252,6 @@ function Warps.set_spawn_warp(warp_id, force) force_warps[warp.force_name] = warp_ids end warp_ids.spawn = warp_id - -- Set the forces spawn to this warp force.set_spawn_position(warp.position, warp.surface) end diff --git a/modules/data/bonus.lua b/modules/data/bonus.lua index 6e905d11..c9be9576 100644 --- a/modules/data/bonus.lua +++ b/modules/data/bonus.lua @@ -5,29 +5,39 @@ local Roles = require 'expcore.roles' --- @dep expcore.roles local Event = require 'utils.event' --- @dep utils.event -local config = require 'config.bonuses' --- @dep config.bonuses +local config = require 'config.bonus' --- @dep config.bonuses local Commands = require 'expcore.commands' --- @dep expcore.commands require 'config.expcore.command_general_parse' ---- Stores the bonus for the player +-- Stores the bonus for the player local PlayerData = require 'expcore.player_data' --- @dep expcore.player_data local PlayerBonus = PlayerData.Settings:combine('Bonus') PlayerBonus:set_default(0) PlayerBonus:set_metadata{ permission = 'command/bonus', stringify = function(value) - if not value or value == 0 then return 'None set' end - return (value*100)..'%' + if not value or value == 0 then + return 'None set' + end + + return value end } ---- Apply a bonus amount to a player -local function apply_bonus(player, amount) - if not amount then return end - if not player.character then return end - for bonus, min_max in pairs(config) do - local increase = min_max[2]*amount - player[bonus] = min_max[1]+increase +--- Apply a bonus to a player +local function apply_bonus(player, stage) + if not player.character then + return + end + + for _, v in pairs(config.player_bonus) do + if v.enabled then + if stage == 0 then + player[v.name] = v.min + else + player[v.name] = v.min + (v.max - v.min) * stage / 10 + end + end end end @@ -38,14 +48,25 @@ end) --- Changes the amount of bonus you receive -- @command bonus --- @tparam number amount range 0-50 the percent increase for your bonus +-- @tparam number amount range 0-10 the increase for your bonus Commands.new_command('bonus', 'Changes the amount of bonus you receive') -:add_param('amount', 'integer-range', 0,50) +:add_param('amount', 'integer-range', 0, 10) :register(function(player, amount) - local percent = amount/100 - PlayerBonus:set(player, percent) + if amount > config.player_bonus_level then + if not Roles.player_allowed(player, 'command/bonus/2') then + Commands.print{'expcom-bonus.perm', 2} + return + end + elseif amount <= config.player_bonus_level then + if not Roles.player_allowed(player, 'command/bonus') then + Commands.print{'expcom-bonus.perm', 1} + return + end + end + + PlayerBonus:set(player, amount) + Commands.print{'expcom-bonus.set', amount} - Commands.print({'expcom-bonus.wip'}, 'orange') end) --- When a player respawns re-apply bonus @@ -54,21 +75,40 @@ Event.add(defines.events.on_player_respawned, function(event) apply_bonus(player, PlayerBonus:get(player)) end) ---- When a player dies allow them to have instant respawn -Event.add(defines.events.on_player_died, function(event) - local player = game.players[event.player_index] - if Roles.player_has_flag(player, 'instance-respawn') then - player.ticks_to_respawn = 120 - end -end) - --- Remove bonus if a player no longer has access to the command local function role_update(event) local player = game.players[event.player_index] if not Roles.player_allowed(player, 'command/bonus') then - PlayerBonus:remove(player) + apply_bonus(player, 0) end end +--- When a player dies allow them to have instant respawn +Event.add(defines.events.on_player_died, function(event) + local player = game.players[event.player_index] + + if Roles.player_has_flag(player, 'instant-respawn') then + player.ticks_to_respawn = 120 + end +end) + +Event.add(defines.events.on_player_created, function(event) + if event.player_index ~= 1 then + return + end + + for _, v in pairs(config.force_bonus) do + if v.enabled then + game.players[event.player_index].force[v.name] = game.players[event.player_index].force[v.name] + v.max + end + end + + for _, v in pairs(config.surface_bonus) do + if v.enabled then + game.players[event.player_index].surface[v.name] = game.players[event.player_index].surface[v.name] + v.max + end + end +end) + Event.add(Roles.events.on_role_assigned, role_update) -Event.add(Roles.events.on_role_unassigned, role_update) \ No newline at end of file +Event.add(Roles.events.on_role_unassigned, role_update) diff --git a/modules/data/personal-logistic.lua b/modules/data/personal-logistic.lua new file mode 100644 index 00000000..2ea28e95 --- /dev/null +++ b/modules/data/personal-logistic.lua @@ -0,0 +1,76 @@ +local Commands = require 'expcore.commands' --- @dep expcore.commands +local config = require 'config.personal_logistic' --- @dep config.personal-logistic + +--[[ +Command 2: +add filter based of inventory + +Command 3: +add filter of those not in inventory: all 0 +game.item_prototypes + +Command 4: +Spidertron request +]] + +local function pl(player, amount) + local c = player.clear_personal_logistic_slot + + for k, v in pairs(config.request) do + c(config.start + v.key) + end + + if (amount == 0) then + return + else + local stats = player.force.item_production_statistics + local s = player.set_personal_logistic_slot + + for k, v in pairs(config.request) do + local v_min = math.ceil(v.min * amount) + local v_max = math.ceil(v.max * amount) + + if v.stack ~= nil and v.stack ~= 1 and v.type ~= 'weapon' then + v_min = math.floor(v_min / v.stack) * v.stack + v_max = math.ceil(v_max / v.stack) * v.stack + end + + if v.upgrade_of == nil then + if v.type ~= nil then + if stats.get_input_count(k) < config.production_required[v.type] then + v_min = 0 + end + end + + s(config.start + v.key, {name=k, min=v_min, max=v_max}) + + else + if v.type ~= nil then + if stats.get_input_count(k) >= config.production_required[v.type] then + s(config.start + v.key, {name=k, min=v_min, max=v_max}) + local vuo = v.upgrade_of + + while (vuo ~= nil) do + s(config.start + config.request[vuo].key, {name=vuo, min=0, max=0}) + vuo = config.request[vuo].upgrade_of + end + else + s(config.start + v.key, {name=k, min=0, max=v_max}) + end + end + end + end + end +end + +Commands.new_command('personal-logistic', 'Set Personal Logistic (0 to cancel all)') +:add_param('amount', 'integer-range', 0, 10) +:add_alias('pl') +:register(function(player, amount) + if player.force.technologies['logistic-robotics'].researched then + pl(player, amount / 10) + return Commands.success + else + player.print('Player logistic not researched') + end +end) diff --git a/modules/data/statistics.lua b/modules/data/statistics.lua index 704b3e9e..aff67adb 100644 --- a/modules/data/statistics.lua +++ b/modules/data/statistics.lua @@ -175,4 +175,4 @@ for statistic, event_name in pairs(config.counters) do if not player.valid or not player.connected then return end stat:increment(player) end) -end \ No newline at end of file +end diff --git a/modules/gui/debug/main_view.lua b/modules/gui/debug/main_view.lua index 6fef9c16..e74fb53f 100644 --- a/modules/gui/debug/main_view.lua +++ b/modules/gui/debug/main_view.lua @@ -32,6 +32,14 @@ function Public.open_dubug(player) return end + --[[ + local screen_element = player.gui.screen + + frame = screen_element.add{type = 'frame', name = main_frame_name, caption = 'Debuggertron 3000'} + frame.style.size = {900, 600} + frame.auto_center = true + ]] + frame = center.add {type = 'frame', name = main_frame_name, caption = 'Debuggertron 3002', direction = 'vertical'} local frame_style = frame.style frame_style.height = 600 diff --git a/modules/gui/player-list.lua b/modules/gui/player-list.lua index 06f614f6..27dc5226 100644 --- a/modules/gui/player-list.lua +++ b/modules/gui/player-list.lua @@ -75,7 +75,7 @@ Gui.element{ local reason = element.parent.entry.text local action_name = SelectedAction:get(player) local reason_callback = config.buttons[action_name].reason_callback - if reason == nil or not reason:find("/S") then reason = 'no reason given' end + if reason == nil or not reason:find("%S") then reason = 'no reason given' end reason_callback(player, reason) SelectedPlayer:remove(player) SelectedAction:remove(player) diff --git a/modules/gui/research.lua b/modules/gui/research.lua new file mode 100644 index 00000000..daf514e6 --- /dev/null +++ b/modules/gui/research.lua @@ -0,0 +1,207 @@ +--- research milestone gui +-- @addon research milestone + +local Gui = require 'expcore.gui' --- @dep expcore.gui +local Global = require 'utils.global' --- @dep utils.global +local Event = require 'utils.event' --- @dep utils.event +local Roles = require 'expcore.roles' --- @dep expcore.roles +local config = require 'config.research' --- @dep config.clock +local format_time = _C.format_time --- @dep expcore.common + +local research = {} +Global.register(research, function(tbl) + research = tbl +end) + +research.time = {} +local res = {} +local res_i = {} +local res_total = 0 +local research_time_format = {hours=true, minutes=true, seconds=true, time=true, string=true} +local empty_time = format_time(0, {hours=true, minutes=true, seconds=true, time=true, string=true, null=true}) + +local function research_res_n(res_) + local res_n = 1 + + for k, _ in pairs(res_) do + if research.time[k] == 0 then + res_n = k - 1 + break + end + end + + if research.time[#res_] > 0 then + if res_n == 1 then + res_n = #res_ + end + end + + if res_n < 3 then + res_n = 3 + end + + return res_n +end + +for i=1, #config.milestone do + res_total = res_total + config.milestone[i].time * 60 + res_i[config.milestone[i].name] = i + research.time[i] = 0 + res[i] = { + name = '[technology=' .. config.milestone[i].name .. '] ' .. config.milestone[i].name:gsub('-', ' '), + prev = res_total, + prev_disp = format_time(res_total, research_time_format), + } +end + +local clock_container = +Gui.element(function(event_trigger, parent) + local container = Gui.container(parent, event_trigger, 200) + local scroll_table = Gui.scroll_table(container, 400, 4) + + scroll_table.add{ + name = 'clock_text', + caption = 'Time:', + type = 'label', + style = 'heading_1_label' + } + + scroll_table.add{ + name = 'clock_text_2', + caption = '', + type = 'label', + style = 'heading_1_label' + } + + scroll_table.add{ + name = 'clock_text_3', + caption = '', + type = 'label', + style = 'heading_1_label' + } + + scroll_table.add{ + name = 'clock_display', + caption = empty_time, + type = 'label', + style = 'heading_1_label' + } + + for i=1, 8 do + scroll_table.add{ + name = 'research_display_n_' .. i, + caption = '', + type = 'label', + style = 'heading_1_label' + } + + scroll_table.add{ + name = 'research_display_d_' .. i, + caption = empty_time, + type = 'label', + style = 'heading_1_label' + } + + scroll_table.add{ + name = 'research_display_p_' .. i, + caption = '', + type = 'label', + style = 'heading_1_label' + } + + scroll_table.add{ + name = 'research_display_t_' .. i, + caption = empty_time, + type = 'label', + style = 'heading_1_label' + } + end + + local res_n = research_res_n(res) + + for j=1, 8 do + local res_j = res_n + j - 3 + if res[res_j] ~= nil then + local res_r = res[res_j] + scroll_table['research_display_n_' .. j].caption = res_r.name + + if research.time[res_j] < res[res_j].prev then + scroll_table['research_display_d_' .. j].caption = '-' .. format_time(res[res_j].prev - research.time[res_j], research_time_format) + else + scroll_table['research_display_d_' .. j].caption = format_time(research.time[res_j] - res[res_j].prev, research_time_format) + end + + scroll_table['research_display_p_' .. j].caption = res_r.prev_disp + scroll_table['research_display_t_' .. j].caption = format_time(research.time[res_j], research_time_format) + else + scroll_table['research_display_n_' .. j].caption = '' + scroll_table['research_display_d_' .. j].caption = '' + scroll_table['research_display_p_' .. j].caption = '' + scroll_table['research_display_t_' .. j].caption = '' + end + end + + return container.parent +end) +:add_to_left_flow() + +Gui.left_toolbar_button('item/space-science-pack', {'expcom-res.main-tooltip'}, clock_container, function(player) + return Roles.player_allowed(player, 'gui/research') +end) + +Event.add(defines.events.on_research_finished, function(event) + if event.research.name == nil then + return + elseif res_i[event.research.name] == nil then + return + end + + local n_i = res_i[event.research.name] + research.time[n_i] = game.tick + + local res_n = research_res_n(res) + local res_disp = {} + + for j=1, 8 do + local res_j = res_n + j - 3 + res_disp[j] = {} + + if res[res_j] ~= nil then + local res_r = res[res_j] + res_disp[j]['n'] = res_r.name + if research.time[res_j] < res[res_j].prev then + res_disp[j]['d'] = '-' .. format_time(res[res_j].prev - research.time[res_j], research_time_format) + else + res_disp[j]['d'] = format_time(research.time[res_j] - res[res_j].prev, research_time_format) + end + + res_disp[j]['p'] = res_r.prev_disp + res_disp[j]['t'] = format_time(research.time[res_j], research_time_format) + else + res_disp[j]['n'] = '' + res_disp[j]['d'] = '' + res_disp[j]['p'] = '' + res_disp[j]['t'] = '' + end + end + + for _, player in pairs(game.connected_players) do + local frame = Gui.get_left_element(player, clock_container) + + for j=1, 8 do + frame.container.scroll.table['research_display_n_' .. j].caption = res_disp[j]['n'] + frame.container.scroll.table['research_display_d_' .. j].caption = res_disp[j]['d'] + frame.container.scroll.table['research_display_p_' .. j].caption = res_disp[j]['p'] + frame.container.scroll.table['research_display_t_' .. j].caption = res_disp[j]['t'] + end + end +end) + +Event.on_nth_tick(60, function() + local current_time = format_time(game.tick, research_time_format) + + for _, player in pairs(game.connected_players) do + local frame = Gui.get_left_element(player, clock_container) + frame.container.scroll.table['clock_display'].caption = current_time + end +end) diff --git a/modules/gui/server-ups.lua b/modules/gui/server-ups.lua index 9d294b36..19fa57aa 100644 --- a/modules/gui/server-ups.lua +++ b/modules/gui/server-ups.lua @@ -58,7 +58,9 @@ local function set_location(event) local label = player.gui.screen[server_ups.name] local res = player.display_resolution local uis = player.display_scale - label.location = { x=res.width-423*uis, y=30*uis } + -- below ups and clock + -- label.location = {x=res.width-423*uis, y=50*uis} + label.location = {x=res.width-363*uis, y=31*uis} end -- Draw the label when the player joins @@ -70,9 +72,10 @@ Event.add(defines.events.on_player_created, function(event) end) -- Update the caption for all online players +-- percentage of game speed Event.on_nth_tick(60, function() if External.valid() then - local caption = 'SUPS = '..External.get_server_ups() + local caption = External.get_server_ups() .. ' (' .. string.format('%.1f', External.get_server_ups() * 5 / 3) .. '%)' for _, player in pairs(game.connected_players) do player.gui.screen[server_ups.name].caption = caption end diff --git a/modules/gui/vlayer.lua b/modules/gui/vlayer.lua new file mode 100644 index 00000000..184f2caa --- /dev/null +++ b/modules/gui/vlayer.lua @@ -0,0 +1,276 @@ +--- Adds a virtual layer to store power to save space. +-- @addon Virtual Layer + +local Gui = require 'expcore.gui' --- @dep expcore.gui +local Roles = require 'expcore.roles' --- @dep expcore.roles +local Event = require 'utils.event' --- @dep utils.event +local config = require 'config.vlayer' --- @dep config.vlayer +local format_number = require('util').format_number +local vlayer = require 'modules.control.vlayer' + +local vlayer_container +local vlayer_display = {} + +local function pos_to_gps_string(pos) + return '[gps=' .. tostring(pos.x) .. ',' .. tostring(pos.y) .. ']' +end + +for i=1, #config.gui.content do + if config.gui.content[i].type == 'item' or config.gui.content[i].type == 'signal' then + vlayer_display[i] = { + type = config.gui.content[i].type, + name = config.gui.content[i].name, + count = 0 + } + end +end + +local function vlayer_convert_chest(player) + local entities = player.surface.find_entities_filtered{position=player.position, radius=8, name='steel-chest', force=player.force} + if (not entities or (#entities == 0)) then + return nil + end + + local target_chest = player.surface.get_closest(player.position, entities) + if (not target_chest) then + player.print('No Steel Chest Detected') + return nil + end + + if (not target_chest.get_inventory(defines.inventory.chest).is_empty()) then + player.print('Chest is not emptied') + return nil + end + + local pos = target_chest.position + + if (not target_chest.destroy()) then + player.print('Unable to convert chest') + return nil + end + + return {x=math.floor(pos.x), y=math.floor(pos.y)} +end + +local function vlayer_convert_chest_storage_input(player) + local pos = vlayer_convert_chest(player) + + if (pos) then + local vlayer_storage = player.surface.create_entity{name='logistic-chest-storage', position=pos, force='neutral'} + game.print(player.name .. ' built a vlayer input on ' .. pos_to_gps_string(pos)) + vlayer_storage.destructible = false + vlayer_storage.minable = false + vlayer_storage.operable = true + vlayer_storage.last_user = player + table.insert(vlayer.storage.input, vlayer_storage) + end +end + +local function vlayer_convert_chest_power(player) + local pos = vlayer_convert_chest(player) + + if (pos) then + if (player.surface.can_place_entity{name='electric-energy-interface', position=pos})then + local vlayer_power = player.surface.create_entity{name='electric-energy-interface', position=pos, force='neutral'} + game.print(player.name .. ' built a vlayer energy interface on ' .. pos_to_gps_string(pos)) + vlayer_power.destructible = false + vlayer_power.minable = false + vlayer_power.operable = false + vlayer_power.last_user = player + vlayer_power.electric_buffer_size = math.floor(config.energy_base_limit / 2) + vlayer_power.power_production = math.floor(config.energy_base_limit / 60) + vlayer_power.power_usage = math.floor(config.energy_base_limit / 60) + vlayer_power.energy = 0 + table.insert(vlayer.power.entity, vlayer_power) + else + player.print('Unable to build energy entity') + end + end +end + +local function vlayer_convert_chest_circuit(player) + local pos = vlayer_convert_chest(player) + + if (pos) then + local circuit_o = player.surface.create_entity{name='constant-combinator', position=pos, force='neutral'} + circuit_o.destructible = false + circuit_o.minable = false + circuit_o.operable = true + circuit_o.last_user = player + + local circuit_oc = circuit_o.get_or_create_control_behavior() + circuit_oc.set_signal(1, {signal={type='virtual', name='signal-P'}, count=0}) + circuit_oc.set_signal(2, {signal={type='virtual', name='signal-S'}, count=0}) + circuit_oc.set_signal(3, {signal={type='virtual', name='signal-M'}, count=0}) + circuit_oc.set_signal(4, {signal={type='virtual', name='signal-C'}, count=0}) + circuit_oc.set_signal(5, {signal={type='virtual', name='signal-D'}, count=0}) + circuit_oc.set_signal(6, {signal={type='virtual', name='signal-T'}, count=0}) + circuit_oc.set_signal(7, {signal={type='virtual', name='signal-L'}, count=0}) + circuit_oc.set_signal(8, {signal={type='virtual', name='signal-A'}, count=0}) + circuit_oc.set_signal(9, {signal={type='virtual', name='signal-B'}, count=0}) + circuit_oc.set_signal(10, {signal={type='item', name='solar-panel'}, count=0}) + circuit_oc.set_signal(11, {signal={type='item', name='accumulator'}, count=0}) + + table.insert(vlayer.power.circuit, circuit_o) + game.print(player.name .. ' built a vlayer circuit on ' .. pos_to_gps_string(pos)) + end +end + +local function vlayer_convert_remove(player) + local entities = player.surface.find_entities_filtered{name={'logistic-chest-storage', 'constant-combinator', 'electric-energy-interface'}, position=player.position, radius=8, force='neutral', limit=1} + + if (not entities or #entities == 0) then + player.print('Entity not found') + else + for _, v in pairs(entities) do + local name = v.name + game.print(player.name .. ' removed a vlayer ' .. config.print_out[v.name] .. ' on ' .. pos_to_gps_string(v.position)) + v.destroy() + + if name == 'logistic-chest-storage' then + for k, vl in pairs(vlayer.storage.input) do + if not vl.valid then + vlayer.storage.input[k] = nil + end + end + + elseif name == 'constant-combinator' then + for k, vl in pairs(vlayer.power.circuit) do + if not vl.valid then + vlayer.power.circuit[k] = nil + end + end + + elseif name == 'electric-energy-interface' then + for k, vl in pairs(vlayer.power.entity) do + if not vl.valid then + vlayer.power.entity[k] = nil + end + end + end + end + end +end + +local vlayer_gui_update + +local button_power = +Gui.element{ + name = 'button_1', + type = 'button', + caption = 'Power Entity', + style = 'button' +}:on_click(function(player) + vlayer_convert_chest_power(player) + vlayer_gui_update() +end) + +local button_storage_input = +Gui.element{ + name = 'button_2', + type = 'button', + caption = 'Storage Input', + style = 'button' +}:on_click(function(player) + vlayer_convert_chest_storage_input(player) + vlayer_gui_update() +end) + +local button_circuit = +Gui.element{ + name = 'button_3', + type = 'button', + caption = 'Circuit', + style = 'button' +}:on_click(function(player) + vlayer_convert_chest_circuit(player) + vlayer_gui_update() +end) + +local button_remove = +Gui.element{ + name = 'button_4', + type = 'button', + caption = 'Remove', + style = 'button' +}:on_click(function(player) + vlayer_convert_remove(player) + vlayer_gui_update() +end) + +function vlayer_gui_update() + local button_power_enabled = #vlayer.power.entity < config.interface_limit.energy + local button_storage_input_enabled = #vlayer.storage.input < config.interface_limit.storage_input + local button_circuit_enabled = #vlayer.power.circuit < config.interface_limit.circuit + + for _, player in pairs(game.connected_players) do + local frame = Gui.get_left_element(player, vlayer_container) + frame.container.scroll.table[button_power.name].enabled = button_power_enabled + frame.container.scroll.table[button_storage_input.name].enabled = button_storage_input_enabled + frame.container.scroll.table[button_circuit.name].enabled = button_circuit_enabled + end +end + +vlayer_container = +Gui.element(function(event_trigger, parent) + local player = Gui.get_player_from_element(parent) + local container = Gui.container(parent, event_trigger, 300) + Gui.header(container, 'VLAYER', '', true) + local scroll_table = Gui.scroll_table(container, 300, 2) + for i=1, #config.gui.content do + scroll_table.add{ + name = 'vlayer_display_' .. i, + caption = config.gui.content[i].title, + type = config.gui.type, + style = config.gui.style + } + end + button_power(scroll_table) + button_storage_input(scroll_table) + button_circuit(scroll_table) + button_remove(scroll_table) + + if (config.land.enabled ~= true) then + for i=7, 12 do + scroll_table['vlayer_display_' .. i].visible = false + end + end + + if not (Roles.player_allowed(player, 'gui/vlayer-edit')) then + scroll_table['vlayer_display_' .. #config.gui.content - 1].visible = false + scroll_table['vlayer_display_' .. #config.gui.content].visible = false + scroll_table[button_power.name].visible = false + scroll_table[button_storage_input.name].visible = false + scroll_table[button_circuit.name].visible = false + scroll_table[button_remove.name].visible = false + end + + scroll_table[button_power.name].enabled = (#vlayer.power.entity < config.interface_limit.energy) + scroll_table[button_storage_input.name].enabled = (#vlayer.storage.input < config.interface_limit.storage_input) + scroll_table[button_circuit.name].enabled = (#vlayer.power.circuit < config.interface_limit.circuit) + + return container.parent +end) +:add_to_left_flow() + +Gui.left_toolbar_button('entity/solar-panel', {'vlayer.main-tooltip'}, vlayer_container, function(player) + return Roles.player_allowed(player, 'gui/vlayer') +end) + +Event.on_nth_tick(config.update_tick, function() + for _, v in pairs(vlayer_display) do + if v.type == 'item' then + v.count = format_number(vlayer.storage.item[v.name]) + elseif v.type == 'signal' then + v.count = format_number(vlayer.circuit.output[v.name].count) + end + end + + for _, player in pairs(game.connected_players) do + local frame = Gui.get_left_element(player, vlayer_container) + + for k, v in pairs(vlayer_display) do + frame.container.scroll.table['vlayer_display_' .. k].caption = v.count + end + end +end) diff --git a/modules/gui/warp-list.lua b/modules/gui/warp-list.lua index 9763233f..4928d66e 100644 --- a/modules/gui/warp-list.lua +++ b/modules/gui/warp-list.lua @@ -111,7 +111,7 @@ Gui.element{ -- Check if there are player entities in the way (has a bigger radius because the enities that can be placed by a player are larger) local entities = surface.find_entities_filtered{ - radius = config.standard_proximity_radius + 4.5, + radius = config.standard_proximity_radius + 2.5, position = position, collision_mask = { 'item-layer', 'object-layer', 'player-layer', 'water-tile' @@ -119,7 +119,7 @@ Gui.element{ } -- Remove 1 because that is the current player if #entities > 1 then - player_return({'expcore-commands.command-fail', {'warp-list.too-close-to-entities', config.standard_proximity_radius + 4.5}}, 'orange_red', player) + player_return({'expcore-commands.command-fail', {'warp-list.too-close-to-entities', config.standard_proximity_radius + 2.5}}, 'orange_red', player) if game.player then game.player.play_sound{path='utility/wire_pickup'} end local character = player.character for _, entity in pairs(entities) do @@ -832,7 +832,7 @@ Event.add(defines.events.on_player_created, function(event) Warps.set_spawn_warp(spawn_id, force) Warps.make_warp_tag(spawn_id) - local entities = player.surface.find_entities_filtered{ type = 'electric-pole', position = spawn_position, radius = 20, limit = 1 } + local entities = player.surface.find_entities_filtered{type='electric-pole', position=spawn_position, radius=20, limit=1} if entities and entities[1] then local warp = Warps.get_warp(spawn_id) warp.electric_pole = entities[1]