diff --git a/maps/mountain_fortress_v2/locomotive.lua b/maps/mountain_fortress_v2/locomotive.lua index 8f2dcaaa..a0d41189 100644 --- a/maps/mountain_fortress_v2/locomotive.lua +++ b/maps/mountain_fortress_v2/locomotive.lua @@ -26,12 +26,21 @@ local function remove_acceleration() if global.locomotive_driver then global.locomotive_driver.destroy() end end +local function set_player_spawn() + if not global.locomotive_cargo then return end + if not global.locomotive_cargo.valid then return end + local position = global.locomotive_cargo.surface.find_non_colliding_position("stone-furnace", global.locomotive_cargo.position, 16, 2) + if not position then return end + game.forces.player.set_spawn_position(position, global.locomotive_cargo.surface) +end + local function tick() if not global.locomotive then return end if not global.locomotive.valid then return end if game.tick % 30 == 0 then accelerate() + if game.tick % 1800 == 0 then set_player_spawn() end else remove_acceleration() end diff --git a/maps/mountain_fortress_v2/main.lua b/maps/mountain_fortress_v2/main.lua index 20be6645..3d76986d 100644 --- a/maps/mountain_fortress_v2/main.lua +++ b/maps/mountain_fortress_v2/main.lua @@ -38,7 +38,7 @@ local starting_items = {['pistol'] = 1, ['firearm-magazine'] = 16, ['rail'] = 16 local function get_gen_settings() local map = { ["seed"] = math.random(1, 1000000), - ["water"] = 0, + ["water"] = 0.001, ["starting_area"] = 1, ["cliff_settings"] = {cliff_elevation_interval = 8, cliff_elevation_0 = 8}, ["default_enable_all_autoplace_controls"] = true, @@ -56,7 +56,8 @@ function reset_map() if not global.active_surface then global.active_surface = game.create_surface("mountain_fortress", get_gen_settings()) - else + else + game.forces.player.set_spawn_position({-2, 16}, global.active_surface) global.active_surface = soft_reset_map(global.active_surface, get_gen_settings(), starting_items) end @@ -88,12 +89,12 @@ end local function on_entity_died(event) if not event.entity.valid then return end - if event.entity == global.locomotive_cargo then + if event.entity == global.locomotive_cargo then + game.print("The cargo was destroyed!") + reset_map() for _, player in pairs(game.connected_players) do player.play_sound{path="utility/game_lost", volume_modifier=0.75} end - game.print("The cargo was destroyed!") - reset_map() --global.wave_defense.game_lost = true return end diff --git a/modules/rpg.lua b/modules/rpg.lua index ad4cda9f..25c71e71 100644 --- a/modules/rpg.lua +++ b/modules/rpg.lua @@ -137,7 +137,9 @@ local function add_gui_increase_stat(element, name, player, width) e.style.horizontal_align = "center" e.style.vertical_align = "center" e.style.padding = 0 - e.style.margin = 0 + e.style.margin = 0 + e.tooltip = "Rightclick to allocate 5 points." + return e end @@ -446,6 +448,18 @@ local function on_gui_click(event) local index = element.name local player = game.players[event.player_index] if not global.rpg[player.index][index] then return end + + if event.button == defines.mouse_button_type.right then + for a = 1, 5, 1 do + if global.rpg[player.index].points_to_distribute <= 0 then draw_gui(player) return end + global.rpg[player.index].points_to_distribute = global.rpg[player.index].points_to_distribute - 1 + global.rpg[player.index][index] = global.rpg[player.index][index] + 1 + update_player_stats(player) + end + draw_gui(player) + return + end + if global.rpg[player.index].points_to_distribute <= 0 then draw_gui(player) return end global.rpg[player.index].points_to_distribute = global.rpg[player.index].points_to_distribute - 1 global.rpg[player.index][index] = global.rpg[player.index][index] + 1 diff --git a/modules/wave_defense.lua b/modules/wave_defense.lua index 9dc0d655..11b4110e 100644 --- a/modules/wave_defense.lua +++ b/modules/wave_defense.lua @@ -243,7 +243,7 @@ function reset_wave_defense() active_biter_count = 0, spawn_position = {x = 0, y = 48}, last_wave = game.tick, - next_wave = game.tick + 36 * 10, + next_wave = game.tick + 3600 * 5, wave_interval = 1800, wave_number = 0, game_lost = false,