1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2024-12-30 23:17:53 +02:00

minimap fixes, fish map scaling, fixes

This commit is contained in:
hanakocz 2020-06-17 07:53:54 +02:00
parent 38a721f8f1
commit ecd9014144
11 changed files with 100 additions and 40 deletions

View File

@ -216,7 +216,10 @@ gui_planet_7=Overstay applies after jump __1__
gui_overstayed=Overstayed!
gui_not_overstayed=Avoided overstay.
minimap=Outside View
minimap_button_tooltip=Open or close Outside View window.
minimap_tooltip=LMB: Increase zoom level.\nRMB: Decrease zoom level.\nMMB: Toggle camera size.\nMap button on top to hide/show
map_on=Automatically show map ON
map_off=OFF
[rocks_yield_ore_veins]

View File

@ -217,7 +217,10 @@ gui_planet_7=засидеться активен после прыжка __1__
gui_overstayed=засидеться!
gui_not_overstayed=засидеться niet.
minimap=Outside View
minimap_button_tooltip=Open or close Outside View window.
minimap_tooltip=LMB: Increase zoom level.\nRMB: Decrease zoom level.\nMMB: Toggle camera size.\nMap button on top to hide/show
map_on=Automatically show map ON
map_off=OFF
train_market=Рынок
train_repair_chest=Ремонтный сундук

View File

@ -188,7 +188,9 @@ function Public.upgrades_coin_cost_difficulty_scaling(difficulty) return difficu
function Public.flamers_nerfs_size(jumps, difficulty) return 0.02 * jumps * difficulty_sloped(difficulty, 1/2) end
function Public.max_new_attack_group_size(difficulty) return math_max(200,math_floor(120 * difficulty_sloped(difficulty, 1))) end
function Public.max_new_attack_group_size(difficulty) return math_min(200,math_floor(120 * difficulty_sloped(difficulty, 1/2))) end
function Public.fish_market_base_modifier(difficulty) return math_floor(500 / difficulty_sloped(difficulty, 1/2)) end
function Public.evoramp50_multiplier_per_10s(difficulty) return (1 + 1/600 * difficulty_sloped(difficulty, 1)) end
@ -311,7 +313,7 @@ function Public.treasure_quantity_difficulty_scaling(difficulty) return difficul
function Public.Base_ore_loot_yield(jumps, scrap)
if scrap then
return 5 + 1 * jumps
return 4 + 0.5 * jumps
else
return 15 + 3 * jumps
end

View File

@ -117,6 +117,7 @@ function Public_chrono.objective_died()
for i = 1, 3, 1 do
surface.create_entity({name = "big-artillery-explosion", position = objective.locomotive_cargo[i].position})
objective.locomotive_cargo[i].destroy()
objective.locomotive_cargo[i] = nil
end
for i = 1, #objective.comfychests,1 do
--surface.create_entity({name = "big-artillery-explosion", position = objective.comfychests[i].position})

View File

@ -395,7 +395,7 @@ local function talks(nearby_characters)
local arg2 = symbols[math_random(1, #symbols)]
local randomphrase = texts["convo_starters"][math_random(1, #texts["convo_starters"])]
str = str .. string.format(randomphrase, arg1, arg2)
if math_random(1,40) == 1 and objective.planet[1].type.id ~= 10 and global.chronojumps >= Balance.jumps_until_overstay_is_on(Difficulty.get().difficulty_vote_value) then
if math_random(1,40) == 1 and objective.planet[1].type.id ~= 10 and objective.chronojumps >= Balance.jumps_until_overstay_is_on(Difficulty.get().difficulty_vote_value) then
local time_until_overstay = (objective.chronochargesneeded * 0.75 / objective.passive_chronocharge_rate - objective.passivetimer)
local time_until_evo = (objective.chronochargesneeded * 0.5 / objective.passive_chronocharge_rate - objective.passivetimer)
if time_until_evo < 0 and time_until_overstay > 0 then

View File

@ -401,9 +401,11 @@ function Public_gui.on_gui_click(event)
planet_gui(player)
return
elseif event.element.name == "minimap_button" then
Minimap.minimap(player)
Minimap.minimap(player, false)
elseif event.element.name =="icw_map" or event.element.name == "icw_map_frame" then
Minimap.toggle_minimap(event)
elseif event.element.name == "switch_auto_map" then
Minimap.toggle_auto(player)
end
if event.element.type ~= "button" and event.element.type ~= "sprite-button" then return end

View File

@ -453,23 +453,27 @@ function Public.enter_cargo_wagon(player, vehicle)
local objective = Chrono_table.get_table()
if not vehicle then log("no vehicle") return end
if not vehicle.valid then log("vehicle invalid") return end
if not objective.locomotive then log("locomotive missing") return end
if not objective.locomotive.valid then log("locomotive invalid") return end
if not game.surfaces["cargo_wagon"] then Public.create_wagon_room() end
local wagon_surface = game.surfaces["cargo_wagon"]
for i = 1, 3, 1 do
if not objective.locomotive_cargo[i] then log("no cargo") return end
if not objective.locomotive_cargo[i].valid then log("cargo invalid") return end
if vehicle == objective.locomotive_cargo[i] then
local x_vector = vehicle.position.x - player.position.x
local position
if x_vector > 0 then
position = {wagon_surface.map_gen_settings.width * -0.5, -128 + 128 * (i - 1)}
else
position = {wagon_surface.map_gen_settings.width * 0.5, -128 + 128 * (i - 1)}
end
player.teleport(wagon_surface.find_non_colliding_position("character", position, 128, 0.5), wagon_surface)
break
end
end
if vehicle.type == "cargo-wagon" then
for i = 1, 3, 1 do
if not objective.locomotive_cargo[i] then log("no cargo") return end
if not objective.locomotive_cargo[i].valid then log("cargo invalid") return end
if vehicle == objective.locomotive_cargo[i] then
local x_vector = vehicle.position.x - player.position.x
local position
if x_vector > 0 then
position = {wagon_surface.map_gen_settings.width * -0.5, -128 + 128 * (i - 1)}
else
position = {wagon_surface.map_gen_settings.width * 0.5, -128 + 128 * (i - 1)}
end
player.teleport(wagon_surface.find_non_colliding_position("character", position, 128, 0.5), wagon_surface)
break
end
end
end
if player.surface.name == "cargo_wagon" and vehicle.type == "car" then
if objective.flame_boots then
objective.flame_boots[player.index] = {fuel = 1, steps = {}}
@ -481,8 +485,13 @@ function Public.enter_cargo_wagon(player, vehicle)
break
end
end
local surface = objective.locomotive_cargo[1].surface
local position = {x = objective.locomotive_cargo[((used_exit - 1) % 3) + 1].position.x + math_sgn(used_exit - 3.5) * 2, y = objective.locomotive_cargo[((used_exit - 1) % 3) + 1].position.y}
local surface = objective.locomotive.surface
local position
if used_exit == 0 or objective.game_lost then
position = game.forces.player.get_spawn_position(surface)
else
position = {x = objective.locomotive_cargo[((used_exit - 1) % 3) + 1].position.x + math_sgn(used_exit - 3.5) * 2, y = objective.locomotive_cargo[((used_exit - 1) % 3) + 1].position.y}
end
local position2 = surface.find_non_colliding_position("character", position, 128, 0.5)
if not position2 then return end
player.teleport(position2, surface)

View File

@ -153,7 +153,7 @@ local function reset_map()
generate_overworld(surface, planet)
Chrono.restart_settings()
for _,player in pairs(game.players) do
Minimap.minimap(player)
Minimap.minimap(player, true)
end
game.forces.player.set_spawn_position({12, 10}, surface)
@ -268,7 +268,6 @@ function Public.chronojump(choice)
objective.lab_cells = {}
objective.active_surface_index = game.create_surface("chronosphere" .. objective.chronojumps, Chrono.get_map_gen_settings()).index
local surface = game.surfaces[objective.active_surface_index]
--log("seed of new surface: " .. surface.map_gen_settings.seed)
local planet = objective.planet
if choice then
Planets.determine_planet(choice)
@ -283,6 +282,7 @@ function Public.chronojump(choice)
game.delete_surface(oldsurface)
Chrono.post_jump()
Event_functions.flamer_nerfs()
Minimap.update_minimap()
--
local pos = objective.locomotive.position or {x=0,y=0}
@ -534,7 +534,6 @@ local function on_init()
end
reset_map()
--if game.surfaces["nauvis"] then game.delete_surface(game.surfaces["nauvis"]) end
end
-- local function on_load()
@ -647,7 +646,7 @@ local function on_player_driving_changed_state(event)
local player = game.players[event.player_index]
local vehicle = event.entity
Locomotive.enter_cargo_wagon(player, vehicle)
Minimap.minimap(player)
Minimap.minimap(player, true)
end
-- function deny_building(event)

View File

@ -3,7 +3,7 @@ local Public = {}
local Chrono_table = require 'maps.chronosphere.table'
local function create_button(player)
local button = player.gui.top.add({ type = "sprite-button", name = "minimap_button", sprite = "utility/map"})
local button = player.gui.top.add({ type = "sprite-button", name = "minimap_button", sprite = "utility/map", tooltip = {"chronosphere.minimap_button_tooltip"}})
button.visible = false
end
@ -28,27 +28,52 @@ local function get_player_data(player)
surface = objective.active_surface_index,
zoom = 0.30,
map_size = 360,
auto_map = true
}
return objective.icw.players[player.index]
end
function Public.toggle_auto(player)
local player_data = get_player_data(player)
local objective = Chrono_table.get_table()
local switch = player.gui.screen.icw_map_frame["switch_auto_map"]
if switch.switch_state == "left" then
objective.icw.players[player.index].auto_map = true
elseif switch.switch_state == "right" then
objective.icw.players[player.index].auto_map = false
end
end
local function kill_minimap(player)
local element = player.gui.screen.icw_map_frame
if element then element.destroy() end
--if element then element.destroy() end
if element.visible then element.visible = false end
end
local function kill_frame(player)
if player.gui.screen.icw_map_frame then
local element = player.gui.screen.icw_map_frame.icw_map
element.destroy()
end
end
local function draw_minimap(player)
local objective = Chrono_table.get_table()
local surface = game.surfaces[objective.active_surface_index]
local position = objective.locomotive.position
local player_data = get_player_data(player)
local frame = player.gui.screen.icw_map_frame
if not frame then
frame = player.gui.screen.add({ type = "frame", name = "icw_map_frame", caption = {"chronosphere.minimap"}})
frame = player.gui.screen.add({ type = "frame", direction = "vertical", name = "icw_map_frame", caption = {"chronosphere.minimap"}})
frame.location = {x = 10, y = 45}
switch_state = "right"
if player_data.auto_map then switch_state = "left" end
frame.add({type = "switch", name = "switch_auto_map", allow_none_state = false, left_label_caption = {"chronosphere.map_on"}, right_label_caption = {"chronosphere.map_off"}})
end
frame.visible = true
local element = frame["icw_map"]
if not element then
local player_data = get_player_data(player)
element = player.gui.screen.icw_map_frame.add({
type = "camera",
name = "icw_map",
@ -65,23 +90,33 @@ local function draw_minimap(player)
element.position = position
end
function Public.minimap(player)
if player.gui.screen["icw_map_frame"] then
function Public.minimap(player, autoaction)
local player_data = get_player_data(player)
local frame = player.gui.screen["icw_map_frame"]
if frame and frame.visible then
kill_minimap(player)
else
if player.surface.name == "cargo_wagon" then
draw_minimap(player)
if autoaction then
if player_data.auto_map then
draw_minimap(player)
end
else
draw_minimap(player)
end
end
end
end
function Public.update_minimap()
local objective = Chrono_table.get_table()
for k, player in pairs(game.connected_players) do
if player.character and player.character.valid then
if player.surface.name == "cargo_wagon" and player.gui.screen.icw_map then
Public.draw_minimap(player)
--if player.character and player.character.valid then
if player.surface.name == "cargo_wagon" and player.gui.screen.icw_map_frame then
kill_frame(player)
draw_minimap(player)
end
end
--end
end
end

View File

@ -3,6 +3,8 @@
local Chrono_table = require 'maps.chronosphere.table'
local Ores = require "maps.chronosphere.ores"
local Specials = require "maps.chronosphere.terrain_specials"
local Difficulty = require 'modules.difficulty_vote'
local Balance = require "maps.chronosphere.balance"
local math_random = math.random
local math_floor = math.floor
local math_min = math.min
@ -596,6 +598,9 @@ local function process_fish_position(p, seed, tiles, entities, treasure, planet)
local body_circle_center_1 = {x = body_center_position.x, y = body_center_position.y - body_spacing}
local body_circle_center_2 = {x = body_center_position.x, y = body_center_position.y + body_spacing}
local difficulty = Difficulty.get().difficulty_vote_value
local biters = Balance.fish_market_base_modifier(difficulty)
--local fin_radius = 200
--local square_fin_radius = fin_radius ^ 2
--local fin_circle_center_1 = {x = -600, y = 0}
@ -618,7 +623,7 @@ local function process_fish_position(p, seed, tiles, entities, treasure, planet)
tiles[#tiles + 1] = {name = "water", position = p}
else
tiles[#tiles + 1] = {name = "grass-1", position = p}
local roll = math_random(1,500)
local roll = math_random(1, biters)
if roll < 4 and p.x > -800 then
entities[#entities + 1] = {name = spawner_raffle[math_random(1, 4)], position = p}
elseif roll == 5 and p.x > -800 then
@ -635,7 +640,7 @@ local function process_fish_position(p, seed, tiles, entities, treasure, planet)
tiles[#tiles + 1] = {name = "out-of-map", position = p}
else --rest
tiles[#tiles + 1 ] = {name = "grass-1", position = p}
local roll = math_random(1,500)
local roll = math_random(1, biters)
if roll < 4 and p.x > -800 then
entities[#entities + 1] = {name = spawner_raffle[math_random(1, 4)], position = p}
elseif roll == 5 and p.x > -800 then
@ -651,7 +656,7 @@ local function process_fish_position(p, seed, tiles, entities, treasure, planet)
else
if p.x > 800 and math_abs(p.y) < p.x - 800 then --tail
tiles[#tiles + 1 ] = {name = "grass-1", position = p}
local roll = math_random(1,500)
local roll = math_random(1, biters)
if roll < 4 and p.x > -800 then
entities[#entities + 1] = {name = spawner_raffle[math_random(1, 4)], position = p}
elseif roll == 5 and p.x > -800 then

View File

@ -29,7 +29,8 @@ function Public_tick.realtime_events()
if objective.jump_countdown_start_time == -1 and objective.passivetimer == math_floor(objective.chronochargesneeded * 0.50 / objective.passive_chronocharge_rate) and objective.chronojumps >= Balance.jumps_until_overstay_is_on(Difficulty.get().difficulty_vote_value) then
game.print({"chronosphere.message_rampup50"}, {r=0.98, g=0.66, b=0.22})
end
if objective.game_lost then return end
if objective.jump_countdown_start_time ~= -1 then
if objective.passivetimer == objective.jump_countdown_start_time + 180 - 60 then
game.print({"chronosphere.message_jump60"}, {r=0.98, g=0.66, b=0.22})