1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-02-21 19:20:07 +02:00

Merge pull request #1442 from RedRafe/updates/frontier

Update Frontier to 2.0
This commit is contained in:
grilledham 2024-11-10 14:33:19 +00:00 committed by GitHub
commit 8645e4b511
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
44 changed files with 146 additions and 129 deletions

View File

@ -22,7 +22,7 @@ local floor = math.floor
local ceil = math.ceil
local fast_remove = table.fast_remove
local collision_mask = {'floor-layer', 'object-layer', 'resource-layer'}
local collision_mask = {'floor', 'object', 'resource'}
local whitelist = defines.deconstruction_item.tile_filter_mode.whitelist
local entity_whitelist = defines.deconstruction_item.entity_filter_mode.whitelist

View File

@ -118,7 +118,7 @@ item_sold_out=SOLD OUT!
item_is_free=FREE!
generic_item_disabled_message=Item is disabled
not_enough_currency=Missing __1__ __2__ to buy __3__
item_with_player_limit_description=You have bought this item __1__ out of __plural_for_parameter_2_{1=1 time|rest=__2__ times}__
item_with_player_limit_description=You have bought this item __1__ out of __plural_for_parameter__2__{1=1 time|rest=__2__ times}__
item_no_longer_available=This item is no longer available in the market
item_disabled_reason=__1__ is disabled. __2__
no_inventory_space=Insufficient inventory space
@ -218,5 +218,5 @@ err_no_armor=[color=blue][Battery recharge][/color] No valid armor to charge was
err_no_accumulators=[color=blue][Battery recharge][/color] No accumulators nearby.
[clear_corpses]
count=[color=blue][Cleaner][/color] __1__ __plural_for_parameter_1_{1=corpse|rest=corpses}__ removed.
count=[color=blue][Cleaner][/color] __1__ __plural_for_parameter__1__{1=corpse|rest=corpses}__ removed.
clear=[color=blue][Cleaner][/color] already clear.

View File

@ -184,14 +184,14 @@ gps=[gps=__1__,__2__,__3__]
tile_unlock=__1__ has unlocked new grounds! __2__
[frontier]
add_rocket=Adding __1__ extra __plural_for_parameter_1_{1=launch|rest=launches}__ thanks to the death of __2__. __3__ __plural_for_parameter_3_{1=rocket|rest=rockets}__ to go!
add_rocket=Adding __1__ extra __plural_for_parameter__1__{1=launch|rest=launches}__ thanks to the death of __2__. __3__ __plural_for_parameter__3__{1=rocket|rest=rockets}__ to go!
earn_coin=[achievement=steamrolled] you steal another treasure [item=coin] from the Kraken's army.
empty_rocket=[color=purple][Kraken][/color] The God of the Sea accepts your rocket offer and rewards you with magic fishes
kraken_eat=[color=purple][Kraken][/color] ate __1__ and was delicious!
loot_chest=[achievement=golem] You find an hidden [color=orange]treasure[/color] beneath the enemy forces
abort=[color=blue][Mapkeeper][/color] Aborting map restart
restart=[color=blue][Mapkeeper][/color] Map is restarting in __1__ __plural_for_parameter_1_{1=second|rest=seconds}__
rocket_launched=[color=blue][Mapkeeper][/color] __1__ __plural_for_parameter_1_{1=rocket|rest=rockets}__ launched, __2__ __plural_for_parameter_2_{1=rocket|rest=rockets}__ to go!
restart=[color=blue][Mapkeeper][/color] Map is restarting in __1__ __plural_for_parameter__1__{1=second|rest=seconds}__
rocket_launched=[color=blue][Mapkeeper][/color] __1__ __plural_for_parameter__1__{1=rocket|rest=rockets}__ launched, __2__ __plural_for_parameter__2__{1=rocket|rest=rockets}__ to go!
rockets_to_launch=Remaining rockets to launch
shop_funds=Available team funds
shop_funds_alert=[color=blue][Mapkeeper][/color] __1__ has rerolled the Spawn shop offers! Remaining funds: [color=green]__2__[/color] x [img=item/coin]

View File

@ -112,7 +112,7 @@ item_sold_out=Loppuun myyty!
item_is_free=ILMAISEN!
generic_item_disabled_message=Kohde on poistettu käytöstä
not_enough_currency=Puuttuu __1__ __2__ ostamaan __3__
item_with_player_limit_description=Olet ostanut tämän kohteen __1__ __plural_for_parameter_2_{1=1 aikaväli rest=__2__ kertaa}__
item_with_player_limit_description=Olet ostanut tämän kohteen __1__ __plural_for_parameter__2__{1=1 aikaväli rest=__2__ kertaa}__
item_no_longer_available=Tämä tuote ei ole enää saatavilla markkinoilla
item_disabled_reason=__1__ on poistettu käytöstä. __2__
no_inventory_space=Riittämätön varaston tila

View File

@ -112,7 +112,7 @@ item_sold_out=UTSOLGT!
item_is_free=GRATIS!
generic_item_disabled_message=Elementet er deaktivert
not_enough_currency=Mangler __1__ __2__ for å kjøpe __3__
item_with_player_limit_description=Du har kjøpt denne tingen __1__ av __plural_for_parameter_2_{1=1 time|rest=__2__ times}__
item_with_player_limit_description=Du har kjøpt denne tingen __1__ av __plural_for_parameter__2__{1=1 time|rest=__2__ times}__
item_no_longer_available=Denne tingen er ikke lenger tilgjengelig i markedet
item_disabled_reason=__1__ er deaktivert. __2__
no_inventory_space=Ikke nok inventar plass

View File

@ -114,7 +114,7 @@ item_sold_out=ПРОДАНО!
item_is_free=БЕСПЛАТНО!
generic_item_disabled_message=Предмет отключен
not_enough_currency=Отсутствует __1__ __2__ для покупки __3__
item_with_player_limit_description=Вы купили этот элемент __1__ из __plural_for_parameter_2_{1=1 единожды|rest=__2__ раз}__
item_with_player_limit_description=Вы купили этот элемент __1__ из __plural_for_parameter__2__{1=1 единожды|rest=__2__ раз}__
item_no_longer_available=Этот предмет больше не доступен на рынке
item_disabled_reason=__1__ отключен. __2__
no_inventory_space=Недостаточно места в инвентаре

View File

@ -114,7 +114,7 @@ item_sold_out=售罄!
item_is_free=免费!
generic_item_disabled_message=物品已禁用
not_enough_currency=缺少 __1__ __2__ 来购买 __3__
item_with_player_limit_description=您已从__plural_for_parameter_2_中购买此项目__1__{1=1 time|rest=__2__ times}__
item_with_player_limit_description=您已从__plural_for_parameter__2__中购买此项目__1__{1=1 time|rest=__2__ times}__
item_no_longer_available=此物品在超市中不再可用
item_disabled_reason=__1__ 已禁用。 __2__
no_inventory_space=库存空间不足

View File

@ -93,9 +93,9 @@ local function run_terrain_module(x, y, world)
if
math.floor(terrain_D) % 5 == 1 and math.random(1, 70) == 1 and
surface.can_place_entity {name = 'rock-big', position = pos}
surface.can_place_entity {name = 'big-rock', position = pos}
then
surface.create_entity {name = 'rock-big', position = pos}
surface.create_entity {name = 'big-rock', position = pos}
end
else
if terrain_D >= 20 then

View File

@ -68,7 +68,7 @@ local function spawn_ores_on_death(event)
ore_type = found_ores[math.random(1,#found_ores)].name
end
if surface.get_tile(position).collides_with("ground-tile") then
if surface.get_tile(position).collides_with("ground_tile") then
surface.create_entity{name = ore_type, position = position, amount = ore_amount_to_add}
end
--return since we might have changed found_ores

View File

@ -70,7 +70,7 @@ local function drop_meteors()
local map_position = {x = chunk_position.x * 32 + rand_x, y = chunk_position.y * 32 + rand_y}
-- Spawn Rock
if surface.get_tile(map_position).collides_with('ground-tile') then
if surface.get_tile(map_position).collides_with('ground_tile') then
surface.create_entity({name = 'huge-rock', position = map_position, move_stuck_players = true,})
surface.create_entity({name = 'massive-explosion', position = map_position,})
end
@ -113,7 +113,7 @@ local function drop_meteors()
if b < a then
ore_amount = math.random(b * ORE_DENSITY - b * (ORE_DENSITY - 8), b * ORE_DENSITY + b * (ORE_DENSITY - 8))
end
if surface.get_tile(map_position.x + x, map_position.y + y).collides_with('ground-tile') then
if surface.get_tile(map_position.x + x, map_position.y + y).collides_with('ground_tile') then
if ores == 'mixed' then
ore_type = BASIC_ORES[math.random(1, #BASIC_ORES)]
end
@ -130,7 +130,7 @@ local function drop_meteors()
local biter_position = {
map_position.x + math.random(-METEOR_SIZE, METEOR_SIZE),
map_position.y + math.random(-METEOR_SIZE, METEOR_SIZE)}
if surface.get_tile(biter_position).collides_with('ground-tile') then
if surface.get_tile(biter_position).collides_with('ground_tile') then
surface.create_entity{
name = biters[unit_index],
position = biter_position,

View File

@ -64,7 +64,7 @@ local function on_built_miner(event)
if rand >= MAX_RAND*(1 - extra_percent) then
local rand_ore = table.get_random_weighted(ORES)
if (rand_ore ~= ore.name) and surface.get_tile(ore.position.x, ore.position.y).collides_with('ground-tile') then
if (rand_ore ~= ore.name) and surface.get_tile(ore.position.x, ore.position.y).collides_with('ground_tile') then
local amount = ore.amount
local ore_position = ore.position
ore.destroy()

View File

@ -184,7 +184,7 @@ local function create_collapse_template(positions, surface)
end
local function create_collapse_alert(surface, position)
local target = surface.create_entity({ position = position, name = 'rock-big' })
local target = surface.create_entity({ position = position, name = 'big-rock' })
for _, player in pairs(game.connected_players) do
player.add_custom_alert(target, collapse_alert, { 'diggy.cave_collapse' }, true)
end

View File

@ -5,6 +5,7 @@ local Restart = require 'features.restart_command'
local ShareGlobals = require 'map_gen.maps.april_fools.scenario.shared_globals'
local ScoreTracker = require 'utils.score_tracker'
local PlayerStats = require 'features.player_stats'
local RS = require 'map_gen.shared.redmew_surface'
local format_number = require 'util'.format_number
return function(config)
@ -143,7 +144,7 @@ return function(config)
local total_ore = 0
local ore_totals_message = '('
for ore_name in pairs(ore_products) do
local count = game.forces["player"].get_item_production_statistics.get_input_count(ore_name)
local count = game.forces["player"].get_item_production_statistics(RS.get_surface_name()).get_input_count(ore_name)
total_ore = total_ore + count
ore_totals_message = ore_totals_message..ore_name:gsub( "-ore", "")..": "..format_number(count, true)..", "
end

View File

@ -174,19 +174,19 @@ end
Template.diggy_rocks = {
'rock-huge-volcanic',
'rock-big-volcanic',
'big-rock-volcanic',
'rock-huge-black',
'rock-big-black',
'big-rock-black',
'rock-huge-grey',
'rock-big-grey',
'big-rock-grey',
'rock-huge-red',
'rock-big-red',
'big-rock-red',
'rock-huge-white',
'rock-big-white',
'big-rock-white',
'rock-huge-brown',
'rock-big-brown',
'big-rock-brown',
'rock-huge-dustyrose',
'rock-big-dustyrose',
'big-rock-dustyrose',
}
Template.diggy_rocks_map = util.list_to_map(Template.diggy_rocks)

View File

@ -971,7 +971,6 @@ Global.register_init(
local surface = game.surfaces[1]
surface.map_gen_settings = {width = 2, height = 2}
surface.clear()
game.forces.player.set_surface_hidden('nauvis', true)
game.forces.player.lock_space_location('nauvis')
local seed = RS.get_surface().map_gen_settings.seed

View File

@ -7,6 +7,7 @@ local MapPoll = require 'map_gen.maps.danger_ores.modules.map_poll'
local ShareGlobals = require 'map_gen.maps.danger_ores.modules.shared_globals'
local ScoreTracker = require 'utils.score_tracker'
local PlayerStats = require 'features.player_stats'
local RS = require 'map_gen.shared.redmew_surface'
local format_number = require 'util'.format_number
return function(config)
@ -145,7 +146,7 @@ return function(config)
local total_ore = 0
local ore_totals_message = '('
for ore_name in pairs(ore_products) do
local count = game.forces["player"].get_item_production_statistics.get_input_count(ore_name)
local count = game.forces["player"].get_item_production_statistics(RS.get_surface_name()).get_input_count(ore_name)
total_ore = total_ore + count
ore_totals_message = ore_totals_message..ore_name:gsub( "-ore", "")..": "..format_number(count, true)..", "
end

View File

@ -110,8 +110,6 @@ Event.on_init(function()
RS.get_surface().always_day = true
RS.get_surface().peaceful_mode = true
game.forces.player.set_surface_hidden('nauvis', true)
end)
require 'map_gen.maps.danger_ores.modules.robot_cargo_capacity'

View File

@ -216,7 +216,7 @@ return function(_, _, world) -- luacheck: ignore 561
end
if noise_trees < -0.5 and (tile_to_insert == 'sand-3' or tile_to_insert == 'sand-1') and random(15) == 1 then
insert(entities, {name = 'rock-big'})
insert(entities, {name = 'big-rock'})
end
local noise_water_1 = perlin.noise(((world.x + seed) / 200), ((world.y + seed) / 200), 0)

View File

@ -182,7 +182,7 @@ local function cutscene_function(player_index, waypoint_index, params)
local radius = 10
local entity
repeat
entity = RS.get_surface().find_entities_filtered {position = {0, 0}, radius = radius, name = 'rock-big', limit = 1}
entity = RS.get_surface().find_entities_filtered {position = {0, 0}, radius = radius, name = 'big-rock', limit = 1}
if radius <= 10 then
radius = 0
end

View File

@ -141,7 +141,7 @@ local function create_collapse_template(positions, surface)
end
local function create_collapse_alert(surface, position)
local target = surface.create_entity({position = position, name = 'rock-big'})
local target = surface.create_entity({position = position, name = 'big-rock'})
for _, player in pairs(game.connected_players) do
player.add_custom_alert(target, collapse_alert, {'diggy.cave_collapse'}, true)
end
@ -215,7 +215,7 @@ local function on_collapse_triggered(event)
local x_t = new_tile_map[x]
if x_t and x_t[y] then
template_insert(surface, {}, {{position = position, name = 'rock-big'}})
template_insert(surface, {}, {{position = position, name = 'big-rock'}})
return
end
spawn_collapse_text(surface, position)

View File

@ -76,7 +76,7 @@ local function update_robot_mining_damage()
robot_mining.damage = old_modifier + robot_mining.active_modifier
end
---Triggers a diggy diggy hole for a given big-rock, rock-big or huge-rock.
---Triggers a diggy diggy hole for a given big-rock, big-rock or huge-rock.
---@param entity LuaEntity
local function diggy_hole(entity)
local tiles = {}
@ -115,7 +115,7 @@ local function diggy_hole(entity)
if predicted < 0.2 then
rocks[i] = {name = 'huge-rock', position = void_position}
elseif predicted < 0.6 then
rocks[i] = {name = 'rock-big', position = void_position}
rocks[i] = {name = 'big-rock', position = void_position}
else
rocks[i] = {name = 'big-rock', position = void_position}
end

View File

@ -208,7 +208,7 @@ local function on_player_mined_entity(event)
local exp = 0
if name == 'big-rock' then
exp = sand_rock_xp + floor(level / 5)
elseif name == 'rock-big' then
elseif name == 'big-rock' then
exp = rock_big_xp + floor(level / 5)
elseif name == 'huge-rock' then
exp = rock_huge_xp + floor(level / 5)
@ -294,7 +294,7 @@ local function on_entity_died(event)
local level = get_force_data(force).current_level
if entity_name == 'big-rock' then
exp = floor((sand_rock_xp + level * 0.2) * 0.5)
elseif entity_name == 'rock-big' then
elseif entity_name == 'big-rock' then
exp = floor((rock_big_xp + level * 0.2) * 0.5)
elseif entity_name == 'huge-rock' then
exp = floor((rock_huge_xp + level * 0.2) * 0.5)
@ -613,7 +613,7 @@ function Experience.register(cfg)
-- Prevents table lookup thousands of times
sand_rock_xp = config.XP['big-rock']
rock_big_xp = config.XP['rock-big']
rock_big_xp = config.XP['big-rock']
rock_huge_xp = config.XP['huge-rock']
end

View File

@ -63,7 +63,7 @@ function StartingZone.register(config)
end
if (distance > rock_range) then
insert(rocks, {name = 'rock-big', position = {x = x, y = y}})
insert(rocks, {name = 'big-rock', position = {x = x, y = y}})
end
-- hack to avoid starting area from collapsing

View File

@ -93,7 +93,6 @@ local config = {
['nuclear-reactor'] = 4,
['stone-wall'] = 3,
['big-rock'] = 2,
['rock-big'] = 2,
['huge-rock'] = 2.5,
['out-of-map'] = 1,
['stone-path'] = 0.03,
@ -359,7 +358,6 @@ local config = {
mining_speed_productivity_multiplier = 5,
XP = {
['big-rock'] = 5,
['rock-big'] = 5,
['huge-rock'] = 10,
['rocket_launch'] = 0.05, -- XP reward in percentage of total experience when a rocket launches (Diggy default: 0.05 which equals 5%)
['rocket_launch_max'] = 500000, -- Max XP reward from rocket launches (Diggy default: 500000)

View File

@ -93,7 +93,6 @@ local config = {
['nuclear-reactor'] = 4,
['stone-wall'] = 3,
['big-rock'] = 2,
['rock-big'] = 2,
['huge-rock'] = 2.5,
['out-of-map'] = 1,
['stone-path'] = 0.03,
@ -359,7 +358,6 @@ local config = {
mining_speed_productivity_multiplier = 5,
XP = {
['big-rock'] = 5,
['rock-big'] = 5,
['huge-rock'] = 10,
['rocket_launch'] = 0.05, -- XP reward in percentage of total experience when a rocket launches (Diggy default: 0.05 which equals 5%)
['rocket_launch_max'] = 500000, -- Max XP reward from rocket launches (Diggy default: 500000)

View File

@ -93,7 +93,6 @@ local config = {
['nuclear-reactor'] = 4,
['stone-wall'] = 3,
['big-rock'] = 2,
['rock-big'] = 2,
['huge-rock'] = 2.5,
['out-of-map'] = 1,
['stone-path'] = 0.03,
@ -359,7 +358,6 @@ local config = {
mining_speed_productivity_multiplier = 5,
XP = {
['big-rock'] = 5,
['rock-big'] = 5,
['huge-rock'] = 10,
['rocket_launch'] = 0.05, -- XP reward in percentage of total experience when a rocket launches (Diggy default: 0.05 which equals 5%)
['rocket_launch_max'] = 500000, -- Max XP reward from rocket launches (Diggy default: 500000)

View File

@ -182,12 +182,12 @@ function Template.resources(surface, resources)
end
end
Template.diggy_rocks = {'big-rock', 'rock-big', 'huge-rock'}
Template.diggy_rocks = {'big-rock', 'big-rock', 'huge-rock'}
---Returns true if the entity name is that of a diggy rock.
---@param entity_name string
function Template.is_diggy_rock(entity_name)
return entity_name == 'big-rock' or entity_name == 'rock-big' or entity_name == 'huge-rock'
return entity_name == 'big-rock' or entity_name == 'big-rock' or entity_name == 'huge-rock'
end
return Template

View File

@ -54,7 +54,7 @@ Enemy.commands = {
}
unit_group.start_moving()
if Public.get()._DEBUG_AI then
Debug.print_admins(string.format('AI [id=%d] | cmd: MOVE [gps=%.2f,%.2f,%s]', unit_group.id, position.x, position.y, unit_group.surface.name), Color.dark_gray)
Debug.print_admins(string.format('AI [id=%d] | cmd: MOVE [gps=%.2f,%.2f,%s]', unit_group.unique_id, position.x, position.y, unit_group.surface.name), Color.dark_gray)
end
end,
scout = function(unit_group, position)
@ -73,7 +73,7 @@ Enemy.commands = {
}
unit_group.start_moving()
if Public.get()._DEBUG_AI then
Debug.print_admins(string.format('AI [id=%d] | cmd: SCOUT [gps=%.2f,%.2f,%s]', unit_group.id, position.x, position.y, unit_group.surface.name), Color.dark_gray)
Debug.print_admins(string.format('AI [id=%d] | cmd: SCOUT [gps=%.2f,%.2f,%s]', unit_group.unique_id, position.x, position.y, unit_group.surface.name), Color.dark_gray)
end
end,
attack = function(unit_group, target)
@ -92,7 +92,7 @@ Enemy.commands = {
distraction = defines.distraction.by_damage
}
if Public.get()._DEBUG_AI then
Debug.print_admins(string.format('AI [id=%d] | cmd: ATTACK [gps=%.2f,%.2f,%s] (type = %s)', unit_group.id, target.position.x, target.position.y, unit_group.surface.name, target.type), Color.dark_gray)
Debug.print_admins(string.format('AI [id=%d] | cmd: ATTACK [gps=%.2f,%.2f,%s] (type = %s)', unit_group.unique_id, target.position.x, target.position.y, unit_group.surface.name, target.type), Color.dark_gray)
end
end
}
@ -132,12 +132,12 @@ Enemy.turret_raffle = {
function Enemy.ai_take_control(unit_group)
local this = Public.get()
if not this.unit_groups[unit_group.id] then
this.unit_groups[unit_group.id] = {
if not this.unit_groups[unit_group.unique_id] then
this.unit_groups[unit_group.unique_id] = {
unit_group = unit_group
}
end
return this.unit_groups[unit_group.id]
return this.unit_groups[unit_group.unique_id]
end
function Enemy.ai_stage_by_distance(posA, posB)
@ -159,13 +159,13 @@ function Enemy.ai_processor(unit_group, result)
end
local this = Public.get()
local data = this.unit_groups[unit_group.id]
local data = this.unit_groups[unit_group.unique_id]
if not data then
return
end
if data.failed_attempts and data.failed_attempts >= 3 then
this.unit_groups[unit_group.id] = nil
this.unit_groups[unit_group.unique_id] = nil
return
end
@ -185,7 +185,7 @@ function Enemy.ai_processor(unit_group, result)
force = 'enemy',
}
if not (data.target and data.target.valid) then
this.unit_groups[unit_group.id] = nil
this.unit_groups[unit_group.unique_id] = nil
return
end
data.position = data.target.position
@ -195,7 +195,7 @@ function Enemy.ai_processor(unit_group, result)
end
if this._DEBUG_AI then
Debug.print_admins(string.format('AI [id=%d] | status: %d', unit_group.id, data.stage), Color.dark_gray)
Debug.print_admins(string.format('AI [id=%d] | status: %d', unit_group.unique_id, data.stage), Color.dark_gray)
end
if data.stage == Enemy.stages.move then
@ -207,7 +207,7 @@ function Enemy.ai_processor(unit_group, result)
else
data.failed_attempts = (data.failed_attempts or 0) + 1
if this._DEBUG_AI then
Debug.print_admins(string.format('AI [id=%d] | FAIL | stage: %d | attempts: %d', unit_group.id, data.stage, data.failed_attempts), Color.dark_gray)
Debug.print_admins(string.format('AI [id=%d] | FAIL | stage: %d | attempts: %d', unit_group.unique_id, data.stage, data.failed_attempts), Color.dark_gray)
end
data.stage, data.position, data.target = nil, nil, nil
Enemy.ai_processor(unit_group, nil)
@ -292,9 +292,10 @@ function Enemy.on_enemy_died(entity)
this.invincible[uid] = nil
if new_entity.type == 'unit' then
if entity.unit_group then
entity.unit_group.add_member(new_entity)
entity.unit_group.set_command(entity.command)
local commandable = entity.commandable
if commandable and commandable.is_unit_group then
commandable.add_member(new_entity)
commandable.set_command(entity.command)
end
end
end
@ -439,7 +440,8 @@ function Enemy.stop_tracking(entity)
end
function Enemy.get_target()
return Table.get_random_dictionary_entry(Public.get().target_entities, false)
local _dict = Public.get().target_entities
return Table.get_random_dictionary_entry(_dict, false)
end
function Enemy.nuclear_explosion(position)

View File

@ -3,7 +3,7 @@ local Public = require 'map_gen.maps.frontier.shared.core'
local Lobby = {}
Lobby.name = 'nauvis'
Lobby.name = 'lobby'
Lobby.mgs = {
water = 0,
default_enable_all_autoplace_controls = false,
@ -83,6 +83,9 @@ function Lobby.on_init()
local surface = Lobby.get_surface()
surface.map_gen_settings = Lobby.mgs
Lobby.on_chunk_generated({ area = {left_top = { x = -Lobby.mgs.width, y = -Lobby.mgs.height }, right_bottom = { x = Lobby.mgs.width, y = Lobby.mgs.height }}, surface = surface })
for _, f in pairs(game.forces) do
f.set_surface_hidden(surface.name, true)
end
end
return Lobby

View File

@ -120,8 +120,11 @@ function Market.spawn_exchange_market(position)
rendering.draw_sprite {
sprite = 'utility/entity_info_dark_background',
surface = surface,
target = market,
target_offset = icon_offset,
target = {
entity = market,
offset = icon_offset,
position = market.position,
},
x_scale = icon_scale * 2,
y_scale = icon_scale * 2,
only_in_alt_mode = true
@ -129,8 +132,11 @@ function Market.spawn_exchange_market(position)
rendering.draw_sprite {
sprite = 'item/' .. most_expensive_item.name,
surface = surface,
target = market,
target_offset = icon_offset,
target = {
entity = market,
offset = icon_offset,
position = market.position,
},
x_scale = icon_scale,
y_scale = icon_scale,
only_in_alt_mode = true

View File

@ -553,7 +553,7 @@ function Restart.print_endgame_statistics()
local total_ore = 0
local ore_totals_message = '('
for ore_name in pairs(ore_products) do
local count = game.forces.player.get_item_production_statistics.get_input_count(ore_name)
local count = game.forces.player.get_item_production_statistics(Public.surface().name).get_input_count(ore_name)
total_ore = total_ore + count
ore_totals_message = ore_totals_message..ore_name:gsub( '-ore', '')..': '..format_number(count, true)..', '
end

View File

@ -68,8 +68,11 @@ function SpawnShop.add_render()
sprite = script.active_mods['redmew-data'] and 'neon-lightning' or 'achievement/lazy-bastard',
x_scale = 0.8,
y_scale = 0.8,
target = e,
target_offset = { 0.8, -4.5 },
target = {
entity = e,
offset = { 0.8, -4.5 },
position = e.position,
},
surface = e.surface,
}
game.forces.player.add_chart_tag(e.surface, {
@ -210,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') }
}
@ -394,7 +397,9 @@ end
function SpawnShop.on_player_refresh(player)
local this = Public.get()
this.spawn_shop_funds = this.spawn_shop_funds - 1
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
@ -480,7 +485,7 @@ function SpawnShop.upgrade_perk(id, levels)
elseif id == 'p_crafting_speed' then
players.manual_crafting_speed_modifier = players.manual_crafting_speed_modifier + 0.02 * levels
elseif id == 'p_health_bonus' then
local HP = prototypes.entity.character.max_health
local HP = prototypes.entity.character.get_max_health()
players.character_health_bonus = players.character_health_bonus + math_ceil(0.02 * HP) * levels
elseif id == 'p_inventory_size' then
players.character_inventory_slots_bonus = players.character_inventory_slots_bonus + 5 * levels

View File

@ -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
@ -243,7 +243,7 @@ function Terrain.rich_rocks(surface, area)
end
for _ = 1, this.rock_richness do
local rock_name = math_random() < 0.4 and 'huge-rock' or 'rock-big'
local rock_name = math_random() < 0.4 and 'huge-rock' or 'big-rock'
place_rock(rock_name)
end
end
@ -444,24 +444,24 @@ function Terrain.clear_area(args)
y = position.y + cb.right_bottom.y,
}
}
for _, e in pairs(surface.find_entities_filtered{ area = area, collision_mask = {'player-layer', 'object-layer'}}) do
for _, e in pairs(surface.find_entities_filtered{ area = area, collision_mask = {'player', 'object'}}) do
e.destroy()
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
surface.set_tiles(tiles, true)
return true
elseif args.radius then
for _, e in pairs(surface.find_entities_filtered{ position = position, radius = args.radius, collision_mask = {'player-layer', 'object-layer'}}) do
for _, e in pairs(surface.find_entities_filtered{ position = position, radius = args.radius, collision_mask = {'player', 'object'}}) do
e.destroy()
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
@ -479,12 +479,12 @@ function Terrain.clear_area(args)
y = position.y + size,
}
}
for _, e in pairs(surface.find_entities_filtered{ area = area, collision_mask = {'player-layer', 'object-layer'}}) do
for _, e in pairs(surface.find_entities_filtered{ area = area, collision_mask = {'player', 'object'}}) do
e.destroy()
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

View File

@ -67,7 +67,7 @@ ScenarioInfo.set_new_info([[
--- Config
local Config = storage.config
Config.redmew_surface.enabled = true
Config.redmew_surface.enabled = false
Config.market.enabled = false
Config.player_rewards.enabled = false
Config.player_shortcuts.enabled = true
@ -260,7 +260,7 @@ local function on_player_changed_position(event)
end
local this = Public.get()
if player.position.x < (-this.left_boundary * 32 - this.kraken_distance) then
if player.physical_position.x < (-this.left_boundary * 32 - this.kraken_distance) then
local player_name = 'a player'
if player.character ~= nil then
player_name = player.name

View File

@ -91,7 +91,7 @@ local function sprinkle(_, _, world)
}
end
local rock_names = {'rock-big', 'huge-rock', 'big-rock'}
local rock_names = {'big-rock', 'huge-rock', 'big-rock'}
local function rocks_func()
local rock = rock_names[math.random(#rock_names)]
return {name = rock}

View File

@ -27,7 +27,7 @@ local oil =
b.resource(b.throttle_world_xy(ore_shape, 1, 8, 1, 8), 'crude-oil', value(150000, 5, 1.05), true)
)
local tree = b.apply_entity(b.full_shape, b.entity(ore_shape, 'tree-01'))
local rock = b.apply_entity(b.full_shape, b.entity(ore_shape, 'rock-big'))
local rock = b.apply_entity(b.full_shape, b.entity(ore_shape, 'big-rock'))
local walk_spiral1 = b.circular_spiral_n_threads(3, 512, 8)
walk_spiral1 = b.flip_x(walk_spiral1)

View File

@ -154,12 +154,12 @@ local function map(x, y, world)
if tile_to_insert == 'sand-1' or tile_to_insert == 'sand-3' then
if random(1, 200) == 1 then
entities[#entities + 1] = {name = 'rock-big'}
entities[#entities + 1] = {name = 'big-rock'}
end
end
if tile_to_insert == 'grass-1' or tile_to_insert == 'grass-2' or tile_to_insert == 'grass-3' then
if random(1, 2000) == 1 then
entities[#entities + 1] = {name = 'rock-big'}
entities[#entities + 1] = {name = 'big-rock'}
end
end

View File

@ -127,7 +127,7 @@ start_circle = b.translate(start_circle, 0, -32)
map = b.any{start_circle, map}
map = b.change_map_gen_collision_tile(map, "water-tile", "grass-1")
map = b.change_map_gen_collision_tile(map, "water_tile", "grass-1")
map = b.rotate(map, degrees(90))
map = b.scale(map, 3, 3)

View File

@ -353,7 +353,7 @@ local function quadrants(x, y)
end
if (abs_x <= 200 and abs_y <= 200) then
if game.surfaces[2].get_tile(x, y).collides_with('water-tile') then
if game.surfaces[2].get_tile(x, y).collides_with('water_tile') then
game.surfaces[2].set_tiles({{name = 'grass-1', position = {x, y}}}, true)
end
local entities = game.surfaces[2].find_entities({{x - 0.5, y - 0.5}, {x + 0.5, y + 0.5}})

View File

@ -6,7 +6,7 @@ local spawn_position = {x = 20, y = 20}
local function is_not_water_tile(_, _, world)
local gen_tile = world.surface.get_tile(world.x, world.y)
return not gen_tile.collides_with('water-tile')
return not gen_tile.collides_with('water_tile')
end
local station_length = 40

View File

@ -148,7 +148,7 @@ local function on_built_pumpjack(event)
if entity.name == 'pumpjack' then
for x = center_x - size, center_x + size do
for y = center_y - size, center_y + size do
if entity.surface.get_tile(x, y).collides_with("ground-tile") then
if entity.surface.get_tile(x, y).collides_with("ground_tile") then
entity.surface.create_entity({name="stone", amount=density, position={x, y}})
end
end

View File

@ -1904,40 +1904,40 @@ function Builders.set_hidden_tile(shape, hidden_tile)
end
local collision_map = {
['concrete'] = 'ground-tile',
['deepwater-green'] = 'water-tile',
['deepwater'] = 'water-tile',
['dirt-1'] = 'ground-tile',
['dirt-2'] = 'ground-tile',
['dirt-3'] = 'ground-tile',
['dirt-4'] = 'ground-tile',
['dirt-5'] = 'ground-tile',
['dirt-6'] = 'ground-tile',
['dirt-7'] = 'ground-tile',
['dry-dirt'] = 'ground-tile',
['grass-1'] = 'ground-tile',
['grass-2'] = 'ground-tile',
['grass-3'] = 'ground-tile',
['grass-4'] = 'ground-tile',
['hazard-concrete-left'] = 'ground-tile',
['hazard-concrete-right'] = 'ground-tile',
['lab-dark-1'] = 'ground-tile',
['lab-dark-2'] = 'ground-tile',
['lab-white'] = 'ground-tile',
['concrete'] = 'ground_tile',
['deepwater-green'] = 'water_tile',
['deepwater'] = 'water_tile',
['dirt-1'] = 'ground_tile',
['dirt-2'] = 'ground_tile',
['dirt-3'] = 'ground_tile',
['dirt-4'] = 'ground_tile',
['dirt-5'] = 'ground_tile',
['dirt-6'] = 'ground_tile',
['dirt-7'] = 'ground_tile',
['dry-dirt'] = 'ground_tile',
['grass-1'] = 'ground_tile',
['grass-2'] = 'ground_tile',
['grass-3'] = 'ground_tile',
['grass-4'] = 'ground_tile',
['hazard-concrete-left'] = 'ground_tile',
['hazard-concrete-right'] = 'ground_tile',
['lab-dark-1'] = 'ground_tile',
['lab-dark-2'] = 'ground_tile',
['lab-white'] = 'ground_tile',
['out-of-map'] = false,
['red-desert-0'] = 'ground-tile',
['red-desert-1'] = 'ground-tile',
['red-desert-2'] = 'ground-tile',
['red-desert-3'] = 'ground-tile',
['sand-1'] = 'ground-tile',
['sand-2'] = 'ground-tile',
['sand-3'] = 'ground-tile',
['stone-path'] = 'ground-tile',
['water-green'] = 'water-tile',
['water'] = 'water-tile',
['refined-concrete'] = 'ground-tile',
['refined-hazard-concrete-left'] = 'ground-tile',
['refined-hazard-concrete-right'] = 'ground-tile'
['red-desert-0'] = 'ground_tile',
['red-desert-1'] = 'ground_tile',
['red-desert-2'] = 'ground_tile',
['red-desert-3'] = 'ground_tile',
['sand-1'] = 'ground_tile',
['sand-2'] = 'ground_tile',
['sand-3'] = 'ground_tile',
['stone-path'] = 'ground_tile',
['water-green'] = 'water_tile',
['water'] = 'water_tile',
['refined-concrete'] = 'ground_tile',
['refined-hazard-concrete-left'] = 'ground_tile',
['refined-hazard-concrete-right'] = 'ground_tile'
}
--- Docs: https://github.com/Refactorio/RedMew/wiki/Using-the-Builders#builderschange_collision_tile
@ -2096,7 +2096,7 @@ function Builders.overlay_tile_land(shape, tile_shape)
return function(x, y, world)
local function handle_tile(tile)
if type(tile) == 'boolean' then
return tile and not world.surface.get_tile(world.x, world.y).collides_with('water-tile')
return tile and not world.surface.get_tile(world.x, world.y).collides_with('water_tile')
else
return not bad_tiles[tile]
end
@ -2136,7 +2136,7 @@ function Builders.fish(shape, spawn_rate)
return {name = 'fish'}
end
elseif tile then
if world.surface.get_tile(world.x, world.y).collides_with('water-tile') and spawn_rate >= random() then
if world.surface.get_tile(world.x, world.y).collides_with('water_tile') and spawn_rate >= random() then
return {name = 'fish'}
end
end

View File

@ -187,6 +187,10 @@ local function create_redmew_surface()
surface = game.create_surface(redmew_surface_name)
end
for _, force in pairs(game.forces) do
force.set_surface_hidden(vanilla_surface_name, true)
end
global_data.surface = surface
if config.difficulty then

View File

@ -139,7 +139,11 @@ end
-- @param key <boolean> to indicate whether to return the key or value
-- @return <any> a random element of table t
function table.get_random_dictionary_entry(t, key)
local target_index = random(1, table_size(t))
local t_size = table_size(t)
if t_size == 0 then
return
end
local target_index = random(1, t_size)
local count = 1
for k, v in pairs(t) do
if target_index == count then