From 8dc2c3e78a83cfb1a509ddd3562c02aa9227ce3f Mon Sep 17 00:00:00 2001 From: RedRafe Date: Sun, 27 Oct 2024 00:21:57 +0200 Subject: [PATCH] Frontier fixes --- map_gen/maps/frontier/modules/enemy.lua | 6 +++++- map_gen/maps/frontier/modules/spawn_shop.lua | 6 ++++-- map_gen/maps/frontier/modules/terrain.lua | 8 ++++---- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/map_gen/maps/frontier/modules/enemy.lua b/map_gen/maps/frontier/modules/enemy.lua index ec6168e4..f2e04a6e 100644 --- a/map_gen/maps/frontier/modules/enemy.lua +++ b/map_gen/maps/frontier/modules/enemy.lua @@ -439,7 +439,11 @@ function Enemy.stop_tracking(entity) end function Enemy.get_target() - return Table.get_random_dictionary_entry(Public.get().target_entities, false) + local _list = Public.get().target_entities + if table_size(_list) == 0 then + return + end + return Table.get_random_dictionary_entry(_list, false) end function Enemy.nuclear_explosion(position) diff --git a/map_gen/maps/frontier/modules/spawn_shop.lua b/map_gen/maps/frontier/modules/spawn_shop.lua index 388bc8e1..55a95947 100644 --- a/map_gen/maps/frontier/modules/spawn_shop.lua +++ b/map_gen/maps/frontier/modules/spawn_shop.lua @@ -213,7 +213,7 @@ function SpawnShop.draw_gui(player) table.add { type = 'sprite-button', sprite = 'item/'..item_stack.name, - style = satisfied and 'recipe_slot_button' or 'yellow_slot_button', + style = satisfied and 'slot_button' or 'yellow_slot_button', number = item_stack.count, tooltip = {'frontier.tt_shop_item_stack', {'?', {'item-name.'..item_stack.name}, {'entity-name.'..item_stack.name}, item_stack.name}, item_stack.count, (satisfied and 'green' or 'yellow') } } @@ -397,7 +397,9 @@ end function SpawnShop.on_player_refresh(player) local this = Public.get() this.spawn_shop_funds = this.spawn_shop_funds - 1 - this.spawn_shop_cooldown[player.index] = game.tick + 40 * SECOND + if not player.admin then + this.spawn_shop_cooldown[player.index] = game.tick + 40 * SECOND + end ScoreTracker.set_for_global(Public.scores.shop_funds.name, this.spawn_shop_funds) player.print('[color=orange][Bard][/color] ' .. bard_refresh_messages[math_random(#bard_refresh_messages)], { sound_path = 'utility/scenario_message', color = Color.dark_grey }) if this.spawn_shop_funds <= 5 then diff --git a/map_gen/maps/frontier/modules/terrain.lua b/map_gen/maps/frontier/modules/terrain.lua index 6a48c565..b86d0330 100644 --- a/map_gen/maps/frontier/modules/terrain.lua +++ b/map_gen/maps/frontier/modules/terrain.lua @@ -203,7 +203,7 @@ function Terrain.scale_resource_richness(surface, area) if resource.prototype.resource_category == 'basic-fluid' then resource.amount = this.ore_base_quantity * 800 * chunks elseif resource.prototype.resource_category == 'basic-solid' then - resource.amount = math_min(0.7 * resource.amount, this.ore_base_quantity * 10 + math_random(100)) + resource.amount = math_min(1+ 0.7 * resource.amount, this.ore_base_quantity * 10 + math_random(100)) end else if resource.prototype.resource_category == 'basic-fluid' then @@ -449,7 +449,7 @@ function Terrain.clear_area(args) end local tiles = {} for _, t in pairs(surface.find_tiles_filtered{ area = area }) do - if t.collides_with('item_layer') then + if t.collides_with('item') then tiles[#tiles +1] = { name = 'nuclear-ground', position = t.position } end end @@ -461,7 +461,7 @@ function Terrain.clear_area(args) end local tiles = {} for _, t in pairs(surface.find_tiles_filtered{ position = position, radius = args.radius }) do - if t.collides_with('item_layer') then + if t.collides_with('item') then tiles[#tiles +1] = { name = 'nuclear-ground', position = t.position } end end @@ -484,7 +484,7 @@ function Terrain.clear_area(args) end local tiles = {} for _, t in pairs(surface.find_tiles_filtered{ area = area }) do - if t.collides_with('item_layer') then + if t.collides_with('item') then tiles[#tiles +1] = { name = 'nuclear-ground', position = t.position } end end