1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-02-15 13:53:09 +02:00

Merge pull request #55 from ComfyFactory/conditionals_removals

removal of conditionals and fixes
This commit is contained in:
Gerkiz 2021-05-15 16:03:21 +02:00 committed by GitHub
commit c9bff24fad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 105 additions and 476 deletions

View File

@ -1,44 +0,0 @@
local Public = {}
local get_noise = require 'utils.get_noise'
local math_abs = math.abs
local math_round = math.round
function Public.set_daytime(surface, tick, static)
if static then
surface.brightness_visual_weights = {
a = 1,
b = 1,
g = 1,
r = 0.57314002513885498
}
surface.daytime = 0.55
surface.freeze_daytime = true
return
end
local noise = get_noise('n1', {x = tick * 1, y = 0}, surface.map_gen_settings.seed)
local daytime = math_abs(math_round(noise, 5))
local brightness_modifier = 1.55 - daytime * 1.5
if brightness_modifier < 0 then
brightness_modifier = 0
end
if brightness_modifier > 1 then
brightness_modifier = 1
end
if noise > 0 then
surface.brightness_visual_weights = {1, brightness_modifier, 1}
else
surface.brightness_visual_weights = {brightness_modifier, 1, 1}
end
if daytime > 0.55 then
daytime = 0.55
end
surface.daytime = daytime
surface.freeze_daytime = true
end
return Public

View File

@ -8,7 +8,6 @@ local Alert = require 'utils.alert'
local Event = require 'utils.event'
local Task = require 'utils.task'
local Token = require 'utils.token'
-- local BM = require 'maps.mountain_fortress_v3.blood_moon'
local raise_event = script.raise_event
local floor = math.floor
@ -50,10 +49,7 @@ local spidertron_unlocked =
Alert.alert_all_players(30, message, nil, 'achievement/tech-maniac', 0.1)
end
)
--[[
local calculate_hp = function(zone)
return 2 + 0.2 * zone - 1 * floor(zone / 20)
end ]]
local first_player_to_zone =
Token.register(
function(data)
@ -179,7 +175,6 @@ local function distance(player)
WPT.set().breached_wall = breached_wall + 1
WPT.set().placed_trains_in_zone.placed = 0
WPT.set().biters.amount = 0
WPT.set('blood_moon', false)
WPT.set().placed_trains_in_zone.randomized = false
WPT.set().placed_trains_in_zone.positions = {}
raise_event(Balance.events.breached_wall, {})
@ -199,25 +194,6 @@ local function distance(player)
end
end
--[[ if breached_wall % 2 == 0 then
local blood_moon = WPT.get('blood_moon')
local t = game.tick
local surface = player.surface
if not blood_moon then
BM.set_daytime(surface, t, true)
WPT.set('blood_moon', true)
end
else
local surface = player.surface
surface.brightness_visual_weights = {
a = 1,
b = 0,
g = 0,
r = 0
}
surface.daytime = 0.7
surface.freeze_daytime = false
end ]]
local data = {
player = player,
breached_wall = breached_wall
@ -241,8 +217,6 @@ local function distance(player)
RPG_Settings.set_value_to_player(index, 'bonus', bonus + 1)
Functions.gain_xp(player, bonus_xp_on_join * bonus)
local message = ({'breached_wall.wall_breached', bonus})
Alert.alert_player_warning(player, 10, message)
return
end
end

View File

@ -20,8 +20,8 @@ local Score = require 'comfy_panel.score'
local Token = require 'utils.token'
-- local HS = require 'maps.mountain_fortress_v3.highscore'
local Discord = require 'utils.discord'
local Core = require "utils.core"
local Diff = require "modules.difficulty_vote_by_amount"
local Core = require 'utils.core'
local Diff = require 'modules.difficulty_vote_by_amount'
local format_number = require 'util'.format_number
-- tables
@ -190,10 +190,6 @@ local function check_health()
return
end
local cargo_health = 600
local modded = is_game_modded()
if modded then
cargo_health = 750
end
if entity.type == 'locomotive' then
entity.health = 1000 * m
else
@ -292,7 +288,7 @@ local function set_train_final_health(final_damage_amount)
local health_text = WPT.get('health_text')
rendering.set_text(health_text, 'HP: ' .. locomotive_health .. ' / ' .. locomotive_max_health)
rendering.set_text(health_text, 'HP: ' .. round(locomotive_health) .. ' / ' .. round(locomotive_max_health))
end
local function protect_entities(event)
@ -656,23 +652,9 @@ local mining_events = {
local ent_to_create = {'biter-spawner', 'spitter-spawner'}
if is_mod_loaded('bobenemies') then
ent_to_create = {'bob-biter-spawner', 'bob-spitter-spawner'}
end
local position = entity.position
local surface = entity.surface
local e = surface.create_entity({name = ent_to_create[random(1, #ent_to_create)], position = position, force = 'enemy'})
if is_mod_loaded('Krastorio2') then
local tiles = {}
for y = 3 * -2, 3 * 2, 1 do
for x = 3 * -2, 3 * 2, 1 do
local p = {y = position.y + y, x = position.x + x}
tiles[#tiles + 1] = {name = 'kr-creep', position = p}
end
end
entity.surface.set_tiles(tiles, true)
end
e.destructible = false
Task.set_timeout_in_ticks(300, immunity_spawner, {entity = e})
@ -690,23 +672,9 @@ local mining_events = {
local ent_to_create = {'biter-spawner', 'spitter-spawner'}
if is_mod_loaded('bobenemies') then
ent_to_create = {'bob-biter-spawner', 'bob-spitter-spawner'}
end
local position = entity.position
local surface = entity.surface
local e = surface.create_entity({name = ent_to_create[random(1, #ent_to_create)], position = position, force = 'enemy'})
if is_mod_loaded('Krastorio2') then
local tiles = {}
for y = 3 * -2, 3 * 2, 1 do
for x = 3 * -2, 3 * 2, 1 do
local p = {y = position.y + y, x = position.x + x}
tiles[#tiles + 1] = {name = 'kr-creep', position = p}
end
end
entity.surface.set_tiles(tiles, true)
end
e.destructible = false
Task.set_timeout_in_ticks(300, immunity_spawner, {entity = e})
@ -1207,20 +1175,37 @@ local function show_mvps(player)
local time_played = Core.format_time(game.ticks_played)
local total_players = #game.players
local pickaxe_tiers = WPT.pickaxe_upgrades
local tier = WPT.get("pickaxe_tier")
local tier = WPT.get('pickaxe_tier')
local pick_tier = pickaxe_tiers[tier]
local server_name = Server.check_server_name('Mtn Fortress')
if server_name then
Server.to_discord_named_embed(send_ping_to_channel, '**Statistics!**\\n\\n'
.. 'Time played: '..time_played..'\\n'
.. 'Game Difficulty: '..diff.name..'\\n'
.. 'Highest wave: '..format_number(wave, true)..'\\n'
.. 'Total connected players: '..total_players..'\\n'
.. 'Threat: '..format_number(threat, true)..'\\n'
.. 'Pickaxe Upgrade: '..pick_tier..' (' ..tier.. ')\\n'
.. 'Collapse Speed: '..collapse_speed..'\\n'
.. 'Collapse Amount: '..collapse_amount..'\\n'
Server.to_discord_named_embed(
send_ping_to_channel,
'**Statistics!**\\n\\n' ..
'Time played: ' ..
time_played ..
'\\n' ..
'Game Difficulty: ' ..
diff.name ..
'\\n' ..
'Highest wave: ' ..
format_number(wave, true) ..
'\\n' ..
'Total connected players: ' ..
total_players ..
'\\n' ..
'Threat: ' ..
format_number(threat, true) ..
'\\n' ..
'Pickaxe Upgrade: ' ..
pick_tier ..
' (' ..
tier ..
')\\n' ..
'Collapse Speed: ' ..
collapse_speed ..
'\\n' .. 'Collapse Amount: ' .. collapse_amount .. '\\n'
)
WPT.set('sent_to_discord', true)
end
@ -1307,7 +1292,7 @@ function Public.loco_died()
this.locomotive_health = 0
this.locomotive.color = {0.49, 0, 255, 1}
rendering.set_text(this.health_text, 'HP: ' .. this.locomotive_health .. ' / ' .. this.locomotive_max_health)
rendering.set_text(this.health_text, 'HP: ' .. round(this.locomotive_health) .. ' / ' .. round(this.locomotive_max_health))
wave_defense_table.game_lost = true
wave_defense_table.target = nil
local msg = defeated_messages[random(1, #defeated_messages)]

View File

@ -696,7 +696,6 @@ function Public.remove_offline_players()
local player_inv = {}
local items = {}
if #offline_players > 0 then
local later = {}
for i = 1, #offline_players, 1 do
if offline_players[i] and game.players[offline_players[i].index] and game.players[offline_players[i].index].connected then
offline_players[i] = nil
@ -752,19 +751,10 @@ function Public.remove_offline_players()
end
end
offline_players[i] = nil
else
later[#later + 1] = offline_players[i]
break
end
end
end
for k, _ in pairs(offline_players) do
offline_players[k] = nil
end
if #later > 0 then
for i = 1, #later, 1 do
offline_players[#offline_players + 1] = later[i]
end
end
end
end
@ -853,11 +843,6 @@ function Public.render_direction(surface)
text = 'Welcome to Wintery Mountain Fortress v3!'
end
local modded = is_game_modded()
if modded then
text = 'Welcome to Modded Mountain Fortress v3!'
end
if counter then
rendering.draw_text {
text = text .. '\nRun: ' .. counter,
@ -989,13 +974,8 @@ function Public.boost_difficulty()
WPT.set('coin_amount', 1)
WPT.set('upgrades').flame_turret.limit = 12
WPT.set('upgrades').landmine.limit = 50
if is_game_modded() then
WPT.set('locomotive_health', 20000)
WPT.set('locomotive_max_health', 20000)
else
WPT.set('locomotive_health', 10000)
WPT.set('locomotive_max_health', 10000)
end
WPT.set('locomotive_health', 10000)
WPT.set('locomotive_max_health', 10000)
WPT.set('bonus_xp_on_join', 500)
WD.set('next_wave', game.tick + 3600 * 15)
WPT.set('spidertron_unlocked_at_zone', 10)
@ -1010,13 +990,8 @@ function Public.boost_difficulty()
WPT.set('coin_amount', 2)
WPT.set('upgrades').flame_turret.limit = 10
WPT.set('upgrades').landmine.limit = 50
if is_game_modded() then
WPT.set('locomotive_health', 12000)
WPT.set('locomotive_max_health', 12000)
else
WPT.set('locomotive_health', 7000)
WPT.set('locomotive_max_health', 7000)
end
WPT.set('locomotive_health', 7000)
WPT.set('locomotive_max_health', 7000)
WPT.set('bonus_xp_on_join', 300)
WD.set('next_wave', game.tick + 3600 * 8)
WPT.set('spidertron_unlocked_at_zone', 8)
@ -1030,13 +1005,8 @@ function Public.boost_difficulty()
WPT.set('coin_amount', 4)
WPT.set('upgrades').flame_turret.limit = 3
WPT.set('upgrades').landmine.limit = 10
if is_game_modded() then
WPT.set('locomotive_health', 8000)
WPT.set('locomotive_max_health', 8000)
else
WPT.set('locomotive_health', 5000)
WPT.set('locomotive_max_health', 5000)
end
WPT.set('locomotive_health', 5000)
WPT.set('locomotive_max_health', 5000)
WPT.set('bonus_xp_on_join', 50)
WD.set('next_wave', game.tick + 3600 * 5)
WPT.set('spidertron_unlocked_at_zone', 6)
@ -1316,9 +1286,6 @@ local disable_recipes = function(force)
force.recipes['locomotive'].enabled = false
force.recipes['pistol'].enabled = false
force.recipes['spidertron-remote'].enabled = false
if is_mod_loaded('Krastorio2') then
force.recipes['kr-advanced-tank'].enabled = false
end
end
function Public.disable_tech()
@ -1331,12 +1298,7 @@ function Public.disable_tech()
force.technologies['optics'].researched = true
force.technologies['railway'].researched = true
force.technologies['land-mine'].enabled = false
if is_mod_loaded('Krastorio2') then
force.technologies['kr-nuclear-locomotive'].enabled = false
force.technologies['kr-nuclear-locomotive'].researched = false
force.technologies['kr-advanced-tank'].enabled = false
force.technologies['kr-advanced-tank'].researched = false
end
disable_recipes(force)
end
@ -1372,16 +1334,9 @@ function Public.on_research_finished(event)
end
end
-- if is_mod_loaded('Krastorio2') then
-- Public.firearm_magazine_ammo = {name = 'rifle-magazine', count = 200}
-- Public.piercing_rounds_magazine_ammo = {name = 'armor-piercing-rifle-magazine', count = 200}
-- Public.uranium_rounds_magazine_ammo = {name = 'uranium-rifle-magazine', count = 200}
-- else
Public.firearm_magazine_ammo = {name = 'firearm-magazine', count = 200}
Public.piercing_rounds_magazine_ammo = {name = 'piercing-rounds-magazine', count = 200}
Public.uranium_rounds_magazine_ammo = {name = 'uranium-rounds-magazine', count = 200}
-- end
Public.light_oil_ammo = {name = 'light-oil', amount = 100}
Public.artillery_shell_ammo = {name = 'artillery-shell', count = 15}
Public.laser_turrent_power_source = {buffer_size = 2400000, power_production = 40000}

View File

@ -367,9 +367,6 @@ function Public.get_scores()
if not secs then
return
else
if is_game_modded() then
score_key = 'mountain_fortress_v3_scores_modded'
end
try_get_data(score_dataset, score_key, get_scores)
end
end
@ -379,9 +376,6 @@ function Public.set_scores(difficulty)
if not secs then
return
else
if is_game_modded() then
score_key = 'mountain_fortress_v3_scores_modded'
end
write_additional_stats(score_key, difficulty)
end
end

View File

@ -35,12 +35,6 @@ local reconstruct_all_trains =
local function get_tile_name()
local main_tile_name = 'black-refined-concrete'
local modded = is_game_modded()
if modded then
if game.active_mods['Krastorio2'] then
main_tile_name = 'kr-black-reinforced-plate'
end
end
return main_tile_name
end
@ -389,9 +383,11 @@ local function kill_wagon_doors(icw, wagon)
return
end
for k, e in pairs(wagon.doors) do
icw.doors[e.unit_number] = nil
e.destroy()
wagon.doors[k] = nil
if e and e.valid then
icw.doors[e.unit_number] = nil
e.destroy()
wagon.doors[k] = nil
end
end
end

View File

@ -37,21 +37,12 @@ function Public.reset()
['locomotive'] = true
}
if is_game_modded() then
this.wagon_areas = {
['cargo-wagon'] = {left_top = {x = -45, y = 0}, right_bottom = {x = 45, y = 100}},
['artillery-wagon'] = {left_top = {x = -45, y = 0}, right_bottom = {x = 45, y = 100}},
['fluid-wagon'] = {left_top = {x = -45, y = 0}, right_bottom = {x = 45, y = 100}},
['locomotive'] = {left_top = {x = -45, y = 0}, right_bottom = {x = 45, y = 100}}
}
else
this.wagon_areas = {
['cargo-wagon'] = {left_top = {x = -30, y = 0}, right_bottom = {x = 30, y = 80}},
['artillery-wagon'] = {left_top = {x = -30, y = 0}, right_bottom = {x = 30, y = 80}},
['fluid-wagon'] = {left_top = {x = -30, y = 0}, right_bottom = {x = 30, y = 80}},
['locomotive'] = {left_top = {x = -30, y = 0}, right_bottom = {x = 30, y = 80}}
}
end
this.wagon_areas = {
['cargo-wagon'] = {left_top = {x = -30, y = 0}, right_bottom = {x = 30, y = 80}},
['artillery-wagon'] = {left_top = {x = -30, y = 0}, right_bottom = {x = 30, y = 80}},
['fluid-wagon'] = {left_top = {x = -30, y = 0}, right_bottom = {x = 30, y = 80}},
['locomotive'] = {left_top = {x = -30, y = 0}, right_bottom = {x = 30, y = 80}}
}
end
function Public.get(key)

View File

@ -464,7 +464,7 @@ local function set_locomotive_health()
if locomotive_health > locomotive_max_health then
WPT.set('locomotive_health', locomotive_max_health)
end
rendering.set_text(WPT.get('health_text'), 'HP: ' .. locomotive_health .. ' / ' .. locomotive_max_health)
rendering.set_text(WPT.get('health_text'), 'HP: ' .. round(locomotive_health) .. ' / ' .. round(locomotive_max_health))
WPT.set('carriages', locomotive.train.carriages)
local carriages = WPT.get('carriages')
if carriages then
@ -474,10 +474,6 @@ local function set_locomotive_health()
return
end
local cargo_health = 600
local modded = is_game_modded()
if modded then
cargo_health = 750
end
if entity.type == 'locomotive' then
entity.health = 1000 * m
else
@ -1094,10 +1090,6 @@ local function gui_click(event)
return
end
local cargo_health = 600
local modded = is_game_modded()
if modded then
cargo_health = 750
end
if entity.type == 'locomotive' then
entity.health = 1000 * m
else
@ -1108,7 +1100,7 @@ local function gui_click(event)
this.train_upgrades = this.train_upgrades + item.stack
this.health_upgrades = this.health_upgrades + item.stack
rendering.set_text(this.health_text, 'HP: ' .. this.locomotive_health .. ' / ' .. this.locomotive_max_health)
rendering.set_text(this.health_text, 'HP: ' .. round(this.locomotive_health) .. ' / ' .. round(this.locomotive_max_health))
redraw_market_items(data.item_frame, player, data.search_text)
redraw_coins_left(data.coins_left, player)
@ -1359,9 +1351,6 @@ local function spawn_biter()
'big-spitter',
'behemoth-spitter'
}
if is_mod_loaded('bobenemies') then
biters = {'bob-leviathan-biter', 'bob-behemoth-biter', 'bob-huge-explosive-spitter'}
end
local size_of = #biters
@ -2004,7 +1993,7 @@ function Public.locomotive_spawn(surface, position)
position = position
}
Task.set_timeout_in_ticks(300, set_loco_tiles, data)
Task.set_timeout_in_ticks(400, set_loco_tiles, data)
for y = -1, 0, 0.05 do
local scale = random(50, 100) * 0.01
@ -2182,58 +2171,27 @@ function Public.get_items()
}
if game.forces.player.technologies['logistics'].researched then
if is_mod_loaded('Krastorio2') then
main_market_items['kr-loader'] = {
stack = 1,
value = 'coin',
price = 128,
tooltip = ({'entity-name.kr-loader'}),
upgrade = false,
static = true
}
else
main_market_items['loader'] = {
stack = 1,
value = 'coin',
price = 128,
tooltip = ({'entity-name.loader'}),
upgrade = false,
static = true
}
end
main_market_items['loader'] = {
stack = 1,
value = 'coin',
price = 128,
tooltip = ({'entity-name.loader'}),
upgrade = false,
static = true
}
end
if game.forces.player.technologies['logistics-2'].researched then
if is_mod_loaded('Krastorio2') then
main_market_items['kr-fast-loader'] = {
stack = 1,
value = 'coin',
price = 256,
tooltip = ({'entity-name.kr-fast-loader'}),
upgrade = false,
static = true
}
else
main_market_items['fast-loader'] = {
stack = 1,
value = 'coin',
price = 256,
tooltip = ({'entity-name.fast-loader'}),
upgrade = false,
static = true
}
end
main_market_items['fast-loader'] = {
stack = 1,
value = 'coin',
price = 256,
tooltip = ({'entity-name.fast-loader'}),
upgrade = false,
static = true
}
end
if game.forces.player.technologies['logistics-3'].researched then
if is_mod_loaded('Krastorio2') then
main_market_items['kr-express-loader'] = {
stack = 1,
value = 'coin',
price = 512,
tooltip = ({'entity-name.kr-express-loader'}),
upgrade = false,
static = true
}
else
main_market_items['express-loader'] = {
stack = 1,
value = 'coin',
@ -2242,7 +2200,6 @@ function Public.get_items()
upgrade = false,
static = true
}
end
end
main_market_items['small-lamp'] = {
stack = 1,
@ -2300,34 +2257,6 @@ function Public.get_items()
upgrade = false,
static = false
}
if is_mod_loaded('Factorio-Tiberium') then
main_market_items['tiberium-ore'] = {
stack = 25,
value = 'coin',
price = 15,
tooltip = ({'item-name.tiberium-ore'}),
upgrade = false,
static = false
}
end
if is_mod_loaded('Krastorio2') then
main_market_items['first-aid-kit'] = {
stack = 1,
value = 'coin',
price = 20,
tooltip = ({'item-name.first-aid-kit'}),
upgrade = false,
static = false
}
main_market_items['kr-creep-collector'] = {
price = 50,
stack = 1,
tooltip = ({'item-name.kr-creep-collector'}),
upgrade = false,
static = true,
value = 'coin'
}
end
main_market_items['land-mine'] = {
stack = 1,
value = 'coin',
@ -2376,16 +2305,6 @@ function Public.get_items()
upgrade = false,
static = true
}
if is_mod_loaded('Krastorio2') then
main_market_items['kr-advanced-tank'] = {
stack = 1,
value = 'coin',
price = 20000,
tooltip = ({'main_market.tank'}),
upgrade = false,
static = true
}
end
local wave_number = WD.get_wave()
if wave_number >= 650 then

View File

@ -263,10 +263,6 @@ function Public.reset_map()
-- HS.get_scores()
if is_game_modded() then
game.difficulty_settings.technology_price_multiplier = 0.5
end
this.chunk_load_tick = game.tick + 200
this.force_chunk = true
this.market_announce = game.tick + 1200
@ -482,20 +478,11 @@ local on_init = function()
game.map_settings.path_finder.general_entity_collision_penalty = 1 -- Recommended value
game.map_settings.path_finder.general_entity_subsequent_collision_penalty = 1 -- Recommended value
local tooltip
if is_game_modded() then
tooltip = {
[1] = ({'main.diff_tooltip', '0', '0.5', '0.15', '0.15', '1', '12', '50', '20000', '100%', '15', '10'}),
[2] = ({'main.diff_tooltip', '0', '0.25', '0.1', '0.1', '2', '10', '50', '12000', '75%', '8', '8'}),
[3] = ({'main.diff_tooltip', '0', '0', '0', '0', '4', '3', '10', '8000', '50%', '5', '6'})
}
else
tooltip = {
[1] = ({'main.diff_tooltip', '0', '0.5', '0.15', '0.15', '1', '12', '50', '10000', '100%', '15', '10'}),
[2] = ({'main.diff_tooltip', '0', '0.25', '0.1', '0.1', '2', '10', '50', '7000', '75%', '8', '8'}),
[3] = ({'main.diff_tooltip', '0', '0', '0', '0', '4', '3', '10', '5000', '50%', '5', '6'})
}
end
local tooltip = {
[1] = ({'main.diff_tooltip', '0', '0.5', '0.15', '0.15', '1', '12', '50', '10000', '100%', '15', '10'}),
[2] = ({'main.diff_tooltip', '0', '0.25', '0.1', '0.1', '2', '10', '50', '7000', '75%', '8', '8'}),
[3] = ({'main.diff_tooltip', '0', '0', '0', '0', '4', '3', '10', '5000', '50%', '5', '6'})
}
Difficulty.set_tooltip(tooltip)

View File

@ -143,10 +143,6 @@ local valid_scrap = {
['mineable-wreckages'] = true
}
if is_mod_loaded('MineableWreckage') then
valid_scrap['mineable-wreckages'] = true
end
local reward_wood = {
['dead-tree-desert'] = true,
['dead-dry-hairy-tree'] = true,
@ -170,10 +166,6 @@ local particles = {
['stone'] = 'stone-particle'
}
if is_mod_loaded('Factorio-Tiberium') then
particles['tiberium-ore'] = 'blood-particle'
end
local function create_particles(surface, name, position, amount, cause_position)
local d1 = (-100 + random(0, 200)) * 0.0004
local d2 = (-100 + random(0, 200)) * 0.0004
@ -213,12 +205,6 @@ local function mining_chances_ores()
{name = 'stone', chance = 13},
{name = 'uranium-ore', chance = 2}
}
if is_mod_loaded('Factorio-Tiberium') then
data[#data + 1] = {name = 'tiberium-ore', chance = 5}
end
if is_mod_loaded('Krastorio2') then
data[#data + 1] = {name = 'raw-rare-metals', chance = 5}
end
return data
end

View File

@ -48,34 +48,6 @@ function Public.create_surface()
['tile:deep-water:probability'] = -10000
}
}
local modded = is_game_modded()
if modded then
map_gen_settings.autoplace_controls = {}
if game.active_mods['Krastorio2'] then
map_gen_settings.autoplace_controls.imersite = {
frequency = 1,
richness = 1,
size = 1
}
map_gen_settings.autoplace_controls['mineral-water'] = {
frequency = 1,
richness = 1,
size = 1
}
map_gen_settings.autoplace_controls['rare-metals'] = {
frequency = 1,
richness = 1,
size = 1
}
end
if game.active_mods['Factorio-Tiberium'] then
map_gen_settings.autoplace_controls.tibGrowthNode = {
frequency = 1,
richness = 1,
size = 1
}
end
end
local mine = {}
mine['control-setting:moisture:bias'] = 0.33

View File

@ -128,34 +128,11 @@ local function get_scrap_mineable_entities()
'crash-site-spaceship-wreck-small-6'
}
local modded = is_game_modded()
if modded then
if game.active_mods['MineableWreckage'] then
scrap_mineable_entities = {'mineable-wreckages'}
end
end
local scrap_mineable_entities_index = #scrap_mineable_entities
return scrap_mineable_entities, scrap_mineable_entities_index
end
local function get_tiberium_trees(entities, p)
if is_mod_loaded('Factorio-Tiberium') then
if random(1, 512) == 1 then
entities[#entities + 1] = {name = 'tibGrowthNode', position = p, amount = 15000}
end
end
end
local function get_imersite_ores(entities, p)
if is_mod_loaded('Krastorio2') then
if random(1, 2048) == 1 then
entities[#entities + 1] = {name = 'imersite', position = p, amount = random(300000, 600000)}
end
end
end
local function is_position_near(area, table_to_check)
local status = false
local function inside(pos)
@ -366,8 +343,6 @@ local function wall(data)
end
end
get_tiberium_trees(entities, p)
if random(1, 40) == 1 then
if
surface.can_place_entity(
@ -444,8 +419,6 @@ local function process_level_14_position(x, y, data)
if random(1, 32) == 1 then
Generate_resources(buildings, p, Public.level_depth)
end
get_tiberium_trees(entities, p)
get_imersite_ores(entities, p)
end
if small_caves > -0.21 and small_caves < 0.21 then
@ -521,8 +494,6 @@ local function process_level_13_position(x, y, data)
if random(1, 32) == 1 then
Generate_resources(buildings, p, Public.level_depth)
end
get_tiberium_trees(entities, p)
get_imersite_ores(entities, p)
end
if small_caves > -0.22 and small_caves < 0.22 then
@ -599,8 +570,6 @@ local function process_level_12_position(x, y, data, void_or_lab)
if random(1, 32) == 1 then
Generate_resources(buildings, p, Public.level_depth)
end
get_tiberium_trees(entities, p)
get_imersite_ores(entities, p)
end
if noise_1 > 0.65 then
@ -695,8 +664,6 @@ local function process_level_11_position(x, y, data)
if random(1, 32) == 1 then
Generate_resources(buildings, p, Public.level_depth)
end
get_tiberium_trees(entities, p)
get_imersite_ores(entities, p)
end
if noise_1 < -0.72 then
@ -795,8 +762,6 @@ local function process_level_10_position(x, y, data)
if random(1, 32) == 1 then
Generate_resources(buildings, p, Public.level_depth)
end
get_tiberium_trees(entities, p)
get_imersite_ores(entities, p)
end
if abs(scrapyard) > 0.40 and abs(scrapyard) < 0.65 then
@ -922,8 +887,6 @@ local function process_level_9_position(x, y, data)
if random(1, 32) == 1 then
Generate_resources(buildings, p, Public.level_depth)
end
get_tiberium_trees(entities, p)
get_imersite_ores(entities, p)
end
if maze_noise < -0.5 or maze_noise > 0.5 then
@ -1032,8 +995,6 @@ local function process_scrap_zone_1(x, y, data, void_or_lab)
if random(1, 32) == 1 then
Generate_resources(buildings, p, Public.level_depth)
end
get_tiberium_trees(entities, p)
get_imersite_ores(entities, p)
end
local large_caves = get_perlin('large_caves', p, seed)
@ -1107,7 +1068,7 @@ local function process_level_7_position(x, y, data, void_or_lab)
if random(1, 64) == 1 and no_rocks_2 > 0.7 then
entities[#entities + 1] = {name = 'crude-oil', position = p, amount = get_oil_amount(p)}
end
get_imersite_ores(entities, p)
if random(1, 2048) == 1 then
treasure[#treasure + 1] = {position = p, chest = 'wooden-chest'}
end
@ -1163,7 +1124,6 @@ local function process_level_7_position(x, y, data, void_or_lab)
if random(1, 32) == 1 then
Generate_resources(buildings, p, Public.level_depth)
end
get_tiberium_trees(entities, p)
end
tiles[#tiles + 1] = {name = 'dirt-7', position = p}
@ -1225,7 +1185,7 @@ local function process_forest_zone_2(x, y, data, void_or_lab)
force = 'enemy'
}
end
get_imersite_ores(entities, p)
return
end
local noise_forest_location = get_perlin('forest_location', p, seed)
@ -1286,7 +1246,7 @@ local function process_forest_zone_2(x, y, data, void_or_lab)
entities[#entities + 1] = {name = 'tree-02-red', position = p}
end
end
get_tiberium_trees(entities, p)
return
end
end
@ -1354,7 +1314,7 @@ local function process_level_5_position(x, y, data, void_or_lab)
force = 'enemy'
}
end
get_imersite_ores(entities, p)
return
end
@ -1378,7 +1338,7 @@ local function process_level_5_position(x, y, data, void_or_lab)
if random(1, 512) == 1 then
treasure[#treasure + 1] = {position = p, chest = 'wooden-chest'}
end
get_tiberium_trees(entities, p)
if random(1, 2) == 1 then
entities[#entities + 1] = {name = rock_raffle[random(1, size_of_rock_raffle)], position = p}
end
@ -1484,7 +1444,7 @@ local function process_level_4_position(x, y, data, void_or_lab)
force = 'enemy'
}
end
get_imersite_ores(entities, p)
return
end
@ -1502,7 +1462,7 @@ local function process_level_4_position(x, y, data, void_or_lab)
if random(1, 2048) == 1 then
treasure[#treasure + 1] = {position = p, chest = 'wooden-chest'}
end
get_tiberium_trees(entities, p)
tiles[#tiles + 1] = {name = 'dirt-7', position = p}
if random(1, 100) > 30 then
entities[#entities + 1] = {name = rock_raffle[random(1, size_of_rock_raffle)], position = p}
@ -1630,7 +1590,7 @@ local function process_level_3_position(x, y, data, void_or_lab)
force = 'enemy'
}
end
get_imersite_ores(entities, p)
if random(1, 256) == 1 then
spawn_turret(entities, p, 3)
end
@ -1655,7 +1615,7 @@ local function process_level_3_position(x, y, data, void_or_lab)
if random(1, 512) == 1 then
treasure[#treasure + 1] = {position = p, chest = 'wooden-chest'}
end
get_tiberium_trees(entities, p)
return
end
@ -1772,7 +1732,7 @@ local function process_level_2_position(x, y, data, void_or_lab)
force = 'enemy'
}
end
get_imersite_ores(entities, p)
if random(1, 256) == 1 then
spawn_turret(entities, p, 2)
end
@ -1797,7 +1757,7 @@ local function process_level_2_position(x, y, data, void_or_lab)
if random(1, 512) == 1 then
treasure[#treasure + 1] = {position = p, chest = 'wooden-chest'}
end
get_tiberium_trees(entities, p)
return
end
@ -1917,8 +1877,6 @@ local function process_forest_zone_1(x, y, data, void_or_lab)
}
end
get_imersite_ores(entities, p)
if random(1, 1024) == 1 then
treasure[#treasure + 1] = {position = p, chest = 'iron-chest'}
end
@ -1941,7 +1899,7 @@ local function process_forest_zone_1(x, y, data, void_or_lab)
if random(1, 32) == 1 then
entities[#entities + 1] = {name = 'tree-0' .. random(1, 9), position = p}
end
get_tiberium_trees(entities, p)
if random(1, 512) == 1 then
treasure[#treasure + 1] = {position = p, chest = 'iron-chest'}
end
@ -2098,8 +2056,6 @@ local function process_level_1_position(x, y, data, void_or_lab)
}
end
get_imersite_ores(entities, p)
if random(1, 1024) == 1 then
treasure[#treasure + 1] = {position = p, chest = 'iron-chest'}
end
@ -2122,7 +2078,7 @@ local function process_level_1_position(x, y, data, void_or_lab)
if random(1, 32) == 1 then
entities[#entities + 1] = {name = 'tree-0' .. random(1, 9), position = p}
end
get_tiberium_trees(entities, p)
if random(1, 512) == 1 then
treasure[#treasure + 1] = {position = p, chest = 'iron-chest'}
end
@ -2284,8 +2240,6 @@ local function process_level_0_position(x, y, data, void_or_lab)
entities[#entities + 1] = {name = 'tree-0' .. random(1, 9), position = p}
end
get_tiberium_trees(entities, p)
if random(1, 512) == 1 then
treasure[#treasure + 1] = {position = p, chest = 'iron-chest'}
end

View File

@ -77,12 +77,17 @@ local entity_types = {
['unit-spawner'] = true
}
local function clear_unit_from_tbl(unit_number)
if this.biter_health_boost_units[unit_number] then
this.biter_health_boost_units[unit_number] = nil
end
end
local removeUnit =
Token.register(
function(data)
local biter_health_boost_units = data.biter_health_boost_units
local unit_number = data.unit_number
biter_health_boost_units[unit_number] = nil
clear_unit_from_tbl(unit_number)
end
)
@ -330,7 +335,7 @@ local function on_entity_died(event)
local wave_count = WD.get_wave()
if health_pool then
Task.set_timeout_in_ticks(30, removeUnit, {unit_number = unit_number, biter_health_boost_units = biter_health_boost_units})
Task.set_timeout_in_ticks(30, removeUnit, {unit_number = unit_number})
if health_pool[3] then
if this.enable_boss_loot then
if random(1, 128) == 1 then

View File

@ -643,7 +643,7 @@ function Public.gain_xp(player, amount, added_to_pool, text)
RPG.debug_log('RPG - ' .. player.name .. ' got org xp: ' .. amount)
end
rpg_t[player.index].xp = rpg_t[player.index].xp + amount
rpg_t[player.index].xp = math.round(rpg_t[player.index].xp + amount, 3)
rpg_t[player.index].xp_since_last_floaty_text = rpg_t[player.index].xp_since_last_floaty_text + amount
if not experience_levels[rpg_t[player.index].level + 1] then

View File

@ -710,6 +710,7 @@ Gui.on_click(
return
end
if frame and frame.valid then
Gui.remove_data_recursively(frame)
frame.destroy()
end
end
@ -731,6 +732,7 @@ Gui.on_click(
end
if frame and frame.valid then
Gui.remove_data_recursively(frame)
frame.destroy()
else
Settings.extra_settings(player)
@ -754,6 +756,7 @@ Gui.on_click(
end
if frame and frame.valid then
Gui.remove_data_recursively(frame)
frame.destroy()
else
Settings.spell_gui_settings(player)

View File

@ -441,7 +441,7 @@ end
--- This rebuilds all spells. Make sure to make changes on_init if you don't
-- want all spells enabled.
function Public.rebuild_spells()
function Public.rebuild_spells(rebuild)
local spells = this.rpg_spells
local new_spells = {}
@ -454,7 +454,9 @@ function Public.rebuild_spells()
end
end
this.rpg_spells = new_spells
if rebuild then
this.rpg_spells = new_spells
end
return new_spells, spell_names
end

View File

@ -55,26 +55,6 @@ function Public.wave_defense_set_unit_raffle(level)
}
)
local bobs_enemies = is_mod_loaded('bobenemies')
if bobs_enemies then
local biter_raffle = WD.get('biter_raffle')
biter_raffle['bob-big-electric-spitter'] = 0
biter_raffle['bob-huge-acid-spitter'] = 0
biter_raffle['bob-huge-explosive-spitter'] = 0
biter_raffle['bob-giant-fire-spitter'] = 0
biter_raffle['bob-giant-poison-spitter'] = 0
biter_raffle['bob-leviathan-spitter'] = 0
local spitter_raffle = WD.get('spitter_raffle')
spitter_raffle['bob-big-piercing-biter'] = 0
spitter_raffle['bob-behemoth-biter'] = 0
spitter_raffle['bob-titan-biter'] = 0
spitter_raffle['bob-giant-poison-biter'] = 0
spitter_raffle['bob-giant-fire-biter'] = 0
spitter_raffle['bob-huge-explosive-biter'] = 0
end
local biter_raffle = WD.get('biter_raffle')
local spitter_raffle = WD.get('spitter_raffle')
if level > 500 then
@ -82,26 +62,10 @@ function Public.wave_defense_set_unit_raffle(level)
spitter_raffle['medium-spitter'] = 500 - (level - 500)
biter_raffle['big-biter'] = (level - 500) * 2
spitter_raffle['big-spitter'] = (level - 500) * 2
if bobs_enemies then
biter_raffle['bob-big-electric-spitter'] = 500 - (level - 500)
biter_raffle['bob-huge-acid-spitter'] = (level - 500) * 2
biter_raffle['bob-huge-explosive-spitter'] = (level - 500) * 2
spitter_raffle['bob-big-piercing-biter'] = 500 - (level - 500)
spitter_raffle['bob-behemoth-biter'] = (level - 500) * 2
spitter_raffle['bob-titan-biter'] = (level - 500) * 2
end
end
if level > 800 then
biter_raffle['behemoth-biter'] = (level - 800) * 2.75
spitter_raffle['behemoth-spitter'] = (level - 800) * 2.75
if bobs_enemies then
biter_raffle['bob-giant-fire-spitter'] = (level - 800) * 2.75
biter_raffle['bob-giant-poison-spitter'] = (level - 800) * 2.75
biter_raffle['bob-leviathan-spitter'] = (level - 800) * 2.75
spitter_raffle['bob-giant-poison-biter'] = (level - 800) * 2.75
spitter_raffle['bob-giant-fire-biter'] = (level - 800) * 2.75
spitter_raffle['bob-huge-explosive-biter'] = (level - 800) * 2.75
end
end
for k, _ in pairs(biter_raffle) do
if biter_raffle[k] < 0 then

View File

@ -14,19 +14,5 @@ local t = {
['big-worm-turret'] = 64,
['behemoth-worm-turret'] = 128
}
if is_mod_loaded('bobenemies') then
t['bob-big-electric-spitter'] = 64
t['bob-huge-acid-spitter'] = 128
t['bob-huge-explosive-spitter'] = 128
t['bob-giant-fire-spitter'] = 512
t['bob-giant-poison-spitter'] = 512
t['bob-leviathan-spitter'] = 1024
t['bob-big-piercing-biter'] = 64
t['bob-behemoth-biter'] = 128
t['bob-titan-biter'] = 128
t['bob-giant-poison-biter'] = 512
t['bob-giant-fire-biter'] = 512
t['bob-huge-explosive-biter'] = 1024
end
return t