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

Mtn: push changes for modded

This commit is contained in:
Gerkiz 2024-11-05 20:04:00 +01:00
parent dd1c0024c0
commit 2ff53ea036
25 changed files with 1398 additions and 173 deletions

View File

@ -102,10 +102,12 @@ flameboots_tooltip=When the bullets simply don´t bite.
explosive_bullets_label=Enable explosive bullets?
explosive_bullets_tooltip=Hurts the biters a bit extra
magic_label=Enable spawning with fish?
magic_label_custom=Enable casting spells with __CONTROL__mtn-ctrl-cast-spell__?
toggle_cast_spell_label=Toggles the ability to cast spells.
cast_spell_enabled_label=Casting spells with fish has been enabled!
cast_spell_disabled_label=Casting spells with fish has been disabled!
magic_tooltip=When simply constructing items is not enough.\nNOTE! Use Raw-fish to cast spells.
magic_tooltip_custom=When simply constructing items is not enough.
magic_spell=Select your spell:
allocation_settings_label=Allocations Settings:
allocation_label=Select your auto-allocate skill.

View File

@ -19,6 +19,17 @@ local coin_yield = {
['medium-spitter'] = 2,
['medium-worm-turret'] = 4,
['small-biter'] = 1,
['mtn-addon-small-piercing-biter'] = 3,
['mtn-addon-small-acid-biter'] = 3,
['mtn-addon-small-explosive-biter'] = 3,
['mtn-addon-small-poison-biter'] = 3,
['mtn-addon-small-fire-biter'] = 3,
['mtn-addon-medium-piercing-biter'] = 6,
['mtn-addon-big-piercing-biter'] = 9,
['mtn-addon-huge-piercing-biter'] = 13,
['mtn-addon-giant-piercing-biter'] = 20,
['mtn-addon-massive-piercing-biter'] = 40,
['mtn-addon-behemoth-piercing-biter'] = 100,
['small-spitter'] = 1,
['small-worm-turret'] = 2,
['spitter-spawner'] = 32

View File

@ -137,12 +137,12 @@ local function spawn_worms(data)
local unit = surface.create_entity({ name = unit_to_create, position = position })
max_biters.amount = max_biters.amount + 1
local worm_unit_settings = WD.get('worm_unit_settings')
local unit_settings = WD.get('unit_settings')
if random(1, 30) == 1 then
BiterHealthBooster.add_boss_unit(unit, modified_boss_unit_health.current_value, 0.38)
else
local final_health = round(modified_unit_health.current_value * worm_unit_settings.scale_units_by_health[unit.name], 3)
local final_health = round(modified_unit_health.current_value * unit_settings.scale_worms_by_health[unit.name], 3)
if final_health < 1 then
final_health = 1
end

View File

@ -25,6 +25,7 @@ local scenario_name = Public.scenario_name
local zone_settings = Public.zone_settings
local remove_boost_movement_speed_on_respawn
local de = defines.events
local is_modded = Public.is_modded
local this = {
power_sources = { index = 1 },
@ -462,6 +463,266 @@ end
local do_season_fix_token = Task.register(do_season_fix)
local set_unit_raffle_token =
Task.register(
function (event)
local level = event.level
if not is_modded then
WD.set(
'biter_raffle',
{
['small-biter'] = round(1000 - level * 1.75, 6),
['medium-biter'] = round(level, 6),
['big-biter'] = 0,
['behemoth-biter'] = 0
}
)
WD.set(
'spitter_raffle',
{
['small-spitter'] = round(1000 - level * 1.75, 6),
['medium-spitter'] = round(level, 6),
['big-spitter'] = 0,
['behemoth-spitter'] = 0
}
)
local biter_raffle = WD.get('biter_raffle') --[[@as table]]
local spitter_raffle = WD.get('spitter_raffle') --[[@as table]]
if level > 500 then
biter_raffle['medium-biter'] = round(500 - (level - 500), 6)
spitter_raffle['medium-spitter'] = round(500 - (level - 500), 6)
biter_raffle['big-biter'] = round((level - 500) * 2, 6)
spitter_raffle['big-spitter'] = round((level - 500) * 2, 6)
end
if level > 800 then
biter_raffle['behemoth-biter'] = round((level - 800) * 2.75, 6)
spitter_raffle['behemoth-spitter'] = round((level - 800) * 2.75, 6)
end
for k, _ in pairs(biter_raffle) do
if biter_raffle[k] < 0 then
biter_raffle[k] = 0
end
end
for k, _ in pairs(spitter_raffle) do
if spitter_raffle[k] < 0 then
spitter_raffle[k] = 0
end
end
else
WD.set(
'biter_raffle',
{
['small-biter'] = round(3000 - level * 1.75, 6),
['mtn-addon-small-piercing-biter-t1'] = round(2500 - level * 1.75, 6),
['mtn-addon-small-acid-biter-t1'] = round(2500 - level * 1.75, 6),
['mtn-addon-small-explosive-biter-t1'] = round(2500 - level * 1.75, 6),
['mtn-addon-small-poison-biter-t1'] = round(2500 - level * 1.75, 6),
['mtn-addon-small-fire-biter-t1'] = round(2500 - level * 1.75, 6),
['mtn-addon-small-piercing-biter-t2'] = round(2000 - level * 1.75, 6),
['mtn-addon-small-acid-biter-t2'] = round(2000 - level * 1.75, 6),
['mtn-addon-small-explosive-biter-t2'] = round(2000 - level * 1.75, 6),
['mtn-addon-small-poison-biter-t2'] = round(2000 - level * 1.75, 6),
['mtn-addon-small-fire-biter-t2'] = round(2000 - level * 1.75, 6),
['mtn-addon-small-piercing-biter-t3'] = round(1500 - level * 1.75, 6),
['mtn-addon-small-acid-biter-t3'] = round(1500 - level * 1.75, 6),
['mtn-addon-small-explosive-biter-t3'] = round(1500 - level * 1.75, 6),
['mtn-addon-small-poison-biter-t3'] = round(1500 - level * 1.75, 6),
['mtn-addon-small-fire-biter-t3'] = round(1500 - level * 1.75, 6),
}
)
WD.set(
'spitter_raffle',
{
['mtn-addon-small-piercing-spitter-t1'] = round(2500 - level * 1.75, 6),
['mtn-addon-small-acid-spitter-t1'] = round(2500 - level * 1.75, 6),
['mtn-addon-small-explosive-spitter-t1'] = round(2500 - level * 1.75, 6),
['mtn-addon-small-poison-spitter-t1'] = round(2500 - level * 1.75, 6),
['mtn-addon-small-fire-spitter-t1'] = round(2500 - level * 1.75, 6),
['mtn-addon-small-piercing-spitter-t2'] = round(2000 - level * 1.75, 6),
['mtn-addon-small-acid-spitter-t2'] = round(2000 - level * 1.75, 6),
['mtn-addon-small-explosive-spitter-t2'] = round(2000 - level * 1.75, 6),
['mtn-addon-small-poison-spitter-t2'] = round(2000 - level * 1.75, 6),
['mtn-addon-small-fire-spitter-t2'] = round(2000 - level * 1.75, 6),
['mtn-addon-small-piercing-spitter-t3'] = round(1500 - level * 1.75, 6),
['mtn-addon-small-acid-spitter-t3'] = round(1500 - level * 1.75, 6),
['mtn-addon-small-explosive-spitter-t3'] = round(1500 - level * 1.75, 6),
['mtn-addon-small-poison-spitter-t3'] = round(1500 - level * 1.75, 6),
['mtn-addon-small-fire-spitter-t3'] = round(1500 - level * 1.75, 6),
}
)
local biter_raffle = WD.get('biter_raffle') --[[@as table]]
local spitter_raffle = WD.get('spitter_raffle') --[[@as table]]
if level > 250 then
biter_raffle['mtn-addon-medium-piercing-biter-t1'] = round(250 - (level - 250), 6)
biter_raffle['mtn-addon-medium-acid-biter-t1'] = round(250 - (level - 250), 6)
biter_raffle['mtn-addon-medium-explosive-biter-t1'] = round(250 - (level - 250), 6)
biter_raffle['mtn-addon-medium-poison-biter-t1'] = round(250 - (level - 250), 6)
biter_raffle['mtn-addon-medium-fire-biter-t1'] = round(250 - (level - 250), 6)
spitter_raffle['mtn-addon-medium-piercing-spitter-t1'] = round(250 - (level - 250), 6)
spitter_raffle['mtn-addon-medium-acid-spitter-t1'] = round(250 - (level - 250), 6)
spitter_raffle['mtn-addon-medium-explosive-spitter-t1'] = round(250 - (level - 250), 6)
spitter_raffle['mtn-addon-medium-poison-spitter-t1'] = round(250 - (level - 250), 6)
spitter_raffle['mtn-addon-medium-fire-spitter-t1'] = round(250 - (level - 250), 6)
end
if level > 300 then
biter_raffle['mtn-addon-medium-piercing-biter-t2'] = round(300 - (level - 300), 6)
biter_raffle['mtn-addon-medium-acid-biter-t2'] = round(300 - (level - 300), 6)
biter_raffle['mtn-addon-medium-explosive-biter-t2'] = round(300 - (level - 300), 6)
biter_raffle['mtn-addon-medium-poison-biter-t2'] = round(300 - (level - 300), 6)
biter_raffle['mtn-addon-medium-fire-biter-t2'] = round(300 - (level - 300), 6)
spitter_raffle['mtn-addon-medium-piercing-spitter-t2'] = round(300 - (level - 300), 6)
spitter_raffle['mtn-addon-medium-acid-spitter-t2'] = round(300 - (level - 300), 6)
spitter_raffle['mtn-addon-medium-explosive-spitter-t2'] = round(300 - (level - 300), 6)
spitter_raffle['mtn-addon-medium-poison-spitter-t2'] = round(300 - (level - 300), 6)
spitter_raffle['mtn-addon-medium-fire-spitter-t2'] = round(300 - (level - 300), 6)
end
if level > 350 then
biter_raffle['mtn-addon-medium-piercing-biter-t3'] = round(350 - (level - 350), 6)
biter_raffle['mtn-addon-medium-acid-biter-t3'] = round(350 - (level - 350), 6)
biter_raffle['mtn-addon-medium-explosive-biter-t3'] = round(350 - (level - 350), 6)
biter_raffle['mtn-addon-medium-poison-biter-t3'] = round(350 - (level - 350), 6)
biter_raffle['mtn-addon-medium-fire-biter-t3'] = round(350 - (level - 350), 6)
spitter_raffle['mtn-addon-medium-piercing-spitter-t3'] = round(350 - (level - 350), 6)
spitter_raffle['mtn-addon-medium-acid-spitter-t3'] = round(350 - (level - 350), 6)
spitter_raffle['mtn-addon-medium-explosive-spitter-t3'] = round(350 - (level - 350), 6)
spitter_raffle['mtn-addon-medium-poison-spitter-t3'] = round(350 - (level - 350), 6)
spitter_raffle['mtn-addon-medium-fire-spitter-t3'] = round(350 - (level - 350), 6)
end
if level > 500 then
biter_raffle['mtn-addon-big-piercing-biter-t1'] = round(500 - (level - 500) * 2, 6)
biter_raffle['mtn-addon-big-acid-biter-t1'] = round(500 - (level - 500) * 2, 6)
biter_raffle['mtn-addon-big-explosive-biter-t1'] = round(500 - (level - 500) * 2, 6)
biter_raffle['mtn-addon-big-poison-biter-t1'] = round(500 - (level - 500) * 2, 6)
biter_raffle['mtn-addon-big-fire-biter-t1'] = round(500 - (level - 500) * 2, 6)
spitter_raffle['mtn-addon-big-piercing-spitter-t1'] = round(500 - (level - 500) * 2, 6)
spitter_raffle['mtn-addon-big-acid-spitter-t1'] = round(500 - (level - 500) * 2, 6)
spitter_raffle['mtn-addon-big-explosive-spitter-t1'] = round(500 - (level - 500) * 2, 6)
spitter_raffle['mtn-addon-big-poison-spitter-t1'] = round(500 - (level - 500) * 2, 6)
spitter_raffle['mtn-addon-big-fire-spitter-t1'] = round(500 - (level - 500) * 2, 6)
end
if level > 550 then
biter_raffle['mtn-addon-big-piercing-biter-t2'] = round(550 - (level - 550) * 2, 6)
biter_raffle['mtn-addon-big-acid-biter-t2'] = round(550 - (level - 550) * 2, 6)
biter_raffle['mtn-addon-big-explosive-biter-t2'] = round(550 - (level - 550) * 2, 6)
biter_raffle['mtn-addon-big-poison-biter-t2'] = round(550 - (level - 550) * 2, 6)
biter_raffle['mtn-addon-big-fire-biter-t2'] = round(550 - (level - 550) * 2, 6)
spitter_raffle['mtn-addon-big-piercing-spitter-t2'] = round(550 - (level - 550) * 2, 6)
spitter_raffle['mtn-addon-big-acid-spitter-t2'] = round(550 - (level - 550) * 2, 6)
spitter_raffle['mtn-addon-big-explosive-spitter-t2'] = round(550 - (level - 550) * 2, 6)
spitter_raffle['mtn-addon-big-poison-spitter-t2'] = round(550 - (level - 550) * 2, 6)
spitter_raffle['mtn-addon-big-fire-spitter-t2'] = round(550 - (level - 550) * 2, 6)
end
if level > 600 then
biter_raffle['mtn-addon-big-piercing-biter-t3'] = round(600 - (level - 600) * 2, 6)
biter_raffle['mtn-addon-big-acid-biter-t3'] = round(600 - (level - 600) * 2, 6)
biter_raffle['mtn-addon-big-explosive-biter-t3'] = round(600 - (level - 600) * 2, 6)
biter_raffle['mtn-addon-big-poison-biter-t3'] = round(600 - (level - 600) * 2, 6)
biter_raffle['mtn-addon-big-fire-biter-t3'] = round(600 - (level - 600) * 2, 6)
spitter_raffle['mtn-addon-big-piercing-spitter-t3'] = round(600 - (level - 600) * 2, 6)
spitter_raffle['mtn-addon-big-acid-spitter-t3'] = round(600 - (level - 600) * 2, 6)
spitter_raffle['mtn-addon-big-explosive-spitter-t3'] = round(600 - (level - 600) * 2, 6)
spitter_raffle['mtn-addon-big-poison-spitter-t3'] = round(600 - (level - 600) * 2, 6)
spitter_raffle['mtn-addon-big-fire-spitter-t3'] = round(600 - (level - 600) * 2, 6)
end
if level > 800 then
biter_raffle['mtn-addon-behemoth-piercing-biter-t1'] = round((level - 800) * 2.75, 6)
biter_raffle['mtn-addon-behemoth-acid-biter-t1'] = round((level - 800) * 2.75, 6)
biter_raffle['mtn-addon-behemoth-explosive-biter-t1'] = round((level - 800) * 2.75, 6)
biter_raffle['mtn-addon-behemoth-poison-biter-t1'] = round((level - 800) * 2.75, 6)
biter_raffle['mtn-addon-behemoth-fire-biter-t1'] = round((level - 800) * 2.75, 6)
spitter_raffle['mtn-addon-behemoth-piercing-spitter-t1'] = round((level - 800) * 2.75, 6)
spitter_raffle['mtn-addon-behemoth-acid-spitter-t1'] = round((level - 800) * 2.75, 6)
spitter_raffle['mtn-addon-behemoth-explosive-spitter-t1'] = round((level - 800) * 2.75, 6)
spitter_raffle['mtn-addon-behemoth-poison-spitter-t1'] = round((level - 800) * 2.75, 6)
spitter_raffle['mtn-addon-behemoth-fire-spitter-t1'] = round((level - 800) * 2.75, 6)
end
if level > 900 then
biter_raffle['mtn-addon-behemoth-piercing-biter-t2'] = round((level - 900) * 2.75, 6)
biter_raffle['mtn-addon-behemoth-acid-biter-t2'] = round((level - 900) * 2.75, 6)
biter_raffle['mtn-addon-behemoth-explosive-biter-t2'] = round((level - 900) * 2.75, 6)
biter_raffle['mtn-addon-behemoth-poison-biter-t2'] = round((level - 900) * 2.75, 6)
biter_raffle['mtn-addon-behemoth-fire-biter-t2'] = round((level - 900) * 2.75, 6)
spitter_raffle['mtn-addon-behemoth-piercing-spitter-t2'] = round((level - 900) * 2.75, 6)
spitter_raffle['mtn-addon-behemoth-acid-spitter-t2'] = round((level - 900) * 2.75, 6)
spitter_raffle['mtn-addon-behemoth-explosive-spitter-t2'] = round((level - 900) * 2.75, 6)
spitter_raffle['mtn-addon-behemoth-poison-spitter-t2'] = round((level - 900) * 2.75, 6)
spitter_raffle['mtn-addon-behemoth-fire-spitter-t2'] = round((level - 900) * 2.75, 6)
end
if level > 1000 then
biter_raffle['mtn-addon-behemoth-piercing-biter-t3'] = round((level - 1000) * 2.75, 6)
biter_raffle['mtn-addon-behemoth-acid-biter-t3'] = round((level - 1000) * 2.75, 6)
biter_raffle['mtn-addon-behemoth-explosive-biter-t3'] = round((level - 1000) * 2.75, 6)
biter_raffle['mtn-addon-behemoth-poison-biter-t3'] = round((level - 1000) * 2.75, 6)
biter_raffle['mtn-addon-behemoth-fire-biter-t3'] = round((level - 1000) * 2.75, 6)
spitter_raffle['mtn-addon-behemoth-piercing-spitter-t3'] = round((level - 1000) * 2.75, 6)
spitter_raffle['mtn-addon-behemoth-acid-spitter-t3'] = round((level - 1000) * 2.75, 6)
spitter_raffle['mtn-addon-behemoth-explosive-spitter-t3'] = round((level - 1000) * 2.75, 6)
spitter_raffle['mtn-addon-behemoth-poison-spitter-t3'] = round((level - 1000) * 2.75, 6)
spitter_raffle['mtn-addon-behemoth-fire-spitter-t3'] = round((level - 1000) * 2.75, 6)
end
for k, _ in pairs(biter_raffle) do
if biter_raffle[k] < 0 then
biter_raffle[k] = 0
end
end
for k, _ in pairs(spitter_raffle) do
if spitter_raffle[k] < 0 then
spitter_raffle[k] = 0
end
end
end
end
)
local set_worm_raffle_token =
Task.register(
function (event)
local level = event.level
WD.set(
'worm_raffle',
{
['small-worm-turret'] = round(1000 - level * 1.75, 6),
['medium-worm-turret'] = round(level, 6),
['big-worm-turret'] = 0,
['behemoth-worm-turret'] = 0
}
)
local worm_raffle = WD.get('worm_raffle') --[[@as table]]
if level > 500 then
worm_raffle['medium-worm-turret'] = round(500 - (level - 500), 6)
worm_raffle['big-worm-turret'] = round((level - 500) * 2, 6)
end
if level > 800 then
worm_raffle['behemoth-worm-turret'] = round((level - 800) * 3, 6)
end
for k, _ in pairs(worm_raffle) do
if worm_raffle[k] < 0 then
worm_raffle[k] = 0
end
end
end
)
local function do_artillery_turrets_targets()
local art_table = this.art_table
local index = art_table.index
@ -1021,6 +1282,339 @@ local function on_player_cursor_stack_changed(event)
end
end
function Public.set_unit_raffle()
local unit_settings = WD.get('unit_settings')
unit_settings.custom_unit_raffle = set_unit_raffle_token
end
function Public.set_threat_values()
WD.set('threat_values', {
['biter-spawner'] = 128,
['spitter-spawner'] = 128,
['behemoth-biter'] = 64,
['behemoth-spitter'] = 64,
['big-biter'] = 16,
['big-spitter'] = 16,
['medium-biter'] = 4,
['medium-spitter'] = 4,
['small-biter'] = 1,
['small-spitter'] = 1,
['small-worm-turret'] = 16,
['medium-worm-turret'] = 32,
['big-worm-turret'] = 64,
['behemoth-worm-turret'] = 128,
-- custom biters/spitters
['mtn-addon-small-piercing-biter-t1'] = 2,
['mtn-addon-small-piercing-biter-t2'] = 3,
['mtn-addon-small-piercing-biter-t3'] = 4,
['mtn-addon-small-acid-biter-t1'] = 2,
['mtn-addon-small-acid-biter-t2'] = 3,
['mtn-addon-small-acid-biter-t3'] = 4,
['mtn-addon-small-explosive-biter-t1'] = 2,
['mtn-addon-small-explosive-biter-t2'] = 3,
['mtn-addon-small-explosive-biter-t3'] = 4,
['mtn-addon-small-poison-biter-t1'] = 2,
['mtn-addon-small-poison-biter-t2'] = 3,
['mtn-addon-small-poison-biter-t3'] = 4,
['mtn-addon-small-fire-biter-t1'] = 2,
['mtn-addon-small-fire-biter-t2'] = 3,
['mtn-addon-small-fire-biter-t3'] = 4,
['mtn-addon-small-piercing-spitter-t1'] = 2,
['mtn-addon-small-piercing-spitter-t2'] = 3,
['mtn-addon-small-piercing-spitter-t3'] = 4,
['mtn-addon-small-acid-spitter-t1'] = 2,
['mtn-addon-small-acid-spitter-t2'] = 3,
['mtn-addon-small-acid-spitter-t3'] = 4,
['mtn-addon-small-explosive-spitter-t1'] = 2,
['mtn-addon-small-explosive-spitter-t2'] = 3,
['mtn-addon-small-explosive-spitter-t3'] = 4,
['mtn-addon-small-poison-spitter-t1'] = 2,
['mtn-addon-small-poison-spitter-t2'] = 3,
['mtn-addon-small-poison-spitter-t3'] = 4,
['mtn-addon-small-fire-spitter-t1'] = 2,
['mtn-addon-small-fire-spitter-t2'] = 3,
['mtn-addon-small-fire-spitter-t3'] = 4,
['mtn-addon-medium-piercing-biter-t1'] = 6,
['mtn-addon-medium-piercing-biter-t2'] = 7,
['mtn-addon-medium-piercing-biter-t3'] = 8,
['mtn-addon-medium-acid-biter-t1'] = 6,
['mtn-addon-medium-acid-biter-t2'] = 7,
['mtn-addon-medium-acid-biter-t3'] = 8,
['mtn-addon-medium-explosive-biter-t1'] = 6,
['mtn-addon-medium-explosive-biter-t2'] = 7,
['mtn-addon-medium-explosive-biter-t3'] = 8,
['mtn-addon-medium-poison-biter-t1'] = 6,
['mtn-addon-medium-poison-biter-t2'] = 7,
['mtn-addon-medium-poison-biter-t3'] = 8,
['mtn-addon-medium-fire-biter-t1'] = 6,
['mtn-addon-medium-fire-biter-t2'] = 7,
['mtn-addon-medium-fire-biter-t3'] = 8,
['mtn-addon-medium-piercing-spitter-t1'] = 6,
['mtn-addon-medium-piercing-spitter-t2'] = 7,
['mtn-addon-medium-piercing-spitter-t3'] = 8,
['mtn-addon-medium-acid-spitter-t1'] = 6,
['mtn-addon-medium-acid-spitter-t2'] = 7,
['mtn-addon-medium-acid-spitter-t3'] = 8,
['mtn-addon-medium-explosive-spitter-t1'] = 6,
['mtn-addon-medium-explosive-spitter-t2'] = 7,
['mtn-addon-medium-explosive-spitter-t3'] = 8,
['mtn-addon-medium-poison-spitter-t1'] = 6,
['mtn-addon-medium-poison-spitter-t2'] = 7,
['mtn-addon-medium-poison-spitter-t3'] = 8,
['mtn-addon-medium-fire-spitter-t1'] = 6,
['mtn-addon-medium-fire-spitter-t2'] = 7,
['mtn-addon-medium-fire-spitter-t3'] = 8,
['mtn-addon-big-piercing-biter-t1'] = 24,
['mtn-addon-big-piercing-biter-t2'] = 26,
['mtn-addon-big-piercing-biter-t3'] = 28,
['mtn-addon-big-acid-biter-t1'] = 24,
['mtn-addon-big-acid-biter-t2'] = 26,
['mtn-addon-big-acid-biter-t3'] = 28,
['mtn-addon-big-explosive-biter-t1'] = 24,
['mtn-addon-big-explosive-biter-t2'] = 26,
['mtn-addon-big-explosive-biter-t3'] = 28,
['mtn-addon-big-poison-biter-t1'] = 24,
['mtn-addon-big-poison-biter-t2'] = 26,
['mtn-addon-big-poison-biter-t3'] = 28,
['mtn-addon-big-fire-biter-t1'] = 24,
['mtn-addon-big-fire-biter-t2'] = 26,
['mtn-addon-big-fire-biter-t3'] = 28,
['mtn-addon-big-piercing-spitter-t1'] = 24,
['mtn-addon-big-piercing-spitter-t2'] = 26,
['mtn-addon-big-piercing-spitter-t3'] = 28,
['mtn-addon-big-acid-spitter-t1'] = 24,
['mtn-addon-big-acid-spitter-t2'] = 26,
['mtn-addon-big-acid-spitter-t3'] = 28,
['mtn-addon-big-explosive-spitter-t1'] = 24,
['mtn-addon-big-explosive-spitter-t2'] = 26,
['mtn-addon-big-explosive-spitter-t3'] = 28,
['mtn-addon-big-poison-spitter-t1'] = 24,
['mtn-addon-big-poison-spitter-t2'] = 26,
['mtn-addon-big-poison-spitter-t3'] = 28,
['mtn-addon-big-fire-spitter-t1'] = 24,
['mtn-addon-big-fire-spitter-t2'] = 26,
['mtn-addon-big-fire-spitter-t3'] = 28,
['mtn-addon-behemoth-piercing-biter-t1'] = 110,
['mtn-addon-behemoth-piercing-biter-t2'] = 120,
['mtn-addon-behemoth-piercing-biter-t3'] = 130,
['mtn-addon-behemoth-acid-biter-t1'] = 110,
['mtn-addon-behemoth-acid-biter-t2'] = 120,
['mtn-addon-behemoth-acid-biter-t3'] = 130,
['mtn-addon-behemoth-explosive-biter-t1'] = 110,
['mtn-addon-behemoth-explosive-biter-t2'] = 120,
['mtn-addon-behemoth-explosive-biter-t3'] = 130,
['mtn-addon-behemoth-poison-biter-t1'] = 110,
['mtn-addon-behemoth-poison-biter-t2'] = 120,
['mtn-addon-behemoth-poison-biter-t3'] = 130,
['mtn-addon-behemoth-fire-biter-t1'] = 110,
['mtn-addon-behemoth-fire-biter-t2'] = 120,
['mtn-addon-behemoth-fire-biter-t3'] = 130,
['mtn-addon-behemoth-piercing-spitter-t1'] = 110,
['mtn-addon-behemoth-piercing-spitter-t2'] = 120,
['mtn-addon-behemoth-piercing-spitter-t3'] = 130,
['mtn-addon-behemoth-acid-spitter-t1'] = 110,
['mtn-addon-behemoth-acid-spitter-t2'] = 120,
['mtn-addon-behemoth-acid-spitter-t3'] = 130,
['mtn-addon-behemoth-explosive-spitter-t1'] = 110,
['mtn-addon-behemoth-explosive-spitter-t2'] = 120,
['mtn-addon-behemoth-explosive-spitter-t3'] = 130,
['mtn-addon-behemoth-poison-spitter-t1'] = 110,
['mtn-addon-behemoth-poison-spitter-t2'] = 120,
['mtn-addon-behemoth-poison-spitter-t3'] = 130,
['mtn-addon-behemoth-fire-spitter-t1'] = 110,
['mtn-addon-behemoth-fire-spitter-t2'] = 120,
['mtn-addon-behemoth-fire-spitter-t3'] = 130,
-- worms
['mtn-addon-small-explosive-worm-turret'] = 20,
['mtn-addon-small-fire-worm-turret'] = 20,
['mtn-addon-small-piercing-worm-turret'] = 20,
['mtn-addon-small-poison-worm-turret'] = 20,
['mtn-addon-small-electric-worm-turret'] = 20,
['mtn-addon-medium-explosive-worm-turret'] = 40,
['mtn-addon-medium-fire-worm-turret'] = 40,
['mtn-addon-medium-piercing-worm-turret'] = 40,
['mtn-addon-medium-poison-worm-turret'] = 40,
['mtn-addon-medium-electric-worm-turret'] = 40,
['mtn-addon-big-explosive-worm-turret'] = 80,
['mtn-addon-big-fire-worm-turret'] = 80,
['mtn-addon-big-piercing-worm-turret'] = 80,
['mtn-addon-big-poison-worm-turret'] = 80,
['mtn-addon-big-electric-worm-turret'] = 80,
['mtn-addon-giant-worm-turret'] = 120,
})
local unit_settings = WD.get('unit_settings')
unit_settings.scale_units_by_health = {
['small-biter'] = 1,
['medium-biter'] = 0.75,
['big-biter'] = 0.5,
['behemoth-biter'] = 0.25,
['small-spitter'] = 1,
['medium-spitter'] = 0.75,
['big-spitter'] = 0.5,
['behemoth-spitter'] = 0.25,
['mtn-addon-small-piercing-biter-t1'] = 0.50,
['mtn-addon-small-piercing-biter-t2'] = 0.50,
['mtn-addon-small-piercing-biter-t3'] = 0.50,
['mtn-addon-small-acid-biter-t1'] = 0.50,
['mtn-addon-small-acid-biter-t2'] = 0.50,
['mtn-addon-small-acid-biter-t3'] = 0.50,
['mtn-addon-small-explosive-biter-t1'] = 0.50,
['mtn-addon-small-explosive-biter-t2'] = 0.50,
['mtn-addon-small-explosive-biter-t3'] = 0.50,
['mtn-addon-small-poison-biter-t1'] = 0.50,
['mtn-addon-small-poison-biter-t2'] = 0.50,
['mtn-addon-small-poison-biter-t3'] = 0.50,
['mtn-addon-small-fire-biter-t1'] = 0.50,
['mtn-addon-small-fire-biter-t2'] = 0.50,
['mtn-addon-small-fire-biter-t3'] = 0.50,
['mtn-addon-small-piercing-spitter-t1'] = 0.50,
['mtn-addon-small-piercing-spitter-t2'] = 0.50,
['mtn-addon-small-piercing-spitter-t3'] = 0.50,
['mtn-addon-small-acid-spitter-t1'] = 0.50,
['mtn-addon-small-acid-spitter-t2'] = 0.50,
['mtn-addon-small-acid-spitter-t3'] = 0.50,
['mtn-addon-small-explosive-spitter-t1'] = 0.50,
['mtn-addon-small-explosive-spitter-t2'] = 0.50,
['mtn-addon-small-explosive-spitter-t3'] = 0.50,
['mtn-addon-small-poison-spitter-t1'] = 0.50,
['mtn-addon-small-poison-spitter-t2'] = 0.50,
['mtn-addon-small-poison-spitter-t3'] = 0.50,
['mtn-addon-small-fire-spitter-t1'] = 0.50,
['mtn-addon-small-fire-spitter-t2'] = 0.50,
['mtn-addon-small-fire-spitter-t3'] = 0.50,
['mtn-addon-medium-piercing-biter-t1'] = 0.25,
['mtn-addon-medium-piercing-biter-t2'] = 0.25,
['mtn-addon-medium-piercing-biter-t3'] = 0.25,
['mtn-addon-medium-acid-biter-t1'] = 0.25,
['mtn-addon-medium-acid-biter-t2'] = 0.25,
['mtn-addon-medium-acid-biter-t3'] = 0.25,
['mtn-addon-medium-explosive-biter-t1'] = 0.25,
['mtn-addon-medium-explosive-biter-t2'] = 0.25,
['mtn-addon-medium-explosive-biter-t3'] = 0.25,
['mtn-addon-medium-poison-biter-t1'] = 0.25,
['mtn-addon-medium-poison-biter-t2'] = 0.25,
['mtn-addon-medium-poison-biter-t3'] = 0.25,
['mtn-addon-medium-fire-biter-t1'] = 0.25,
['mtn-addon-medium-fire-biter-t2'] = 0.25,
['mtn-addon-medium-fire-biter-t3'] = 0.25,
['mtn-addon-medium-piercing-spitter-t1'] = 0.25,
['mtn-addon-medium-piercing-spitter-t2'] = 0.25,
['mtn-addon-medium-piercing-spitter-t3'] = 0.25,
['mtn-addon-medium-acid-spitter-t1'] = 0.25,
['mtn-addon-medium-acid-spitter-t2'] = 0.25,
['mtn-addon-medium-acid-spitter-t3'] = 0.25,
['mtn-addon-medium-explosive-spitter-t1'] = 0.25,
['mtn-addon-medium-explosive-spitter-t2'] = 0.25,
['mtn-addon-medium-explosive-spitter-t3'] = 0.25,
['mtn-addon-medium-poison-spitter-t1'] = 0.25,
['mtn-addon-medium-poison-spitter-t2'] = 0.25,
['mtn-addon-medium-poison-spitter-t3'] = 0.25,
['mtn-addon-medium-fire-spitter-t1'] = 0.25,
['mtn-addon-medium-fire-spitter-t2'] = 0.25,
['mtn-addon-medium-fire-spitter-t3'] = 0.25,
['mtn-addon-big-piercing-biter-t1'] = 0.25,
['mtn-addon-big-piercing-biter-t2'] = 0.25,
['mtn-addon-big-piercing-biter-t3'] = 0.25,
['mtn-addon-big-acid-biter-t1'] = 0.25,
['mtn-addon-big-acid-biter-t2'] = 0.25,
['mtn-addon-big-acid-biter-t3'] = 0.25,
['mtn-addon-big-explosive-biter-t1'] = 0.25,
['mtn-addon-big-explosive-biter-t2'] = 0.25,
['mtn-addon-big-explosive-biter-t3'] = 0.25,
['mtn-addon-big-poison-biter-t1'] = 0.25,
['mtn-addon-big-poison-biter-t2'] = 0.25,
['mtn-addon-big-poison-biter-t3'] = 0.25,
['mtn-addon-big-fire-biter-t1'] = 0.25,
['mtn-addon-big-fire-biter-t2'] = 0.25,
['mtn-addon-big-fire-biter-t3'] = 0.25,
['mtn-addon-big-piercing-spitter-t1'] = 0.25,
['mtn-addon-big-piercing-spitter-t2'] = 0.25,
['mtn-addon-big-piercing-spitter-t3'] = 0.25,
['mtn-addon-big-acid-spitter-t1'] = 0.25,
['mtn-addon-big-acid-spitter-t2'] = 0.25,
['mtn-addon-big-acid-spitter-t3'] = 0.25,
['mtn-addon-big-explosive-spitter-t1'] = 0.25,
['mtn-addon-big-explosive-spitter-t2'] = 0.25,
['mtn-addon-big-explosive-spitter-t3'] = 0.25,
['mtn-addon-big-poison-spitter-t1'] = 0.25,
['mtn-addon-big-poison-spitter-t2'] = 0.25,
['mtn-addon-big-poison-spitter-t3'] = 0.25,
['mtn-addon-big-fire-spitter-t1'] = 0.25,
['mtn-addon-big-fire-spitter-t2'] = 0.25,
['mtn-addon-big-fire-spitter-t3'] = 0.25,
['mtn-addon-behemoth-piercing-biter-t1'] = 0.25,
['mtn-addon-behemoth-piercing-biter-t2'] = 0.25,
['mtn-addon-behemoth-piercing-biter-t3'] = 0.25,
['mtn-addon-behemoth-acid-biter-t1'] = 0.25,
['mtn-addon-behemoth-acid-biter-t2'] = 0.25,
['mtn-addon-behemoth-acid-biter-t3'] = 0.25,
['mtn-addon-behemoth-explosive-biter-t1'] = 0.25,
['mtn-addon-behemoth-explosive-biter-t2'] = 0.25,
['mtn-addon-behemoth-explosive-biter-t3'] = 0.25,
['mtn-addon-behemoth-poison-biter-t1'] = 0.25,
['mtn-addon-behemoth-poison-biter-t2'] = 0.25,
['mtn-addon-behemoth-poison-biter-t3'] = 0.25,
['mtn-addon-behemoth-fire-biter-t1'] = 0.25,
['mtn-addon-behemoth-fire-biter-t2'] = 0.25,
['mtn-addon-behemoth-fire-biter-t3'] = 0.25,
['mtn-addon-behemoth-piercing-spitter-t1'] = 0.25,
['mtn-addon-behemoth-piercing-spitter-t2'] = 0.25,
['mtn-addon-behemoth-piercing-spitter-t3'] = 0.25,
['mtn-addon-behemoth-acid-spitter-t1'] = 0.25,
['mtn-addon-behemoth-acid-spitter-t2'] = 0.25,
['mtn-addon-behemoth-acid-spitter-t3'] = 0.25,
['mtn-addon-behemoth-explosive-spitter-t1'] = 0.25,
['mtn-addon-behemoth-explosive-spitter-t2'] = 0.25,
['mtn-addon-behemoth-explosive-spitter-t3'] = 0.25,
['mtn-addon-behemoth-poison-spitter-t1'] = 0.25,
['mtn-addon-behemoth-poison-spitter-t2'] = 0.25,
['mtn-addon-behemoth-poison-spitter-t3'] = 0.25,
['mtn-addon-behemoth-fire-spitter-t1'] = 0.25,
['mtn-addon-behemoth-fire-spitter-t2'] = 0.25,
['mtn-addon-behemoth-fire-spitter-t3'] = 0.25,
}
unit_settings.scale_worms_by_health = {
['land-mine'] = 0.5, -- not active as of now
['gun-turret'] = 0.5, -- not active as of now
['flamethrower-turret'] = 0.4, -- not active as of now
['artillery-turret'] = 0.25, -- not active as of now
['small-worm-turret'] = 0.8,
['medium-worm-turret'] = 0.6,
['big-worm-turret'] = 0.3,
['behemoth-worm-turret'] = 0.3,
['mtn-addon-small-explosive-worm-turret'] = 0.50,
['mtn-addon-small-fire-worm-turret'] = 0.50,
['mtn-addon-small-piercing-worm-turret'] = 0.50,
['mtn-addon-small-poison-worm-turret'] = 0.50,
['mtn-addon-small-electric-worm-turret'] = 0.50,
['mtn-addon-medium-explosive-worm-turret'] = 0.25,
['mtn-addon-medium-fire-worm-turret'] = 0.25,
['mtn-addon-medium-piercing-worm-turret'] = 0.25,
['mtn-addon-medium-poison-worm-turret'] = 0.25,
['mtn-addon-medium-electric-worm-turret'] = 0.25,
['mtn-addon-big-explosive-worm-turret'] = 0.1,
['mtn-addon-big-fire-worm-turret'] = 0.1,
['mtn-addon-big-piercing-worm-turret'] = 0.1,
['mtn-addon-big-poison-worm-turret'] = 0.1,
['mtn-addon-big-electric-worm-turret'] = 0.1,
['mtn-addon-giant-worm-turret'] = 0.05,
}
end
function Public.set_worm_raffle()
local unit_settings = WD.get('unit_settings')
unit_settings.custom_worm_raffle = set_worm_raffle_token
end
function Public.find_rocks_and_slowly_remove()
local active_surface_index = Public.get('active_surface_index')
local surface = game.get_surface(active_surface_index)
@ -1058,7 +1652,7 @@ function Public.find_void_tiles_and_replace()
}
end
local tiles = surface.find_tiles_filtered({ area = area, name = { 'out-of-map', 'water', 'deepwater', 'water-green', 'deepwater-green' } })
local tiles = surface.find_tiles_filtered({ area = area, name = { 'out-of-map', 'water', 'deepwater', 'water-green', 'deepwater-green', 'void-tile' } })
if tiles and #tiles > 0 then
Public.set('tiles_to_replace', tiles)
end
@ -1378,7 +1972,7 @@ function Public.set_spawn_position()
return false
end
local get_tile = surface.get_tile(tile)
if get_tile.valid and get_tile.name == 'out-of-map' then
if get_tile.valid and (get_tile.name == 'out-of-map' or get_tile.name == 'void-tile') then
remove(tbl, inc - inc + 1)
return true
else
@ -1536,7 +2130,7 @@ function Public.on_player_joined_game(event)
else
local p = { x = player.physical_position.x, y = player.physical_position.y }
local get_tile = surface.get_tile(p.x, p.y)
if get_tile.valid and get_tile.name == 'out-of-map' then
if get_tile.valid and (get_tile.name == 'out-of-map' or get_tile.name == 'void-tile') then
local pos = surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(surface), 3, 0)
if pos then
player.teleport(pos, surface)

View File

@ -349,8 +349,8 @@ local function do_place_entities(data)
if entity then
if e.note then -- small-worm-turret, medium-worm-turret, big-worm-turret, behemoth-worm-turret
local modified_unit_health = WD.get('modified_unit_health')
local worm_unit_settings = WD.get('worm_unit_settings')
local final_health = round(modified_unit_health.current_value * worm_unit_settings.scale_units_by_health[entity.name], 3)
local unit_settings = WD.get('unit_settings')
local final_health = round(modified_unit_health.current_value * unit_settings.scale_worms_by_health[entity.name], 3)
if final_health < 1 then
final_health = 1
end

View File

@ -16,6 +16,13 @@ local round = math.round
local floor = math.floor
local module_tag = '[color=blue]Comfylatron:[/color] '
local is_modded = script.active_mods['MtnFortressAddons'] or false
local out_of_map_tile = 'out-of-map'
if is_modded then
out_of_map_tile = 'void-tile'
end
local messages = {
' vehicle was nibbled to death.',
' vehicle should not have played with the biters.',
@ -890,12 +897,12 @@ function Public.remove_surface(player)
end
for _, tile in pairs(surface.find_tiles_filtered({ area = car.area })) do
surface.set_tiles({ { name = 'out-of-map', position = tile.position } }, true)
surface.set_tiles({ { name = out_of_map_tile, position = tile.position } }, true)
end
for _, x in pairs({ car.area.left_top.x - 1.5, car.area.right_bottom.x + 1.5 }) do
local p = { x = x, y = car.area.left_top.y + ((car.area.right_bottom.y - car.area.left_top.y) * 0.5) }
surface.set_tiles({ { name = 'out-of-map', position = { x = p.x + 0.5, y = p.y } } }, true)
surface.set_tiles({ { name = 'out-of-map', position = { x = p.x - 1, y = p.y } } }, true)
surface.set_tiles({ { name = out_of_map_tile, position = { x = p.x + 0.5, y = p.y } } }, true)
surface.set_tiles({ { name = out_of_map_tile, position = { x = p.x - 1, y = p.y } } }, true)
end
game.delete_surface(surface)
end
@ -972,12 +979,12 @@ function Public.kill_car(entity)
local surface = game.surfaces[surface_index]
kill_doors(car)
for _, tile in pairs(surface.find_tiles_filtered({ area = car.area })) do
surface.set_tiles({ { name = 'out-of-map', position = tile.position } }, true)
surface.set_tiles({ { name = out_of_map_tile, position = tile.position } }, true)
end
for _, x in pairs({ car.area.left_top.x - 1.5, car.area.right_bottom.x + 1.5 }) do
local p = { x = x, y = car.area.left_top.y + ((car.area.right_bottom.y - car.area.left_top.y) * 0.5) }
surface.set_tiles({ { name = 'out-of-map', position = { x = p.x + 0.5, y = p.y } } }, true)
surface.set_tiles({ { name = 'out-of-map', position = { x = p.x - 1, y = p.y } } }, true)
surface.set_tiles({ { name = out_of_map_tile, position = { x = p.x + 0.5, y = p.y } } }, true)
surface.set_tiles({ { name = out_of_map_tile, position = { x = p.x - 1, y = p.y } } }, true)
end
car.entity.force.chart(surface, car.area)
game.delete_surface(surface)
@ -1141,7 +1148,7 @@ function Public.create_room_surface(car)
surface.force_generate_chunk_requests()
exclude_surface(surface)
for _, tile in pairs(surface.find_tiles_filtered({ area = { { -2, -2 }, { 2, 2 } } })) do
surface.set_tiles({ { name = 'out-of-map', position = tile.position } }, true)
surface.set_tiles({ { name = out_of_map_tile, position = tile.position } }, true)
end
local surfaces = IC.get('surfaces')
surfaces[unit_number] = surface.index

View File

@ -12,6 +12,13 @@ local deepcopy = table.deepcopy
local random = math.random
local sqrt = math.sqrt
local is_modded = script.active_mods['MtnFortressAddons'] or false
local out_of_map_tile = 'out-of-map'
if is_modded then
out_of_map_tile = 'void-tile'
end
local scenario_name = WPT.scenario_name
local fallout_width = 64
local fallout_debris = {}
@ -332,7 +339,7 @@ function Public.hazardous_debris()
local position = fallout_debris[random(1, size_of_debris)]
local p = { x = position[1], y = position[2] }
local get_tile = surface.get_tile(p)
if get_tile.valid and get_tile.name == 'out-of-map' then
if get_tile.valid and get_tile.name == out_of_map_tile then
create({ name = 'slowdown-capsule', position = position, force = 'neutral', target = { position[1], position[2] + fallout_width * 2 }, speed = speed })
end
end
@ -341,7 +348,7 @@ function Public.hazardous_debris()
local position = fallout_debris[random(1, size_of_debris)]
local p = { x = position[1], y = position[2] }
local get_tile = surface.get_tile(p)
if get_tile.valid and get_tile.name == 'out-of-map' then
if get_tile.valid and get_tile.name == out_of_map_tile then
create({ name = 'slowdown-capsule', position = position, force = 'neutral', target = { position[1], position[2] + fallout_width * 2 }, speed = speed })
end
end
@ -350,7 +357,7 @@ function Public.hazardous_debris()
local position = fallout_debris[random(1, size_of_debris)]
local p = { x = position[1], y = position[2] }
local get_tile = surface.get_tile(p)
if get_tile.valid and get_tile.name == 'out-of-map' then
if get_tile.valid and get_tile.name == out_of_map_tile then
create(
{
name = 'atomic-bomb-wave-spawns-nuke-shockwave-explosion',
@ -367,7 +374,7 @@ function Public.hazardous_debris()
local position = fallout_debris[random(1, size_of_debris)]
local p = { x = position[1], y = position[2] }
local get_tile = surface.get_tile(p)
if get_tile.valid and get_tile.name == 'out-of-map' then
if get_tile.valid and get_tile.name == out_of_map_tile then
create(
{
name = 'slowdown-capsule',
@ -384,7 +391,7 @@ function Public.hazardous_debris()
local position = fallout_debris[random(1, size_of_debris)]
local p = { x = position[1], y = position[2] }
local get_tile = surface.get_tile(p)
if get_tile.valid and get_tile.name == 'out-of-map' then
if get_tile.valid and get_tile.name == out_of_map_tile then
create({ name = 'shotgun-pellet', position = position, force = 'neutral', target = { position[1], position[2] + fallout_width * 2 }, speed = speed })
end
end
@ -393,7 +400,7 @@ function Public.hazardous_debris()
local position = fallout_debris[random(1, size_of_debris)]
local p = { x = position[1], y = position[2] }
local get_tile = surface.get_tile(p)
if get_tile.valid and get_tile.name == 'out-of-map' then
if get_tile.valid and get_tile.name == out_of_map_tile then
create({ name = 'cannon-projectile', position = position, force = 'neutral', target = { position[1], position[2] + fallout_width * 2 }, speed = speed })
end
end
@ -402,7 +409,7 @@ function Public.hazardous_debris()
local position = fallout_debris[random(1, size_of_debris)]
local p = { x = position[1], y = position[2] }
local get_tile = surface.get_tile(p)
if get_tile.valid and get_tile.name == 'out-of-map' then
if get_tile.valid and get_tile.name == out_of_map_tile then
create(
{
name = 'atomic-bomb-wave-spawns-nuke-shockwave-explosion',
@ -419,7 +426,7 @@ function Public.hazardous_debris()
local position = fallout_debris[random(1, size_of_debris)]
local p = { x = position[1], y = position[2] }
local get_tile = surface.get_tile(p)
if get_tile.valid and get_tile.name == 'out-of-map' then
if get_tile.valid and get_tile.name == out_of_map_tile then
create(
{
name = 'uranium-cannon-projectile',
@ -570,12 +577,12 @@ function Public.kill_wagon(icw, entity)
kick_players_out_of_vehicles(wagon)
kill_wagon_doors(icw, wagon)
for _, tile in pairs(surface.find_tiles_filtered({ area = wagon.area })) do
surface.set_tiles({ { name = 'out-of-map', position = tile.position } }, true)
surface.set_tiles({ { name = out_of_map_tile, position = tile.position } }, true)
end
for _, x in pairs({ wagon.area.left_top.x - 1.5, wagon.area.right_bottom.x + 1.5 }) do
local p = { x = x, y = wagon.area.left_top.y + ((wagon.area.right_bottom.y - wagon.area.left_top.y) * 0.5) }
surface.set_tiles({ { name = 'out-of-map', position = { x = p.x + 0.5, y = p.y } } }, true)
surface.set_tiles({ { name = 'out-of-map', position = { x = p.x - 1, y = p.y } } }, true)
surface.set_tiles({ { name = out_of_map_tile, position = { x = p.x + 0.5, y = p.y } } }, true)
surface.set_tiles({ { name = out_of_map_tile, position = { x = p.x - 1, y = p.y } } }, true)
end
wagon.entity.force.chart(surface, wagon.area)
icw.wagons[entity.unit_number] = nil
@ -607,7 +614,7 @@ function Public.create_room_surface(icw, unit_number)
surface.force_generate_chunk_requests()
exclude_surface(surface)
for _, tile in pairs(surface.find_tiles_filtered({ area = { { -2, -2 }, { 2, 2 } } })) do
surface.set_tiles({ { name = 'out-of-map', position = tile.position } }, true)
surface.set_tiles({ { name = out_of_map_tile, position = tile.position } }, true)
end
icw.surfaces[#icw.surfaces + 1] = surface
return surface
@ -896,7 +903,7 @@ local function move_room_to_train(icw, train, wagon)
end
for _, tile in pairs(wagon.surface.find_tiles_filtered({ area = wagon.area })) do
wagon.surface.set_tiles({ { name = 'out-of-map', position = tile.position } }, true)
wagon.surface.set_tiles({ { name = out_of_map_tile, position = tile.position } }, true)
end
wagon.entity.force.chart(wagon.surface, wagon.area)

View File

@ -37,6 +37,15 @@ else
}
end
if Public.is_modded then
biters = {
'mtn-addon-behemoth-acid-biter-t1',
'mtn-addon-behemoth-fire-biter-t3',
'mtn-addon-big-explosive-spitter-t3',
'mtn-addon-big-poison-spitter-t3'
}
end
local function shoo(event)
local icw_locomotive = Public.get('icw_locomotive')
if not icw_locomotive then return end

View File

@ -439,6 +439,10 @@ function Public.pre_init_task(current_task)
Public.stateful.clear_all_frames()
Public.sr_reset_forces()
WD.set('wave_interval', 4500)
Public.set_threat_values()
Public.set_unit_raffle()
Public.set_worm_raffle()
RPG.set_extra('modded_hotkeys', true)
current_task.message = 'Pre init done!'
current_task.state = 'init_stateful'
@ -792,6 +796,7 @@ function Public.init_mtn()
T.sub_caption_color = { r = 0, g = 150, b = 0 }
Explosives.set_destructible_tile('out-of-map', 1500)
Explosives.set_destructible_tile('void-tile', 1500)
Explosives.set_destructible_tile('water', 1000)
Explosives.set_destructible_tile('water-green', 1000)
Explosives.set_destructible_tile('deepwater-green', 1000)

View File

@ -112,7 +112,16 @@ local scrap_yield_amounts = {
local valid_rocks = {
['big-sand-rock'] = true,
['big-rock'] = true,
['huge-rock'] = true
['huge-rock'] = true,
['huge-rock-crisp'] = true,
['big-rock-crisp'] = true,
['big-sand-rock-crisp'] = true,
['huge-rock-crisp-1'] = true,
['big-rock-crisp-1'] = true,
['big-sand-rock-crisp-1'] = true,
['huge-rock-crisp-2'] = true,
['big-rock-crisp-2'] = true,
['big-sand-rock-crisp-2'] = true,
}
local valid_trees = {
@ -136,13 +145,28 @@ local valid_scrap = {
['crash-site-spaceship-wreck-small-4'] = true,
['crash-site-spaceship-wreck-small-5'] = true,
['crash-site-spaceship-wreck-small-6'] = true,
['mineable-wreckages'] = true
['mineable-wreckages'] = true,
['mineable-wreckages-1'] = true,
['mineable-wreckages-2'] = true,
['mineable-wreckages-3'] = true,
['mineable-wreckages-4'] = true,
['mineable-wreckages-5'] = true,
['mineable-wreckages-6'] = true,
}
local rock_yield = {
['big-rock'] = 1,
['huge-rock'] = 2,
['big-sand-rock'] = 1
['big-sand-rock'] = 1,
['huge-rock-crisp'] = 2,
['big-rock-crisp'] = 1,
['big-sand-rock-crisp'] = 1,
['huge-rock-red'] = 2,
['big-rock-red'] = 1,
['big-sand-rock-red'] = 1,
['huge-rock-green'] = 2,
['big-rock-green'] = 1,
['big-sand-rock-green'] = 1,
}
local particles = {

View File

@ -32,8 +32,10 @@ local round = math.round
local floor = math.floor
local dataset = 'scenario_settings'
local dataset_key = 'mtn_v3'
local dataset_key_modded = 'mtn_v3_modded'
local dataset_key_dev = 'mtn_v3_dev'
local dataset_key_previous = 'mtn_v3_previous'
local dataset_key_modded_previous = 'mtn_v3_modded_previous'
local dataset_key_previous_dev = 'mtn_v3_previous_dev'
local send_ping_to_channel = Discord.channel_names.mtn_channel
local scenario_name = Public.scenario_name
@ -1339,7 +1341,11 @@ local function apply_startup_settings(settings)
-- Server.stop_scenario()
if server_name_matches then
Server.set_data(dataset, dataset_key, settings)
if Public.is_modded then
Server.set_data(dataset, dataset_key_modded, settings)
else
Server.set_data(dataset, dataset_key, settings)
end
else
Server.set_data(dataset, dataset_key_dev, settings)
end
@ -1363,7 +1369,11 @@ local apply_settings_token =
season = 1
}
if server_name_matches then
Server.set_data(dataset, dataset_key, settings)
if Public.is_modded then
Server.set_data(dataset, dataset_key_modded, settings)
else
Server.set_data(dataset, dataset_key, settings)
end
else
Server.set_data(dataset, dataset_key_dev, settings)
end
@ -1436,6 +1446,12 @@ local function grant_non_limit_reached_buff()
return all_buffs[1]
end
-- local Alert = require 'utils.alert'
-- local Stateful = require 'maps.mountain_fortress_v3.stateful.table'
-- local buff = Stateful.save_settings()
-- Alert.alert_all_players(100, 'Buff granted from previous run: ' .. buff.discord)
-- Alert.alert_all_players(100, 'Buff granted from previous run: ' .. buff.discord)
-- Alert.alert_all_players(100, 'Buff granted from previous run: ' .. buff.discord)
function Public.save_settings()
local granted_buff = grant_non_limit_reached_buff()
this.buffs[#this.buffs + 1] = granted_buff
@ -1453,7 +1469,11 @@ function Public.save_settings()
local server_name_matches = Server.check_server_name(Public.discord_name)
if server_name_matches then
Server.set_data(dataset, dataset_key, settings)
if Public.is_modded then
Server.set_data(dataset, dataset_key_modded, settings)
else
Server.set_data(dataset, dataset_key, settings)
end
else
Server.set_data(dataset, dataset_key_dev, settings)
end
@ -1472,7 +1492,11 @@ function Public.save_settings_before_reset()
local server_name_matches = Server.check_server_name(Public.discord_name)
if server_name_matches then
Server.set_data(dataset, dataset_key_previous, settings)
if Public.is_modded then
Server.set_data(dataset, dataset_key_modded_previous, settings)
else
Server.set_data(dataset, dataset_key_previous, settings)
end
else
Server.set_data(dataset, dataset_key_previous_dev, settings)
end
@ -1883,7 +1907,11 @@ function Public.stateful_on_server_started()
this.settings_applied = true
if server_name_matches then
Server.try_get_data(dataset, dataset_key, apply_settings_token)
if Public.is_modded then
Server.try_get_data(dataset, dataset_key_modded, apply_settings_token)
else
Server.try_get_data(dataset, dataset_key, apply_settings_token)
end
else
Server.try_get_data(dataset, dataset_key_dev, apply_settings_token)
this.test_mode = true
@ -1902,7 +1930,11 @@ Event.add(
this.settings_applied = true
if server_name_matches then
Server.try_get_data(dataset, dataset_key, apply_settings_token)
if Public.is_modded then
Server.try_get_data(dataset, dataset_key_modded, apply_settings_token)
else
Server.try_get_data(dataset, dataset_key, apply_settings_token)
end
else
Server.try_get_data(dataset, dataset_key_dev, apply_settings_token)
this.test_mode = true
@ -1934,6 +1966,30 @@ Server.on_data_set_changed(
end
)
Server.on_data_set_changed(
dataset_key_modded,
function (data)
if data.value then
local settings = data.value
if settings.rounds_survived ~= nil then
this.rounds_survived = settings.rounds_survived
end
if settings.season ~= nil then
this.season = settings.season
end
if settings.test_mode ~= nil then
this.test_mode = settings.test_mode
end
if settings.buffs ~= nil then
this.buffs = settings.buffs
end
if settings.current_date ~= nil then
this.current_date = settings.current_date
end
end
end
)
Server.on_data_set_changed(
dataset_key_dev,
function (data)

View File

@ -57,6 +57,8 @@ Public.scenario_name = scenario_name
local discord_name = 'Mtn Fortress'
Public.discord_name = discord_name
Public.is_modded = script.active_mods['MtnFortressAddons'] or false
Global.register(
this,
function (tbl)
@ -147,6 +149,7 @@ Public.pickaxe_upgrades = {
function Public.reset_main_table()
-- @start
this.space_age = script.active_mods['space-age'] or false
this.modded = script.active_mods['MtnFortressAddons'] or false
-- these 3 are in case of stop/start/reloading the instance.
this.soft_reset = true
this.restart = false
@ -313,7 +316,11 @@ function Public.reset_main_table()
this.spidertron_unlocked_at_zone = 11
this.spidertron_unlocked_enabled = false
-- this.void_or_tile = 'lab-dark-2'
this.void_or_tile = 'out-of-map'
if Public.is_modded then
this.void_or_tile = 'void-tile'
else
this.void_or_tile = 'out-of-map'
end
this.validate_spider = {}
this.check_afk_players = true
this.winter_mode = false

View File

@ -7,6 +7,8 @@ local abs = math.abs
local floor = math.floor
local ceil = math.ceil
local is_modded = Public.is_modded
local scenario_name = Public.scenario_name
local zone_settings = Public.zone_settings
local worm_level_modifier = 0.19
@ -46,6 +48,16 @@ if not has_space_age() then
start_ground_tiles = vanilla_start_ground_tiles
end
local out_of_map_tile = 'out-of-map'
if is_modded then
out_of_map_tile = 'void-tile'
end
local custom_stone_wall = 'stone-wall'
if is_modded then
custom_stone_wall = 'steel-wall'
end
local nuclear_tiles = {
'nuclear-ground',
'nuclear-ground',
@ -79,6 +91,21 @@ local rock_raffle = {
'huge-rock'
}
if is_modded then
rock_raffle = {
'huge-rock-crisp',
'big-rock-crisp',
'big-sand-rock-crisp',
'huge-rock-crisp-1',
'big-rock-crisp-1',
'big-sand-rock-crisp-1',
'huge-rock-crisp-2',
'big-rock-crisp-2',
'big-sand-rock-crisp-2',
}
end
local size_of_rock_raffle = #rock_raffle
local tree_raffle = {
@ -148,6 +175,31 @@ local turret_list = {
[6] = { name = 'artillery-turret', callback = callback[6] }
}
if is_modded then
turret_list = {}
turret_list[#turret_list + 1] = { name = 'mtn-addon-gun-turret-1', callback = callback[1] }
turret_list[#turret_list + 1] = { name = 'mtn-addon-gun-turret-2', callback = callback[2] }
turret_list[#turret_list + 1] = { name = 'mtn-addon-gun-turret-3', callback = callback[3] }
turret_list[#turret_list + 1] = { name = 'mtn-addon-gun-turret-4', callback = callback[4] }
turret_list[#turret_list + 1] = { name = 'mtn-addon-gun-turret-5', callback = callback[4] }
turret_list[#turret_list + 1] = { name = 'mtn-addon-gun-turret-6', callback = callback[4] }
turret_list[#turret_list + 1] = { name = 'mtn-addon-gun-turret-7', callback = callback[4] }
turret_list[#turret_list + 1] = { name = 'mtn-addon-gun-turret-8', callback = callback[4] }
turret_list[#turret_list + 1] = { name = 'mtn-addon-gun-turret-9', callback = callback[4] }
turret_list[#turret_list + 1] = { name = 'mtn-addon-laser-turret-1', callback = nil }
turret_list[#turret_list + 1] = { name = 'mtn-addon-laser-turret-2', callback = nil }
turret_list[#turret_list + 1] = { name = 'mtn-addon-laser-turret-3', callback = nil }
turret_list[#turret_list + 1] = { name = 'mtn-addon-laser-turret-4', callback = nil }
turret_list[#turret_list + 1] = { name = 'mtn-addon-laser-turret-5', callback = nil }
turret_list[#turret_list + 1] = { name = 'mtn-addon-laser-turret-6', callback = nil }
turret_list[#turret_list + 1] = { name = 'mtn-addon-laser-turret-7', callback = nil }
turret_list[#turret_list + 1] = { name = 'mtn-addon-laser-turret-8', callback = nil }
turret_list[#turret_list + 1] = { name = 'mtn-addon-laser-turret-9', callback = nil }
turret_list[#turret_list + 1] = { name = 'flamethrower-turret', callback = callback[5] }
turret_list[#turret_list + 1] = { name = 'artillery-turret', callback = callback[6] }
end
local function get_scrap_mineable_entities()
local scrap_mineable_entities = {
'crash-site-spaceship-wreck-small-1',
@ -163,6 +215,23 @@ local function get_scrap_mineable_entities()
'crash-site-spaceship-wreck-small-6'
}
if is_modded then
scrap_mineable_entities = {
'mineable-wreckage-1',
'mineable-wreckage-1',
'mineable-wreckage-1',
'mineable-wreckage-1',
'mineable-wreckage-4',
'mineable-wreckage-4',
'mineable-wreckage-4',
'mineable-wreckage-4',
'mineable-wreckage-6',
'mineable-wreckage-6',
'mineable-wreckage-6',
'mineable-wreckage-6',
}
end
local scrap_mineable_entities_index = #scrap_mineable_entities
return scrap_mineable_entities, scrap_mineable_entities_index
@ -458,7 +527,7 @@ local function wall(p, data)
if
surface.can_place_entity(
{
name = 'stone-wall',
name = custom_stone_wall,
position = p,
force = 'enemy'
}
@ -475,7 +544,7 @@ local function wall(p, data)
if y <= 22 then
if random(1, y + 1) == 1 then
entities[#entities + 1] = {
name = 'stone-wall',
name = custom_stone_wall,
position = p,
force = 'neutral',
callback = stone_wall
@ -580,7 +649,7 @@ local function wall(p, data)
else
if random(1, 32 - y) == 1 then
entities[#entities + 1] = {
name = 'stone-wall',
name = custom_stone_wall,
position = p,
force = 'neutral',
callback = stone_wall
@ -618,26 +687,58 @@ local function wall(p, data)
spawn_turret(entities, p, 2)
end
elseif abs(p.y) < zone_settings.zone_depth * 2.5 then
if random(1, 8) == 1 then
if random(1, 4) == 1 then
spawn_turret(entities, p, 3)
else
spawn_turret(entities, p, 4)
end
elseif abs(p.y) < zone_settings.zone_depth * 3.5 then
if random(1, 4) == 1 then
spawn_turret(entities, p, 4)
spawn_turret(entities, p, 5)
else
spawn_turret(entities, p, 3)
spawn_turret(entities, p, 6)
end
elseif abs(p.y) < zone_settings.zone_depth * 4.5 then
if random(1, 4) == 1 then
spawn_turret(entities, p, 4)
spawn_turret(entities, p, 7)
else
spawn_turret(entities, p, 5)
spawn_turret(entities, p, 8)
end
elseif abs(p.y) < zone_settings.zone_depth * 5.5 then
if random(1, 4) == 1 then
spawn_turret(entities, p, 4)
spawn_turret(entities, p, 9)
elseif random(1, 2) == 1 then
spawn_turret(entities, p, 5)
spawn_turret(entities, p, 10)
end
elseif abs(p.y) < zone_settings.zone_depth * 6.5 then
if random(1, 4) == 1 then
spawn_turret(entities, p, 11)
elseif random(1, 2) == 1 then
spawn_turret(entities, p, 12)
end
elseif abs(p.y) < zone_settings.zone_depth * 7.5 then
if random(1, 4) == 1 then
spawn_turret(entities, p, 13)
elseif random(1, 2) == 1 then
spawn_turret(entities, p, 14)
end
elseif abs(p.y) < zone_settings.zone_depth * 8.5 then
if random(1, 4) == 1 then
spawn_turret(entities, p, 15)
elseif random(1, 2) == 1 then
spawn_turret(entities, p, 16)
end
elseif abs(p.y) < zone_settings.zone_depth * 9.5 then
if random(1, 4) == 1 then
spawn_turret(entities, p, 17)
elseif random(1, 2) == 1 then
spawn_turret(entities, p, 18)
end
elseif abs(p.y) < zone_settings.zone_depth * 10.5 then
if random(1, 4) == 1 then
spawn_turret(entities, p, 19)
elseif random(1, 2) == 1 then
spawn_turret(entities, p, 20)
end
end
elseif abs(p.y) > zone_settings.zone_depth * 5.5 then
@ -2938,7 +3039,7 @@ end
local function out_of_map(p, data)
local tiles = data.tiles
tiles[#tiles + 1] = { name = 'out-of-map', position = p }
tiles[#tiles + 1] = { name = out_of_map_tile, position = p }
end
function Public.heavy_functions(data)
@ -2955,7 +3056,7 @@ function Public.heavy_functions(data)
local pre_final_battle = Public.get('pre_final_battle')
if pre_final_battle then
local tiles = data.tiles
tiles[#tiles + 1] = { name = 'out-of-map', position = p }
tiles[#tiles + 1] = { name = out_of_map_tile, position = p }
return
end
@ -3054,7 +3155,7 @@ Event.add(
local tiles = {}
for x = 0, 31 do
for y = 0, 31 do
tiles[#tiles + 1] = { name = 'out-of-map', position = { left_top.x + x, left_top.y + y } }
tiles[#tiles + 1] = { name = out_of_map_tile, position = { left_top.x + x, left_top.y + y } }
end
end
surface.set_tiles(tiles, false)
@ -3095,7 +3196,7 @@ Event.add(
if left_top.y > 32 then
for k, v in pairs(loading_chunk_vectors) do
tiles[k] = { name = 'out-of-map', position = { left_top.x + v[1], left_top.y + v[2] } }
tiles[k] = { name = out_of_map_tile, position = { left_top.x + v[1], left_top.y + v[2] } }
end
end
surface.set_tiles(tiles, false)
@ -3118,7 +3219,7 @@ Event.add(
if math.abs(left_top.y) > 128 then
for k, v in pairs(loading_chunk_vectors) do
tiles[k] = { name = 'out-of-map', position = { left_top.x + v[1], left_top.y + v[2] } }
tiles[k] = { name = out_of_map_tile, position = { left_top.x + v[1], left_top.y + v[2] } }
end
end
surface.set_tiles(tiles, false)

View File

@ -789,15 +789,16 @@ end
Gui.on_click(
auto_stash_button_name,
function (event)
local is_spamming = SpamProtection.is_spamming(event.player, nil, 'Autostash click')
if is_spamming then
return
end
local player = event.player
if not player or not player.valid or not player.character then
return player.print(module_name .. 'It seems that you are not in the realm of living.', { color = Color.warning })
end
local is_spamming = SpamProtection.is_spamming(player, nil, 'Autostash click')
if is_spamming then
return
end
if player.controller_type == defines.controllers.remote then
return player.print(module_name .. 'It seems that you are not in the realm of living.', { color = Color.warning })
end
@ -806,6 +807,144 @@ Gui.on_click(
end
)
if script.active_mods['MtnFortressAddons'] then
Event.add("mtn-ctrl-autostash-all", function (event)
local player = game.get_player(event.player_index)
if not player or not player.valid then
return
end
local is_spamming = SpamProtection.is_spamming(player, nil, 'Autostash click')
if is_spamming then
return
end
if not player.character then
return player.print(module_name .. 'It seems that you are not in the realm of living.',
{ color = Color.warning })
end
if player.controller_type == defines.controllers.remote then
return player.print(module_name .. 'It seems that you are not in the realm of living.',
{ color = Color.warning })
end
event.button = defines.mouse_button_type.left
auto_stash(player, event)
end)
Event.add("mtn-ctrl-autostash-ores", function (event)
local player = game.get_player(event.player_index)
if not player or not player.valid then
return
end
local is_spamming = SpamProtection.is_spamming(player, nil, 'Autostash click')
if is_spamming then
return
end
if not player.character then
return player.print(module_name .. 'It seems that you are not in the realm of living.',
{ color = Color.warning })
end
if player.controller_type == defines.controllers.remote then
return player.print(module_name .. 'It seems that you are not in the realm of living.',
{ color = Color.warning })
end
event.button = defines.mouse_button_type.right
auto_stash(player, event)
end)
Event.add("mtn-ctrl-autostash-furnaces", function (event)
local player = game.get_player(event.player_index)
if not player or not player.valid then
return
end
local is_spamming = SpamProtection.is_spamming(player, nil, 'Autostash click')
if is_spamming then
return
end
if not player.character then
return player.print(module_name .. 'It seems that you are not in the realm of living.',
{ color = Color.warning })
end
if player.controller_type == defines.controllers.remote then
return player.print(module_name .. 'It seems that you are not in the realm of living.',
{ color = Color.warning })
end
event.control = true
event.button = defines.mouse_button_type.right
auto_stash(player, event)
end)
Event.add("mtn-ctrl-autostash-filtered", function (event)
local player = game.get_player(event.player_index)
if not player or not player.valid then
return
end
if not player then return end
local is_spamming = SpamProtection.is_spamming(player, nil, 'Autostash click')
if is_spamming then
return
end
if not player.character then
return player.print(module_name .. 'It seems that you are not in the realm of living.',
{ color = Color.warning })
end
if player.controller_type == defines.controllers.remote then
return player.print(module_name .. 'It seems that you are not in the realm of living.',
{ color = Color.warning })
end
event.shift = true
event.button = defines.mouse_button_type.left
auto_stash(player, event)
end)
Event.add("mtn-ctrl-autostash-wagon", function (event)
local player = game.get_player(event.player_index)
if not player or not player.valid then
return
end
local is_spamming = SpamProtection.is_spamming(player, nil, 'Autostash click')
if is_spamming then
return
end
if not player.character then
return player.print(module_name .. 'It seems that you are not in the realm of living.',
{ color = Color.warning })
end
if player.controller_type == defines.controllers.remote then
return player.print(module_name .. 'It seems that you are not in the realm of living.',
{ color = Color.warning })
end
event.shift = true
event.button = defines.mouse_button_type.right
auto_stash(player, event)
end)
end
function Public.insert_into_furnace(value)
this.insert_into_furnace = value or false
end

View File

@ -1124,6 +1124,52 @@ function Public.get_heal_modifier_from_using_fish(player)
end
end
function Public.get_mana_modifier_from_using_fish(player, item)
local rpg_extra = Public.get('rpg_extra')
if rpg_extra.disable_get_heal_modifier_from_using_fish then
return
end
local rpg_t = Public.get_value_from_player(player.index)
if not rpg_t then return end
if rpg_t.mana_max < 1 then
return
end
if rpg_t.mana >= rpg_t.mana_max then
rpg_t.mana = rpg_t.mana_max
return
end
if player.character == nil then return end
local base_amount = item == 'cooked-fish' and 40 or item == 'grilled-fish' and 80 or 0
local rng = random(base_amount, base_amount * rpg_extra.mana_modifier)
local position = player.physical_position
local mana_max = rpg_t.mana_max
local color
if rpg_t.mana > (mana_max * 0.50) then
color = { b = 0.2, r = 0.1, g = 1, a = 0.8 }
elseif rpg_t.mana > (mana_max * 0.25) then
color = { r = 1, g = 1, b = 0 }
else
color = { b = 0.1, r = 1, g = 0, a = 0.8 }
end
player.create_local_flying_text(
{
position = { position.x, position.y + 0.6 },
text = '+' .. rng,
color = color,
}
)
rpg_t.mana = rpg_t.mana + rng
if rpg_t.mana >= rpg_t.mana_max then
rpg_t.mana = rpg_t.mana_max
end
end
function Public.get_mana_modifier(player)
local rpg_t = Public.get_value_from_player(player.index)
if not rpg_t then return end

View File

@ -9,6 +9,7 @@ local Explosives = require 'modules.explosives'
local StatData = require 'utils.datastore.statistics'
local WD = require 'modules.wave_defense.table'
local Math2D = require 'math2d'
local Color = require 'utils.color_presets'
StatData.add_normalize('spells', 'Spells casted')
@ -887,6 +888,167 @@ local function tame_unit_effects(player, entity)
}
end
local function on_player_used_capsule_custom(event)
local enable_mana = Public.get('rpg_extra').enable_mana
if not enable_mana then
return
end
local player = game.get_player(event.player_index)
if not player or not player.valid then
return
end
local
is_spamming = SpamProtection.is_spamming(player, nil, 'RPG - on_player_used_capsule_custom')
if is_spamming then
return
end
local projectile_types = Public.get_projectiles
if not player.character or not player.character.valid then
return
end
if not Public.check_is_surface_valid(player) then
return
end
local rpg_t = Public.get_value_from_player(player.index)
if not rpg_t.enable_entity_spawn then
player.print('[RPG] You must enable the button in the spell GUI to cast a spell.', { color = Color.warning })
return
end
local mana = rpg_t.mana
local surface = player.surface
local spell = Public.get_spell_by_name(rpg_t, rpg_t.dropdown_select_name)
if not spell then
return
end
if spell.enforce_cooldown then
if Public.is_cooldown_active_for_player(player) then
Public.cast_spell(player, true)
return
end
end
local position = event.cursor_position
if not position then
return
end
local radius = 15
local area = {
left_top = { x = position.x - radius, y = position.y - radius },
right_bottom = { x = position.x + radius, y = position.y + radius }
}
if not spell.enabled then
return Public.cast_spell(player, true)
end
if rpg_t.level < spell.level then
return Public.cast_spell(player, true)
end
if not Math2D.bounding_box.contains_point(area, player.physical_position) then
Public.cast_spell(player, true)
return
end
if mana < spell.mana_cost then
return Public.cast_spell(player, true)
end
local target_pos
if spell.target then
target_pos = { position.x, position.y }
elseif projectile_types[spell.entityName] then
local coord_modifier = get_near_coord_modifier(projectile_types[spell.entityName].max_range)
target_pos = { position.x + coord_modifier.x, position.y + coord_modifier.y }
end
local range
if spell.range then
range = spell.range
else
range = 0
end
local force
if spell.force then
force = spell.force
else
force = 'player'
end
local data = {
self = spell,
player = player,
damage_entity = damage_entity,
position = position,
surface = surface,
force = force,
target_pos = target_pos,
range = range,
tame_unit_effects = tame_unit_effects,
explosives = Explosives,
rpg_t = rpg_t
}
local funcs = {
remove_mana = Public.remove_mana,
damage_player_over_time = Public.damage_player_over_time,
cast_spell = Public.cast_spell
}
rpg_t.amount = 0
local cast_spell = spell.callback(data, funcs)
if not cast_spell then
return
end
if rpg_t.amount == 0 then
rpg_t.amount = 1
end
Event.raise(Public.events.on_spell_cast_success, { player_index = player.index, spell_name = spell.entityName, amount = rpg_t.amount })
StatData.get_data(player):increase('spells')
if spell.enforce_cooldown then
if player.gui.screen[spell_gui_frame_name] then
local f = player.gui.screen[spell_gui_frame_name]
if f then
if f[cooldown_indicator_name] then
Public.register_cooldown_for_player_progressbar(player, spell)
end
end
else
Public.register_cooldown_for_player(player, spell)
end
end
Public.update_mana(player)
local reward_xp = spell.mana_cost * 0.085
if reward_xp < 1 then
reward_xp = 1
end
Public.gain_xp(player, reward_xp)
if spell.log_spell then
local msg = player.name .. ' casted ' .. spell.entityName .. '. '
AntiGrief.insert_into_capsule_history(player, position, msg)
end
end
local function on_player_used_capsule(event)
local enable_mana = Public.get('rpg_extra').enable_mana
if not enable_mana then
@ -916,13 +1078,21 @@ local function on_player_used_capsule(event)
local name = item.name
local rpg_t = Public.get_value_from_player(player.index)
if not rpg_t then return end
if name == 'cooked-fish' or name == 'grilled-fish' then
Public.get_mana_modifier_from_using_fish(player, name)
return
end
if name ~= 'raw-fish' then
return
end
Public.get_heal_modifier_from_using_fish(player)
local rpg_t = Public.get_value_from_player(player.index)
if not rpg_t.enable_entity_spawn then
return
@ -1096,6 +1266,9 @@ Event.add(defines.events.on_player_repaired_entity, on_player_repaired_entity)
Event.add(defines.events.on_player_respawned, on_player_respawned)
Event.add(defines.events.on_player_rotated_entity, on_player_rotated_entity)
Event.add(defines.events.on_pre_player_mined_item, on_pre_player_mined_item)
if script.active_mods['MtnFortressAddons'] then
Event.add('mtn-ctrl-cast-spell', on_player_used_capsule_custom)
end
Event.add(defines.events.on_player_used_capsule, on_player_used_capsule)
Event.add(defines.events.on_player_changed_surface, on_player_changed_surface)
Event.add(defines.events.on_player_removed, on_player_removed)

View File

@ -544,12 +544,21 @@ function Public.extra_settings(player)
local mana_grid = mana_frame.add({ type = 'table', column_count = 2 })
local modded_hotkeys = rpg_extra.modded_hotkeys
local magic_caption = ({ 'rpg_settings.magic_label' })
local magic_tooltip = ({ 'rpg_settings.magic_tooltip' })
if modded_hotkeys then
magic_caption = ({ 'rpg_settings.magic_label_custom' })
magic_tooltip = ({ 'rpg_settings.magic_tooltip_custom' })
end
local enable_entity =
setting_grid_2.add(
{
type = 'label',
caption = ({ 'rpg_settings.magic_label' }),
tooltip = ({ 'rpg_settings.magic_tooltip' })
caption = magic_caption,
tooltip = magic_tooltip
}
)

View File

@ -29,7 +29,7 @@ local cooldown_indicator_name = Gui.uid_name()
Global.register(
this,
function(tbl)
function (tbl)
this = tbl
end
)
@ -42,7 +42,7 @@ Public.events = {
Public.points_per_level = 5
Public.experience_levels = {0}
Public.experience_levels = { 0 }
for a = 1, 4999, 1 do -- max level
Public.experience_levels[#Public.experience_levels + 1] = Public.experience_levels[#Public.experience_levels] + a * 8
end
@ -62,7 +62,7 @@ Public.die_cause = {
Public.nth_tick = 18001
Public.visuals_delay = 1800
Public.xp_floating_text_color = {157, 157, 157}
Public.xp_floating_text_color = { 157, 157, 157 }
Public.enemy_types = {
['unit'] = true,
@ -79,11 +79,11 @@ Public.classes = {
}
Public.auto_allocate_nodes = {
{'allocations.deactivated'},
{'allocations.str'},
{'allocations.mag'},
{'allocations.dex'},
{'allocations.vit'}
{ 'allocations.deactivated' },
{ 'allocations.str' },
{ 'allocations.mag' },
{ 'allocations.dex' },
{ 'allocations.vit' }
}
Public.auto_allocate_nodes_func = {
@ -101,6 +101,7 @@ function Public.reset_table(migrate)
this.rpg_extra.level_limit_enabled = false
this.rpg_extra.global_pool = 0
this.rpg_extra.heal_modifier = 2
this.rpg_extra.mana_modifier = 2
this.rpg_extra.personal_tax_rate = 0.3
this.rpg_extra.leftover_pool = 0
this.rpg_extra.turret_kills_to_global_pool = true
@ -165,6 +166,16 @@ function Public.get(key)
end
end
--- Gets value from table
---@param key string
function Public.get_extra(key)
if key then
return this.rpg_extra[key]
else
return this.rpg_extra
end
end
--- Gets value from player rpg_t table
---@param key string|integer
---@param value string|nil
@ -235,6 +246,19 @@ function Public.set(key, value)
end
end
--- Sets value to table
---@param key string
function Public.set_extra(key, value)
if key and (value or value == false) then
this.rpg_extra[key] = value
return this.rpg_extra[key]
elseif key then
return this.rpg_extra[key]
else
return this.rpg_extra
end
end
--- Toggle debug - when you need to troubleshoot.
function Public.toggle_debug(value)
this.rpg_extra.debug = value or false
@ -499,14 +523,14 @@ Public.spell2_button_name = spell2_button_name
Public.spell3_button_name = spell3_button_name
Public.cooldown_indicator_name = cooldown_indicator_name
local on_init = function()
local on_init = function ()
Public.reset_table()
end
Event.on_init(on_init)
Event.on_configuration_changed(
function()
function ()
print('[RPG] Migrating to new version')
Public.migrate_to_new_version()
end

View File

@ -1,4 +1,5 @@
local Public = require 'modules.wave_defense.table'
local Task = require 'utils.task_token'
local round = math.round
function Public.wave_defense_roll_biter_name()
@ -34,46 +35,52 @@ function Public.wave_defense_roll_spitter_name()
end
function Public.wave_defense_set_unit_raffle(level)
Public.set(
'biter_raffle',
{
['small-biter'] = round(1000 - level * 1.75, 6),
['medium-biter'] = round(level, 6),
['big-biter'] = 0,
['behemoth-biter'] = 0
}
)
local unit_settings = Public.get('unit_settings') --[[@as table]]
if unit_settings.custom_unit_raffle then
local callback = Task.get(unit_settings.custom_unit_raffle)
callback({ level = level })
else
Public.set(
'biter_raffle',
{
['small-biter'] = round(1000 - level * 1.75, 6),
['medium-biter'] = round(level, 6),
['big-biter'] = 0,
['behemoth-biter'] = 0
}
)
Public.set(
'spitter_raffle',
{
['small-spitter'] = round(1000 - level * 1.75, 6),
['medium-spitter'] = round(level, 6),
['big-spitter'] = 0,
['behemoth-spitter'] = 0
}
)
Public.set(
'spitter_raffle',
{
['small-spitter'] = round(1000 - level * 1.75, 6),
['medium-spitter'] = round(level, 6),
['big-spitter'] = 0,
['behemoth-spitter'] = 0
}
)
local biter_raffle = Public.get('biter_raffle') --[[@as table]]
local spitter_raffle = Public.get('spitter_raffle') --[[@as table]]
if level > 500 then
biter_raffle['medium-biter'] = round(500 - (level - 500), 6)
spitter_raffle['medium-spitter'] = round(500 - (level - 500), 6)
biter_raffle['big-biter'] = round((level - 500) * 2, 6)
spitter_raffle['big-spitter'] = round((level - 500) * 2, 6)
end
if level > 800 then
biter_raffle['behemoth-biter'] = round((level - 800) * 2.75, 6)
spitter_raffle['behemoth-spitter'] = round((level - 800) * 2.75, 6)
end
for k, _ in pairs(biter_raffle) do
if biter_raffle[k] < 0 then
biter_raffle[k] = 0
local biter_raffle = Public.get('biter_raffle') --[[@as table]]
local spitter_raffle = Public.get('spitter_raffle') --[[@as table]]
if level > 500 then
biter_raffle['medium-biter'] = round(500 - (level - 500), 6)
spitter_raffle['medium-spitter'] = round(500 - (level - 500), 6)
biter_raffle['big-biter'] = round((level - 500) * 2, 6)
spitter_raffle['big-spitter'] = round((level - 500) * 2, 6)
end
end
for k, _ in pairs(spitter_raffle) do
if spitter_raffle[k] < 0 then
spitter_raffle[k] = 0
if level > 800 then
biter_raffle['behemoth-biter'] = round((level - 800) * 2.75, 6)
spitter_raffle['behemoth-spitter'] = round((level - 800) * 2.75, 6)
end
for k, _ in pairs(biter_raffle) do
if biter_raffle[k] < 0 then
biter_raffle[k] = 0
end
end
for k, _ in pairs(spitter_raffle) do
if spitter_raffle[k] < 0 then
spitter_raffle[k] = 0
end
end
end
end
@ -95,27 +102,33 @@ function Public.wave_defense_roll_worm_name()
end
function Public.wave_defense_set_worm_raffle(level)
Public.set(
'worm_raffle',
{
['small-worm-turret'] = round(1000 - level * 1.75, 6),
['medium-worm-turret'] = round(level, 6),
['big-worm-turret'] = 0,
['behemoth-worm-turret'] = 0
}
)
local worm_raffle = Public.get('worm_raffle') --[[@as table]]
local unit_settings = Public.get('unit_settings') --[[@as table]]
if unit_settings.custom_worm_raffle then
local callback = Task.get(unit_settings.custom_worm_raffle)
callback({ level = level })
else
Public.set(
'worm_raffle',
{
['small-worm-turret'] = round(1000 - level * 1.75, 6),
['medium-worm-turret'] = round(level, 6),
['big-worm-turret'] = 0,
['behemoth-worm-turret'] = 0
}
)
local worm_raffle = Public.get('worm_raffle') --[[@as table]]
if level > 500 then
worm_raffle['medium-worm-turret'] = round(500 - (level - 500), 6)
worm_raffle['big-worm-turret'] = round((level - 500) * 2, 6)
end
if level > 800 then
worm_raffle['behemoth-worm-turret'] = round((level - 800) * 3, 6)
end
for k, _ in pairs(worm_raffle) do
if worm_raffle[k] < 0 then
worm_raffle[k] = 0
if level > 500 then
worm_raffle['medium-worm-turret'] = round(500 - (level - 500), 6)
worm_raffle['big-worm-turret'] = round((level - 500) * 2, 6)
end
if level > 800 then
worm_raffle['behemoth-worm-turret'] = round((level - 800) * 3, 6)
end
for k, _ in pairs(worm_raffle) do
if worm_raffle[k] < 0 then
worm_raffle[k] = 0
end
end
end
end

View File

@ -113,12 +113,12 @@ local function spawn_worms(data)
local unit_to_create = Public.wave_defense_roll_worm_name(sqrt(position.x ^ 2 + position.y ^ 2) * 0.20)
local unit = surface.create_entity({ name = unit_to_create, position = position })
local worm_unit_settings = Public.get('worm_unit_settings')
local unit_settings = Public.get('unit_settings')
if random(1, 30) == 1 then
BiterHealthBooster.add_boss_unit(unit, modified_boss_unit_health.current_value, 0.38)
else
local final_health = round(modified_unit_health.current_value * worm_unit_settings.scale_units_by_health[unit.name], 3)
local final_health = round(modified_unit_health.current_value * unit_settings.scale_worms_by_health[unit.name], 3)
if final_health < 1 then
final_health = 1
end

View File

@ -24,7 +24,4 @@ Public.side_targets = Side_targets
local Threat_events = require 'modules.wave_defense.threat_events'
Public.threat_events = Threat_events
local Threat_values = require 'modules.wave_defense.threat_values'
Public.threat_value = Threat_values
return Public

View File

@ -222,13 +222,14 @@ local function is_unit_valid(biter, max_biter_age, tick)
end
local function refresh_active_unit_threat()
local threat_values = Public.get('threat_values')
local active_biter_threat = Public.get('active_biter_threat')
local generated_units = Public.get('generated_units')
Public.debug_print('refresh_active_unit_threat - current value ' .. active_biter_threat)
local biter_threat = 0
for k, biter in pairs(generated_units.active_biters) do
if valid(biter.entity) then
biter_threat = biter_threat + Public.threat_values[biter.entity.name]
biter_threat = biter_threat + threat_values[biter.entity.name]
else
generated_units.active_biters[k] = nil
end
@ -248,6 +249,7 @@ local function time_out_biters()
local max_active_biters = Public.get('max_active_biters')
local active_biter_threat = Public.get('active_biter_threat')
local valid_enemy_forces = Public.get('valid_enemy_forces')
local threat_values = Public.get('threat_values')
if active_biter_count < 0 then
Public.set('active_biter_count', 0)
@ -266,7 +268,7 @@ local function time_out_biters()
Public.set('active_biter_count', active_biter_count - 1)
local entity = biter.entity
if entity and entity.valid then
Public.set('active_biter_threat', active_biter_threat - round(Public.threat_values[entity.name] * biter_health_boost, 2))
Public.set('active_biter_threat', active_biter_threat - round(threat_values[entity.name] * biter_health_boost, 2))
if valid_enemy_forces[entity.force.name] then
entity.destroy()
end
@ -469,6 +471,7 @@ local function spawn_biter(surface, position, force_spawn, is_boss_biter, unit_s
end
local boosted_health = BiterHealthBooster.get('biter_health_boost')
local threat_values = Public.get('threat_values')
local name
if random(1, 100) > 73 then
@ -567,7 +570,7 @@ local function spawn_biter(surface, position, force_spawn, is_boss_biter, unit_s
local active_biter_count = Public.get('active_biter_count')
Public.set('active_biter_count', active_biter_count + 1)
local active_biter_threat = Public.get('active_biter_threat')
Public.set('active_biter_threat', active_biter_threat + round(Public.threat_values[name] * boosted_health, 2))
Public.set('active_biter_threat', active_biter_threat + round(threat_values[name] * boosted_health, 2))
return biter
end
@ -609,7 +612,7 @@ local function spawn_worm(surface, position, is_boss_worm)
if (increase_health_per_wave and (wave_number >= boost_units_when_wave_is_above)) and not is_boss_worm then
local modified_unit_health = Public.get('modified_unit_health')
local unit_settings = Public.get('unit_settings')
local final_health = round(modified_unit_health.current_value * unit_settings.worm_unit_settings[worm.name], 3)
local final_health = round(modified_unit_health.current_value * unit_settings.scale_worms_by_health[worm.name], 3)
if final_health < 1 then
final_health = 1
end

View File

@ -149,6 +149,22 @@ function Public.reset_wave_defense()
},
nests = {}
}
this.threat_values = {
['biter-spawner'] = 128,
['spitter-spawner'] = 128,
['behemoth-biter'] = 64,
['behemoth-spitter'] = 64,
['big-biter'] = 16,
['big-spitter'] = 16,
['medium-biter'] = 4,
['medium-spitter'] = 4,
['small-biter'] = 1,
['small-spitter'] = 1,
['small-worm-turret'] = 16,
['medium-worm-turret'] = 32,
['big-worm-turret'] = 64,
['behemoth-worm-turret'] = 128
}
this.unit_settings = {
scale_units_by_health = {
['small-biter'] = 1,
@ -159,11 +175,8 @@ function Public.reset_wave_defense()
['medium-spitter'] = 0.75,
['big-spitter'] = 0.5,
['behemoth-spitter'] = 0.25
}
}
this.worm_unit_settings = {
-- note that final health modifier isn't lower than 1
scale_units_by_health = {
},
scale_worms_by_health = {
['land-mine'] = 0.5, -- not active as of now
['gun-turret'] = 0.5, -- not active as of now
['flamethrower-turret'] = 0.4, -- not active as of now

View File

@ -45,11 +45,12 @@ local function remove_unit(entity)
if not biter_health_boost_units then
return
end
local threat_values = Public.get('threat_values')
if biter_health_boost_units[unit_number] then
m = 1 / biter_health_boost_units[unit_number][2]
end
local active_threat_loss = math.round(Public.threat_values[entity.name] * m, 2)
local active_threat_loss = math.round(threat_values[entity.name] * m, 2)
local active_biter_threat = Public.get('active_biter_threat')
Public.set('active_biter_threat', active_biter_threat - active_threat_loss)
local active_biter_count = Public.get('active_biter_count')
@ -146,7 +147,8 @@ local place_nest_near_unit_group = function ()
remove_unit(unit)
unit.destroy()
local threat = Public.get('threat')
Public.set('threat', threat - Public.threat_values[name])
local threat_values = Public.get('threat_values')
Public.set('threat', threat - threat_values[name])
return true
end
@ -276,14 +278,15 @@ function Public.build_worm()
return
end
local u = unit.surface.create_entity({ name = worm, position = position, force = unit.force })
local worm_unit_settings = Public.get('worm_unit_settings')
local unit_settings = Public.get('unit_settings')
local modified_unit_health = Public.get('modified_unit_health')
local modified_boss_unit_health = Public.get('modified_boss_unit_health')
local threat_values = Public.get('threat_values')
if boss then
BiterHealthBooster.add_boss_unit(u, modified_boss_unit_health.current_value, 0.5)
else
local final_health = round(modified_unit_health.current_value * worm_unit_settings.scale_units_by_health[worm], 3)
local final_health = round(modified_unit_health.current_value * unit_settings.scale_worms_by_health[worm], 3)
if final_health < 1 then
final_health = 1
end
@ -294,7 +297,7 @@ function Public.build_worm()
unit.surface.create_entity({ name = 'blood-explosion-huge', position = unit.position })
remove_unit(unit)
unit.destroy()
Public.set('threat', threat - Public.threat_values[worm])
Public.set('threat', threat - threat_values[worm])
end
function Public.build_worm_custom()
@ -451,49 +454,51 @@ local function on_entity_died(event)
return
end
local threat_values = Public.get('threat_values')
local disable_threat_below_zero = Public.get('disable_threat_below_zero')
local valid_enemy_forces = Public.get('valid_enemy_forces')
if not valid_enemy_forces then
goto continue
goto end_if
end
if entity.type == 'unit' then
local biter_health_boost = BiterHealthBooster.get('biter_health_boost')
if not Public.threat_values[entity.name] then
if not threat_values[entity.name] then
goto continue
end
if disable_threat_below_zero then
local threat = Public.get('threat')
local sub = math.round(threat - Public.threat_values[entity.name] * biter_health_boost, 2)
local sub = math.round(threat - threat_values[entity.name] * biter_health_boost, 2)
if sub <= 0 or threat <= 0 then
Public.set('threat', 0)
remove_unit(entity)
goto continue
end
Public.set('threat', math.round(threat - Public.threat_values[entity.name] * biter_health_boost, 2))
Public.set('threat', math.round(threat - threat_values[entity.name] * biter_health_boost, 2))
remove_unit(entity)
else
local threat = Public.get('threat')
Public.set('threat', math.round(threat - Public.threat_values[entity.name] * biter_health_boost, 2))
Public.set('threat', math.round(threat - threat_values[entity.name] * biter_health_boost, 2))
remove_unit(entity)
end
::continue::
else
local biter_health_boost = BiterHealthBooster.get('biter_health_boost')
if valid_enemy_forces[entity.force.name] then
if entity.health then
if Public.threat_values[entity.name] then
if threat_values[entity.name] then
local threat = Public.get('threat')
Public.set('threat', math.round(threat - Public.threat_values[entity.name] * biter_health_boost, 2))
Public.set('threat', math.round(threat - threat_values[entity.name] * biter_health_boost, 2))
end
spawn_unit_spawner_inhabitants(entity)
end
end
end
::continue::
::end_if::
if entity.force.index == 3 then
if event.cause then

View File

@ -1,20 +0,0 @@
local Public = require 'modules.wave_defense.table'
Public.threat_values = {
['biter-spawner'] = 128,
['spitter-spawner'] = 128,
['behemoth-biter'] = 64,
['behemoth-spitter'] = 64,
['big-biter'] = 16,
['big-spitter'] = 16,
['medium-biter'] = 4,
['medium-spitter'] = 4,
['small-biter'] = 1,
['small-spitter'] = 1,
['small-worm-turret'] = 16,
['medium-worm-turret'] = 32,
['big-worm-turret'] = 64,
['behemoth-worm-turret'] = 128
}
return Public