1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2024-12-28 23:06:38 +02:00

Mtn v3 - fixes

Fixed an issue whenever a player was teleported backwards when reaching the "wall" when being too far away the locomotive/collapse.
Fixed an issue when a player mined and got a reward, they get stuck in the newly placed entity.
Fixed an issue that artilleries could set their cooldown before even firing a round.
Fixed that loot chests could spawn inside a market making them unobtainable.
Adjusted most nth_tick function handlers.
Fixed an issue where wagons that spawned in the wild could be destroyed by biters/artilleries.
Reduced the "breach zone" objective to be more aligned with the rest of the other objectives.
Fixed an issue whenever a player enabled a new spell to the "mini-spell-gui" it didn't update the main slotted spell.
This commit is contained in:
Gerkiz 2024-02-28 00:19:42 +01:00
parent 4af5ac30b4
commit c23b111ebf
17 changed files with 278 additions and 115 deletions

View File

@ -163,7 +163,14 @@ local check_distance_between_player_and_locomotive = function(player)
local c_y = collapse_position.y
if p_y - t_y <= gap_between_locomotive.neg_gap then
player.teleport({position.x, locomotive.position.y + gap_between_locomotive.neg_gap + 2}, surface)
local source = {position.x, locomotive.position.y + gap_between_locomotive.neg_gap + 4}
local source_position = surface.find_non_colliding_position('character', source, 32, 1)
if source_position then
player.teleport(source_position, surface)
else
player.teleport(source, surface)
end
player.print(({'breached_wall.hinder'}), Color.warning)
if player.driving then
player.driving = false
@ -178,7 +185,14 @@ local check_distance_between_player_and_locomotive = function(player)
end
if p_y - c_y <= gap_between_locomotive.neg_gap_collapse then
player.teleport({position.x, c_y + gap_between_locomotive.neg_gap_collapse + 2}, surface)
local source = {position.x, c_y + gap_between_locomotive.neg_gap_collapse + 4}
local source_position = surface.find_non_colliding_position('character', source, 32, 1)
if source_position then
player.teleport(source_position, surface)
else
player.teleport(source, surface)
end
player.print(({'breached_wall.hinder_collapse'}), Color.warning)
if player.driving then
player.driving = false

View File

@ -13,7 +13,7 @@ Public.terrain = require 'maps.mountain_fortress_v3.terrain'
Public.generate = require 'maps.mountain_fortress_v3.generate'
Public.get_perlin = require 'maps.mountain_fortress_v3.get_perlin'
Public.gui = require 'maps.mountain_fortress_v3.gui'
Public.highscore = require 'maps.mountain_fortress_v3.highscore'
-- Public.highscore = require 'maps.mountain_fortress_v3.highscore'
Public.locomotive = require 'maps.mountain_fortress_v3.locomotive'
Public.loot = require 'maps.mountain_fortress_v3.loot'
Public.mining = require 'maps.mountain_fortress_v3.mining'

View File

@ -84,20 +84,23 @@ local reset_game =
function(data)
local this = data.this
if this.soft_reset then
Public.set_scores()
-- Highscore currently being reworked
-- Public.set_scores()
this.game_reset_tick = nil
Public.reset_map()
return
end
if this.restart then
Public.set_scores()
-- Highscore currently being reworked
-- Public.set_scores()
local message = ({'entity.reset_game'})
Server.to_discord_bold(message, true)
Server.start_scenario('Mountain_Fortress_v3')
return
end
if this.shutdown then
Public.set_scores()
-- Highscore currently being reworked
-- Public.set_scores()
local message = ({'entity.shutdown_game'})
Server.to_discord_bold(message, true)
Server.stop_scenario()
@ -491,6 +494,27 @@ local immunity_spawner =
end
)
local unstuck_player_token =
Task.register(
function(data)
local index = data.index
if not index then
return
end
local player = game.get_player(index)
if not player or not player.valid then
return
end
local surface = player.surface
local position = surface.find_non_colliding_position('character', player.position, 32, 1)
if not position then
return
end
player.teleport(position, surface)
end
)
local mining_events = {
{
function()
@ -583,6 +607,7 @@ local mining_events = {
function(entity, index)
local player = game.get_player(index)
hidden_treasure(player, entity)
Task.set_timeout_in_ticks(5, unstuck_player_token, {index = index})
end,
1024,
'Treasure Tier #1'
@ -591,6 +616,7 @@ local mining_events = {
function(entity, index)
local player = game.get_player(index)
hidden_treasure(player, entity)
Task.set_timeout_in_ticks(5, unstuck_player_token, {index = index})
end,
512,
'Treasure Tier #2'
@ -599,6 +625,7 @@ local mining_events = {
function(entity, index)
local player = game.get_player(index)
hidden_treasure(player, entity)
Task.set_timeout_in_ticks(5, unstuck_player_token, {index = index})
end,
256,
'Treasure Tier #3'
@ -607,6 +634,7 @@ local mining_events = {
function(entity, index)
local player = game.get_player(index)
hidden_treasure(player, entity)
Task.set_timeout_in_ticks(5, unstuck_player_token, {index = index})
end,
128,
'Treasure Tier #4'
@ -615,6 +643,7 @@ local mining_events = {
function(entity, index)
local player = game.get_player(index)
hidden_treasure(player, entity)
Task.set_timeout_in_ticks(5, unstuck_player_token, {index = index})
end,
64,
'Treasure Tier #5'
@ -623,6 +652,7 @@ local mining_events = {
function(entity, index)
local player = game.get_player(index)
hidden_treasure(player, entity)
Task.set_timeout_in_ticks(5, unstuck_player_token, {index = index})
end,
32,
'Treasure Tier #6'
@ -631,6 +661,7 @@ local mining_events = {
function(entity, index)
local player = game.get_player(index)
hidden_treasure(player, entity)
Task.set_timeout_in_ticks(5, unstuck_player_token, {index = index})
end,
16,
'Treasure Tier #7'
@ -650,7 +681,7 @@ local mining_events = {
e.destructible = false
Task.set_timeout_in_ticks(300, immunity_spawner, {entity = e})
Public.unstuck_player(index)
Task.set_timeout_in_ticks(5, unstuck_player_token, {index = index})
end,
512,
'Nest #1'
@ -670,7 +701,7 @@ local mining_events = {
e.destructible = false
Task.set_timeout_in_ticks(300, immunity_spawner, {entity = e})
Public.unstuck_player(index)
Task.set_timeout_in_ticks(5, unstuck_player_token, {index = index})
end,
512,
'Nest #2'
@ -715,7 +746,7 @@ local mining_events = {
local position = entity.position
local surface = entity.surface
surface.create_entity({name = 'car', position = position, force = 'player'})
Public.unstuck_player(index)
Task.set_timeout_in_ticks(5, unstuck_player_token, {index = index})
local player = game.players[index]
local msg = ({'entity.found_car', player.name})
Alert.alert_player(player, 15, msg)
@ -1296,9 +1327,16 @@ local function show_mvps(player)
end
function Public.unstuck_player(index)
if not index then
return
end
local player = game.get_player(index)
if not player or not player.valid then
return
end
local surface = player.surface
local position = surface.find_non_colliding_position('character', player.position, 32, 0.5)
local position = surface.find_non_colliding_position('character', player.position, 32, 1)
if not position then
return
end

View File

@ -282,12 +282,18 @@ local artillery_target_callback =
function(data)
local position = data.position
local entity = data.entity
local index = data.index
local art_table = this.art_table
local outpost = art_table[index]
if not entity.valid then
outpost.last_fire_tick = 0
return
end
local tx, ty = position.x, position.y
local fired_at_target = false
local pos = entity.position
local x, y = pos.x, pos.y
@ -302,6 +308,7 @@ local artillery_target_callback =
force = 'enemy',
speed = 1.5
}
fired_at_target = true
elseif entity.name ~= 'character' then
entity.surface.create_entity {
name = 'rocket',
@ -310,8 +317,13 @@ local artillery_target_callback =
force = 'enemy',
speed = 1.5
}
fired_at_target = true
end
end
if not fired_at_target then
outpost.last_fire_tick = 0
end
end
)
@ -430,8 +442,6 @@ local function do_artillery_turrets_targets()
return
end
outpost.last_fire_tick = now
local turret = turrets[1]
local area = outpost.artillery_area
local surface = turret.surface
@ -444,10 +454,12 @@ local function do_artillery_turrets_targets()
local position = turret.position
outpost.last_fire_tick = now
for i = 1, count do
local entity = entities[random(#entities)]
if entity and entity.valid then
local data = {position = position, entity = entity}
local data = {position = position, entity = entity, index = index}
Task.set_timeout_in_ticks(i * 60, artillery_target_callback, data)
end
end
@ -537,8 +549,12 @@ Public.disable_minable_and_ICW_callback =
Task.register(
function(entity)
if entity and entity.valid then
local wagons_in_the_wild = Public.get('wagons_in_the_wild')
entity.minable = false
entity.destructible = false
ICW.register_wagon(entity)
wagons_in_the_wild[entity.unit_number] = entity
end
end
)
@ -1414,6 +1430,35 @@ function Public.on_player_respawned(event)
end
end
function Public.on_player_driving_changed_state(event)
local player = game.get_player(event.player_index)
if not player or not player.valid then
return
end
local entity = event.entity
if not entity or not entity.valid then
return
end
local unit_number = entity.unit_number
local wagons_in_the_wild = Public.get('wagons_in_the_wild')
if not wagons_in_the_wild or not next(wagons_in_the_wild) then
return
end
local wagon = wagons_in_the_wild[unit_number]
if not wagon or not wagon.valid then
wagons_in_the_wild[unit_number] = nil
return
end
wagon.destructible = true
wagons_in_the_wild[unit_number] = nil
end
function Public.on_player_changed_position(event)
local active_surface_index = Public.get('active_surface_index')
if not active_surface_index then
@ -1741,12 +1786,14 @@ local on_player_left_game = Public.on_player_left_game
local on_research_finished = Public.on_research_finished
local on_player_changed_position = Public.on_player_changed_position
local on_player_respawned = Public.on_player_respawned
local on_player_driving_changed_state = Public.on_player_driving_changed_state
Event.add(de.on_player_joined_game, on_player_joined_game)
Event.add(de.on_player_left_game, on_player_left_game)
Event.add(de.on_research_finished, on_research_finished)
Event.add(de.on_player_changed_position, on_player_changed_position)
Event.add(de.on_player_respawned, on_player_respawned)
Event.add(de.on_player_driving_changed_state, on_player_driving_changed_state)
Event.on_nth_tick(10, tick)
Event.add(WD.events.on_wave_created, on_wave_created)

View File

@ -141,7 +141,17 @@ local function do_place_treasure(data)
if random(1, 6) == 1 then
e.chest = 'iron-chest'
end
Public.add_loot(surface, e.position, e.chest)
if
surface.count_entities_filtered {
area = {{e.position.x - 2, e.position.y - 2}, {e.position.x + 2, e.position.y + 2}},
name = 'market',
limit = 1
} == 0
then
Public.add_loot(surface, e.position, e.chest)
else
Public.add_loot(surface, e.position, e.chest, true)
end
end
end

View File

@ -97,24 +97,20 @@ local function on_player_respawned(event)
Functions.on_player_respawned(player)
end
local function on_tick()
local tick = game.tick
if tick % 30 == 1 then
Functions.item_transfer()
local upgrades = WPT.get('upgrades')
if upgrades.has_upgraded_health_pool then
Functions.check_entity_healths()
end
local function nth_30_tick()
Functions.item_transfer()
local upgrades = WPT.get('upgrades')
if upgrades.has_upgraded_health_pool then
Functions.check_entity_healths()
end
end
if tick % 240 == 0 then
Minimap.update_minimap()
end
local function nth_240_tick()
Minimap.update_minimap()
end
if tick % 400 == 0 then
Functions.remove_invalid_cars()
end
local function nth_400_tick()
Functions.remove_invalid_cars()
end
local function on_gui_closed(event)
@ -305,7 +301,9 @@ end
local changed_surface = Minimap.changed_surface
Event.on_init(on_init)
Event.add(defines.events.on_tick, on_tick)
Event.on_nth_tick(30, nth_30_tick)
Event.on_nth_tick(240, nth_240_tick)
Event.on_nth_tick(400, nth_400_tick)
Event.add(defines.events.on_gui_opened, on_gui_opened)
Event.add(defines.events.on_gui_closed, on_gui_closed)
Event.add(defines.events.on_player_driving_changed_state, on_player_driving_changed_state)

View File

@ -102,19 +102,16 @@ local function on_gui_click(event)
Functions.toggle_minimap(icw, event)
end
local function on_tick()
local tick = game.tick
local function nth_5_tick()
Functions.item_transfer()
end
if tick % 5 == 0 then
Functions.item_transfer()
end
local function nth_20_tick()
Functions.hazardous_debris()
end
if tick % 20 == 0 then
Functions.hazardous_debris()
end
if tick % 240 == 0 then
Functions.update_minimap()
end
local function nth_240_tick()
Functions.update_minimap()
end
local function on_init()
@ -157,7 +154,9 @@ end
local on_player_or_robot_built_tile = Functions.on_player_or_robot_built_tile
Event.on_init(on_init)
Event.on_nth_tick(5, on_tick)
Event.on_nth_tick(5, nth_5_tick)
Event.on_nth_tick(20, nth_20_tick)
Event.on_nth_tick(240, nth_240_tick)
Event.add(defines.events.on_player_driving_changed_state, on_player_driving_changed_state)
Event.add(defines.events.on_player_changed_surface, on_player_changed_surface)
Event.add(defines.events.on_entity_died, on_entity_died)

View File

@ -374,6 +374,7 @@ local function set_carriages()
for i = 1, #carriages do
local e = carriages[i]
if (e and e.valid) then
e.destructible = true
t[e.unit_number] = true
end
end

View File

@ -26,7 +26,7 @@ function Public.get_distance(position)
return difficulty
end
function Public.add_loot(surface, position, chest)
function Public.add_loot(surface, position, chest, collision)
local loot_stats = Public.get('loot_stats') -- loot_stats.normal == 48
local budget = loot_stats.normal + abs(position.y) * 1.75
budget = budget * random(25, 175) * 0.01
@ -52,7 +52,17 @@ function Public.add_loot(surface, position, chest)
local slots = c.get_inventory_size(defines.inventory.chest)
local item_stacks = LootRaffle.roll(result, slots, blacklist)
local container = surface.create_entity({name = chest, position = position, force = 'neutral', create_build_effect_smoke = false})
local new_position = position
if collision then
new_position = surface.find_non_colliding_position(chest, position, 32, 1)
if not new_position then
new_position = position
end
end
local container = surface.create_entity({name = chest, position = new_position, force = 'neutral', create_build_effect_smoke = false})
for _, item_stack in pairs(item_stacks) do
container.insert(item_stack)
end

View File

@ -157,6 +157,8 @@ function Public.reset_map()
surface.daytime = 0.45
end
surface.brightness_visual_weights = {0.92, 0.92, 0.92}
JailData.set_valid_surface(tostring(surface.name))
JailData.reset_vote_table()
@ -180,14 +182,14 @@ function Public.reset_map()
Public.init_enemy_weapon_damage()
AntiGrief.whitelist_types('tree', true)
-- AntiGrief.whitelist_types('tree', true)
AntiGrief.enable_capsule_warning(false)
AntiGrief.enable_capsule_cursor_warning(false)
AntiGrief.enable_jail(true)
AntiGrief.damage_entity_threshold(20)
AntiGrief.decon_surface_blacklist(surface.name)
AntiGrief.filtered_types_on_decon({'tree', 'simple-entity', 'fish'})
AntiGrief.set_limit_per_table(0)
AntiGrief.set_limit_per_table(2000)
PL.show_roles_in_list(true)
PL.rpg_enabled(true)
@ -265,7 +267,8 @@ function Public.reset_map()
Task.set_queue_speed(16)
Public.get_scores()
-- Highscore currently being reworked
-- Public.get_scores()
this.chunk_load_tick = game.tick + 400
this.force_chunk = true
@ -356,14 +359,16 @@ local has_the_game_ended = function()
if this.soft_reset and this.game_reset_tick == 0 then
this.game_reset_tick = nil
Public.set_scores(diff_name)
-- Highscore currently being reworked
-- Public.set_scores(diff_name)
Public.reset_map()
return
end
if this.restart and this.game_reset_tick == 0 then
if not this.announced_message then
Public.set_scores(diff_name)
-- Highscore currently being reworked
-- Public.set_scores(diff_name)
game.print(({'entity.notify_restart'}), {r = 0.22, g = 0.88, b = 0.22})
local message = 'Soft-reset is disabled! Server will restart from scenario to load new changes.'
Server.to_discord_bold(table.concat {'*** ', message, ' ***'})
@ -374,7 +379,8 @@ local has_the_game_ended = function()
end
if this.shutdown and this.game_reset_tick == 0 then
if not this.announced_message then
Public.set_scores(diff_name)
-- Highscore currently being reworked
-- Public.set_scores(diff_name)
game.print(({'entity.notify_shutdown'}), {r = 0.22, g = 0.88, b = 0.22})
local message = 'Soft-reset is disabled! Server will shutdown. Most likely because of updates.'
Server.to_discord_bold(table.concat {'*** ', message, ' ***'})
@ -482,41 +488,35 @@ local handle_changes = function()
print('Received new changes from backend.')
end
local on_tick = function()
local nth_40_tick = function()
local update_gui = Public.update_gui
local tick = game.tick
local players = game.connected_players
if tick % 40 == 0 then
for i = 1, #players do
local player = players[i]
update_gui(player)
end
lock_locomotive_positions()
is_player_valid()
is_locomotive_valid()
has_the_game_ended()
chunk_load()
for i = 1, #players do
local player = players[i]
update_gui(player)
end
lock_locomotive_positions()
is_player_valid()
is_locomotive_valid()
has_the_game_ended()
chunk_load()
end
if tick % 250 == 0 then
compare_collapse_and_train()
Public.set_spawn_position()
end
local nth_250_tick = function()
compare_collapse_and_train()
Public.set_spawn_position()
end
if tick % 1000 == 0 then
collapse_after_wave_200()
Public.set_difficulty()
Public.is_creativity_mode_on()
end
local nth_1000_tick = function()
collapse_after_wave_200()
Public.set_difficulty()
Public.is_creativity_mode_on()
end
local on_init = function()
Public.reset_map()
game.map_settings.path_finder.general_entity_collision_penalty = 10 -- Recommended value
game.map_settings.path_finder.general_entity_subsequent_collision_penalty = 3 -- Recommended value
local tooltip = {
[1] = ({'main.diff_tooltip', '500', '50%', '15%', '15%', '1', '12', '50', '10000', '100%', '15', '10'}),
[2] = ({'main.diff_tooltip', '300', '25%', '10%', '10%', '2', '10', '50', '7000', '75%', '8', '8'}),
@ -556,7 +556,9 @@ Server.on_scenario_changed(
end
)
Event.on_nth_tick(10, on_tick)
Event.on_nth_tick(40, nth_40_tick)
Event.on_nth_tick(250, nth_250_tick)
Event.on_nth_tick(1000, nth_1000_tick)
Event.on_init(on_init)
return Public

View File

@ -10,6 +10,7 @@ local types = {
}
local testing = false
local zone_settings = Public.zone_settings
local testing_loot = {
{
@ -652,37 +653,39 @@ if testing then
}
end
function Public.spawn_random_buildings(entities, p, depth)
function Public.spawn_random_buildings(entities, p)
local randomizer = random(1, #buildings)
local low = random(1, 2)
local medium = random(2, 3)
local high = 3
if abs(p.y) < depth * 1.5 then
local zone_depth = zone_settings.zone_depth
if abs(p.y) < zone_depth * 1.5 then
if random(1, 16) == 1 then
return buildings[randomizer](entities, p, medium)
else
return buildings[randomizer](entities, p, low)
end
elseif abs(p.y) < depth * 2.5 then
elseif abs(p.y) < zone_depth * 2.5 then
if random(1, 8) == 1 then
return buildings[randomizer](entities, p, medium)
else
return buildings[randomizer](entities, p, medium)
end
elseif abs(p.y) < depth * 3.5 then
elseif abs(p.y) < zone_depth * 3.5 then
if random(1, 4) == 1 then
return buildings[randomizer](entities, p, high)
else
return buildings[randomizer](entities, p, medium)
end
elseif abs(p.y) < depth * 4.5 then
elseif abs(p.y) < zone_depth * 4.5 then
if random(1, 4) == 1 then
return buildings[randomizer](entities, p, high)
else
return buildings[randomizer](entities, p, high)
end
elseif abs(p.y) < depth * 5.5 then
elseif abs(p.y) < zone_depth * 5.5 then
if random(1, 4) == 1 then
return buildings[randomizer](entities, p, high)
elseif random(1, 2) == 1 then
@ -690,10 +693,9 @@ function Public.spawn_random_buildings(entities, p, depth)
elseif random(1, 8) == 1 then
return buildings[randomizer](entities, p, high)
end
end
if abs(p.y) > depth * 5.5 then
elseif abs(p.y) > zone_depth * 5.5 then
if random(1, 32) == 1 then
return buildings[randomizer](entities, p, medium)
return buildings[randomizer](entities, p, high)
end
end
end

View File

@ -1243,7 +1243,7 @@ function Public.reset_stateful(refresh_gui, clear_buffs)
}
else
this.objectives = {
randomized_zone = scale(3, 20),
randomized_zone = scale(4, 15, 1.013),
randomized_wave = scale(200, 1000),
supplies = get_random_items(),
single_item = get_random_item(),

View File

@ -294,6 +294,8 @@ function Public.reset_main_table()
rocks_yield_ore_distance_modifier = 0.020
}
this.wagons_in_the_wild = {}
for k, _ in pairs(this.players) do
this.players[k] = {}
end

View File

@ -586,7 +586,7 @@ local function zone_14(x, y, data, _, adjusted_zones)
--Resource Spots
if smol_areas < -0.71 then
if random(1, 32) == 1 then
Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
Public.spawn_random_buildings(buildings, p)
end
end
@ -666,7 +666,7 @@ local function zone_13(x, y, data, _, adjusted_zones)
--Resource Spots
if smol_areas < -0.72 then
if random(1, 32) == 1 then
Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
Public.spawn_random_buildings(buildings, p)
end
end
@ -747,7 +747,7 @@ local function zone_12(x, y, data, void_or_lab, adjusted_zones)
--Resource Spots
if smol_areas < -0.72 then
if random(1, 32) == 1 then
Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
Public.spawn_random_buildings(buildings, p)
end
end
@ -841,7 +841,7 @@ local function zone_11(x, y, data, _, adjusted_zones)
--Resource Spots
if smol_areas < -0.72 then
if random(1, 32) == 1 then
Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
Public.spawn_random_buildings(buildings, p)
end
end
@ -940,7 +940,7 @@ local function zone_10(x, y, data, _, adjusted_zones)
--Resource Spots
if smol_areas < -0.72 then
if random(1, 32) == 1 then
Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
Public.spawn_random_buildings(buildings, p)
end
end
@ -1082,7 +1082,7 @@ local function zone_9(x, y, data, _, adjusted_zones)
--Resource Spots
if smol_areas < -0.72 then
if random(1, 32) == 1 then
Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
Public.spawn_random_buildings(buildings, p)
end
end
@ -1205,7 +1205,7 @@ local function zone_scrap_2(x, y, data, void_or_lab, adjusted_zones)
--Resource Spots
if cave_rivers < -0.72 then
if random(1, 32) == 1 then
Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
Public.spawn_random_buildings(buildings, p)
end
end
@ -1338,7 +1338,7 @@ local function zone_scrap_1(x, y, data, void_or_lab, adjusted_zones)
--Resource Spots
if smol_areas < -0.72 then
if random(1, 32) == 1 then
Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
Public.spawn_random_buildings(buildings, p)
end
end
@ -1470,7 +1470,7 @@ local function zone_7(x, y, data, void_or_lab, adjusted_zones)
--Resource Spots
if smol_areas < -0.72 then
if random(1, 32) == 1 then
Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
Public.spawn_random_buildings(buildings, p)
end
end
@ -1524,7 +1524,7 @@ local function zone_forest_2(x, y, data, void_or_lab, adjusted_zones)
if smol_areas < 0.055 and smol_areas > -0.025 then
tiles[#tiles + 1] = {name = 'deepwater-green', position = p}
if random(1, 32) == 1 then
Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
Public.spawn_random_buildings(buildings, p)
end
if random(1, 128) == 1 then
Biters.wave_defense_set_worm_raffle(abs(p.y) * worm_level_modifier)
@ -1666,7 +1666,7 @@ local function zone_5(x, y, data, void_or_lab, adjusted_zones)
if smol_areas < 0.055 and smol_areas > -0.025 then
tiles[#tiles + 1] = {name = 'deepwater-green', position = p}
if random(1, 32) == 1 then
Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
Public.spawn_random_buildings(buildings, p)
end
if random(1, 128) == 1 then
Biters.wave_defense_set_worm_raffle(abs(p.y) * worm_level_modifier)
@ -1802,7 +1802,7 @@ local function zone_4(x, y, data, void_or_lab, adjusted_zones)
if smol_areas < 0.055 and smol_areas > -0.025 then
tiles[#tiles + 1] = {name = 'deepwater-green', position = p}
if random(1, 32) == 1 then
Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
Public.spawn_random_buildings(buildings, p)
end
if random(1, 128) == 1 then
Biters.wave_defense_set_worm_raffle(abs(p.y) * worm_level_modifier)
@ -1862,7 +1862,7 @@ local function zone_3(x, y, data, void_or_lab, adjusted_zones)
if smol_areas < 0.055 and smol_areas > -0.025 then
tiles[#tiles + 1] = {name = 'deepwater-green', position = p}
if random(1, 32) == 1 then
Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
Public.spawn_random_buildings(buildings, p)
end
if random(1, 128) == 1 then
Biters.wave_defense_set_worm_raffle(abs(p.y) * worm_level_modifier)
@ -2025,7 +2025,7 @@ local function zone_2(x, y, data, void_or_lab, adjusted_zones)
if smol_areas < 0.055 and smol_areas > -0.025 then
tiles[#tiles + 1] = {name = 'deepwater-green', position = p}
if random(1, 32) == 1 then
Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
Public.spawn_random_buildings(buildings, p)
end
if random(1, 128) == 1 then
Biters.wave_defense_set_worm_raffle(abs(p.y) * worm_level_modifier)
@ -2170,7 +2170,7 @@ local function zone_forest_1(x, y, data, void_or_lab, adjusted_zones)
if smol_areas < 0.055 and smol_areas > -0.025 then
tiles[#tiles + 1] = {name = 'deepwater-green', position = p}
if random(1, 32) == 1 then
Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
Public.spawn_random_buildings(buildings, p)
end
if random(1, 128) == 1 then
Biters.wave_defense_set_worm_raffle(abs(p.y) * worm_level_modifier)
@ -2352,7 +2352,7 @@ local function zone_1(x, y, data, void_or_lab, adjusted_zones)
if smol_areas < 0.055 and smol_areas > -0.025 then
tiles[#tiles + 1] = {name = 'deepwater-green', position = p}
if random(1, 32) == 1 then
Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
Public.spawn_random_buildings(buildings, p)
end
if random(1, 32) == 1 then
Biters.wave_defense_set_worm_raffle(abs(p.y) * worm_level_modifier)
@ -2519,7 +2519,7 @@ local function starting_zone(x, y, data, void_or_lab, adjusted_zones)
if smol_areas < 0.057 and smol_areas > -0.021 then
tiles[#tiles + 1] = {name = void_or_lab, position = p}
if random(1, 32) == 1 then
Public.spawn_random_buildings(buildings, p, zone_settings.zone_depth)
Public.spawn_random_buildings(buildings, p)
end
if random(1, 128) == 1 then
Biters.wave_defense_set_worm_raffle(abs(p.y) * worm_level_modifier)

View File

@ -646,50 +646,73 @@ Gui.on_click(
toggle_state(player, character_resource_reach_distance_bonus, 'character_resource_reach_distance_bonus')
toggle_state(player, character_running_speed_modifier, 'character_running_speed_modifier')
local spell_index = nil
if conjure_gui_input and conjure_gui_input.valid and conjure_gui_input.selected_index then
local items = conjure_gui_input.items
local spell_name = items[conjure_gui_input.selected_index]
if spell_name and spell_name[1] then
rpg_t.dropdown_select_name = spell_name[1]
elseif spell_name then
spell_name = spell_name and spell_name[1] or spell_name
if spell_name then
rpg_t.dropdown_select_name = spell_name
end
rpg_t.dropdown_select_index = conjure_gui_input.selected_index
end
if spell_gui_input1 and spell_gui_input1.valid and spell_gui_input1.selected_index then
local items = spell_gui_input1.items
local spell_name = items[spell_gui_input1.selected_index]
spell_name = spell_name and spell_name[1] or spell_name
if spell_name then
if rpg_t.dropdown_select_name == rpg_t.dropdown_select_name_1 and rpg_t.dropdown_select_name_1 ~= spell_name then
rpg_t.dropdown_select_name = spell_name
rpg_t.dropdown_select_index = spell_gui_input1.selected_index
spell_index = 1
end
if spell_name and spell_name[1] then
rpg_t.dropdown_select_name_1 = spell_name[1]
elseif spell_name then
rpg_t.dropdown_select_name_1 = spell_name
end
rpg_t.dropdown_select_index_1 = spell_gui_input1.selected_index
end
if spell_gui_input2 and spell_gui_input2.valid and spell_gui_input2.selected_index then
local items = spell_gui_input2.items
local spell_name = items[spell_gui_input2.selected_index]
spell_name = spell_name and spell_name[1] or spell_name
if spell_name then
if rpg_t.dropdown_select_name == rpg_t.dropdown_select_name_2 and rpg_t.dropdown_select_name_2 ~= spell_name then
rpg_t.dropdown_select_name = spell_name
rpg_t.dropdown_select_index = spell_gui_input2.selected_index
spell_index = 2
end
if spell_name and spell_name[1] then
rpg_t.dropdown_select_name_2 = spell_name[1]
elseif spell_name then
rpg_t.dropdown_select_name_2 = spell_name
end
rpg_t.dropdown_select_index_2 = spell_gui_input2.selected_index
end
if spell_gui_input3 and spell_gui_input3.valid and spell_gui_input3.selected_index then
local items = spell_gui_input3.items
local spell_name = items[spell_gui_input3.selected_index]
if spell_name and spell_name[1] then
rpg_t.dropdown_select_name_3 = spell_name[1]
elseif spell_name then
spell_name = spell_name and spell_name[1] or spell_name
if spell_name then
if rpg_t.dropdown_select_name == rpg_t.dropdown_select_name_3 and rpg_t.dropdown_select_name_3 ~= spell_name then
rpg_t.dropdown_select_name = spell_name
rpg_t.dropdown_select_index = spell_gui_input3.selected_index
spell_index = 3
end
rpg_t.dropdown_select_name_3 = spell_name
end
rpg_t.dropdown_select_index_3 = spell_gui_input3.selected_index
end
if player.gui.screen[spell_gui_frame_name] then
Public.update_spell_gui(player, nil)
Public.update_spell_gui(player, spell_index)
end
if reset_gui_input and reset_gui_input.valid and reset_gui_input.state then

View File

@ -141,6 +141,7 @@ function Public.update_spell_gui(player, spell_index)
if rpg_t.dropdown_select_index_1 == rpg_t.dropdown_select_index then
spell_table[spell1_button_name].enabled = false
spell_table[spell1_button_name].number = 1
rpg_t.dropdown_select_name = rpg_t.dropdown_select_name_1
else
spell_table[spell1_button_name].enabled = true
spell_table[spell1_button_name].number = nil
@ -148,6 +149,7 @@ function Public.update_spell_gui(player, spell_index)
if rpg_t.dropdown_select_index_2 == rpg_t.dropdown_select_index then
spell_table[spell2_button_name].enabled = false
spell_table[spell2_button_name].number = 1
rpg_t.dropdown_select_name = rpg_t.dropdown_select_name_2
else
spell_table[spell2_button_name].enabled = true
spell_table[spell2_button_name].number = nil
@ -155,6 +157,7 @@ function Public.update_spell_gui(player, spell_index)
if rpg_t.dropdown_select_index_3 == rpg_t.dropdown_select_index then
spell_table[spell3_button_name].enabled = false
spell_table[spell3_button_name].number = 1
rpg_t.dropdown_select_name = rpg_t.dropdown_select_name_3
else
spell_table[spell3_button_name].enabled = true
spell_table[spell3_button_name].number = nil

View File

@ -495,6 +495,20 @@ Event.add(
function(event)
local player = game.get_player(event.player_index)
destroy_frame(player)
if this.activate_custom_buttons then
get_player_data(player, true)
end
end
)
Event.add(
defines.events.on_player_left_game,
function(event)
local player = game.get_player(event.player_index)
destroy_frame(player)
if this.activate_custom_buttons then
get_player_data(player, true)
end
end
)