From 1f2fa4d910efb0bc334518c7976cfc25fc9f2b0f Mon Sep 17 00:00:00 2001 From: Gerkiz Date: Thu, 30 Jul 2020 22:27:38 +0200 Subject: [PATCH] minor fixes --- maps/mountain_fortress_v3/functions.lua | 2 +- .../resource_generator.lua | 64 +++++++++---------- modules/rpg/main.lua | 13 ---- utils/core.lua | 8 +++ 4 files changed, 41 insertions(+), 46 deletions(-) diff --git a/maps/mountain_fortress_v3/functions.lua b/maps/mountain_fortress_v3/functions.lua index bebff1dd..60dbe85e 100644 --- a/maps/mountain_fortress_v3/functions.lua +++ b/maps/mountain_fortress_v3/functions.lua @@ -536,7 +536,7 @@ Public.magic_item_crafting_callback_weighted = else local furance_item = stack.furance_item if furance_item then - local inv = entity.get_inventory(2) -- defines.inventory.furnace_source + local inv = entity.get_inventory(defines.inventory.furnace_result) inv.insert(furance_item) end end diff --git a/maps/mountain_fortress_v3/resource_generator.lua b/maps/mountain_fortress_v3/resource_generator.lua index a95e34d5..170a4ab6 100644 --- a/maps/mountain_fortress_v3/resource_generator.lua +++ b/maps/mountain_fortress_v3/resource_generator.lua @@ -54,21 +54,21 @@ local ammo_loot = { { stack = { recipe = 'piercing-rounds-magazine', - output = {item = 'piercing-rounds-magazine', min_rate = 0.5 / 8 / 60, distance_factor = 1 / 10 / 60 / 512} + output = {item = 'piercing-rounds-magazine', min_rate = 1 / 2 / 60, distance_factor = 1 / 10 / 60 / 512} }, weight = 1 }, { stack = { recipe = 'firearm-magazine', - output = {item = 'firearm-magazine', min_rate = 1 / 4 / 60, distance_factor = 1 / 4 / 60 / 512} + output = {item = 'firearm-magazine', min_rate = 1 / 2 / 60, distance_factor = 1 / 4 / 60 / 512} }, weight = 4 }, { stack = { recipe = 'shotgun-shell', - output = {item = 'shotgun-shell', min_rate = 0.5 / 8 / 60, distance_factor = 1 / 6 / 60 / 512} + output = {item = 'shotgun-shell', min_rate = 1 / 2 / 60, distance_factor = 1 / 8 / 60 / 512} }, weight = 4 }, @@ -86,7 +86,7 @@ local oil_loot = { stack = { recipe = 'basic-oil-processing', output = { - min_rate = 0.5 / 8 / 60, + min_rate = 4.125 / 60, distance_factor = 1 / 10 / 60 / 512, item = 'petroleum-gas', fluidbox_index = 2 @@ -113,7 +113,7 @@ local oil_prod_loot = { recipe = 'lubricant', output = { item = 'lubricant', - min_rate = 0.5 / 8 / 60, + min_rate = 2.825 / 60, distance_factor = 1 / 10 / 60 / 512, fluidbox_index = 2 } @@ -125,7 +125,7 @@ local oil_prod_loot = { recipe = 'solid-fuel-from-light-oil', output = { item = 'solid-fuel', - min_rate = 1 / 4 / 60, + min_rate = 2 / 60, distance_factor = 1 / 4 / 60 / 512 } }, @@ -136,8 +136,8 @@ local oil_prod_loot = { recipe = 'sulfuric-acid', output = { item = 'sulfuric-acid', - min_rate = 0.5 / 8 / 60, - distance_factor = 1 / 6 / 60 / 512, + min_rate = 2.825 / 60, + distance_factor = 1 / 8 / 60 / 512, fluidbox_index = 2 } }, @@ -148,7 +148,7 @@ local oil_prod_loot = { recipe = 'battery', output = { item = 'battery', - min_rate = 0.5 / 8 / 60, + min_rate = 2 / 60, distance_factor = 1 / 25 / 60 / 512 } }, @@ -159,7 +159,7 @@ local oil_prod_loot = { recipe = 'sulfur', output = { item = 'sulfur', - min_rate = 0.5 / 8 / 60, + min_rate = 2.825 / 60, distance_factor = 1 / 25 / 60 / 512 } }, @@ -170,7 +170,7 @@ local oil_prod_loot = { recipe = 'plastic-bar', output = { item = 'plastic-bar', - min_rate = 0.5 / 8 / 60, + min_rate = 2 / 60, distance_factor = 1 / 25 / 60 / 512 } }, @@ -182,126 +182,126 @@ local resource_loot = { { stack = { recipe = 'stone-wall', - output = {item = 'stone-wall', min_rate = 1 / 4 / 60, distance_factor = 1 / 8 / 60 / 512} + output = {item = 'stone-wall', min_rate = 1.5 / 60, distance_factor = 1 / 6 / 60 / 512} }, weight = 10 }, { stack = { recipe = 'iron-gear-wheel', - output = {item = 'iron-gear-wheel', min_rate = 1 / 4 / 60, distance_factor = 1 / 6 / 60 / 512} + output = {item = 'iron-gear-wheel', min_rate = 1.5 / 60, distance_factor = 1 / 6 / 60 / 512} }, weight = 12 }, { stack = { recipe = 'inserter', - output = {item = 'inserter', min_rate = 1 / 4 / 60, distance_factor = 1 / 8 / 60 / 512} + output = {item = 'inserter', min_rate = 1.5 / 60, distance_factor = 1 / 6 / 60 / 512} }, weight = 12 }, { stack = { recipe = 'transport-belt', - output = {item = 'transport-belt', min_rate = 1 / 4 / 60, distance_factor = 1 / 8 / 60 / 512} + output = {item = 'transport-belt', min_rate = 1.5 / 60, distance_factor = 1 / 6 / 60 / 512} }, weight = 8 }, { stack = { recipe = 'underground-belt', - output = {item = 'underground-belt', min_rate = 1 / 4 / 60, distance_factor = 1 / 8 / 60 / 512} + output = {item = 'underground-belt', min_rate = 1.0 / 60, distance_factor = 1 / 6 / 60 / 512} }, weight = 8 }, { stack = { recipe = 'small-electric-pole', - output = {item = 'small-electric-pole', min_rate = 1 / 4 / 60, distance_factor = 1 / 6 / 60 / 512} + output = {item = 'small-electric-pole', min_rate = 1.0 / 60, distance_factor = 1 / 6 / 60 / 512} }, weight = 8 }, { stack = { recipe = 'fast-transport-belt', - output = {item = 'fast-transport-belt', min_rate = 1 / 4 / 60, distance_factor = 1 / 12 / 60 / 512} + output = {item = 'fast-transport-belt', min_rate = 1 / 4 / 60, distance_factor = 1 / 8 / 60 / 512} }, weight = 5 }, { stack = { recipe = 'fast-underground-belt', - output = {item = 'fast-underground-belt', min_rate = 1 / 4 / 60, distance_factor = 1 / 12 / 60 / 512} + output = {item = 'fast-underground-belt', min_rate = 1 / 4 / 60, distance_factor = 1 / 8 / 60 / 512} }, weight = 5 }, { stack = { recipe = 'solar-panel', - output = {item = 'solar-panel', min_rate = 1 / 4 / 60, distance_factor = 1 / 12 / 60 / 512} + output = {item = 'solar-panel', min_rate = 1 / 6 / 60, distance_factor = 1 / 8 / 60 / 512} }, weight = 3 }, { stack = { recipe = 'productivity-module', - output = {item = 'productivity-module', min_rate = 1 / 4 / 60, distance_factor = 1 / 20 / 60 / 512} + output = {item = 'productivity-module', min_rate = 1 / 6 / 60, distance_factor = 1 / 8 / 60 / 512} }, weight = 0.9 }, { stack = { recipe = 'effectivity-module', - output = {item = 'effectivity-module', min_rate = 1 / 4 / 60, distance_factor = 1 / 20 / 60 / 512} + output = {item = 'effectivity-module', min_rate = 1 / 6 / 60, distance_factor = 1 / 8 / 60 / 512} }, weight = 0.9 }, { stack = { recipe = 'speed-module', - output = {item = 'speed-module', min_rate = 1 / 4 / 60, distance_factor = 1 / 20 / 60 / 512} + output = {item = 'speed-module', min_rate = 1 / 6 / 60, distance_factor = 1 / 8 / 60 / 512} }, weight = 0.8 }, { stack = { recipe = 'productivity-module-2', - output = {item = 'productivity-module-2', min_rate = 1 / 4 / 60, distance_factor = 1 / 20 / 60 / 512} + output = {item = 'productivity-module-2', min_rate = 1 / 8 / 60, distance_factor = 1 / 8 / 60 / 512} }, weight = 0.5 }, { stack = { recipe = 'effectivity-module-2', - output = {item = 'effectivity-module-2', min_rate = 1 / 4 / 60, distance_factor = 1 / 20 / 60 / 512} + output = {item = 'effectivity-module-2', min_rate = 1 / 8 / 60, distance_factor = 1 / 8 / 60 / 512} }, weight = 0.5 }, { stack = { recipe = 'speed-module-2', - output = {item = 'speed-module-2', min_rate = 1 / 4 / 60, distance_factor = 1 / 20 / 60 / 512} + output = {item = 'speed-module-2', min_rate = 1 / 8 / 60, distance_factor = 1 / 8 / 60 / 512} }, weight = 0.5 }, { stack = { recipe = 'productivity-module-3', - output = {item = 'productivity-module-3', min_rate = 1 / 4 / 60, distance_factor = 1 / 30 / 60 / 512} + output = {item = 'productivity-module-3', min_rate = 1 / 10 / 60, distance_factor = 1 / 8 / 60 / 512} }, weight = 0.25 }, { stack = { recipe = 'effectivity-module-3', - output = {item = 'effectivity-module-3', min_rate = 1 / 4 / 60, distance_factor = 1 / 30 / 60 / 512} + output = {item = 'effectivity-module-3', min_rate = 1 / 10 / 60, distance_factor = 1 / 8 / 60 / 512} }, weight = 0.25 }, { stack = { recipe = 'speed-module-3', - output = {item = 'speed-module-3', min_rate = 1 / 4 / 60, distance_factor = 1 / 30 / 60 / 512} + output = {item = 'speed-module-3', min_rate = 1 / 10 / 60, distance_factor = 1 / 8 / 60 / 512} }, weight = 0.10 } @@ -311,21 +311,21 @@ local furnace_loot = { { stack = { furance_item = 'iron-plate', - output = {item = 'iron-plate', min_rate = 1 / 4 / 60, distance_factor = 1 / 6 / 60 / 512} + output = {item = 'iron-plate', min_rate = 2.0 / 60, distance_factor = 1 / 6 / 60 / 512} }, weight = 4 }, { stack = { furance_item = 'copper-plate', - output = {item = 'copper-plate', min_rate = 1 / 4 / 60, distance_factor = 1 / 6 / 60 / 512} + output = {item = 'copper-plate', min_rate = 2.0 / 60, distance_factor = 1 / 6 / 60 / 512} }, weight = 4 }, { stack = { furance_item = 'steel-plate', - output = {item = 'steel-plate', min_rate = 0.5 / 8 / 60, distance_factor = 1 / 15 / 60 / 512} + output = {item = 'steel-plate', min_rate = 1.0 / 60, distance_factor = 1 / 8 / 60 / 512} }, weight = 1 } diff --git a/modules/rpg/main.lua b/modules/rpg/main.lua index 9b111925..a9ed381f 100644 --- a/modules/rpg/main.lua +++ b/modules/rpg/main.lua @@ -1006,18 +1006,6 @@ local function on_player_used_capsule(event) return end -local function on_player_died(event) - local player = game.get_player(event.player_index) - if not player or not player.valid then - return - end - - local left = player.gui.left - local screen = player.gui.screen - local main_frame = left[main_frame_name] - RPG_GUI.remove_main_frame(main_frame, screen) -end - local function tick() local ticker = game.tick local count = #game.connected_players @@ -1075,7 +1063,6 @@ Event.add(defines.events.on_player_crafted_item, on_player_crafted_item) Event.add(defines.events.on_player_joined_game, on_player_joined_game) Event.add(defines.events.on_player_repaired_entity, on_player_repaired_entity) Event.add(defines.events.on_player_respawned, on_player_respawned) -Event.add(defines.events.on_player_died, on_player_died) Event.add(defines.events.on_player_rotated_entity, on_player_rotated_entity) Event.add(defines.events.on_pre_player_mined_item, on_pre_player_mined_item) Event.add(defines.events.on_player_used_capsule, on_player_used_capsule) diff --git a/utils/core.lua b/utils/core.lua index 417cf08b..25492a15 100644 --- a/utils/core.lua +++ b/utils/core.lua @@ -257,6 +257,14 @@ function Public.silent_action_warning(warning_prefix, msg, player) Server.to_discord_bold(msg) end +--- Takes msg and logs it. +-- @param msg The message to print +-- @param warning_prefix The name of the module/warning +function Public.log_msg(warning_prefix, msg) + msg = format('%s %s', warning_prefix, msg) + log(msg) +end + --- Takes a string, number, or LuaPlayer and returns a valid LuaPlayer or nil. -- Intended for commands as there are extra checks in place. -- @param