1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-03-25 21:29:06 +02:00

Fix luacheck

This commit is contained in:
Gerkiz 2024-10-25 22:32:25 +02:00
parent 93cdb0fb54
commit a96ab444f2
26 changed files with 715 additions and 584 deletions

View File

@ -34,7 +34,7 @@
--[Set Defaults]--
-------------------------------------------------------------------------------
local LINE_LENGTH = false -- It is 2017 limits on length are a waste
local IGNORE = { '21./%w+_$', '21./^_%w+$', '213/[ijk]', '213/index', '213/key' }
local IGNORE = { '21./%w+_$', '21./^_%w+$', '213/[ijk]', '213/index', '213/key', '58[1-2]' }
local NOT_GLOBALS = { 'coroutine', 'io', 'socket', 'dofile', 'loadfile' } -- These globals are not available to the factorio API
local STD_CONTROL = 'lua52c+factorio+factorio_control+stdlib+factorio_defines'
@ -81,7 +81,8 @@ exclude_files = {
--Ignore development mods
'**/combat-tester/',
'**/test-maker/',
'**/trailer/'
'**/trailer/',
'**/.vscode/'
}
-------------------------------------------------------------------------------
@ -238,13 +239,14 @@ stds.factorio_control = {
'on_event',
'on_init',
'on_load',
'register_on_entity_destroyed',
'register_on_object_destroyed',
'on_configuration_changed',
'raise_event',
'get_event_handler',
'mod_name',
'get_event_order',
'generate_event_name',
'register_on_entity_destroyed',
'active_mods'
},
other_fields = false
@ -268,6 +270,7 @@ stds.factorio_control = {
other_fields = false,
read_only = true,
fields = {
'get_all_objects',
'set_visible',
'draw_line',
'draw_text',
@ -316,6 +319,7 @@ stds.factorio_control = {
'set_alignment',
'get_scale_with_zoom',
'set_scale_with_zoom',
'get_object_by_id',
'get_filled',
'set_filled',
'get_radius',
@ -454,26 +458,74 @@ stds.factorio_control = {
},
prototypes = {
other_fields = false,
read_only = false,
read_only = true,
fields = {
style = { read_only = true, other_fields = true },
entity = { read_only = true, other_fields = true },
item = { read_only = true, other_fields = true },
fluid = { read_only = true, other_fields = true },
tile = { read_only = true, other_fields = true },
equipment = { read_only = true, other_fields = true },
damage = { read_only = true, other_fields = true },
virtual_signal = { read_only = true, other_fields = true },
equipment_grid = { read_only = true, other_fields = true },
recipe = { read_only = true, other_fields = true },
technology = { read_only = true, other_fields = true },
decorative = { read_only = true, other_fields = true },
particle = { read_only = true, other_fields = true },
"get_achievement_filtered",
"get_decorative_filtered",
"get_entity_filtered",
"get_equipment_filtered",
"get_fluid_filtered",
"get_history",
"get_item_filtered",
"get_mod_setting_filtered",
"get_recipe_filtered",
"get_technology_filtered",
"get_tile_filtered",
achievement = { read_only = true, other_fields = true },
active_trigger = { read_only = true, other_fields = true },
airborne_pollutant = { read_only = true, other_fields = true },
ammo_category = { read_only = true, other_fields = true },
asteroid_chunk = { read_only = true, other_fields = true },
autoplace_control = { read_only = true, other_fields = true },
quality = { read_only = true, other_fields = true },
burner_usage = { read_only = true, other_fields = true },
collision_layer = { read_only = true, other_fields = true },
custom_event = { read_only = true, other_fields = true },
custom_input = { read_only = true, other_fields = true },
damage = { read_only = true, other_fields = true },
decorative = { read_only = true, other_fields = true },
entity = { read_only = true, other_fields = true },
recipe = { read_only = true, other_fields = true },
equipment = { read_only = true, other_fields = true },
equipment_category = { read_only = true, other_fields = true },
equipment_grid = { read_only = true, other_fields = true },
fluid = { read_only = true, other_fields = true },
font = { read_only = true, other_fields = true },
fuel_category = { read_only = true, other_fields = true },
item = { read_only = true, other_fields = true },
item_group = { read_only = true, other_fields = true },
item_subgroup = { read_only = true, other_fields = true },
map_gen_preset = { read_only = true, other_fields = true },
mod_setting = { read_only = true, other_fields = true },
module_category = { read_only = true, other_fields = true },
named_noise_expression = { read_only = true, other_fields = true },
named_noise_function = { read_only = true, other_fields = true },
particle = { read_only = true, other_fields = true },
procession = { read_only = true, other_fields = true },
procession_layer_inheritance_group = { read_only = true, other_fields = true },
quality = { read_only = true, other_fields = true },
recipe_category = { read_only = true, other_fields = true },
resource_category = { read_only = true, other_fields = true },
shortcut = { read_only = true, other_fields = true },
space_connection = { read_only = true, other_fields = true },
space_location = { read_only = false, other_fields = true },
style = { read_only = true, other_fields = true },
surface = { read_only = true, other_fields = true },
surface_property = { read_only = true, other_fields = true },
technology = { read_only = true, other_fields = true },
tile = { read_only = true, other_fields = true },
trivial_smoke = { read_only = true, other_fields = true },
virtual_signal = { read_only = true, other_fields = true },
"max_beacon_supply_area_distance",
"max_electric_pole_connection_distance",
"max_electric_pole_supply_area_distance",
"max_force_distraction_chunk_distance",
"max_force_distraction_distance",
"max_gate_activation_distance",
"max_inserter_reach_distance",
"max_pipe_to_ground_distance",
"max_underground_belt_distance",
}
}
},
},
globals = {
-- @global@: The global dictionary, useful for storing data persistent across a save-load cycle.
@ -514,7 +566,77 @@ stds.factorio_data = {
},
mods = {
other_fields = true
}
},
prototypes = {
other_fields = false,
read_only = true,
fields = {
"get_achievement_filtered",
"get_decorative_filtered",
"get_entity_filtered",
"get_equipment_filtered",
"get_fluid_filtered",
"get_history",
"get_item_filtered",
"get_mod_setting_filtered",
"get_recipe_filtered",
"get_technology_filtered",
"get_tile_filtered",
achievement = { read_only = true, other_fields = true },
active_trigger = { read_only = true, other_fields = true },
airborne_pollutant = { read_only = true, other_fields = true },
ammo_category = { read_only = true, other_fields = true },
asteroid_chunk = { read_only = true, other_fields = true },
autoplace_control = { read_only = true, other_fields = true },
burner_usage = { read_only = true, other_fields = true },
collision_layer = { read_only = true, other_fields = true },
custom_event = { read_only = true, other_fields = true },
custom_input = { read_only = true, other_fields = true },
damage = { read_only = true, other_fields = true },
decorative = { read_only = true, other_fields = true },
entity = { read_only = true, other_fields = true },
recipe = { read_only = true, other_fields = true },
equipment = { read_only = true, other_fields = true },
equipment_category = { read_only = true, other_fields = true },
equipment_grid = { read_only = true, other_fields = true },
fluid = { read_only = true, other_fields = true },
font = { read_only = true, other_fields = true },
fuel_category = { read_only = true, other_fields = true },
item = { read_only = true, other_fields = true },
item_group = { read_only = true, other_fields = true },
item_subgroup = { read_only = true, other_fields = true },
map_gen_preset = { read_only = true, other_fields = true },
mod_setting = { read_only = true, other_fields = true },
module_category = { read_only = true, other_fields = true },
named_noise_expression = { read_only = true, other_fields = true },
named_noise_function = { read_only = true, other_fields = true },
particle = { read_only = true, other_fields = true },
procession = { read_only = true, other_fields = true },
procession_layer_inheritance_group = { read_only = true, other_fields = true },
quality = { read_only = true, other_fields = true },
recipe_category = { read_only = true, other_fields = true },
resource_category = { read_only = true, other_fields = true },
shortcut = { read_only = true, other_fields = true },
space_connection = { read_only = true, other_fields = true },
space_location = { read_only = true, other_fields = true },
style = { read_only = true, other_fields = true },
surface = { read_only = true, other_fields = true },
surface_property = { read_only = true, other_fields = true },
technology = { read_only = true, other_fields = true },
tile = { read_only = true, other_fields = true },
trivial_smoke = { read_only = true, other_fields = true },
virtual_signal = { read_only = true, other_fields = true },
"max_beacon_supply_area_distance",
"max_electric_pole_connection_distance",
"max_electric_pole_supply_area_distance",
"max_force_distraction_chunk_distance",
"max_force_distraction_distance",
"max_gate_activation_distance",
"max_inserter_reach_distance",
"max_pipe_to_ground_distance",
"max_underground_belt_distance",
}
},
}
} --))
@ -1048,6 +1170,8 @@ stds.stdlib = {
'mean',
'binary_search',
'shuffle_table',
'spairs',
'shuffle_by_distance',
'map',
'avg',
'count_keys',
@ -1126,7 +1250,6 @@ stds.stdlib = {
'asin',
'max',
'clamp',
'round',
'modf',
'midrange_mean',
'pow',
@ -1192,6 +1315,7 @@ stds.stdlib = {
'inline_if',
'install',
'GAME',
'PROTOTYPES',
'AREA',
'POSITION',
'TILE',
@ -1246,6 +1370,7 @@ stds.factorio_defines = {
}
},
anticolor = { other_fields = true },
build_mode = { fields = { 'forced', 'normal', 'superforced' } },
behavior_result = { fields = { 'success', 'in_progress', 'deleted', 'fail' } },
build_check_type = { fields = { 'script', 'manual', 'ghost_revive', 'ghost_place' } },
chain_signal_state = { fields = { 'partially_open', 'none_open', 'none', 'all_open' } },
@ -1363,6 +1488,30 @@ stds.factorio_defines = {
direction = {
fields = { 'southwest', 'north', 'northeast', 'west', 'east', 'northwest', 'south', 'southeast' }
},
entity_status_diode = {
fields = { 'green', 'red', 'yellow' }
},
wire_origin = {
fields = {
'player',
'radars',
'script',
}
},
wire_connector_id = {
fields = {
'circuit_green',
'circuit_red',
'combinator_input_green',
'combinator_input_red',
'combinator_output_green',
'combinator_output_red',
'pole_copper',
'power_switch_left_copper',
'power_switch_right_copper',
}
},
disconnect_reason = {
fields = {
'desync_limit_reached',
@ -1424,6 +1573,7 @@ stds.factorio_defines = {
events = {
fields = {
'on_picked_up_item',
'on_object_destroyed',
'on_entity_cloned',
'on_player_main_inventory_changed',
'on_entity_damaged',
@ -1648,6 +1798,8 @@ stds.factorio_defines = {
'clear_selected_deconstruction_item',
'set_single_blueprint_record_icon',
'set_logistic_trash_filter_item',
'toggle_artillery_auto_targeting',
'set_rocket_silo_send_to_orbit_automated_mode',
'drop_to_blueprint_book',
'open_tutorials_gui',
'upgrade_opened_blueprint',
@ -1862,6 +2014,52 @@ stds.factorio_defines = {
inventory = {
fields = {
'car_ammo',
'cargo_unit',
'artillery_turret_ammo',
'artillery_wagon_ammo',
'assembling_machine_input',
'assembling_machine_modules',
'assembling_machine_output',
'beacon_modules',
'burnt_result',
'car_ammo',
'car_trunk',
'cargo_wagon',
'character_ammo',
'character_armor',
'character_corpse',
'character_guns',
'character_main',
'character_trash',
'character_vehicle',
'chest',
'editor_ammo',
'editor_armor',
'editor_guns',
'editor_main',
'fuel',
'furnace_modules',
'furnace_result',
'furnace_source',
'god_main',
'item_main',
'lab_input',
'lab_modules',
'mining_drill_modules',
'roboport_material',
'roboport_robot',
'robot_cargo',
'robot_repair',
'rocket',
'rocket_silo_input',
'rocket_silo_modules',
'rocket_silo_output',
'rocket_silo_result',
'rocket_silo_rocket',
'spider_ammo',
'spider_trash',
'spider_trunk',
'turret_ammo',
'furnace_result',
'furnace_source',
'character_ammo',

View File

@ -433,7 +433,7 @@ local function create_attack_group(surface, force_name, biter_force_name)
send_group(unit_group, force_name, side_target)
storage.unit_groups[unit_groupunique_id] = unit_group
storage.unit_groups[unit_group.unique_id] = unit_group
end
Public.pre_main_attack = function ()

View File

@ -10,7 +10,7 @@ local Server = require 'utils.server'
local math_random = math.random
local math_max = math.max
function Public.get_map_gen_settings(planet_name)
function Public.get_map_gen_settings(_)
local seed = math_random(1, 1000000)
local map_gen_settings = prototypes.space_location['nauvis'].map_gen_settings
-- if planet_name then
@ -30,7 +30,7 @@ function Public.get_map_gen_settings(planet_name)
map_gen_settings.width = 960
map_gen_settings.height = 960
map_gen_settings.starting_area = 1
map_gen_settings.cliff_settings = {name = 'cliff', cliff_elevation_interval = 0, cliff_elevation_0 = 0, cliff_smoothing = 0.5, richness = 0}
map_gen_settings.cliff_settings = { name = 'cliff', cliff_elevation_interval = 0, cliff_elevation_0 = 0, cliff_smoothing = 0.5, richness = 0 }
map_gen_settings.default_enable_all_autoplace_controls = false
return map_gen_settings
end
@ -118,7 +118,7 @@ function Public.restart_settings()
production.experience[key] = 0
end
for _, player in pairs(game.connected_players) do
playertable.flame_boots[player.index] = {fuel = 1, steps = {}}
playertable.flame_boots[player.index] = { fuel = 1, steps = {} }
end
storage.friendly_fire_history = {}
storage.landfill_history = {}
@ -172,22 +172,22 @@ end
function Public.set_difficulty_settings()
local objective = Chrono_table.get_table()
local difficulty_tooltips = {
[1] = {'chronosphere.difficulty1'},
[2] = {'chronosphere.difficulty2'},
[3] = {'chronosphere.difficulty3'},
[4] = {'chronosphere.difficulty4'},
[5] = {'chronosphere.difficulty5'},
[6] = {'chronosphere.difficulty6'},
[7] = {'chronosphere.difficulty7'}
[1] = { 'chronosphere.difficulty1' },
[2] = { 'chronosphere.difficulty2' },
[3] = { 'chronosphere.difficulty3' },
[4] = { 'chronosphere.difficulty4' },
[5] = { 'chronosphere.difficulty5' },
[6] = { 'chronosphere.difficulty6' },
[7] = { 'chronosphere.difficulty7' }
}
local difficulty_names = {
[1] = {name = {'chronosphere.difficulty1name'}, value = 0.25, color = {r = 0.00, g = 0.45, b = 0.00}, print_color = {r = 0.00, g = 0.8, b = 0.00}, enabled = true},
[2] = {name = {'chronosphere.difficulty2name'}, value = 0.50, color = {r = 0.00, g = 0.35, b = 0.00}, print_color = {r = 0.00, g = 0.6, b = 0.00}, enabled = true},
[3] = {name = {'chronosphere.difficulty3name'}, value = 0.75, color = {r = 0.00, g = 0.25, b = 0.00}, print_color = {r = 0.00, g = 0.4, b = 0.00}, enabled = true},
[4] = {name = {'chronosphere.difficulty4name'}, value = 1.00, color = {r = 0.00, g = 0.00, b = 0.25}, print_color = {r = 0.00, g = 0.0, b = 0.50}, enabled = true},
[5] = {name = {'chronosphere.difficulty5name'}, value = 1.50, color = {r = 0.25, g = 0.00, b = 0.00}, print_color = {r = 0.40, g = 0.0, b = 0.00}, enabled = true},
[6] = {name = {'chronosphere.difficulty6name'}, value = 3.00, color = {r = 0.35, g = 0.00, b = 0.00}, print_color = {r = 0.60, g = 0.0, b = 0.00}, enabled = true},
[7] = {name = {'chronosphere.difficulty7name'}, value = 5.00, color = {r = 0.45, g = 0.00, b = 0.00}, print_color = {r = 0.80, g = 0.0, b = 0.00}, enabled = true}
[1] = { name = { 'chronosphere.difficulty1name' }, value = 0.25, color = { r = 0.00, g = 0.45, b = 0.00 }, print_color = { r = 0.00, g = 0.8, b = 0.00 }, enabled = true },
[2] = { name = { 'chronosphere.difficulty2name' }, value = 0.50, color = { r = 0.00, g = 0.35, b = 0.00 }, print_color = { r = 0.00, g = 0.6, b = 0.00 }, enabled = true },
[3] = { name = { 'chronosphere.difficulty3name' }, value = 0.75, color = { r = 0.00, g = 0.25, b = 0.00 }, print_color = { r = 0.00, g = 0.4, b = 0.00 }, enabled = true },
[4] = { name = { 'chronosphere.difficulty4name' }, value = 1.00, color = { r = 0.00, g = 0.00, b = 0.25 }, print_color = { r = 0.00, g = 0.0, b = 0.50 }, enabled = true },
[5] = { name = { 'chronosphere.difficulty5name' }, value = 1.50, color = { r = 0.25, g = 0.00, b = 0.00 }, print_color = { r = 0.40, g = 0.0, b = 0.00 }, enabled = true },
[6] = { name = { 'chronosphere.difficulty6name' }, value = 3.00, color = { r = 0.35, g = 0.00, b = 0.00 }, print_color = { r = 0.60, g = 0.0, b = 0.00 }, enabled = true },
[7] = { name = { 'chronosphere.difficulty7name' }, value = 5.00, color = { r = 0.45, g = 0.00, b = 0.00 }, print_color = { r = 0.80, g = 0.0, b = 0.00 }, enabled = true }
}
if objective.config.lock_difficulties then
difficulty_names[1].enabled = false
@ -208,10 +208,10 @@ function Public.objective_died()
end
objective.health = 0
local surface = objective.surface
game.print({'chronosphere.message_game_lost1'})
game.print({'chronosphere.message_game_lost2'})
game.print({ 'chronosphere.message_game_lost1' })
game.print({ 'chronosphere.message_game_lost2' })
for i = 1, 3, 1 do
surface.create_entity({name = 'big-artillery-explosion', position = objective.locomotive_cargo[i].position})
surface.create_entity({ name = 'big-artillery-explosion', position = objective.locomotive_cargo[i].position })
objective.locomotive_cargo[i].destroy()
objective.locomotive_cargo[i] = nil
end
@ -228,7 +228,7 @@ function Public.objective_died()
objective.accumulators = {}
objective.game_lost = true
objective.game_reset_tick = game.tick + 1800
game.play_sound {path = 'utility/game_lost', volume_modifier = 0.75}
game.play_sound { path = 'utility/game_lost', volume_modifier = 0.75 }
end
local function check_nuke_silos()
@ -258,28 +258,28 @@ function Public.process_jump()
objective.giftmas_delivered = 0
objective.jump_countdown_start_time = -1
objective.dangertimer = 1200
game.print({'chronosphere.message_jump', objective.chronojumps}, {r = 0.98, g = 0.66, b = 0.22})
Server.to_discord_embed({'chronosphere.message_jump', objective.chronojumps}, true)
game.print({ 'chronosphere.message_jump', objective.chronojumps }, { r = 0.98, g = 0.66, b = 0.22 })
Server.to_discord_embed({ 'chronosphere.message_jump', objective.chronojumps }, true)
if objective.chronojumps == Balance.jumps_until_overstay_is_on(Difficulty.get().difficulty_vote_value) then
game.print({'chronosphere.message_evolve'}, {r = 0.98, g = 0.36, b = 0.22})
game.print({ 'chronosphere.message_evolve' }, { r = 0.98, g = 0.36, b = 0.22 })
elseif objective.chronojumps == 7 then
game.print({'chronosphere.message_quest_research'}, {r = 0.98, g = 0.36, b = 0.22})
game.print({ 'chronosphere.message_quest_research' }, { r = 0.98, g = 0.36, b = 0.22 })
elseif objective.chronojumps >= 15 and objective.computermessage == 0 then
game.print({'chronosphere.message_quest1'}, {r = 0.98, g = 0.36, b = 0.22})
game.print({ 'chronosphere.message_quest1' }, { r = 0.98, g = 0.36, b = 0.22 })
objective.computermessage = 1
game.play_sound {path = 'utility/new_objective', volume_modifier = 0.85}
game.play_sound { path = 'utility/new_objective', volume_modifier = 0.85 }
elseif objective.chronojumps >= 20 and objective.computermessage == 2 then
game.print({'chronosphere.message_quest3'}, {r = 0.98, g = 0.36, b = 0.22})
game.print({ 'chronosphere.message_quest3' }, { r = 0.98, g = 0.36, b = 0.22 })
objective.computermessage = 3
game.play_sound {path = 'utility/new_objective', volume_modifier = 0.85}
game.play_sound { path = 'utility/new_objective', volume_modifier = 0.85 }
elseif objective.chronojumps >= 25 and objective.computermessage == 4 then
game.print({'chronosphere.message_quest5'}, {r = 0.98, g = 0.36, b = 0.22})
game.print({ 'chronosphere.message_quest5' }, { r = 0.98, g = 0.36, b = 0.22 })
objective.computermessage = 5
game.play_sound {path = 'utility/new_objective', volume_modifier = 0.85}
game.play_sound { path = 'utility/new_objective', volume_modifier = 0.85 }
end
if (objective.passivetimer - 180) * objective.passive_chronocharge_rate > objective.chronochargesneeded * 0.75 and objective.chronojumps >= Balance.jumps_until_overstay_is_on(Difficulty.get().difficulty_vote_value) then
game.print({'chronosphere.message_overstay'}, {r = 0.98, g = 0.36, b = 0.22})
game.print({ 'chronosphere.message_overstay' }, { r = 0.98, g = 0.36, b = 0.22 })
end
if objective.world.id == 2 and objective.world.variant.id == 2 then
check_nuke_silos()
@ -289,11 +289,11 @@ end
function Public.get_wagons(start)
local objective = Chrono_table.get_table()
local wagons = {}
wagons[1] = {inventory = {}, bar = 0, filters = {}}
wagons[2] = {inventory = {}, bar = 0, filters = {}}
wagons[3] = {inventory = {}, bar = 0, filters = {}}
wagons[1] = { inventory = {}, bar = 0, filters = {} }
wagons[2] = { inventory = {}, bar = 0, filters = {} }
wagons[3] = { inventory = {}, bar = 0, filters = {} }
if start then
wagons[1].inventory[1] = {name = 'raw-fish', count = 100}
wagons[1].inventory[1] = { name = 'raw-fish', count = 100 }
for i = 21, 37, 1 do
wagons[1].filters[i] = 'atomic-bomb'
end
@ -343,10 +343,10 @@ function Public.post_jump()
game.forces.enemy.set_evolution_factor(1, surface)
end
if objective.world.id == 7 then
objective.locomotive_cargo[1].insert({name = 'space-science-pack', count = 1000})
objective.locomotive_cargo[1].insert({ name = 'space-science-pack', count = 1000 })
if objective.looted_nukes > 0 then
objective.locomotive_cargo[1].insert({name = 'atomic-bomb', count = objective.looted_nukes})
game.print({'chronosphere.message_fishmarket3'}, {r = 0.98, g = 0.66, b = 0.22})
objective.locomotive_cargo[1].insert({ name = 'atomic-bomb', count = objective.looted_nukes })
game.print({ 'chronosphere.message_fishmarket3' }, { r = 0.98, g = 0.66, b = 0.22 })
end
objective.chronochargesneeded = 200000000
elseif objective.world.id == 2 and objective.world.variant.id == 2 then
@ -363,7 +363,7 @@ function Public.post_jump()
objective.gen_speed = 2
end
for _, player in pairs(game.connected_players) do
playertable.flame_boots[player.index] = {fuel = 1, steps = {}}
playertable.flame_boots[player.index] = { fuel = 1, steps = {} }
end
game.map_settings.enemy_evolution.time_factor = 7e-05 + 3e-06 * (objective.chronojumps + objective.overstaycount)
@ -388,15 +388,15 @@ end
function Public.message_on_arrival()
local objective = Chrono_table.get_table()
local world = objective.world
game.print({'chronosphere.map_jump', world.variant.name, world.ores.name, world.dayspeed.name}, {r = 0.98, g = 0.66, b = 0.22})
Server.to_discord_embed({'chronosphere.map_jump', world.variant.name, world.ores.name, world.dayspeed.name}, true)
game.print({ 'chronosphere.map_jump', world.variant.name, world.ores.name, world.dayspeed.name }, { r = 0.98, g = 0.66, b = 0.22 })
Server.to_discord_embed({ 'chronosphere.map_jump', world.variant.name, world.ores.name, world.dayspeed.name }, true)
if world.id == 4 then
game.print({'chronosphere.message_choppy'}, {r = 0.98, g = 0.66, b = 0.22})
game.print({ 'chronosphere.message_choppy' }, { r = 0.98, g = 0.66, b = 0.22 })
elseif world.id == 1 and world.variant.id == 11 then
game.print({'chronosphere.message_lava'}, {r = 0.98, g = 0.66, b = 0.22})
game.print({ 'chronosphere.message_lava' }, { r = 0.98, g = 0.66, b = 0.22 })
elseif world.id == 7 then
game.print({'chronosphere.message_fishmarket1'}, {r = 0.98, g = 0.66, b = 0.22})
game.print({'chronosphere.message_fishmarket2'}, {r = 0.98, g = 0.66, b = 0.22})
game.print({ 'chronosphere.message_fishmarket1' }, { r = 0.98, g = 0.66, b = 0.22 })
game.print({ 'chronosphere.message_fishmarket2' }, { r = 0.98, g = 0.66, b = 0.22 })
end
end
@ -406,12 +406,12 @@ local function create_chunk_list(surface)
local chunks = {}
for x = -464, 464, 32 do
for y = -464, 464, 32 do
chunks[#chunks + 1] = {pos = {x, y}, generated = surface.is_chunk_generated({x, y}), distance = math.sqrt(x * x + y * y)}
chunks[#chunks + 1] = { pos = { x, y }, generated = surface.is_chunk_generated({ x, y }), distance = math.sqrt(x * x + y * y) }
end
end
for k, v in table.spairs(
chunks,
function(t, a, b)
function (t, a, b)
return t[b].distance > t[a].distance
end
) do
@ -429,7 +429,7 @@ function Public.setup_world(surface)
else
surface.min_brightness = 0
end
surface.brightness_visual_weights = {1, 1, 1}
surface.brightness_visual_weights = { 1, 1, 1 }
objective.surface = surface
surface.daytime = world.daytime
local timer = world.dayspeed.timer
@ -461,7 +461,7 @@ function Public.setup_world(surface)
local mgs = surface.map_gen_settings
mgs.width = 2176
surface.map_gen_settings = mgs
surface.request_to_generate_chunks({-960, -64}, 0.5)
surface.request_to_generate_chunks({ -960, -64 }, 0.5)
surface.force_generate_chunk_requests()
else
create_chunk_list(surface)

View File

@ -34,13 +34,13 @@ end
local function reward_ores(amount, mined_loot, surface, player, entity)
local a = 0
if player then
a = player.insert {name = mined_loot, count = amount}
a = player.insert { name = mined_loot, count = amount }
end
amount = amount - a
if amount > 0 then
if amount >= 50 then
for i = 1, math_floor(amount / 50), 1 do
local e = surface.create_entity {name = 'item-on-ground', position = entity.position, stack = {name = mined_loot, count = 50}}
local e = surface.create_entity { name = 'item-on-ground', position = entity.position, stack = { name = mined_loot, count = 50 } }
if e and e.valid then
e.to_be_looted = true
end
@ -49,9 +49,9 @@ local function reward_ores(amount, mined_loot, surface, player, entity)
end
if amount > 0 then
if amount < 5 then
surface.spill_item_stack(entity.position, {name = mined_loot, count = amount}, true)
surface.spill_item_stack(entity.position, { name = mined_loot, count = amount }, true)
else
local e = surface.create_entity {name = 'item-on-ground', position = entity.position, stack = {name = mined_loot, count = amount}}
local e = surface.create_entity { name = 'item-on-ground', position = entity.position, stack = { name = mined_loot, count = amount } }
if e and e.valid then
e.to_be_looted = true
end
@ -78,7 +78,7 @@ function Public.isprotected(entity)
return true
end
local objective = Chrono_table.get_table()
local protected = {objective.locomotive, objective.locomotive_cargo[1], objective.locomotive_cargo[2], objective.locomotive_cargo[3]}
local protected = { objective.locomotive, objective.locomotive_cargo[1], objective.locomotive_cargo[2], objective.locomotive_cargo[3] }
for i = 1, #protected do
if protected[i] == entity then
return true
@ -95,7 +95,7 @@ end
function Public.trap(entity, trap)
if trap then
tick_tack_trap(entity.surface, entity.position)
tick_tack_trap(entity.surface, {x = entity.position.x + math_random(-2, 2), y = entity.position.y + math_random(-2, 2)})
tick_tack_trap(entity.surface, { x = entity.position.x + math_random(-2, 2), y = entity.position.y + math_random(-2, 2) })
return
end
if math_random(1, 256) == 1 then
@ -123,7 +123,7 @@ function Public.lava_planet(event)
if surface.name == 'cargo_wagon' then
return
end
local safe = {'stone-path', 'concrete', 'hazard-concrete-left', 'hazard-concrete-right', 'refined-concrete', 'refined-hazard-concrete-left', 'refined-hazard-concrete-right'}
local safe = { 'stone-path', 'concrete', 'hazard-concrete-left', 'hazard-concrete-right', 'refined-concrete', 'refined-hazard-concrete-left', 'refined-hazard-concrete-right' }
local pavement = surface.get_tile(player.position.x, player.position.y)
for i = 1, 7, 1 do
if pavement.name == safe[i] then
@ -137,10 +137,10 @@ function Public.lava_planet(event)
local elements = #steps
steps[elements + 1] = {x = player.position.x, y = player.position.y}
steps[elements + 1] = { x = player.position.x, y = player.position.y }
if elements > 10 then
surface.create_entity({name = 'fire-flame', position = steps[elements - 1]})
surface.create_entity({ name = 'fire-flame', position = steps[elements - 1] })
for i = 1, elements, 1 do
steps[i] = steps[i + 1]
end
@ -152,7 +152,7 @@ function Public.shred_simple_entities(entity)
if game.forces.enemy.get_evolution_factor(entity.surface) < 0.25 then
return
end
local simple_entities = entity.surface.find_entities_filtered({type = {'simple-entity', 'tree'}, area = {{entity.position.x - 3, entity.position.y - 3}, {entity.position.x + 3, entity.position.y + 3}}})
local simple_entities = entity.surface.find_entities_filtered({ type = { 'simple-entity', 'tree' }, area = { { entity.position.x - 3, entity.position.y - 3 }, { entity.position.x + 3, entity.position.y + 3 } } })
for _, simple_entity in pairs(simple_entities) do
if simple_entity.valid then
simple_entity.destroy()
@ -165,7 +165,7 @@ function Public.spawner_loot(surface, position)
local objective = Chrono_table.get_table()
local count = math_random(1, 1 + objective.chronojumps)
objective.research_tokens.weapons = objective.research_tokens.weapons + count
FT.flying_text(nil, surface, position, {'chronosphere.token_weapons_add', count}, {r = 0.8, g = 0.8, b = 0.8})
FT.flying_text(nil, surface, position, { 'chronosphere.token_weapons_add', count }, { r = 0.8, g = 0.8, b = 0.8 })
script.raise_event(Chrono_table.events['update_upgrades_gui'], {})
end
end
@ -189,10 +189,10 @@ end
function Public.choppy_loot(event)
local entity = event.entity
local choppy_entity_yield = {
['tree-01'] = {'iron-ore'},
['tree-02-red'] = {'copper-ore'},
['tree-04'] = {'coal'},
['tree-08-brown'] = {'stone'}
['tree-01'] = { 'iron-ore' },
['tree-02-red'] = { 'copper-ore' },
['tree-04'] = { 'coal' },
['tree-08-brown'] = { 'stone' }
}
if choppy_entity_yield[entity.name] then
if event.buffer then
@ -207,7 +207,7 @@ function Public.choppy_loot(event)
local main_item = choppy_entity_yield[entity.name][math_random(1, #choppy_entity_yield[entity.name])]
local text = '+' .. amount .. ' [item=' .. main_item .. '] +' .. second_item_amount .. ' [item=' .. second_item .. ']'
local player = game.get_player(event.player_index)
FT.flying_text(player, entity.surface, entity.position, text, {r = 0.8, g = 0.8, b = 0.8})
FT.flying_text(player, entity.surface, entity.position, text, { r = 0.8, g = 0.8, b = 0.8 })
reward_ores(amount, main_item, entity.surface, player, player)
reward_ores(second_item_amount, second_item, entity.surface, player, player)
end
@ -217,10 +217,10 @@ function Public.rocky_loot(event)
local player = game.get_player(event.player_index)
if not player or not player.valid then return end
local amount = math_ceil(get_ore_amount(false))
local rock_mining = {'iron-ore', 'iron-ore', 'iron-ore', 'iron-ore', 'copper-ore', 'copper-ore', 'copper-ore', 'stone', 'stone', 'coal', 'coal'}
local rock_mining = { 'iron-ore', 'iron-ore', 'iron-ore', 'iron-ore', 'copper-ore', 'copper-ore', 'copper-ore', 'stone', 'stone', 'coal', 'coal' }
local mined_loot = rock_mining[math_random(1, #rock_mining)]
local text = '+' .. amount .. ' [item=' .. mined_loot .. ']'
FT.flying_text(player, player.surface, player.position, text, {r = 0.98, g = 0.66, b = 0.22})
FT.flying_text(player, player.surface, player.position, text, { r = 0.98, g = 0.66, b = 0.22 })
reward_ores(amount, mined_loot, player.surface, player, player)
reward_ores(math_random(1, 3), 'raw-fish', player.surface, player, player)
end
@ -235,12 +235,12 @@ function Public.scrap_loot(event)
local player = game.get_player(event.player_index)
if not player or not player.valid then return end
local text = '+' .. amount .. ' [item=' .. scrap.name .. '] + ' .. amount2 .. ' [item=' .. scrap2.name .. ']'
FT.flying_text(player, player.surface, player.position, text, {r = 0.98, g = 0.66, b = 0.22})
FT.flying_text(player, player.surface, player.position, text, { r = 0.98, g = 0.66, b = 0.22 })
reward_ores(amount, scrap.name, player.surface, player, player)
reward_ores(amount2, scrap2.name, player.surface, player, player)
if math_random(1, 50) == 1 then
objective.research_tokens.tech = objective.research_tokens.tech + 1
FT.flying_text(player, player.surface, {x = player.position.x, y = player.position.y - 0.5}, {'chronosphere.token_tech_add', 1}, {r = 0.8, g = 0.8, b = 0.8})
FT.flying_text(player, player.surface, { x = player.position.x, y = player.position.y - 0.5 }, { 'chronosphere.token_tech_add', 1 }, { r = 0.8, g = 0.8, b = 0.8 })
end
end
@ -272,11 +272,11 @@ function Public.swamp_loot(event)
amount = 50
end
local rock_mining = {'iron-ore', 'iron-ore', 'coal'}
local rock_mining = { 'iron-ore', 'iron-ore', 'coal' }
local mined_loot = rock_mining[math_random(1, #rock_mining)]
reward_ores(amount, mined_loot, surface, nil, event.entity)
local text = '+' .. amount .. ' [img=item/' .. mined_loot .. ']'
FT.flying_text(nil, surface, event.entity.position, text, {r = 0.7, g = 0.8, b = 0.4})
FT.flying_text(nil, surface, event.entity.position, text, { r = 0.7, g = 0.8, b = 0.4 })
end
function Public.biter_loot(event)
@ -292,7 +292,7 @@ function Public.danger_silo(entity)
if objective.dangers and #objective.dangers >= 1 then
for i = 1, #objective.dangers, 1 do
if entity == objective.dangers[i].silo then
game.print({'chronosphere.message_silo', Balance.nukes_looted_per_silo(Difficulty.get().difficulty_vote_value)}, {r = 0.98, g = 0.66, b = 0.22})
game.print({ 'chronosphere.message_silo', Balance.nukes_looted_per_silo(Difficulty.get().difficulty_vote_value) }, { r = 0.98, g = 0.66, b = 0.22 })
objective.dangers[i].destroyed = true
objective.dangers[i].silo = nil
objective.dangers[i].speaker.destroy()
@ -325,8 +325,8 @@ function Public.biter_immunities(event)
end
end
end
-- else -- other planets
-- event.entity.health = math_floor(event.entity.health + event.final_damage_amount - (event.final_damage_amount / (1 + 0.02 * Difficulty.get().difficulty_vote_value * objective.chronojumps)))
-- else -- other planets
-- event.entity.health = math_floor(event.entity.health + event.final_damage_amount - (event.final_damage_amount / (1 + 0.02 * Difficulty.get().difficulty_vote_value * objective.chronojumps)))
end
elseif event.damage_type.name == 'poison' then
if id == 8 then --swamp planet
@ -344,13 +344,13 @@ function Public.flamer_nerfs()
local difficulty = Difficulty.get().difficulty_vote_value
local flame_researches = {
[1] = {name = 'refined-flammables-1', bonus = 0.2},
[2] = {name = 'refined-flammables-2', bonus = 0.2},
[3] = {name = 'refined-flammables-3', bonus = 0.2},
[4] = {name = 'refined-flammables-4', bonus = 0.3},
[5] = {name = 'refined-flammables-5', bonus = 0.3},
[6] = {name = 'refined-flammables-6', bonus = 0.4},
[7] = {name = 'refined-flammables-7', bonus = 0.2}
[1] = { name = 'refined-flammables-1', bonus = 0.2 },
[2] = { name = 'refined-flammables-2', bonus = 0.2 },
[3] = { name = 'refined-flammables-3', bonus = 0.2 },
[4] = { name = 'refined-flammables-4', bonus = 0.3 },
[5] = { name = 'refined-flammables-5', bonus = 0.3 },
[6] = { name = 'refined-flammables-6', bonus = 0.4 },
[7] = { name = 'refined-flammables-7', bonus = 0.2 }
}
local flamer_power = 0
@ -367,10 +367,10 @@ end
local mining_researches = {
-- these already give .1 productivity so we're only adding .1 to get to 20%
['mining-productivity-1'] = {bonus_productivity = .1, bonus_mining_speed = .2, bonus_inventory = 10},
['mining-productivity-2'] = {bonus_productivity = .1, bonus_mining_speed = .2, bonus_inventory = 10},
['mining-productivity-3'] = {bonus_productivity = .1, bonus_mining_speed = .2, bonus_inventory = 10},
['mining-productivity-4'] = {bonus_productivity = .1, bonus_mining_speed = .2, bonus_inventory = 10, infinite = true, infinite_level = 4}
['mining-productivity-1'] = { bonus_productivity = .1, bonus_mining_speed = .2, bonus_inventory = 10 },
['mining-productivity-2'] = { bonus_productivity = .1, bonus_mining_speed = .2, bonus_inventory = 10 },
['mining-productivity-3'] = { bonus_productivity = .1, bonus_mining_speed = .2, bonus_inventory = 10 },
['mining-productivity-4'] = { bonus_productivity = .1, bonus_mining_speed = .2, bonus_inventory = 10, infinite = true, infinite_level = 4 }
}
function Public.mining_buffs(event)
@ -419,11 +419,11 @@ function Public.on_technology_effects_reset(event)
local fake_event = {}
Public.mining_buffs(nil)
for name, bonuses in pairs(mining_researches) do
technology = force.technologies[name]
local technology = force.technologies[name]
if technology.researched == true or bonuses.infinite == true then
fake_event.research = technology
if bonuses.infinite and bonuses.infinite_level and technology.level > bonuses.infinite_level then
for i = bonuses.infinite_level, technology.level - 1 do
for _ = bonuses.infinite_level, technology.level - 1 do
Public.mining_buffs(fake_event)
end
else
@ -444,7 +444,7 @@ end
function Public.initiate_jump_countdown()
local objective = Chrono_table.get_table()
objective.jump_countdown_start_time = objective.passivetimer
game.print({'chronosphere.message_jump180'}, {r = 0.98, g = 0.66, b = 0.22})
game.print({ 'chronosphere.message_jump180' }, { r = 0.98, g = 0.66, b = 0.22 })
end
function Public.render_train_hp()
@ -452,34 +452,34 @@ function Public.render_train_hp()
local surface = game.surfaces[objective.active_surface_index]
objective.health_text =
rendering.draw_text {
text = {'chronosphere.train_HP', objective.health, objective.max_health},
surface = surface,
target = {
entity = objective.locomotive,
offset = {0, -2.5},
position = objective.locomotive.position
},
color = objective.locomotive.color,
scale = 1.40,
font = 'default-game',
alignment = 'center',
scale_with_zoom = false
}
text = { 'chronosphere.train_HP', objective.health, objective.max_health },
surface = surface,
target = {
entity = objective.locomotive,
offset = { 0, -2.5 },
position = objective.locomotive.position
},
color = objective.locomotive.color,
scale = 1.40,
font = 'default-game',
alignment = 'center',
scale_with_zoom = false
}
objective.caption =
rendering.draw_text {
text = {'chronosphere.train_name'},
surface = surface,
target = {
entity = objective.locomotive,
offset = {0, -4.25},
position = objective.locomotive.position
},
color = objective.locomotive.color,
scale = 1.80,
font = 'default-game',
alignment = 'center',
scale_with_zoom = false
}
text = { 'chronosphere.train_name' },
surface = surface,
target = {
entity = objective.locomotive,
offset = { 0, -4.25 },
position = objective.locomotive.position
},
color = objective.locomotive.color,
scale = 1.80,
font = 'default-game',
alignment = 'center',
scale_with_zoom = false
}
end
function Public.set_objective_health(final_damage_amount)
@ -498,14 +498,14 @@ function Public.set_objective_health(final_damage_amount)
if objective.health < objective.max_health / 2 and final_damage_amount > 0 then
Upgrades.trigger_poison()
end
objective.health_text.text = {'chronosphere.train_HP', objective.health, objective.max_health}
objective.health_text.text = { 'chronosphere.train_HP', objective.health, objective.max_health }
end
function Public.nuclear_artillery(entity, cause)
local objective = Chrono_table.get_table()
if objective.upgrades[23] ~= 1 then return end
if objective.upgrades[24] > 0 and objective.last_artillery_event ~= game.tick then
entity.surface.create_entity({name = 'atomic-rocket', position = entity.position, force = 'player', speed = 1, max_range = 100, target = entity, source = cause})
entity.surface.create_entity({ name = 'atomic-rocket', position = entity.position, force = 'player', speed = 1, max_range = 100, target = entity, source = cause })
objective.upgrades[24] = objective.upgrades[24] - 1
objective.last_artillery_event = game.tick
end

View File

@ -10,11 +10,11 @@ local math_abs = math.abs
local math_ceil = math.ceil
Public.tokens = {
['biters'] = {name = 'token_biters', sprite = 'virtual-signal/signal-B', tooltip = {'chronosphere.token_info_biters'}, enabled = false},
['ammo'] = {name = 'token_ammo', sprite = 'virtual-signal/signal-A', tooltip = {'chronosphere.token_info_ammo'}, enabled = true},
['tech'] = {name = 'token_tech', sprite = 'virtual-signal/signal-T', tooltip = {'chronosphere.token_info_tech'}, enabled = false},
['ecology'] = {name = 'token_ecology', sprite = 'virtual-signal/signal-E', tooltip = {'chronosphere.token_info_ecology'}, enabled = false},
['weapons'] = {name = 'token_weapons', sprite = 'virtual-signal/signal-W', tooltip = {'chronosphere.token_info_weapons'}, enabled = false}
['biters'] = { name = 'token_biters', sprite = 'virtual-signal/signal-B', tooltip = { 'chronosphere.token_info_biters' }, enabled = false },
['ammo'] = { name = 'token_ammo', sprite = 'virtual-signal/signal-A', tooltip = { 'chronosphere.token_info_ammo' }, enabled = true },
['tech'] = { name = 'token_tech', sprite = 'virtual-signal/signal-T', tooltip = { 'chronosphere.token_info_tech' }, enabled = false },
['ecology'] = { name = 'token_ecology', sprite = 'virtual-signal/signal-E', tooltip = { 'chronosphere.token_info_ecology' }, enabled = false },
['weapons'] = { name = 'token_weapons', sprite = 'virtual-signal/signal-W', tooltip = { 'chronosphere.token_info_weapons' }, enabled = false }
}
function Public.add_ammo_tokens(player)
@ -23,7 +23,7 @@ function Public.add_ammo_tokens(player)
if not inventory or not inventory.valid then
return
end
local count = inventory.remove({name = 'pistol', count = 5})
local count = inventory.remove({ name = 'pistol', count = 5 })
objective.research_tokens.ammo = objective.research_tokens.ammo + count
script.raise_event(Chrono_table.events['update_upgrades_gui'], {})
end
@ -42,13 +42,13 @@ end
function Public.upgrade1(coin_scaling)
local objective = Chrono_table.get_table()
local upgrade = {
name = {'chronosphere.upgrade_train_armor'},
name = { 'chronosphere.upgrade_train_armor' },
sprite = 'recipe/locomotive',
max_level = 36,
type = 'train',
enabled = true,
message = {'chronosphere.upgrade_train_armor_message'},
tooltip = {'chronosphere.upgrade_train_armor_tooltip', 36, objective.max_health},
message = { 'chronosphere.upgrade_train_armor_message' },
tooltip = { 'chronosphere.upgrade_train_armor_tooltip', 36, objective.max_health },
jump_limit = objective.upgrades[1],
cost = {
item1 = {
@ -57,7 +57,7 @@ function Public.upgrade1(coin_scaling)
sprite = 'item/coin',
count = 500 * coin_scaling * (1 + 2 * objective.upgrades[1])
},
item2 = {name = 'copper-plate', tt = 'item-name', sprite = 'item/copper-plate', count = 1500}
item2 = { name = 'copper-plate', tt = 'item-name', sprite = 'item/copper-plate', count = 1500 }
},
virtual_cost = {
virtual1 = {
@ -76,22 +76,22 @@ function Public.upgrade2(coin_scaling)
local objective = Chrono_table.get_table()
local difficulty = Difficulty.get().difficulty_vote_value
local upgrade = {
name = {'chronosphere.upgrade_filter'},
name = { 'chronosphere.upgrade_filter' },
sprite = 'recipe/efficiency-module',
max_level = 9,
type = 'train',
enabled = true,
message = {'chronosphere.upgrade_filter_message'},
message = { 'chronosphere.upgrade_filter_message' },
tooltip = {
'chronosphere.upgrade_filter_tooltip',
math_floor(100 * Balance.machine_pollution_transfer_from_inside_factor(difficulty, objective.upgrades[2]))
},
jump_limit = (1 + objective.upgrades[2]) * 3 or 0,
cost = {
item1 = {name = 'coin', tt = 'item-name', sprite = 'item/coin', count = 5000 * coin_scaling},
item2 = {name = 'electronic-circuit', tt = 'item-name', sprite = 'item/electronic-circuit', count = math_min(1 + objective.upgrades[2], 3) * 500 + 500},
item3 = {name = 'advanced-circuit', tt = 'item-name', sprite = 'item/advanced-circuit', count = math_max(math_min(1 + objective.upgrades[2], 6) - 3, 0) * 500},
item4 = {name = 'processing-unit', tt = 'item-name', sprite = 'item/processing-unit', count = math_max(math_min(1 + objective.upgrades[2], 9) - 6, 0) * 500}
item1 = { name = 'coin', tt = 'item-name', sprite = 'item/coin', count = 5000 * coin_scaling },
item2 = { name = 'electronic-circuit', tt = 'item-name', sprite = 'item/electronic-circuit', count = math_min(1 + objective.upgrades[2], 3) * 500 + 500 },
item3 = { name = 'advanced-circuit', tt = 'item-name', sprite = 'item/advanced-circuit', count = math_max(math_min(1 + objective.upgrades[2], 6) - 3, 0) * 500 },
item4 = { name = 'processing-unit', tt = 'item-name', sprite = 'item/processing-unit', count = math_max(math_min(1 + objective.upgrades[2], 9) - 6, 0) * 500 }
},
virtual_cost = {
virtual1 = {
@ -109,13 +109,13 @@ end
function Public.upgrade3(coin_scaling)
local objective = Chrono_table.get_table()
local upgrade = {
name = {'chronosphere.upgrade_accumulators'},
name = { 'chronosphere.upgrade_accumulators' },
sprite = 'recipe/accumulator',
max_level = 24,
type = 'train',
enabled = true,
message = {'chronosphere.upgrade_accumulators_message'},
tooltip = {'chronosphere.upgrade_accumulators_tooltip'},
message = { 'chronosphere.upgrade_accumulators_message' },
tooltip = { 'chronosphere.upgrade_accumulators_tooltip' },
jump_limit = objective.upgrades[3],
cost = {
item1 = {
@ -124,10 +124,10 @@ function Public.upgrade3(coin_scaling)
sprite = 'item/coin',
count = 3000 * coin_scaling * (1 + objective.upgrades[3] / 4)
},
item2 = {name = 'battery', tt = 'item-name', sprite = 'item/battery', count = 100 * (1 + objective.upgrades[3])}
item2 = { name = 'battery', tt = 'item-name', sprite = 'item/battery', count = 100 * (1 + objective.upgrades[3]) }
},
virtual_cost = {
virtual1 = {type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 6 * (1 + objective.upgrades[3] / 2)}
virtual1 = { type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 6 * (1 + objective.upgrades[3] / 2) }
}
}
return upgrade
@ -136,13 +136,13 @@ end
function Public.upgrade4(coin_scaling)
local objective = Chrono_table.get_table()
local upgrade = {
name = {'chronosphere.upgrade_loot_pickup'},
name = { 'chronosphere.upgrade_loot_pickup' },
sprite = 'recipe/long-handed-inserter',
max_level = 4,
type = 'player',
enabled = true,
message = {'chronosphere.upgrade_loot_pickup_message'},
tooltip = {'chronosphere.upgrade_loot_pickup_tooltip', objective.upgrades[4]},
message = { 'chronosphere.upgrade_loot_pickup_message' },
tooltip = { 'chronosphere.upgrade_loot_pickup_tooltip', objective.upgrades[4] },
jump_limit = 0,
cost = {
item1 = {
@ -151,10 +151,10 @@ function Public.upgrade4(coin_scaling)
sprite = 'item/coin',
count = 1000 * coin_scaling * (1 + objective.upgrades[4])
},
item2 = {name = 'long-handed-inserter', tt = 'entity-name', sprite = 'recipe/long-handed-inserter', count = 400}
item2 = { name = 'long-handed-inserter', tt = 'entity-name', sprite = 'recipe/long-handed-inserter', count = 400 }
},
virtual_cost = {
virtual1 = {type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 10 * (1 + objective.upgrades[4])}
virtual1 = { type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 10 * (1 + objective.upgrades[4]) }
}
}
return upgrade
@ -163,13 +163,13 @@ end
function Public.upgrade5(coin_scaling)
local objective = Chrono_table.get_table()
local upgrade = {
name = {'chronosphere.upgrade_inventory_size'},
name = { 'chronosphere.upgrade_inventory_size' },
sprite = 'entity/character',
max_level = 4,
type = 'player',
enabled = true,
message = {'chronosphere.upgrade_inventory_size_message'},
tooltip = {'chronosphere.upgrade_inventory_size_tooltip'},
message = { 'chronosphere.upgrade_inventory_size_message' },
tooltip = { 'chronosphere.upgrade_inventory_size_tooltip' },
jump_limit = (1 + objective.upgrades[5]) * 5,
cost = {
item1 = {
@ -178,9 +178,9 @@ function Public.upgrade5(coin_scaling)
sprite = 'item/coin',
count = 2500 * coin_scaling * (1 + objective.upgrades[5])
},
item2 = {name = 'wooden-chest', tt = 'entity-name', sprite = 'item/wooden-chest', count = math_max(0, 250 - math_abs(objective.upgrades[5]) * 250)},
item3 = {name = 'iron-chest', tt = 'entity-name', sprite = 'item/iron-chest', count = math_max(0, 250 - math_abs(objective.upgrades[5] - 1) * 250)},
item4 = {name = 'steel-chest', tt = 'entity-name', sprite = 'item/steel-chest', count = math_max(0, 250 - math_abs(objective.upgrades[5] - 2) * 250)},
item2 = { name = 'wooden-chest', tt = 'entity-name', sprite = 'item/wooden-chest', count = math_max(0, 250 - math_abs(objective.upgrades[5]) * 250) },
item3 = { name = 'iron-chest', tt = 'entity-name', sprite = 'item/iron-chest', count = math_max(0, 250 - math_abs(objective.upgrades[5] - 1) * 250) },
item4 = { name = 'steel-chest', tt = 'entity-name', sprite = 'item/steel-chest', count = math_max(0, 250 - math_abs(objective.upgrades[5] - 2) * 250) },
item5 = {
name = 'storage-chest',
tt = 'entity-name',
@ -189,7 +189,7 @@ function Public.upgrade5(coin_scaling)
}
},
virtual_cost = {
virtual1 = {type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 10 * (1 + objective.upgrades[5])}
virtual1 = { type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 10 * (1 + objective.upgrades[5]) }
}
}
return upgrade
@ -198,13 +198,13 @@ end
function Public.upgrade6(coin_scaling)
local objective = Chrono_table.get_table()
local upgrade = {
name = {'chronosphere.upgrade_repair'},
name = { 'chronosphere.upgrade_repair' },
sprite = 'recipe/repair-pack',
max_level = 4,
type = 'train',
enabled = true,
message = {'chronosphere.upgrade_repair_message'},
tooltip = {'chronosphere.upgrade_repair_tooltip', objective.upgrades[6]},
message = { 'chronosphere.upgrade_repair_message' },
tooltip = { 'chronosphere.upgrade_repair_tooltip', objective.upgrades[6] },
jump_limit = 0,
cost = {
item1 = {
@ -213,10 +213,10 @@ function Public.upgrade6(coin_scaling)
sprite = 'item/coin',
count = 1000 * coin_scaling * (1 + objective.upgrades[6])
},
item2 = {name = 'repair-pack', tt = 'item-name', sprite = 'recipe/repair-pack', count = 200 * (1 + objective.upgrades[6])}
item2 = { name = 'repair-pack', tt = 'item-name', sprite = 'recipe/repair-pack', count = 200 * (1 + objective.upgrades[6]) }
},
virtual_cost = {
virtual1 = {type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 10 * (1 + objective.upgrades[6])}
virtual1 = { type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 10 * (1 + objective.upgrades[6]) }
}
}
return upgrade
@ -224,18 +224,18 @@ end
function Public.upgrade7(coin_scaling)
local upgrade = {
name = {'chronosphere.upgrade_water'},
name = { 'chronosphere.upgrade_water' },
sprite = 'fluid/water',
max_level = 1,
type = 'train',
enabled = true,
message = {'chronosphere.upgrade_water_message'},
tooltip = {'chronosphere.upgrade_water_tooltip'},
message = { 'chronosphere.upgrade_water_message' },
tooltip = { 'chronosphere.upgrade_water_tooltip' },
jump_limit = 0,
cost = {
item1 = {name = 'coin', tt = 'item-name', sprite = 'item/coin', count = 2000 * coin_scaling},
item2 = {name = 'pipe', tt = 'entity-name', sprite = 'item/pipe', count = 500},
item3 = {name = 'pump', tt = 'entity-name', sprite = 'item/pump', count = 10}
item1 = { name = 'coin', tt = 'item-name', sprite = 'item/coin', count = 2000 * coin_scaling },
item2 = { name = 'pipe', tt = 'entity-name', sprite = 'item/pipe', count = 500 },
item3 = { name = 'pump', tt = 'entity-name', sprite = 'item/pump', count = 10 }
},
virtual_cost = {}
}
@ -245,18 +245,18 @@ end
function Public.upgrade8(coin_scaling)
local objective = Chrono_table.get_table()
local upgrade = {
name = {'chronosphere.upgrade_output'},
name = { 'chronosphere.upgrade_output' },
sprite = 'recipe/cargo-wagon',
max_level = 2,
type = 'train',
enabled = true,
message = {'chronosphere.upgrade_output_message'},
tooltip = {'chronosphere.upgrade_output_tooltip'},
message = { 'chronosphere.upgrade_output_message' },
tooltip = { 'chronosphere.upgrade_output_tooltip' },
jump_limit = 0,
cost = {
item1 = {name = 'coin', tt = 'item-name', sprite = 'item/coin', count = 2000 * coin_scaling},
item2 = {name = 'fast-inserter', tt = 'entity-name', sprite = 'recipe/fast-inserter', count = (1 - objective.upgrades[8]) * 200},
item3 = {name = 'constant-combinator', tt = 'entity-name', sprite = 'recipe/constant-combinator', count = objective.upgrades[8] * 200}
item1 = { name = 'coin', tt = 'item-name', sprite = 'item/coin', count = 2000 * coin_scaling },
item2 = { name = 'fast-inserter', tt = 'entity-name', sprite = 'recipe/fast-inserter', count = (1 - objective.upgrades[8]) * 200 },
item3 = { name = 'constant-combinator', tt = 'entity-name', sprite = 'recipe/constant-combinator', count = objective.upgrades[8] * 200 }
},
virtual_cost = {}
}
@ -266,13 +266,13 @@ end
function Public.upgrade9(coin_scaling)
local objective = Chrono_table.get_table()
local upgrade = {
name = {'chronosphere.upgrade_storage'},
name = { 'chronosphere.upgrade_storage' },
sprite = 'item/storage-chest',
max_level = 4,
type = 'train',
enabled = true,
message = {'chronosphere.upgrade_storage_message'},
tooltip = {'chronosphere.upgrade_storage_tooltip'},
message = { 'chronosphere.upgrade_storage_message' },
tooltip = { 'chronosphere.upgrade_storage_tooltip' },
jump_limit = (1 + objective.upgrades[9]) * 5,
cost = {
item1 = {
@ -281,9 +281,9 @@ function Public.upgrade9(coin_scaling)
sprite = 'item/coin',
count = 3000 * coin_scaling * (1 + objective.upgrades[9])
},
item2 = {name = 'wooden-chest', tt = 'entity-name', sprite = 'item/wooden-chest', count = math_max(0, 250 - math_abs(objective.upgrades[9]) * 250)},
item3 = {name = 'iron-chest', tt = 'entity-name', sprite = 'item/iron-chest', count = math_max(0, 250 - math_abs(objective.upgrades[9] - 1) * 250)},
item4 = {name = 'steel-chest', tt = 'entity-name', sprite = 'item/steel-chest', count = math_max(0, 250 - math_abs(objective.upgrades[9] - 2) * 250)},
item2 = { name = 'wooden-chest', tt = 'entity-name', sprite = 'item/wooden-chest', count = math_max(0, 250 - math_abs(objective.upgrades[9]) * 250) },
item3 = { name = 'iron-chest', tt = 'entity-name', sprite = 'item/iron-chest', count = math_max(0, 250 - math_abs(objective.upgrades[9] - 1) * 250) },
item4 = { name = 'steel-chest', tt = 'entity-name', sprite = 'item/steel-chest', count = math_max(0, 250 - math_abs(objective.upgrades[9] - 2) * 250) },
item5 = {
name = 'storage-chest',
tt = 'entity-name',
@ -299,63 +299,63 @@ end
function Public.upgrade10(coin_scaling)
local objective = Chrono_table.get_table()
local upgrade = {
name = {'chronosphere.upgrade_poison'},
name = { 'chronosphere.upgrade_poison' },
sprite = 'recipe/poison-capsule',
max_level = 4,
type = 'train',
enabled = true,
message = {'chronosphere.upgrade_poison_message'},
tooltip = {'chronosphere.upgrade_poison_tooltip', math_ceil(objective.poisontimeout / 6)},
message = { 'chronosphere.upgrade_poison_message' },
tooltip = { 'chronosphere.upgrade_poison_tooltip', math_ceil(objective.poisontimeout / 6) },
jump_limit = 0,
cost = {
item1 = {name = 'coin', tt = 'item-name', sprite = 'item/coin', count = 1000 * coin_scaling},
item2 = {name = 'poison-capsule', tt = 'item-name', sprite = 'recipe/poison-capsule', count = 50}
item1 = { name = 'coin', tt = 'item-name', sprite = 'item/coin', count = 1000 * coin_scaling },
item2 = { name = 'poison-capsule', tt = 'item-name', sprite = 'recipe/poison-capsule', count = 50 }
},
virtual_cost = {
virtual1 = {type = 'ammo', name = Public.tokens.ammo.name, tt = 'chronosphere', sprite = Public.tokens.ammo.sprite, count = 10}
virtual1 = { type = 'ammo', name = Public.tokens.ammo.name, tt = 'chronosphere', sprite = Public.tokens.ammo.sprite, count = 10 }
}
}
return upgrade
end
function Public.upgrade11(_coin_scaling)
function Public.upgrade11()
local upgrade = {
name = {'chronosphere.upgrade_fusion'},
name = { 'chronosphere.upgrade_fusion' },
sprite = 'recipe/fission-reactor-equipment',
max_level = 999,
type = 'player',
enabled = true,
message = {'chronosphere.upgrade_fusion_message'},
tooltip = {'chronosphere.upgrade_fusion_tooltip'},
message = { 'chronosphere.upgrade_fusion_message' },
tooltip = { 'chronosphere.upgrade_fusion_tooltip' },
jump_limit = 24,
cost = {
item1 = {name = 'low-density-structure', tt = 'item-name', sprite = 'item/low-density-structure', count = 70},
item2 = {name = 'processing-unit', tt = 'item-name', sprite = 'item/processing-unit', count = 50},
item3 = {name = 'solar-panel-equipment', tt = 'equipment-name', sprite = 'item/solar-panel-equipment', count = 16}
item1 = { name = 'low-density-structure', tt = 'item-name', sprite = 'item/low-density-structure', count = 70 },
item2 = { name = 'processing-unit', tt = 'item-name', sprite = 'item/processing-unit', count = 50 },
item3 = { name = 'solar-panel-equipment', tt = 'equipment-name', sprite = 'item/solar-panel-equipment', count = 16 }
},
virtual_cost = {
virtual1 = {type = 'weapons', name = Public.tokens.weapons.name, tt = 'chronosphere', sprite = Public.tokens.weapons.sprite, count = 160}
virtual1 = { type = 'weapons', name = Public.tokens.weapons.name, tt = 'chronosphere', sprite = Public.tokens.weapons.sprite, count = 160 }
}
}
return upgrade
end
function Public.upgrade12(_coin_scaling)
function Public.upgrade12()
local upgrade = {
name = {'chronosphere.upgrade_mk2'},
name = { 'chronosphere.upgrade_mk2' },
sprite = 'recipe/power-armor-mk2',
max_level = 999,
type = 'player',
enabled = true,
message = {'chronosphere.upgrade_mk2_message'},
tooltip = {'chronosphere.upgrade_mk2_tooltip'},
message = { 'chronosphere.upgrade_mk2_message' },
tooltip = { 'chronosphere.upgrade_mk2_tooltip' },
jump_limit = 28,
cost = {
item1 = {name = 'low-density-structure', tt = 'item-name', sprite = 'item/low-density-structure', count = 100},
item3 = {name = 'power-armor', tt = 'item-name', sprite = 'item/power-armor', count = 1}
item1 = { name = 'low-density-structure', tt = 'item-name', sprite = 'item/low-density-structure', count = 100 },
item3 = { name = 'power-armor', tt = 'item-name', sprite = 'item/power-armor', count = 1 }
},
virtual_cost = {
virtual1 = {type = 'weapons', name = Public.tokens.weapons.name, tt = 'chronosphere', sprite = Public.tokens.weapons.sprite, count = 300}
virtual1 = { type = 'weapons', name = Public.tokens.weapons.name, tt = 'chronosphere', sprite = Public.tokens.weapons.sprite, count = 300 }
}
}
return upgrade
@ -363,21 +363,21 @@ end
function Public.upgrade13(coin_scaling)
local upgrade = {
name = {'chronosphere.upgrade_computer1'},
name = { 'chronosphere.upgrade_computer1' },
sprite = 'item/advanced-circuit',
max_level = 1,
type = 'quest',
enabled = true,
message = {'chronosphere.upgrade_computer1_message'},
tooltip = {'chronosphere.upgrade_computer1_tooltip'},
message = { 'chronosphere.upgrade_computer1_message' },
tooltip = { 'chronosphere.upgrade_computer1_tooltip' },
jump_limit = 15,
cost = {
item1 = {name = 'coin', tt = 'item-name', sprite = 'item/coin', count = 5000 * coin_scaling},
item2 = {name = 'advanced-circuit', tt = 'item-name', sprite = 'item/advanced-circuit', count = 1000},
item3 = {name = 'copper-plate', tt = 'item-name', sprite = 'item/copper-plate', count = 2000}
item1 = { name = 'coin', tt = 'item-name', sprite = 'item/coin', count = 5000 * coin_scaling },
item2 = { name = 'advanced-circuit', tt = 'item-name', sprite = 'item/advanced-circuit', count = 1000 },
item3 = { name = 'copper-plate', tt = 'item-name', sprite = 'item/copper-plate', count = 2000 }
},
virtual_cost = {
virtual1 = {type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 100}
virtual1 = { type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 100 }
}
}
return upgrade
@ -386,21 +386,21 @@ end
function Public.upgrade14(coin_scaling)
local objective = Chrono_table.get_table()
local upgrade = {
name = {'chronosphere.upgrade_computer2'},
name = { 'chronosphere.upgrade_computer2' },
sprite = 'item/processing-unit',
max_level = 1,
type = 'quest',
enabled = objective.upgrades[13] == 1,
message = {'chronosphere.upgrade_computer2_message'},
tooltip = {'chronosphere.upgrade_computer2_tooltip'},
message = { 'chronosphere.upgrade_computer2_message' },
tooltip = { 'chronosphere.upgrade_computer2_tooltip' },
jump_limit = 20,
cost = {
item1 = {name = 'coin', tt = 'item-name', sprite = 'item/coin', count = 10000 * coin_scaling},
item2 = {name = 'processing-unit', tt = 'item-name', sprite = 'item/processing-unit', count = 1000},
item3 = {name = 'nuclear-reactor', tt = 'entity-name', sprite = 'item/nuclear-reactor', count = 1}
item1 = { name = 'coin', tt = 'item-name', sprite = 'item/coin', count = 10000 * coin_scaling },
item2 = { name = 'processing-unit', tt = 'item-name', sprite = 'item/processing-unit', count = 1000 },
item3 = { name = 'nuclear-reactor', tt = 'entity-name', sprite = 'item/nuclear-reactor', count = 1 }
},
virtual_cost = {
virtual1 = {type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 200}
virtual1 = { type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 200 }
}
}
return upgrade
@ -409,45 +409,45 @@ end
function Public.upgrade15(coin_scaling)
local objective = Chrono_table.get_table()
local upgrade = {
name = {'chronosphere.upgrade_computer3'},
name = { 'chronosphere.upgrade_computer3' },
sprite = 'item/utility-science-pack',
max_level = 10,
type = 'quest',
enabled = objective.upgrades[14] == 1,
message = {'chronosphere.upgrade_computer3_message', objective.upgrades[15] + 1},
tooltip = {'chronosphere.upgrade_computer3_tooltip'},
message = { 'chronosphere.upgrade_computer3_message', objective.upgrades[15] + 1 },
tooltip = { 'chronosphere.upgrade_computer3_tooltip' },
jump_limit = 25,
cost = {
item1 = {name = 'coin', tt = 'item-name', sprite = 'item/coin', count = 2000 * coin_scaling},
item2 = {name = 'low-density-structure', tt = 'item-name', sprite = 'item/low-density-structure', count = 100},
item3 = {name = 'utility-science-pack', tt = 'item-name', sprite = 'item/utility-science-pack', count = 100},
item4 = {name = 'uranium-fuel-cell', tt = 'item-name', sprite = 'item/uranium-fuel-cell', count = 50}
item1 = { name = 'coin', tt = 'item-name', sprite = 'item/coin', count = 2000 * coin_scaling },
item2 = { name = 'low-density-structure', tt = 'item-name', sprite = 'item/low-density-structure', count = 100 },
item3 = { name = 'utility-science-pack', tt = 'item-name', sprite = 'item/utility-science-pack', count = 100 },
item4 = { name = 'uranium-fuel-cell', tt = 'item-name', sprite = 'item/uranium-fuel-cell', count = 50 }
},
virtual_cost = {
virtual1 = {type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 30}
virtual1 = { type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 30 }
}
}
return upgrade
end
function Public.upgrade16(_coin_scaling)
function Public.upgrade16()
local objective = Chrono_table.get_table()
local upgrade = {
name = {'chronosphere.upgrade_computer4'},
name = { 'chronosphere.upgrade_computer4' },
sprite = 'item/space-science-pack',
max_level = 1,
type = 'quest',
enabled = objective.upgrades[15] == 10,
message = {'chronosphere.upgrade_computer4_message'},
tooltip = {'chronosphere.upgrade_computer4_tooltip'},
message = { 'chronosphere.upgrade_computer4_message' },
tooltip = { 'chronosphere.upgrade_computer4_tooltip' },
jump_limit = 25,
cost = {
item1 = {name = 'rocket-silo', tt = 'entity-name', sprite = 'item/rocket-silo', count = 1},
item2 = {name = 'space-science-pack', tt = 'item-name', sprite = 'item/space-science-pack', count = 1},
item3 = {name = 'spidertron', tt = 'entity-name', sprite = 'item/spidertron', count = 2}
item1 = { name = 'rocket-silo', tt = 'entity-name', sprite = 'item/rocket-silo', count = 1 },
item2 = { name = 'space-science-pack', tt = 'item-name', sprite = 'item/space-science-pack', count = 1 },
item3 = { name = 'spidertron', tt = 'entity-name', sprite = 'item/spidertron', count = 2 }
},
virtual_cost = {
virtual1 = {type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 400}
virtual1 = { type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 400 }
}
}
return upgrade
@ -456,45 +456,45 @@ end
function Public.upgrade17(coin_scaling)
local objective = Chrono_table.get_table()
local upgrade = {
name = {'chronosphere.upgrade_nukeshied'},
name = { 'chronosphere.upgrade_nukeshied' },
sprite = 'item/rocket',
max_level = 1,
type = 'quest',
enabled = (objective.config.jumpfailure and objective.chronojumps >= 19) or (objective.world.id == 2 and objective.world.variant.id == 2),
message = {'chronosphere.upgrade_nukeshield_message'},
tooltip = {'chronosphere.upgrade_nukeshield_tooltip'},
message = { 'chronosphere.upgrade_nukeshield_message' },
tooltip = { 'chronosphere.upgrade_nukeshield_tooltip' },
jump_limit = 0,
cost = {
item1 = {name = 'rocket', tt = 'item-name', sprite = 'item/rocket', count = 1000},
item2 = {name = 'coin', tt = 'item-name', sprite = 'item/coin', count = 5000 * coin_scaling}
item1 = { name = 'rocket', tt = 'item-name', sprite = 'item/rocket', count = 1000 },
item2 = { name = 'coin', tt = 'item-name', sprite = 'item/coin', count = 5000 * coin_scaling }
},
virtual_cost = {
virtual1 = {type = 'ammo', name = Public.tokens.ammo.name, tt = 'chronosphere', sprite = Public.tokens.ammo.sprite, count = 200},
virtual2 = {type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 40}
virtual1 = { type = 'ammo', name = Public.tokens.ammo.name, tt = 'chronosphere', sprite = Public.tokens.ammo.sprite, count = 200 },
virtual2 = { type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 40 }
}
}
return upgrade
end
function Public.upgrade18(_coin_scaling)
function Public.upgrade18()
local objective = Chrono_table.get_table()
local upgrade = {
name = {'chronosphere.upgrade_researchspeed'},
name = { 'chronosphere.upgrade_researchspeed' },
sprite = 'item/lab',
max_level = 4,
type = 'quest',
enabled = objective.chronojumps >= 7,
message = {'chronosphere.upgrade_researchspeed_message'},
tooltip = {'chronosphere.upgrade_researchspeed_tooltip'},
message = { 'chronosphere.upgrade_researchspeed_message' },
tooltip = { 'chronosphere.upgrade_researchspeed_tooltip' },
jump_limit = (1 + objective.upgrades[18]) * 6,
cost = {
item1 = {name = 'lab', tt = 'item-name', sprite = 'item/lab', count = 50 * (1 + objective.upgrades[18])},
item2 = {name = 'speed-module', tt = 'item-name', sprite = 'item/speed-module', count = 20 * (1 + objective.upgrades[18])},
item3 = {name = 'productivity-module', tt = 'item-name', sprite = 'item/productivity-module', count = 20 * (1 + objective.upgrades[18])},
item4 = {name = 'speed-module-2', tt = 'item-name', sprite = 'item/speed-module-2', count = 20 * (objective.upgrades[18] / 2)}
item1 = { name = 'lab', tt = 'item-name', sprite = 'item/lab', count = 50 * (1 + objective.upgrades[18]) },
item2 = { name = 'speed-module', tt = 'item-name', sprite = 'item/speed-module', count = 20 * (1 + objective.upgrades[18]) },
item3 = { name = 'productivity-module', tt = 'item-name', sprite = 'item/productivity-module', count = 20 * (1 + objective.upgrades[18]) },
item4 = { name = 'speed-module-2', tt = 'item-name', sprite = 'item/speed-module-2', count = 20 * (objective.upgrades[18] / 2) }
},
virtual_cost = {
virtual1 = {type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 200}
virtual1 = { type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 200 }
}
}
return upgrade
@ -503,13 +503,13 @@ end
function Public.upgrade19(coin_scaling)
local objective = Chrono_table.get_table()
local upgrade = {
name = {'chronosphere.upgrade_craftingspeed'},
name = { 'chronosphere.upgrade_craftingspeed' },
sprite = 'item/assembling-machine-1',
max_level = 4,
type = 'player',
enabled = true,
message = {'chronosphere.upgrade_craftingspeed_message'},
tooltip = {'chronosphere.upgrade_craftingspeed_tooltip'},
message = { 'chronosphere.upgrade_craftingspeed_message' },
tooltip = { 'chronosphere.upgrade_craftingspeed_tooltip' },
jump_limit = (1 + objective.upgrades[19]) * 5,
cost = {
item1 = {
@ -518,11 +518,11 @@ function Public.upgrade19(coin_scaling)
sprite = 'item/coin',
count = 1000 * coin_scaling * (1 + objective.upgrades[19])
},
item2 = {name = 'assembling-machine-1', tt = 'entity-name', sprite = 'item/assembling-machine-1', count = 50 * (1 + objective.upgrades[19])},
item3 = {name = 'assembling-machine-2', tt = 'entity-name', sprite = 'item/assembling-machine-2', count = 50 * (objective.upgrades[19])}
item2 = { name = 'assembling-machine-1', tt = 'entity-name', sprite = 'item/assembling-machine-1', count = 50 * (1 + objective.upgrades[19]) },
item3 = { name = 'assembling-machine-2', tt = 'entity-name', sprite = 'item/assembling-machine-2', count = 50 * (objective.upgrades[19]) }
},
virtual_cost = {
virtual1 = {type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 10 * (1 + objective.upgrades[19])}
virtual1 = { type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 10 * (1 + objective.upgrades[19]) }
}
}
return upgrade
@ -531,13 +531,13 @@ end
function Public.upgrade20(coin_scaling)
local objective = Chrono_table.get_table()
local upgrade = {
name = {'chronosphere.upgrade_discharge'},
name = { 'chronosphere.upgrade_discharge' },
sprite = 'item/discharge-defense-equipment',
max_level = 5,
type = 'player',
enabled = true,
message = {'chronosphere.upgrade_discharge_message'},
tooltip = {'chronosphere.upgrade_discharge_tooltip'},
message = { 'chronosphere.upgrade_discharge_message' },
tooltip = { 'chronosphere.upgrade_discharge_tooltip' },
jump_limit = 5 + (1 + objective.upgrades[20]) * 8,
cost = {
item1 = {
@ -546,10 +546,10 @@ function Public.upgrade20(coin_scaling)
sprite = 'item/coin',
count = 5000 * coin_scaling * (1 + objective.upgrades[20])
},
item2 = {name = 'discharge-defense-equipment', tt = 'equipment-name', sprite = 'item/discharge-defense-equipment', count = 2 * (1 + objective.upgrades[20])}
item2 = { name = 'discharge-defense-equipment', tt = 'equipment-name', sprite = 'item/discharge-defense-equipment', count = 2 * (1 + objective.upgrades[20]) }
},
virtual_cost = {
virtual1 = {type = 'ammo', name = Public.tokens.ammo.name, tt = 'chronosphere', sprite = Public.tokens.ammo.sprite, count = 50 * (1 + objective.upgrades[20])},
virtual1 = { type = 'ammo', name = Public.tokens.ammo.name, tt = 'chronosphere', sprite = Public.tokens.ammo.sprite, count = 50 * (1 + objective.upgrades[20]) },
virtual2 = {
type = 'biters',
name = Public.tokens.biters.name,
@ -562,28 +562,28 @@ function Public.upgrade20(coin_scaling)
return upgrade
end
function Public.upgrade21(_coin_scaling)
function Public.upgrade21()
local objective = Chrono_table.get_table()
local difficulty = Difficulty.get().difficulty_vote_value
local upgrade = {
name = {'chronosphere.upgrade_spidertron'},
name = { 'chronosphere.upgrade_spidertron' },
sprite = 'recipe/spidertron',
max_level = 2,
type = 'quest',
enabled = objective.upgrades[15] == 10 and difficulty >= 1,
message = {'chronosphere.upgrade_spidertron_message', objective.upgrades[21] + 1},
tooltip = {'chronosphere.upgrade_spidertron_tooltip'},
message = { 'chronosphere.upgrade_spidertron_message', objective.upgrades[21] + 1 },
tooltip = { 'chronosphere.upgrade_spidertron_tooltip' },
jump_limit = 20,
cost = {
item1 = {name = 'automation-science-pack', tt = 'item-name', sprite = 'item/automation-science-pack', count = (1 - objective.upgrades[21]) * 3000},
item2 = {name = 'logistic-science-pack', tt = 'item-name', sprite = 'item/logistic-science-pack', count = (1 - objective.upgrades[21]) * 3000},
item3 = {name = 'military-science-pack', tt = 'item-name', sprite = 'item/military-science-pack', count = (1 - objective.upgrades[21]) * 2400},
item4 = {name = 'chemical-science-pack', tt = 'item-name', sprite = 'item/chemical-science-pack', count = objective.upgrades[21] * 1250},
item5 = {name = 'production-science-pack', tt = 'item-name', sprite = 'item/production-science-pack', count = objective.upgrades[21] * 1250},
item6 = {name = 'utility-science-pack', tt = 'item-name', sprite = 'item/utility-science-pack', count = objective.upgrades[21] * 1250}
item1 = { name = 'automation-science-pack', tt = 'item-name', sprite = 'item/automation-science-pack', count = (1 - objective.upgrades[21]) * 3000 },
item2 = { name = 'logistic-science-pack', tt = 'item-name', sprite = 'item/logistic-science-pack', count = (1 - objective.upgrades[21]) * 3000 },
item3 = { name = 'military-science-pack', tt = 'item-name', sprite = 'item/military-science-pack', count = (1 - objective.upgrades[21]) * 2400 },
item4 = { name = 'chemical-science-pack', tt = 'item-name', sprite = 'item/chemical-science-pack', count = objective.upgrades[21] * 1250 },
item5 = { name = 'production-science-pack', tt = 'item-name', sprite = 'item/production-science-pack', count = objective.upgrades[21] * 1250 },
item6 = { name = 'utility-science-pack', tt = 'item-name', sprite = 'item/utility-science-pack', count = objective.upgrades[21] * 1250 }
},
virtual_cost = {
virtual1 = {type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 100}
virtual1 = { type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 100 }
}
}
return upgrade
@ -592,13 +592,13 @@ end
function Public.upgrade22(coin_scaling)
local objective = Chrono_table.get_table()
local upgrade = {
name = {'chronosphere.upgrade_train_lasers'},
name = { 'chronosphere.upgrade_train_lasers' },
sprite = 'item/personal-laser-defense-equipment',
max_level = 4,
type = 'train',
enabled = true,
message = {'chronosphere.upgrade_train_lasers_message'},
tooltip = {'chronosphere.upgrade_train_lasers_tooltip'},
message = { 'chronosphere.upgrade_train_lasers_message' },
tooltip = { 'chronosphere.upgrade_train_lasers_tooltip' },
jump_limit = (2 + objective.upgrades[22]) * 5,
cost = {
item1 = {
@ -607,12 +607,12 @@ function Public.upgrade22(coin_scaling)
sprite = 'item/coin',
count = 5000 * coin_scaling * (1 + objective.upgrades[22])
},
item2 = {name = 'laser-turret', tt = 'item-name', sprite = 'item/laser-turret', count = 25 * (1 + objective.upgrades[22])},
item3 = {name = 'accumulator', tt = 'entity-name', sprite = 'item/accumulator', count = 25 * (1 + objective.upgrades[22])}
item2 = { name = 'laser-turret', tt = 'item-name', sprite = 'item/laser-turret', count = 25 * (1 + objective.upgrades[22]) },
item3 = { name = 'accumulator', tt = 'entity-name', sprite = 'item/accumulator', count = 25 * (1 + objective.upgrades[22]) }
},
virtual_cost = {
virtual1 = {type = 'ammo', name = Public.tokens.ammo.name, tt = 'chronosphere', sprite = Public.tokens.ammo.sprite, count = 20 * (1 + objective.upgrades[22])},
virtual2 = {type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 10 * (1 + objective.upgrades[22])}
virtual1 = { type = 'ammo', name = Public.tokens.ammo.name, tt = 'chronosphere', sprite = Public.tokens.ammo.sprite, count = 20 * (1 + objective.upgrades[22]) },
virtual2 = { type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 10 * (1 + objective.upgrades[22]) }
}
}
return upgrade
@ -621,71 +621,71 @@ end
function Public.upgrade23(coin_scaling)
local objective = Chrono_table.get_table()
local upgrade = {
name = {'chronosphere.upgrade_nuclear_artillery'},
name = { 'chronosphere.upgrade_nuclear_artillery' },
sprite = 'recipe/artillery-turret',
max_level = 1,
type = 'quest',
enabled = objective.upgrades[15] == 10 and game.forces.player.technologies['artillery'].researched == true,
message = {'chronosphere.upgrade_nuclear_artillery_message'},
tooltip = {'chronosphere.upgrade_nuclear_artillery_tooltip'},
message = { 'chronosphere.upgrade_nuclear_artillery_message' },
tooltip = { 'chronosphere.upgrade_nuclear_artillery_tooltip' },
jump_limit = 20,
cost = {
item1 = {name = 'coin', tt = 'item-name', sprite = 'item/coin', count = 10000 * coin_scaling},
item2 = {name = 'artillery-turret', tt = 'entity-name', sprite = 'item/artillery-turret', count = 10},
item3 = {name = 'military-science-pack', tt = 'item-name', sprite = 'item/military-science-pack', count = 1000},
item4 = {name = 'atomic-bomb', tt = 'item-name', sprite = 'item/atomic-bomb', count = 20},
item5 = {name = 'utility-science-pack', tt = 'item-name', sprite = 'item/utility-science-pack', count = 50},
item6 = {name = 'space-science-pack', tt = 'item-name', sprite = 'item/space-science-pack', count = 1}
item1 = { name = 'coin', tt = 'item-name', sprite = 'item/coin', count = 10000 * coin_scaling },
item2 = { name = 'artillery-turret', tt = 'entity-name', sprite = 'item/artillery-turret', count = 10 },
item3 = { name = 'military-science-pack', tt = 'item-name', sprite = 'item/military-science-pack', count = 1000 },
item4 = { name = 'atomic-bomb', tt = 'item-name', sprite = 'item/atomic-bomb', count = 20 },
item5 = { name = 'utility-science-pack', tt = 'item-name', sprite = 'item/utility-science-pack', count = 50 },
item6 = { name = 'space-science-pack', tt = 'item-name', sprite = 'item/space-science-pack', count = 1 }
},
virtual_cost = {
virtual1 = {type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 200}
virtual1 = { type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 200 }
}
}
return upgrade
end
function Public.upgrade24(_coin_scaling)
function Public.upgrade24()
local objective = Chrono_table.get_table()
local upgrade = {
name = {'chronosphere.upgrade_nuclear_artillery_ammo'},
name = { 'chronosphere.upgrade_nuclear_artillery_ammo' },
sprite = 'item/atomic-bomb',
max_level = 100,
type = 'quest',
enabled = objective.upgrades[23] == 1,
message = {'chronosphere.upgrade_nuclear_artillery_ammo_message'},
tooltip = {'chronosphere.upgrade_nuclear_artillery_ammo_tooltip'},
message = { 'chronosphere.upgrade_nuclear_artillery_ammo_message' },
tooltip = { 'chronosphere.upgrade_nuclear_artillery_ammo_tooltip' },
jump_limit = 20,
cost = {
item1 = {name = 'atomic-bomb', tt = 'item-name', sprite = 'item/atomic-bomb', count = 10}
item1 = { name = 'atomic-bomb', tt = 'item-name', sprite = 'item/atomic-bomb', count = 10 }
},
virtual_cost = {
virtual1 = {type = 'biters', name = Public.tokens.biters.name, tt = 'chronosphere', sprite = Public.tokens.biters.sprite, count = 500}
virtual1 = { type = 'biters', name = Public.tokens.biters.name, tt = 'chronosphere', sprite = Public.tokens.biters.sprite, count = 500 }
}
}
return upgrade
end
function Public.upgrade25(_coin_scaling)
function Public.upgrade25()
local objective = Chrono_table.get_table()
local upgrade = {
name = {'chronosphere.upgrade_poison_mastery'},
name = { 'chronosphere.upgrade_poison_mastery' },
sprite = 'item/heavy-armor',
max_level = 4,
type = 'quest',
enabled = objective.poison_mastery_unlocked >= 10,
message = {'chronosphere.upgrade_poison_mastery_message'},
tooltip = {'chronosphere.upgrade_poison_mastery_tooltip'},
message = { 'chronosphere.upgrade_poison_mastery_message' },
tooltip = { 'chronosphere.upgrade_poison_mastery_tooltip' },
jump_limit = 0,
cost = {
item1 = {name = 'heavy-armor', tt = 'item-name', sprite = 'item/heavy-armor', count = 10},
item2 = {name = 'power-armor', tt = 'item-name', sprite = 'item/power-armor', count = (1 + objective.upgrades[25])},
item3 = {name = 'poison-capsule', tt = 'item-name', sprite = 'recipe/poison-capsule', count = 50 * (1 + objective.upgrades[25])},
item4 = {name = 'military-science-pack', tt = 'item-name', sprite = 'item/military-science-pack', count = (1 + objective.upgrades[25]) * 100},
item5 = {name = 'chemical-science-pack', tt = 'item-name', sprite = 'item/chemical-science-pack', count = objective.upgrades[25] * 100}
item1 = { name = 'heavy-armor', tt = 'item-name', sprite = 'item/heavy-armor', count = 10 },
item2 = { name = 'power-armor', tt = 'item-name', sprite = 'item/power-armor', count = (1 + objective.upgrades[25]) },
item3 = { name = 'poison-capsule', tt = 'item-name', sprite = 'recipe/poison-capsule', count = 50 * (1 + objective.upgrades[25]) },
item4 = { name = 'military-science-pack', tt = 'item-name', sprite = 'item/military-science-pack', count = (1 + objective.upgrades[25]) * 100 },
item5 = { name = 'chemical-science-pack', tt = 'item-name', sprite = 'item/chemical-science-pack', count = objective.upgrades[25] * 100 }
},
virtual_cost = {
virtual1 = {type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 20 * (1 + objective.upgrades[25])},
virtual2 = {type = 'ammo', name = Public.tokens.ammo.name, tt = 'chronosphere', sprite = Public.tokens.ammo.sprite, count = 10 * (1 + objective.upgrades[25])}
virtual1 = { type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 20 * (1 + objective.upgrades[25]) },
virtual2 = { type = 'ammo', name = Public.tokens.ammo.name, tt = 'chronosphere', sprite = Public.tokens.ammo.sprite, count = 10 * (1 + objective.upgrades[25]) }
}
}
return upgrade
@ -694,17 +694,17 @@ end
function Public.upgrade26(coin_scaling)
local objective = Chrono_table.get_table()
local upgrade = {
name = {'chronosphere.upgrade_giftmas'},
name = { 'chronosphere.upgrade_giftmas' },
sprite = 'entity/tree-01',
max_level = 4,
type = 'quest',
enabled = objective.giftmas_enabled,
message = {'chronosphere.upgrade_giftmas_message'},
tooltip = {'chronosphere.upgrade_giftmas_tooltip'},
message = { 'chronosphere.upgrade_giftmas_message' },
tooltip = { 'chronosphere.upgrade_giftmas_tooltip' },
jump_limit = 0,
cost = {
item1 = {name = 'small-lamp', tt = 'item-name', sprite = 'item/small-lamp', count = 50 * (1 + objective.upgrades[26])},
item2 = {name = 'coin', tt = 'item-name', sprite = 'item/coin', count = 1000 * coin_scaling * (1 + objective.upgrades[26])}
item1 = { name = 'small-lamp', tt = 'item-name', sprite = 'item/small-lamp', count = 50 * (1 + objective.upgrades[26]) },
item2 = { name = 'coin', tt = 'item-name', sprite = 'item/coin', count = 1000 * coin_scaling * (1 + objective.upgrades[26]) }
},
virtual_cost = {}
}
@ -713,20 +713,20 @@ end
function Public.upgrade27(coin_scaling)
local upgrade = {
name = {'chronosphere.upgrade_radar'},
name = { 'chronosphere.upgrade_radar' },
sprite = 'entity/radar',
max_level = 1,
type = 'train',
enabled = true,
message = {'chronosphere.upgrade_radar_message'},
tooltip = {'chronosphere.upgrade_radar_tooltip'},
message = { 'chronosphere.upgrade_radar_message' },
tooltip = { 'chronosphere.upgrade_radar_tooltip' },
jump_limit = 0,
cost = {
item1 = {name = 'radar', tt = 'entity-name', sprite = 'entity/radar', count = 200},
item2 = {name = 'coin', tt = 'item-name', sprite = 'item/coin', count = 1000 * coin_scaling}
item1 = { name = 'radar', tt = 'entity-name', sprite = 'entity/radar', count = 200 },
item2 = { name = 'coin', tt = 'item-name', sprite = 'item/coin', count = 1000 * coin_scaling }
},
virtual_cost = {
virtual1 = {type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 20}
virtual1 = { type = 'tech', name = Public.tokens.tech.name, tt = 'chronosphere', sprite = Public.tokens.tech.sprite, count = 20 }
}
}
return upgrade
@ -762,21 +762,21 @@ function Public.upgrades()
[8] = Public.upgrade8(coin_scaling),
[9] = Public.upgrade9(coin_scaling),
[10] = Public.upgrade10(coin_scaling),
[11] = Public.upgrade11(coin_scaling),
[12] = Public.upgrade12(coin_scaling),
[11] = Public.upgrade11(),
[12] = Public.upgrade12(),
[13] = Public.upgrade13(coin_scaling),
[14] = Public.upgrade14(coin_scaling),
[15] = Public.upgrade15(coin_scaling),
[16] = Public.upgrade16(coin_scaling),
[16] = Public.upgrade16(),
[17] = Public.upgrade17(coin_scaling),
[18] = Public.upgrade18(coin_scaling),
[18] = Public.upgrade18(),
[19] = Public.upgrade19(coin_scaling),
[20] = Public.upgrade20(coin_scaling),
[21] = Public.upgrade21(coin_scaling),
[21] = Public.upgrade21(),
[22] = Public.upgrade22(coin_scaling),
[23] = Public.upgrade23(coin_scaling),
[24] = Public.upgrade24(coin_scaling),
[25] = Public.upgrade25(coin_scaling),
[24] = Public.upgrade24(),
[25] = Public.upgrade25(),
[26] = Public.upgrade26(coin_scaling),
[27] = Public.upgrade27(coin_scaling)

View File

@ -14,13 +14,13 @@ local function protect(entity, operable)
entity.destructible = false
entity.operable = operable
end
--[[
local function connect_entities(entity1, entity2, wire_type)
local wireconnector1 = entity1.get_wire_connector(wire_type, true)
local wireconnector2 = entity2.get_wire_connector(wire_type, true)
wireconnector1.connect_to(wireconnector2)
end
]]
function Public.create_wagon_room()
local objective = Chrono_table.get_table()
@ -33,12 +33,12 @@ function Public.create_wagon_room()
['height'] = height + 128,
['water'] = 0,
['starting_area'] = 1,
['cliff_settings'] = {cliff_elevation_interval = 0, cliff_elevation_0 = 0},
['cliff_settings'] = { cliff_elevation_interval = 0, cliff_elevation_0 = 0 },
['default_enable_all_autoplace_controls'] = true,
['autoplace_settings'] = {
['entity'] = {treat_missing_as_default = false},
['tile'] = {treat_missing_as_default = true},
['decorative'] = {treat_missing_as_default = false}
['entity'] = { treat_missing_as_default = false },
['tile'] = { treat_missing_as_default = true },
['decorative'] = { treat_missing_as_default = false }
}
}
if not game.surfaces['cargo_wagon'] then
@ -47,68 +47,68 @@ function Public.create_wagon_room()
local surface = game.surfaces['cargo_wagon']
surface.freeze_daytime = true
surface.daytime = 0.1
surface.request_to_generate_chunks({0, 0}, 12)
surface.request_to_generate_chunks({ 0, 0 }, 12)
surface.force_generate_chunk_requests()
local tiles = {}
local carfpos = {
[1] = {x = -33, y = -127},
[2] = {x = -33, y = -128},
[3] = {x = -33, y = -129},
[4] = {x = -33, y = -130},
[5] = {x = 32, y = -127},
[6] = {x = 32, y = -128},
[7] = {x = 32, y = -129},
[8] = {x = 32, y = -130},
[9] = {x = -33, y = -2},
[10] = {x = -33, y = -1},
[11] = {x = -33, y = 0},
[12] = {x = -33, y = 1},
[13] = {x = 32, y = -2},
[14] = {x = 32, y = -1},
[15] = {x = 32, y = 0},
[16] = {x = 32, y = 1},
[17] = {x = -33, y = 126},
[18] = {x = -33, y = 127},
[19] = {x = -33, y = 128},
[20] = {x = -33, y = 129},
[21] = {x = 32, y = 126},
[22] = {x = 32, y = 127},
[23] = {x = 32, y = 128},
[24] = {x = 32, y = 129}
[1] = { x = -33, y = -127 },
[2] = { x = -33, y = -128 },
[3] = { x = -33, y = -129 },
[4] = { x = -33, y = -130 },
[5] = { x = 32, y = -127 },
[6] = { x = 32, y = -128 },
[7] = { x = 32, y = -129 },
[8] = { x = 32, y = -130 },
[9] = { x = -33, y = -2 },
[10] = { x = -33, y = -1 },
[11] = { x = -33, y = 0 },
[12] = { x = -33, y = 1 },
[13] = { x = 32, y = -2 },
[14] = { x = 32, y = -1 },
[15] = { x = 32, y = 0 },
[16] = { x = 32, y = 1 },
[17] = { x = -33, y = 126 },
[18] = { x = -33, y = 127 },
[19] = { x = -33, y = 128 },
[20] = { x = -33, y = 129 },
[21] = { x = 32, y = 126 },
[22] = { x = 32, y = 127 },
[23] = { x = 32, y = 128 },
[24] = { x = 32, y = 129 }
}
for i = 1, 24, 1 do
tiles[#tiles + 1] = {name = 'tutorial-grid', position = {carfpos[i].x, carfpos[i].y}}
tiles[#tiles + 1] = { name = 'tutorial-grid', position = { carfpos[i].x, carfpos[i].y } }
end
for x = width * -0.5, width * 0.5 - 1, 1 do
for y = height * 0.5, height * 0.7, 1 do
tiles[#tiles + 1] = {name = 'out-of-map', position = {x, y}}
tiles[#tiles + 1] = { name = 'out-of-map', position = { x, y } }
end
for y = height * -0.7, height * -0.5, 1 do
tiles[#tiles + 1] = {name = 'out-of-map', position = {x, y}}
tiles[#tiles + 1] = { name = 'out-of-map', position = { x, y } }
end
for y = height * -0.5 + 3, height * 0.5 - 4, 1 do
tiles[#tiles + 1] = {name = 'tutorial-grid', position = {x, y}}
tiles[#tiles + 1] = { name = 'tutorial-grid', position = { x, y } }
end
for y = height * -0.16 - 5, height * -0.16 + 0, 1 do
tiles[#tiles + 1] = {name = 'out-of-map', position = {x, y}}
tiles[#tiles + 1] = { name = 'out-of-map', position = { x, y } }
end
for y = height * 0.16 - 0, height * 0.16 + 5, 1 do
tiles[#tiles + 1] = {name = 'out-of-map', position = {x, y}}
tiles[#tiles + 1] = { name = 'out-of-map', position = { x, y } }
end
for y = height * -0.5, height * -0.5 + 2, 1 do
tiles[#tiles + 1] = {name = 'out-of-map', position = {x, y}}
tiles[#tiles + 1] = { name = 'out-of-map', position = { x, y } }
end
for y = height * 0.5 - 3, height * 0.5, 1 do
tiles[#tiles + 1] = {name = 'out-of-map', position = {x, y}}
tiles[#tiles + 1] = { name = 'out-of-map', position = { x, y } }
end
end
for x = width * -0.2 + 1, width * 0.2 - 1, 1 do
for y = height * -0.16 - 5, height * -0.16 + 0, 1 do
tiles[#tiles + 1] = {name = 'tutorial-grid', position = {x, y}}
tiles[#tiles + 1] = { name = 'tutorial-grid', position = { x, y } }
end
for y = height * 0.16 - 0, height * 0.16 + 5, 1 do
tiles[#tiles + 1] = {name = 'tutorial-grid', position = {x, y}}
tiles[#tiles + 1] = { name = 'tutorial-grid', position = { x, y } }
end
--for y = height * -0.5 -5, height * -0.5 + 3, 1 do
-- tiles[#tiles + 1] = {name = "tutorial-grid", position = {x,y}}
@ -117,13 +117,13 @@ function Public.create_wagon_room()
for x = width * -0.5 + 5, width * 0.5 - 6, 1 do
for y = height * -0.7 + 18, height * -0.5 - 5, 1 do
tiles[#tiles + 1] = {name = 'tutorial-grid', position = {x, y}}
tiles[#tiles + 1] = { name = 'tutorial-grid', position = { x, y } }
end
end
for x = width * -0.5 - 6, width * -0.5 + 3, 1 do -- combinators
for y = -251, -241, 1 do
tiles[#tiles + 1] = {name = 'tutorial-grid', position = {x, y}}
tiles[#tiles + 1] = { name = 'tutorial-grid', position = { x, y } }
end
end
surface.set_tiles(tiles)
@ -131,16 +131,16 @@ function Public.create_wagon_room()
for x = width * -0.4 + 6, width * 0.4 - 6, 1 do
for y = height * -0.5 + 7, height * -0.5 + 10, 1 do
water_tiles[#water_tiles + 1] = {name = 'water', position = {x, y}}
water_tiles[#water_tiles + 1] = { name = 'water', position = { x, y } }
--surface.set_tiles({{name = "water", position = p}})
if math_random(1, 3) == 1 and (x ~= width * -0.4 + 6) and (y ~= height * -0.5 + 7) then
surface.create_entity({name = 'fish', position = {x, y}})
surface.create_entity({ name = 'fish', position = { x, y } })
end
end
end
surface.set_tiles(water_tiles)
Functions.build_blueprint(surface, {-38, -251}, 1, "player")
Functions.build_blueprint(surface, { -38, -251 }, 1, "player")
-- local combinators = {}
-- for x = width * -0.5 - 6, width * -0.5 + 3, 1 do
-- for y = -250, -244, 2 do
@ -162,19 +162,19 @@ function Public.create_wagon_room()
-- end
-- end
-- local checker = surface.create_entity({name = 'decider-combinator', position = {x = width * -0.5 - 6, y = -242}, force = 'player', create_build_effect_smoke = false})
-- if not checker or not checker.valid then return end
-- if not checker or not checker.valid then return end
-- local rules3 = checker.get_control_behavior()
-- local dec_condition = {
-- first_signal = {type = 'virtual', name = 'signal-A'},
-- second_signal = {type = 'virtual', name = 'signal-B'},
-- comparator = '>',
-- }
-- local dec_output = {
-- output_signal = {type = 'virtual', name = 'signal-C'},
-- copy_count_from_input = false
-- }
-- rules3.set_condition(1, dec_condition)
-- rules3.set_output(1, dec_output)
-- rules3.parameters = {
@ -214,11 +214,11 @@ function Public.create_wagon_room()
-- protect(speaker, false)
-- protect(checker, false)
for k, x in pairs({-1, 0}) do
for _, x in pairs({ -1, 0 }) do
for i = 1, 12, 1 do
local step = math_floor((i - 1) / 4)
local y = -131 + i + step * 128 - step * 4
local e = surface.create_entity({name = 'red-chest', position = {x, y}, force = 'player', create_build_effect_smoke = false})
local e = surface.create_entity({ name = 'red-chest', position = { x, y }, force = 'player', create_build_effect_smoke = false })
protect(e, true)
--e.link_id = 1000 + i + 12 * (k - 1)
table.insert(objective.comfychests2, e)
@ -237,32 +237,32 @@ function Public.create_wagon_room()
-- protect(substation, true)
for j = 1, 4, 1 do
local xx = x - 2 * j
local acumulator = surface.create_entity({name = 'accumulator', position = {xx, y}, force = 'player', create_build_effect_smoke = false})
if i == 3 and j == 1 then
--acumulator.connect_neighbour({wire = defines.wire_type.green, target_entity = substation})
end
local acumulator = surface.create_entity({ name = 'accumulator', position = { xx, y }, force = 'player', create_build_effect_smoke = false })
-- if i == 3 and j == 1 then
-- --acumulator.connect_neighbour({wire = defines.wire_type.green, target_entity = substation})
-- end
protect(acumulator, true)
table.insert(objective.accumulators, acumulator)
end
for k = 1, 4, 1 do
local xx = x + 2 * k
local acumulator = surface.create_entity({name = 'accumulator', position = {xx, y}, force = 'player', create_build_effect_smoke = false})
local acumulator = surface.create_entity({ name = 'accumulator', position = { xx, y }, force = 'player', create_build_effect_smoke = false })
protect(acumulator, true)
table.insert(objective.accumulators, acumulator)
end
end
local powerpole = surface.create_entity({name = 'big-electric-pole', position = {0, height * -0.5}, force = 'player', create_build_effect_smoke = false})
local powerpole = surface.create_entity({ name = 'big-electric-pole', position = { 0, height * -0.5 }, force = 'player', create_build_effect_smoke = false })
protect(powerpole, false)
local laser_battery = surface.create_entity({name = 'accumulator', position = {-31, height * -0.5 + 4}, force = 'player', create_build_effect_smoke = false})
local laser_battery = surface.create_entity({ name = 'accumulator', position = { -31, height * -0.5 + 4 }, force = 'player', create_build_effect_smoke = false })
protect(laser_battery, true)
objective.laser_battery = laser_battery
rendering.draw_text {
text = {'chronosphere.train_laser_battery'},
text = { 'chronosphere.train_laser_battery' },
surface = surface,
target = {
entity = laser_battery,
offset = {0, -2.5},
offset = { 0, -2.5 },
position = laser_battery and laser_battery.position
},
color = objective.locomotive.color,
@ -272,20 +272,20 @@ function Public.create_wagon_room()
scale_with_zoom = false
}
local market = surface.create_entity({name = 'market', position = {-28, height * -0.5 + 4}, force = 'neutral', create_build_effect_smoke = false})
local market = surface.create_entity({ name = 'market', position = { -28, height * -0.5 + 4 }, force = 'neutral', create_build_effect_smoke = false })
protect(market, true)
local repairchest = surface.create_entity({name = 'blue-chest', position = {-24, height * -0.5 + 3}, force = 'player'})
local repairchest = surface.create_entity({ name = 'blue-chest', position = { -24, height * -0.5 + 3 }, force = 'player' })
protect(repairchest, true)
objective.upgradechest[0] = repairchest
rendering.draw_text {
text = {'chronosphere.train_repair_chest'},
text = { 'chronosphere.train_repair_chest' },
surface = surface,
target = {
entity = repairchest,
offset = {0, -2.5},
offset = { 0, -2.5 },
position = repairchest and repairchest.position
},
target_offset = {0, -2.5},
target_offset = { 0, -2.5 },
color = objective.locomotive.color,
scale = 1.00,
font = 'default-game',
@ -294,7 +294,7 @@ function Public.create_wagon_room()
}
local upgrades = Upgrades.upgrades()
for i = 1, #upgrades, 1 do
local e = surface.create_entity({name = 'blue-chest', position = {-21 + i, height * -0.5 + 3}, force = 'player'})
local e = surface.create_entity({ name = 'blue-chest', position = { -21 + i, height * -0.5 + 3 }, force = 'player' })
protect(e, true)
objective.upgradechest[i] = e
rendering.draw_sprite {
@ -302,7 +302,7 @@ function Public.create_wagon_room()
surface = surface,
target = {
entity = e,
offset = {0, -1.3},
offset = { 0, -1.3 },
position = e and e.position
},
font = 'default-game',
@ -311,14 +311,14 @@ function Public.create_wagon_room()
end
rendering.draw_text {
text = {'chronosphere.train_market'},
text = { 'chronosphere.train_market' },
surface = surface,
target = {
entity = market,
offset = {0, -3.5},
offset = { 0, -3.5 },
position = market and market.position
},
target_offset = {0, -3.5},
target_offset = { 0, -3.5 },
color = objective.locomotive.color,
scale = 1.00,
font = 'default-game',
@ -326,11 +326,11 @@ function Public.create_wagon_room()
scale_with_zoom = false
}
rendering.draw_text {
text = {'chronosphere.train_upgrades'},
text = { 'chronosphere.train_upgrades' },
surface = surface,
target = {
entity = objective.upgradechest[8],
offset = {0, -3.5},
offset = { 0, -3.5 },
position = objective.upgradechest[8].position
},
color = objective.locomotive.color,
@ -340,11 +340,11 @@ function Public.create_wagon_room()
scale_with_zoom = false
}
rendering.draw_text {
text = {'chronosphere.train_upgrades_sub'},
text = { 'chronosphere.train_upgrades_sub' },
surface = surface,
target = {
entity = objective.upgradechest[8],
offset = {0, -2.5},
offset = { 0, -2.5 },
position = objective.upgradechest[8].position
},
color = objective.locomotive.color,
@ -361,18 +361,18 @@ function Public.create_wagon_room()
--generate cars--
local car_pos = {
{x = width * -0.5 - 1.4, y = -128},
{x = width * -0.5 - 1.4, y = 0},
{x = width * -0.5 - 1.4, y = 128},
{x = width * 0.5 + 1.4, y = -128},
{x = width * 0.5 + 1.4, y = 0},
{x = width * 0.5 + 1.4, y = 128}
{ x = width * -0.5 - 1.4, y = -128 },
{ x = width * -0.5 - 1.4, y = 0 },
{ x = width * -0.5 - 1.4, y = 128 },
{ x = width * 0.5 + 1.4, y = -128 },
{ x = width * 0.5 + 1.4, y = 0 },
{ x = width * 0.5 + 1.4, y = 128 }
}
objective.car_exits = {}
for i = 1, 6, 1 do
local e = surface.create_entity({name = 'car', position = car_pos[i], force = 'player', create_build_effect_smoke = false})
local e = surface.create_entity({ name = 'car', position = car_pos[i], force = 'player', create_build_effect_smoke = false })
if not e or not e.valid then break end
e.get_inventory(defines.inventory.fuel).insert({name = 'wood', count = 16})
e.get_inventory(defines.inventory.fuel).insert({ name = 'wood', count = 16 })
protect(e, false)
objective.car_exits[i] = e
end
@ -387,7 +387,7 @@ function Public.create_wagon_room()
x = x + 1
end
for y = 68, height * 0.5 - 7, 1 do
positions[#positions + 1] = {x = x, y = y}
positions[#positions + 1] = { x = x, y = y }
end
end
table.shuffle_table(positions)
@ -399,11 +399,11 @@ function Public.create_wagon_room()
if not positions[i] then
break
end
local e = surface.create_entity({name = 'wooden-chest', position = positions[i], force = 'player', create_build_effect_smoke = false})
local e = surface.create_entity({ name = 'wooden-chest', position = positions[i], force = 'player', create_build_effect_smoke = false })
if not e or not e.valid then break end
local inventory = e.get_inventory(defines.inventory.chest)
if not inventory or not inventory.valid then break end
inventory.insert({name = 'raw-fish', count = math_random(2, 5)})
inventory.insert({ name = 'raw-fish', count = math_random(2, 5) })
i = i + 1
end
@ -411,7 +411,7 @@ function Public.create_wagon_room()
if not positions[i] then
break
end
surface.create_entity({name = 'wooden-chest', position = positions[i], force = 'player', create_build_effect_smoke = false})
surface.create_entity({ name = 'wooden-chest', position = positions[i], force = 'player', create_build_effect_smoke = false })
i = i + 1
end
@ -420,7 +420,7 @@ function Public.create_wagon_room()
log('ran out of cargo box positions')
break
end
local e = surface.create_entity({name = 'wooden-chest', position = positions[i], force = 'player', create_build_effect_smoke = false})
local e = surface.create_entity({ name = 'wooden-chest', position = positions[i], force = 'player', create_build_effect_smoke = false })
if not e or not e.valid then break end
local inventory = e.get_inventory(defines.inventory.chest)
if not inventory or not inventory.valid then break end
@ -434,8 +434,8 @@ function Public.create_wagon_room()
else
factory = 'assembling-machine-2'
end
local position = {x = -32 + key * 3, y = height * 0.5 - 5}
local e = surface.create_entity({name = factory, force = 'player', position = position})
local position = { x = -32 + key * 3, y = height * 0.5 - 5 }
local e = surface.create_entity({ name = factory, force = 'player', position = position })
e.active = false
protect(e, false)
e.rotatable = false

View File

@ -720,8 +720,8 @@ local biter_attack_wave = function ()
unit_groups[i] = surface.create_unit_group({ position = { x = x_raffle[i], y = y_raffle[i] } })
local unit_group = unit_groups[i]
if unit_group and unit_group.valid then
if not this.unit_groups[unit_groupunique_id] then
this.unit_groups[unit_groupunique_id] = unit_group
if not this.unit_groups[unit_group.unique_id] then
this.unit_groups[unit_group.unique_id] = unit_group
end
Task.set_timeout_in_ticks(i, spawn_biters_token, { attack_wave_threat = this.attack_wave_threat, unit_group = unit_group, surface = surface, biter_pool = biter_pool })
end
@ -731,8 +731,8 @@ local biter_attack_wave = function ()
unit_groups[i] = surface.create_unit_group({ position = { x = x_raffle[i], y = y_raffle[i] } })
local unit_group = unit_groups[i]
if unit_group and unit_group.valid then
if not this.unit_groups[unit_groupunique_id] then
this.unit_groups[unit_groupunique_id] = unit_group
if not this.unit_groups[unit_group.unique_id] then
this.unit_groups[unit_group.unique_id] = unit_group
end
Task.set_timeout_in_ticks(i, spawn_biters_token, { attack_wave_threat = this.attack_wave_threat, unit_group = unit_group, surface = surface, biter_pool = biter_pool })
end

View File

@ -29,7 +29,6 @@ local item_worths = {
['inserter'] = 8,
['long-handed-inserter'] = 16,
['fast-inserter'] = 32,
['bulk-inserter'] = 128,
['bulk-inserter'] = 160,
['small-electric-pole'] = 4,
['medium-electric-pole'] = 32,

View File

@ -9,7 +9,7 @@ local Vacants = require 'modules.clear_vacant_players'
local Math = require 'utils.math.math'
local Public = {}
local mixed_ores = { 'copper-ore', 'iron-ore', 'stone', 'coal' }
-- local mixed_ores = { 'copper-ore', 'iron-ore', 'stone', 'coal' }
local function clear_selectors(journey)
for k, world_selector in pairs(journey.world_selectors) do
@ -59,7 +59,7 @@ local function place_teleporter(journey, surface, position, build_beacon)
surface.create_entity({ name = 'electric-beam-no-sound', position = position, source = { x = position.x - 1.5, y = position.y + 7.5 }, target = { x = position.x - 1.5, y = position.y - 1.0 } })
surface.destroy_decoratives({ area = { { position.x - 5, position.y - 5 }, { position.x + 5, position.y + 5 } } })
if build_beacon then
local beacon = surface.create_entity({ name = 'cargo-landing-pad', position = { x = position.x + 3 , y = position.y + 2}, force = 'player' })
local beacon = surface.create_entity({ name = 'cargo-landing-pad', position = { x = position.x + 3, y = position.y + 2 }, force = 'player' })
journey.beacon_objective_health = 10000
beacon.operable = true
beacon.minable = false
@ -69,7 +69,7 @@ local function place_teleporter(journey, surface, position, build_beacon)
surface = surface,
target = {
entity = beacon,
offset = {0, -1.5},
offset = { 0, -1.5 },
position = beacon.position
},
color = { 0, 1, 0 },
@ -84,7 +84,7 @@ local function place_teleporter(journey, surface, position, build_beacon)
surface = surface,
target = {
entity = beacon,
offset = {0, -1.0},
offset = { 0, -1.0 },
position = beacon.position
},
color = { 0, 1, 0 },
@ -98,7 +98,7 @@ local function place_teleporter(journey, surface, position, build_beacon)
end
end
local function destroy_teleporter(journey, surface, position)
local function destroy_teleporter(_, surface, position)
local tiles = {}
for x = -2, 7, 1 do
for y = -2, 7, 1 do
@ -123,7 +123,7 @@ local function drop_player_items(journey, player)
player.clear_cursor()
for i = 1, player.crafting_queue_size, 1 do
for _ = 1, player.crafting_queue_size, 1 do
if player.crafting_queue_size > 0 then
player.cancel_crafting { index = 1, count = 99999999 }
end
@ -138,7 +138,7 @@ local function drop_player_items(journey, player)
for i = 1, #inventory, 1 do
local slot = inventory[i]
if slot.valid and slot.valid_for_read then
surface.spill_item_stack({position = player.position, stack = slot, enable_looted = true, allow_belts = false})
surface.spill_item_stack({ position = player.position, stack = slot, enable_looted = true, allow_belts = false })
end
end
inventory.clear()
@ -252,7 +252,7 @@ local function delete_nauvis_chunks(journey)
return
end
for c = 1, 12, 1 do
for _ = 1, 12, 1 do
local chunk_position = journey.nauvis_chunk_positions[journey.size_of_nauvis_chunk_positions]
if chunk_position then
surface.delete_chunk(chunk_position)
@ -327,11 +327,14 @@ local function cargo_gui(name, itemname, tooltip, value, hidden)
sprite.style.padding = 0
local progressbar = frame.add({ type = 'progressbar', name = name .. '_progressbar', value = 0 })
progressbar.style = 'achievement_progressbar'
progressbar.style.minimal_width = 100
progressbar.style.maximal_width = 100
progressbar.style.top_margin = 2
progressbar.style.right_margin = 6
progressbar.style.height = 20
local progressbar_style = progressbar.style --[[@as LuaGuiElementStyle]]
progressbar_style.minimal_width = 100
progressbar_style.maximal_width = 100
---@diagnostic disable-next-line: inject-field
progressbar_style.top_margin = 2
---@diagnostic disable-next-line: inject-field
progressbar_style.right_margin = 6
progressbar_style.height = 20
end
local frame = player.gui.top[name]
frame.tooltip = tooltip
@ -373,8 +376,6 @@ function Public.update_tooltips(journey)
end
function Public.draw_gui(journey)
local surface = game.surfaces.nauvis
local mgs = surface.map_gen_settings
local caption = { 'journey.world', journey.world_number, Constants.unique_world_traits[journey.world_trait].name }
local tooltip = { 'journey.world_tooltip', Constants.unique_world_traits[journey.world_trait].desc, journey.tooltip_modifiers, journey.tooltip_capsules }
@ -444,7 +445,6 @@ end
function Public.on_mothership_chunk_generated(event)
local left_top = event.area.left_top
local surface = event.surface
local seed = surface.map_gen_settings.seed
local tiles = {}
for x = 0, 31, 1 do
for y = 0, 31, 1 do
@ -555,7 +555,7 @@ function Public.hard_reset(journey)
surface.daytime = Math.random(1, 100) * 0.01
if journey.world_selectors and journey.world_selectors[1].border then
for k, world_selector in pairs(journey.world_selectors) do
for _, world_selector in pairs(journey.world_selectors) do
for _, ID in pairs(world_selector.rectangles) do
ID.destroy()
end
@ -729,7 +729,7 @@ function Public.draw_mothership(journey)
local chest = surface.create_entity({ name = 'infinity-chest', position = { (x - 2) * m, y }, force = 'player' })
if not chest or not chest.valid then break end
chest.set_infinity_container_filter(1, { name = 'solid-fuel', count = 50, index = 1 })
chest.set_infinity_container_filter(2, { name = 'artillery-shell', count = 1 , index = 2})
chest.set_infinity_container_filter(2, { name = 'artillery-shell', count = 1, index = 2 })
protect(chest, false)
end
@ -749,7 +749,7 @@ function Public.teleport_players_to_mothership(journey)
for _, player in pairs(game.connected_players) do
if player.surface.name ~= 'mothership' then
Public.clear_player(player)
player.teleport(surface.find_non_colliding_position('character', { 0, 0 }, 32, 0.5) or {0,0}, surface)
player.teleport(surface.find_non_colliding_position('character', { 0, 0 }, 32, 0.5) or { 0, 0 }, surface)
journey.characters_in_mothership = journey.characters_in_mothership + 1
table.insert(journey.mothership_messages, 'Welcome home ' .. player.name .. '!')
return
@ -815,19 +815,19 @@ local function draw_background(journey, surface)
return
end
local speed = journey.mothership_speed
for c = 1, 16 * speed, 1 do
for _ = 1, 16 * speed, 1 do
local position = Constants.particle_spawn_vectors[Math.random(1, Constants.size_of_particle_spawn_vectors)]
surface.create_entity({ name = 'shotgun-pellet', position = position, target = { position[1], position[2] + Constants.mothership_radius * 2 }, speed = speed })
end
for c = 1, 16 * speed, 1 do
for _ = 1, 16 * speed, 1 do
local position = Constants.particle_spawn_vectors[Math.random(1, Constants.size_of_particle_spawn_vectors)]
surface.create_entity({ name = 'piercing-shotgun-pellet', position = position, target = { position[1], position[2] + Constants.mothership_radius * 2 }, speed = speed })
end
for c = 1, 2 * speed, 1 do
for _ = 1, 2 * speed, 1 do
local position = Constants.particle_spawn_vectors[Math.random(1, Constants.size_of_particle_spawn_vectors)]
surface.create_entity({ name = 'cannon-projectile', position = position, target = { position[1], position[2] + Constants.mothership_radius * 2 }, speed = speed })
end
for c = 1, 1 * speed, 1 do
for _ = 1, 1 * speed, 1 do
local position = Constants.particle_spawn_vectors[Math.random(1, Constants.size_of_particle_spawn_vectors)]
surface.create_entity({ name = 'uranium-cannon-projectile', position = position, target = { position[1], position[2] + Constants.mothership_radius * 2 }, speed = speed })
end
@ -848,7 +848,7 @@ local function draw_background(journey, surface)
end
end
local function roll_bonus_goods(journey, trait, amount)
local function roll_bonus_goods(_, trait, amount)
local loot = Constants.unique_world_traits[trait].loot
local bonus_goods = {}
while #bonus_goods < (amount or 3) do
@ -976,7 +976,7 @@ function Public.set_world_selectors(journey)
}
)
for k2, modifier in pairs(modifiers) do
for _, modifier in pairs(modifiers) do
y_modifier = y_modifier + 0.8
local text = ''
if modifier.value > 0 then
@ -1033,7 +1033,7 @@ function Public.set_world_selectors(journey)
y_modifier = y_modifier + 1.1
local x_modifier = -0.5
for k2, good in pairs(world_selector.bonus_goods) do
for _, good in pairs(world_selector.bonus_goods) do
local render_id =
rendering.draw_text {
text = '+' .. good[2],
@ -1055,13 +1055,13 @@ function Public.set_world_selectors(journey)
x_modifier = x_modifier + 0.18
end
local render_id =
local another_render_id =
rendering.draw_sprite {
sprite = 'item/' .. good[1],
surface = surface,
target = { position.x + x_modifier, position.y + 0.5 + y_modifier }
}
table.insert(texts, render_id)
table.insert(texts, another_render_id)
x_modifier = x_modifier + 1.70
end
@ -1445,7 +1445,7 @@ function Public.dispatch_goods(journey)
if journey.dispatch_beacon_position then
local good = goods_to_dispatch[journey.dispatch_key]
surface.spill_item_stack({position = journey.dispatch_beacon_position, stack = { name = good[1], count = good[2] }, enable_looted = true, allow_belts = false})
surface.spill_item_stack({ position = journey.dispatch_beacon_position, stack = { name = good[1], count = good[2] }, enable_looted = true, allow_belts = false })
table.remove(journey.goods_to_dispatch, journey.dispatch_key)
journey.dispatch_beacon = nil
journey.dispatch_beacon_position = nil
@ -1648,7 +1648,7 @@ function Public.lure_biters(journey, position)
--return (#biters or 0)
end
function Public.lure_far_biters(journey)
function Public.lure_far_biters(_)
-- if journey.game_state ~= 'world' or not journey.beacon_objective.valid then return end
-- if journey.beacon_timer < journey.world_modifiers['beacon_irritation'] then
-- journey.beacon_timer = journey.beacon_timer + 10

View File

@ -1224,7 +1224,6 @@ local inserters = {
['long-handed-inserter'] = true,
['burner-inserter'] = true,
['fast-inserter'] = true,
['bulk-inserter'] = true,
['bulk-inserter'] = true
}
local loaders = {

View File

@ -93,7 +93,6 @@ local this = {
['inserter'] = { value = 8, rarity = 1 },
['long-handed-inserter'] = { value = 12, rarity = 2 },
['fast-inserter'] = { value = 16, rarity = 4 },
['bulk-inserter'] = { value = 96, rarity = 6 },
['bulk-inserter'] = { value = 128, rarity = 7 },
['small-electric-pole'] = { value = 2, rarity = 1 },
['medium-electric-pole'] = { value = 12, rarity = 4 },

View File

@ -666,7 +666,7 @@ local function redraw_market_items(gui, player, search_text)
gui.clear()
end
local player_item_count = 0
local player_item_count
if not (gui and gui.valid) then
return

View File

@ -300,16 +300,16 @@ function Public.reset_map()
if this.adjusted_zones.reversed then
if not surface.is_chunk_generated({ x = -20, y = -22 }) then
-- surface.request_to_generate_chunks({ x = -20, y = -22 }, 1)
-- surface.force_generate_chunk_requests()
surface.request_to_generate_chunks({ x = -20, y = -22 }, 1)
surface.force_generate_chunk_requests()
end
game.forces.player.set_spawn_position({ x = -27, y = -25 }, surface)
WD.set_spawn_position({ x = -16, y = -80 })
WD.enable_inverted(true)
else
if not surface.is_chunk_generated({ x = -20, y = 22 }) then
-- surface.request_to_generate_chunks({ x = -20, y = 22 }, 1)
-- surface.force_generate_chunk_requests()
surface.request_to_generate_chunks({ x = -20, y = 22 }, 1)
surface.force_generate_chunk_requests()
end
game.forces.player.set_spawn_position({ x = -27, y = 25 }, surface)
WD.set_spawn_position({ x = -16, y = 80 })

View File

@ -79,45 +79,6 @@ local function pretty_format(input)
return result
end
local function final_arena_disabled()
if stateful.collection.final_arena_disabled then
game.print('[color=yellow][Mtn v3][/color] Game won!')
game.print('[color=yellow][Mtn v3][/color] Final battle arena is currently being tweaked.')
collection.game_won = true
stateful.collection.gather_time = 0
stateful.collection.gather_time_timer = 0
collection.survive_for = 0
collection.survive_for_timer = 0
refresh_frames()
local reversed = Public.get_stateful_settings('reversed')
if reversed then
Public.set_stateful_settings('reversed', false)
else
Public.set_stateful_settings('reversed', true)
end
collection.game_won_notified = true
refresh_boss_frame()
play_game_won()
WD.disable_spawning_biters(true)
Collapse.start_now(false)
WD.nuke_wave_gui()
Server.to_discord_embed('Game won!')
stateful.rounds_survived = stateful.rounds_survived + 1
stateful.selected_objectives = nil
local buff = Stateful.save_settings()
notify_won_to_discord(buff)
local locomotive = Public.get('locomotive')
if locomotive and locomotive.valid then
locomotive.surface.spill_item_stack({ position = locomotive.position, stack = { name = 'coin', count = 512, quality = 'normal' } })
end
Public.set('game_reset_tick', 5400)
return true
end
return false
end
local function notify_won_to_discord(buff)
if not buff then
return error('Buff is required when sending message to discord.', 2)
@ -851,18 +812,6 @@ main_frame = function (player)
spacer(frame)
frame.add({ type = 'line' })
spacer(frame)
-- if not stateful.collection.final_arena_disabled then
-- local final_label = frame.add({type = 'label', caption = {'stateful.tooltip_final'}})
-- final_label.style.single_line = false
-- else
-- local final_label_disabled = frame.add({type = 'label', caption = {'stateful.tooltip_final_disabled'}})
-- final_label_disabled.style.single_line = false
-- local reason_label = frame.add({type = 'label', caption = {'stateful.tooltip_completing'}})
-- reason_label.style.single_line = false
-- end
-- spacer(frame)
-- frame.add({type = 'line'})
spacer(frame)
local close = frame.add({ type = 'button', name = close_button, caption = 'Close' })
close.style.horizontally_stretchable = true
@ -1257,10 +1206,6 @@ local function update_raw()
Alert.alert_all_players(300, 'All objectives has been completed!')
Alert.alert_all_players(300, 'Take your time to prepare for the final push!')
if final_arena_disabled() then
return
end
stateful.collection.gather_time = tick + (10 * 3600)
stateful.collection.gather_time_timer = tick + (10 * 3600)
game.forces.enemy.set_evolution_factor(1, player.surface)

View File

@ -36,7 +36,7 @@ Public.noiseparams = {
type = 'simplex_2d',
normalised = false,
params = {
{ wavelength = 0, amplitude = rscale * 1.0 },
{ wavelength = 0, amplitude = rscale * 1.0 },
{ wavelength = 2.5, amplitude = rscale * 0.23 },
},
},
@ -47,16 +47,16 @@ Public.noiseparams = {
params = {
-- shape:
{ wavelength = 1600, amplitude = hscale * 22 },
{ wavelength = 800, amplitude = hscale * 18 },
{ wavelength = 400, amplitude = hscale * 15 },
{ wavelength = 300, amplitude = hscale * 11 },
{ wavelength = 200, amplitude = hscale * 8 },
{ wavelength = 140, amplitude = hscale * 6 },
{ wavelength = 100, amplitude = hscale * 4 },
{ wavelength = 800, amplitude = hscale * 18 },
{ wavelength = 400, amplitude = hscale * 15 },
{ wavelength = 300, amplitude = hscale * 11 },
{ wavelength = 200, amplitude = hscale * 8 },
{ wavelength = 140, amplitude = hscale * 6 },
{ wavelength = 100, amplitude = hscale * 4 },
-- edges:
{ wavelength = 60, amplitude = hscale * 2.5 },
{ wavelength = 30, amplitude = hscale * 1.5 },
{ wavelength = 9, amplitude = hscale * 0.5 },
{ wavelength = 60, amplitude = hscale * 2.5 },
{ wavelength = 30, amplitude = hscale * 1.5 },
{ wavelength = 9, amplitude = hscale * 0.5 },
},
},
@ -65,8 +65,8 @@ Public.noiseparams = {
normalised = false,
params = {
{ wavelength = 300, amplitude = 15 / 100 },
{ wavelength = 65, amplitude = 90 / 100 },
{ wavelength = 7, amplitude = 5 / 100 },
{ wavelength = 65, amplitude = 90 / 100 },
{ wavelength = 7, amplitude = 5 / 100 },
},
},
@ -75,8 +75,8 @@ Public.noiseparams = {
normalised = true,
params = {
{ wavelength = 100, amplitude = 80 },
{ wavelength = 50, amplitude = 20 },
{ wavelength = 6, amplitude = 20 },
{ wavelength = 50, amplitude = 20 },
{ wavelength = 6, amplitude = 20 },
},
},
@ -85,7 +85,7 @@ Public.noiseparams = {
normalised = true,
params = {
{ wavelength = 250, amplitude = 70 },
{ wavelength = 50, amplitude = 20 },
{ wavelength = 50, amplitude = 20 },
},
},
}

View File

@ -70,8 +70,8 @@ function Public.fleeing_biteys(entity, cause)
local unit_group = unit.unit_group
if unit_group then
if unit_group.valid then
if not unit_groups[unit_groupunique_id] then
unit_groups[unit_groupunique_id] = unit_group
if not unit_groups[unit_group.unique_id] then
unit_groups[unit_group.unique_id] = unit_group
end
end
else

View File

@ -292,9 +292,9 @@ local function is_valid_location(force_name, surface, position)
for _, vector in pairs(town_wall_vectors) do
local p = { x = math_floor(position.x + vector[1]), y = math_floor(position.y + vector[2]) }
if Building.in_restricted_zone(surface, p) then
for _, p in pairs(game.connected_players) do
if p.surface == surface then
p.create_local_flying_text({
for _, player in pairs(game.connected_players) do
if player.surface == surface then
player.create_local_flying_text({
position = position,
text = 'Can not build in restricted zone!',
color = { r = 0.77, g = 0.0, b = 0.0 }

View File

@ -1122,12 +1122,8 @@ function Public._esp:work(tick)
if self.last_command < tick then
if self.command == 'goto' then
self:go_to_location_command()
elseif self.command == 'attack' then
-- self:attack_command()
-- self:go_to_location_command()
elseif self.command == 'attack_area' then
self:attack_area_command()
-- self:go_to_location_command()
end
self.last_command = tick + 500

View File

@ -73,7 +73,7 @@ local place_nest_near_unit_group = function ()
local disable_spawn_near_target = Public.get('disable_spawn_near_target')
local generated_units = Public.get('generated_units')
local group = generated_units.unit_groups[random_groupunique_id]
local group = generated_units.unit_groups[random_group.unique_id]
if not group then
return
end
@ -234,7 +234,7 @@ function Public.build_worm()
return
end
local generated_units = Public.get('generated_units')
local group = generated_units.unit_groups[random_groupunique_id]
local group = generated_units.unit_groups[random_group.unique_id]
if not group then
return
end

View File

@ -5,7 +5,6 @@ local Server = require 'utils.server'
-- localized functions
local random = math.random
local sqrt = math.sqrt
local floor = math.floor
local format = string.format
local match = string.match

View File

@ -7,14 +7,13 @@ local concat = table.concat
local inspect = table.inspect
local pcall = pcall
local loadstring = loadstring
local rawset = rawset
local Public = {}
local luaObject = {'{', nil, ", name = '", nil, "'}"}
local luaPlayer = {"{LuaPlayer, name = '", nil, "', index = ", nil, '}'}
local luaEntity = {"{LuaEntity, name = '", nil, "', unit_number = ", nil, '}'}
local luaGuiElement = {"{LuaGuiElement, name = '", nil, "'}"}
local luaObject = { '{', nil, ", name = '", nil, "'}" }
local luaPlayer = { "{LuaPlayer, name = '", nil, "', index = ", nil, '}' }
local luaEntity = { "{LuaEntity, name = '", nil, "', unit_number = ", nil, '}' }
local luaGuiElement = { "{LuaGuiElement, name = '", nil, "'}" }
local function get(obj, prop)
return obj[prop]
@ -82,10 +81,11 @@ local function inspect_process(item)
end
end
local inspect_options = {process = inspect_process}
local inspect_options = { process = inspect_process }
function Public.dump(data)
return inspect(data, inspect_options)
end
local dump = Public.dump
function Public.dump_ignore_builder(ignore)
@ -97,14 +97,14 @@ function Public.dump_ignore_builder(ignore)
return inspect_process(item)
end
local options = {process = process}
return function(data)
local options = { process = process }
return function (data)
return inspect(data, options)
end
end
function Public.dump_function(func)
local res = {'upvalues:\n'}
local res = { 'upvalues:\n' }
if debug.getupvalue == nil then
return concat(res)

View File

@ -2,9 +2,6 @@
local Public = {}
local Global = require 'utils.global'
local Utils = require 'utils.utils'
---Command to move
---@param position MapPosition
---@param distraction defines.distraction|nil
@ -50,7 +47,7 @@ end
---@param distraction defines.distraction|nil
function Public.command_attack_obstacles(surface, position, distraction)
local commands = {}
local obstacles = surface.find_entities_filtered {position = position, radius = 25, type = {'simple-entity', 'tree', 'simple-entity-with-owner'}, limit = 100}
local obstacles = surface.find_entities_filtered { position = position, radius = 25, type = { 'simple-entity', 'tree', 'simple-entity-with-owner' }, limit = 100 }
if obstacles then
--table.shuffle_table(obstacles)
table.shuffle_by_distance(obstacles, position)
@ -105,4 +102,4 @@ end
---TODO: more advanced functions and direct LuaCommandable stuff
return Public
return Public

View File

@ -100,7 +100,6 @@ market.logistic = {
['long-handed-inserter'] = { value = 12, rarity = 2 },
['fast-inserter'] = { value = 16, rarity = 4 },
['bulk-inserter'] = { value = 96, rarity = 6 },
['bulk-inserter'] = { value = 128, rarity = 7 },
['small-electric-pole'] = { value = 2, rarity = 1 },
['medium-electric-pole'] = { value = 12, rarity = 4 },
['big-electric-pole'] = { value = 24, rarity = 5 },

View File

@ -33,7 +33,6 @@ local item_worths = {
['long-handed-inserter'] = 8,
['fast-inserter'] = 16,
['bulk-inserter'] = 128,
['bulk-inserter'] = 160,
['small-electric-pole'] = 2,
['medium-electric-pole'] = 32,
['big-electric-pole'] = 64,

View File

@ -9,27 +9,27 @@ local traps = {}
Global.register(
traps,
function(t)
function (t)
traps = t
end
)
local tick_tacks = {'*tick*', '*tick*', '*tack*', '*tak*', '*tik*', '*tok*'}
local tick_tacks = { '*tick*', '*tick*', '*tack*', '*tak*', '*tik*', '*tok*' }
local kaboom_weights = {
{name = 'grenade', chance = 7},
{name = 'cluster-grenade', chance = 1},
{name = 'destroyer-capsule', chance = 1},
{name = 'defender-capsule', chance = 4},
{name = 'distractor-capsule', chance = 3},
{name = 'poison-capsule', chance = 2},
{name = 'explosive-uranium-cannon-projectile', chance = 3},
{name = 'explosive-cannon-projectile', chance = 5}
{ name = 'grenade', chance = 7 },
{ name = 'cluster-grenade', chance = 1 },
{ name = 'destroyer-capsule', chance = 1 },
{ name = 'defender-capsule', chance = 4 },
{ name = 'distractor-capsule', chance = 3 },
{ name = 'poison-capsule', chance = 2 },
{ name = 'explosive-uranium-cannon-projectile', chance = 3 },
{ name = 'explosive-cannon-projectile', chance = 5 }
}
local colors = {
trap = {r = 0.75, g = 0.75, b = 0.75},
sentries = {r = 0.8, g = 0.0, b = 0.0},
trap = { r = 0.75, g = 0.75, b = 0.75 },
sentries = { r = 0.8, g = 0.0, b = 0.0 },
}
local kabooms = {}
@ -47,7 +47,7 @@ local function create_flying_text(surface, position, text)
if text == '...' then
return
end
surface.play_sound({path = 'utility/armor_insert', position = position, volume_modifier = 0.75})
surface.play_sound({ path = 'utility/armor_insert', position = position, volume_modifier = 0.75 })
end
---Creates actual final effect
@ -63,7 +63,7 @@ local function create_kaboom(surface, position, name, force)
local speed = 0.5
if name == 'defender-capsule' or name == 'destroyer-capsule' or name == 'distractor-capsule' then
FT.flying_text(nil, surface, position, '(((Sentries Engaging Target)))', colors.sentries)
local nearest_player_unit = surface.find_nearest_enemy({position = position, max_distance = 128, force = force})
local nearest_player_unit = surface.find_nearest_enemy({ position = position, max_distance = 128, force = force })
if nearest_player_unit then
target = nearest_player_unit.position
end
@ -81,7 +81,7 @@ local function create_kaboom(surface, position, name, force)
end
---Create Tick Tack Trap
---@param surface LuaSurface
---@param surface LuaSurface
---@param position MapPosition
---@param force LuaForce|nil #optional, if nil, uses enemy force
local function tick_tack_trap(surface, position, force)
@ -113,18 +113,18 @@ local function tick_tack_trap(surface, position, force)
if t < tick_tack_count * 60 then
traps[tick][#traps[tick] + 1] = {
callback = 'create_flying_text',
params = {surface, {x = position.x, y = position.y}, tick_tacks[math.random(1, #tick_tacks)]}
params = { surface, { x = position.x, y = position.y }, tick_tacks[math.random(1, #tick_tacks)] }
}
else
if math.random(1, 10) == 1 then
traps[tick][#traps[tick] + 1] = {
callback = 'create_flying_text',
params = {surface, {x = position.x, y = position.y}, '...'}
params = { surface, { x = position.x, y = position.y }, '...' }
}
else
traps[tick][#traps[tick] + 1] = {
callback = 'create_kaboom',
params = {surface, {x = position.x, y = position.y}, kabooms[math.random(1, #kabooms)], force}
params = { surface, { x = position.x, y = position.y }, kabooms[math.random(1, #kabooms)], force }
}
end
end

View File

@ -36,6 +36,7 @@ function Public.round(num, idp)
return math.floor(num * mult + 0.5) / mult
end
--luacheck: ignore 122
function math.round(num, idp)
return Public.round(num, idp)
end