1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-14 02:34:09 +02:00

Changes to modules and map

This commit is contained in:
Gerkiz 2021-11-22 20:16:33 +01:00
parent ca21084402
commit a4f45b8734
18 changed files with 292 additions and 137 deletions

View File

@ -119,8 +119,10 @@ allocation_tooltip=This will automatically allocate all available points to the
[spells]
acid_stream=Bitter Spew
railgun_beam=Shoop Da Whoop!!
raw_fish=Conjure Raw-fish
dynamites=Conjure Explosives
tank=Conjure Tank
spidertron=Conjure Spidertron
comfylatron=Suicidal Comfylatron
distractor=Distractor Capsule
warp=Warp Gate

View File

@ -117,7 +117,6 @@ allocation_tooltip=Это автоматически распределит вс
[spells]
acid_stream=Кислота плеваки
railgun_beam=Вжжжух!!
raw_fish=Наколдовать сырую рыбу
comfylatron=Комфилатрон-камикадзе
distractor=Капсула с дронами-приманками

View File

@ -104,7 +104,6 @@ allocation_tooltip=这将自动将所有可用的点分配给给定的节点。
[spells]
acid_stream=沙虫口水
railgun_beam=轨道炮
raw_fish=生成鱼
comfylatron=自爆机器人
distractor=防御无人机

View File

@ -878,6 +878,7 @@ function Public.set_difficulty()
end
local Diff = Difficulty.get()
local wave_defense_table = WD.get_table()
local check_if_threat_below_zero = WPT.get('check_if_threat_below_zero')
local collapse_amount = WPT.get('collapse_amount')
local collapse_speed = WPT.get('collapse_speed')
local difficulty = WPT.get('difficulty')
@ -921,19 +922,25 @@ function Public.set_difficulty()
amount = difficulty.highest -- lowered from 20 to 10
end
local threat_check = nil
if check_if_threat_below_zero then
threat_check = wave_defense_table.threat <= 0
end
if Diff.name == "I'm too young to die" then
wave_defense_table.wave_interval = 3600 - player_count * 60
if wave_defense_table.wave_interval < 1800 or wave_defense_table.threat <= 0 then
if wave_defense_table.wave_interval < 1800 or threat_check then
wave_defense_table.wave_interval = 1800
end
elseif Diff.name == 'Hurt me plenty' then
wave_defense_table.wave_interval = 2600 - player_count * 60
if wave_defense_table.wave_interval < 1500 or wave_defense_table.threat <= 0 then
if wave_defense_table.wave_interval < 1500 or threat_check then
wave_defense_table.wave_interval = 1500
end
elseif Diff.name == 'Ultra-violence' then
wave_defense_table.wave_interval = 1600 - player_count * 60
if wave_defense_table.wave_interval < 1100 or wave_defense_table.threat <= 0 then
if wave_defense_table.wave_interval < 1100 or threat_check then
wave_defense_table.wave_interval = 1100
end
end
@ -1109,8 +1116,6 @@ function Public.boost_difficulty()
local force = game.forces.player
local unit_modifiers = WD.get('modified_unit_health')
if name == "I'm too young to die" then
force.manual_mining_speed_modifier = force.manual_mining_speed_modifier + 0.5
force.character_running_speed_modifier = 0.15
@ -1127,8 +1132,6 @@ function Public.boost_difficulty()
WD.set_normal_unit_current_per_wave(0.08)
WD.set_boss_unit_current_health(2)
WD.set_boss_unit_current_per_wave(0.15)
unit_modifiers.limit_value = 30
unit_modifiers.health_increase_per_boss_wave = 0.04
WPT.set('difficulty_set', true)
elseif name == 'Hurt me plenty' then
force.manual_mining_speed_modifier = force.manual_mining_speed_modifier + 0.25
@ -1146,8 +1149,6 @@ function Public.boost_difficulty()
WD.set_normal_unit_current_per_wave(0.12)
WD.set_boss_unit_current_health(3)
WD.set_boss_unit_current_per_wave(0.20)
unit_modifiers.limit_value = 40
unit_modifiers.health_increase_per_boss_wave = 0.06
WPT.set('difficulty_set', true)
elseif name == 'Ultra-violence' then
force.character_running_speed_modifier = 0
@ -1159,13 +1160,11 @@ function Public.boost_difficulty()
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)
WD.set_normal_unit_current_health(2)
WD.set_normal_unit_current_per_wave(0.2)
WD.set_boss_unit_current_health(4)
WD.set_boss_unit_current_per_wave(0.4)
WPT.set('spidertron_unlocked_at_zone', 6)
unit_modifiers.limit_value = 50
unit_modifiers.health_increase_per_boss_wave = 0.08
WPT.set('difficulty_set', true)
end
end

View File

@ -375,7 +375,10 @@ local function kick_players_from_surface(car)
if validate_entity(main_surface) then
for _, e in pairs(surface.find_entities_filtered({area = car.area})) do
if validate_entity(e) and e.name == 'character' and e.player then
e.player.teleport(main_surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(main_surface), 3, 0, 5), main_surface)
e.player.teleport(
main_surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(main_surface), 3, 0, 5),
main_surface
)
end
end
check_if_players_are_in_nauvis()
@ -420,7 +423,10 @@ local function kick_player_from_surface(player, target)
if p then
target.teleport(p, car.entity.surface)
else
target.teleport(main_surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(main_surface), 3, 0, 5), main_surface)
target.teleport(
main_surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(main_surface), 3, 0, 5),
main_surface
)
end
target.print('You were kicked out of ' .. player.name .. ' vehicle.', Color.warning)
end
@ -642,7 +648,9 @@ local find_remove_car =
return
end
for _, dropped_ent in pairs(surface.find_entities_filtered {type = 'item-entity', area = {{position.x - 10, position.y - 10}, {position.x + 10, position.y + 10}}}) do
for _, dropped_ent in pairs(
surface.find_entities_filtered {type = 'item-entity', area = {{position.x - 10, position.y - 10}, {position.x + 10, position.y + 10}}}
) do
if dropped_ent and dropped_ent.valid and dropped_ent.stack then
if types[dropped_ent.stack.name] then
dropped_ent.destroy()

View File

@ -738,7 +738,10 @@ Gui.on_click(
if not misc_settings[player.index].final_warning then
misc_settings[player.index].final_warning = true
player.print('[IC] WARNING! WARNING WARNING! Pressing the save button ONE MORE TIME will DELETE your surface. This action is irreversible!', Color.red)
player.print(
'[IC] WARNING! WARNING WARNING! Pressing the save button ONE MORE TIME will DELETE your surface. This action is irreversible!',
Color.red
)
Task.set_timeout_in_ticks(600, clear_misc_settings, {player_index = player.index})
return
end

View File

@ -11,7 +11,7 @@ local random = math.random
local function initial_cargo_boxes()
return {
{name = 'loader', count = 1},
{name = 'loader', count = 2},
{name = 'coal', count = random(32, 64)},
{name = 'coal', count = random(32, 64)},
{name = 'iron-ore', count = random(32, 128)},
@ -22,15 +22,22 @@ local function initial_cargo_boxes()
{name = 'submachine-gun', count = 1},
{name = 'submachine-gun', count = 1},
{name = 'submachine-gun', count = 1},
{name = 'submachine-gun', count = 1},
{name = 'submachine-gun', count = 1},
{name = 'shotgun', count = 1},
{name = 'shotgun', count = 1},
{name = 'shotgun', count = 1},
{name = 'gun-turret', count = 1},
{name = 'gun-turret', count = 1},
{name = 'gun-turret', count = 1},
{name = 'shotgun-shell', count = random(4, 5)},
{name = 'shotgun-shell', count = random(4, 5)},
{name = 'shotgun-shell', count = random(4, 5)},
{name = 'land-mine', count = random(6, 18)},
{name = 'grenade', count = random(2, 3)},
{name = 'grenade', count = random(2, 3)},
{name = 'grenade', count = random(2, 3)},
{name = 'grenade', count = random(2, 7)},
{name = 'grenade', count = random(2, 8)},
{name = 'grenade', count = random(2, 7)},
{name = 'light-armor', count = random(2, 4)},
{name = 'iron-gear-wheel', count = random(7, 15)},
{name = 'iron-gear-wheel', count = random(7, 15)},
{name = 'iron-gear-wheel', count = random(7, 15)},
@ -43,9 +50,10 @@ local function initial_cargo_boxes()
{name = 'copper-plate', count = random(15, 23)},
{name = 'copper-plate', count = random(15, 23)},
{name = 'copper-plate', count = random(15, 23)},
{name = 'firearm-magazine', count = random(10, 30)},
{name = 'firearm-magazine', count = random(10, 30)},
{name = 'firearm-magazine', count = random(10, 30)},
{name = 'firearm-magazine', count = random(10, 56)},
{name = 'firearm-magazine', count = random(10, 56)},
{name = 'firearm-magazine', count = random(10, 56)},
{name = 'firearm-magazine', count = random(10, 56)},
{name = 'rail', count = random(16, 24)},
{name = 'rail', count = random(16, 24)}
}

View File

@ -220,6 +220,7 @@ function Public.reset_table()
this.prestige_system_enabled = false
this.has_upgraded_health_pool = false
this.mystical_chest_enabled = true
this.check_if_threat_below_zero = false
this.mc_rewards = {
current = {},
temp_boosts = {}

View File

@ -16,8 +16,10 @@ Public.level_width = WPT.level_width
local worm_level_modifier = 0.19
local start_ground_tiles = {
'black-refined-concrete',
'nuclear-ground'
'hazard-concrete-left',
'hazard-concrete-right',
'brown-refined-concrete',
'concrete'
}
local wagon_raffle = {
@ -2406,7 +2408,7 @@ local function border_chunk(p, data)
end
local noise = get_perlin('dungeons', pos, 14882)
local index = floor(noise * 32) % 2 + 1
local index = floor(noise * 32) % 4 + 1
tiles[#tiles + 1] = {name = start_ground_tiles[index], position = pos}
local scrap_mineable_entities, scrap_mineable_entities_index = get_scrap_mineable_entities()

View File

@ -183,7 +183,7 @@ local function set_difficulty()
end
if this.difficulty_vote_index ~= index then
local message = table.concat({'>> Map difficulty has changed to ', this.difficulties[index].name, ' difficulty!'})
local message = table.concat({'*** Map difficulty has changed to ', this.difficulties[index].name, ' difficulty! ***'})
game.print(message, this.difficulties[index].print_color)
Server.to_discord_embed(message)
end
@ -321,7 +321,9 @@ local function on_gui_click(event)
set_difficulty()
Public.difficulty_gui()
event.element.parent.destroy()
game.print(player.name .. ' has voted for ' .. this.difficulties[i].name .. ' difficulty!', this.difficulties[i].print_color)
local message = '*** ' .. player.name .. ' has voted for ' .. this.difficulties[i].name .. ' difficulty! ***'
game.print(message, this.difficulties[i].print_color)
Server.to_discord_embed(message)
end
function Public.set_tooltip(...)

View File

@ -128,6 +128,30 @@ commands.add_command(
)
if _DEBUG then
commands.add_command(
'give_xp',
'DEBUG ONLY - if you are seeing this then this map is running on debug-mode.',
function(cmd)
local p
local player = game.player
local param = tonumber(cmd.parameter)
if player then
if player ~= nil then
p = player.print
if not player.admin then
p("[ERROR] You're not admin!", Color.fail)
return
end
if not param then
return
end
p('Distributed ' .. param .. ' of xp.')
Public.give_xp(param)
end
end
end
)
commands.add_command(
'rpg_debug_module',
'',

View File

@ -1189,8 +1189,6 @@ local function on_player_used_capsule(event)
return
end
local obj_name = object.obj_to_create
if not Math2D.bounding_box.contains_point(area, player.position) then
player.print(({'rpg_main.not_inside_pos'}), Color.fail)
return
@ -1203,8 +1201,8 @@ local function on_player_used_capsule(event)
local target_pos
if object.target then
target_pos = {position.x, position.y}
elseif projectile_types[obj_name] then
local coord_modifier = get_near_coord_modifier(projectile_types[obj_name].max_range)
elseif projectile_types[object.entityName] then
local coord_modifier = get_near_coord_modifier(projectile_types[object.entityName].max_range)
local proj_pos = {position.x + coord_modifier.x, position.y + coord_modifier.y}
target_pos = proj_pos
end
@ -1223,15 +1221,15 @@ local function on_player_used_capsule(event)
force = 'player'
end
if obj_name == 'suicidal_comfylatron' then
if object.entityName == 'suicidal_comfylatron' then
Public.suicidal_comfylatron(position, surface)
p(({'rpg_main.suicidal_comfylatron', 'Suicidal Comfylatron'}), Color.success)
Public.remove_mana(player, object.mana_cost)
elseif obj_name == 'repair_aoe' then
elseif object.entityName == 'repair_aoe' then
local ents = Public.repair_aoe(player, position)
p(({'rpg_main.repair_aoe', ents}), Color.success)
Public.remove_mana(player, object.mana_cost)
elseif obj_name == 'pointy_explosives' then
elseif object.entityName == 'pointy_explosives' then
local entities =
player.surface.find_entities_filtered {
force = player.force,
@ -1253,7 +1251,7 @@ local function on_player_used_capsule(event)
player.print(({'rpg_main.detonate_chest_failed'}), Color.fail)
end
end
elseif obj_name == 'warp-gate' then
elseif object.entityName == 'warp-gate' then
local pos = surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(surface), 3, 0, 5)
if pos then
player.teleport(pos, surface)
@ -1265,62 +1263,62 @@ local function on_player_used_capsule(event)
Public.damage_player_over_time(player, random(8, 16))
player.play_sound {path = 'utility/armor_insert', volume_modifier = 1}
p(({'rpg_main.warped_ok'}), Color.info)
elseif obj_name == 'fish' then -- spawn in some fish
player.insert({name = 'raw-fish', count = object.amount})
p(({'rpg_main.object_spawned', 'raw-fish'}), Color.success)
elseif object.capsule then -- spawn in capsules i.e objects that are usable with mouse-click
player.insert({name = object.entityName, count = object.amount})
p(({'rpg_main.object_spawned', object.entityName}), Color.success)
Public.remove_mana(player, object.mana_cost)
elseif projectile_types[obj_name] then -- projectiles
elseif projectile_types[object.entityName] then -- projectiles
for i = 1, object.amount do
local damage_area = {
left_top = {x = position.x - 2, y = position.y - 2},
right_bottom = {x = position.x + 2, y = position.y + 2}
}
create_projectile(surface, obj_name, position, force, target_pos, range)
create_projectile(surface, object.entityName, position, force, target_pos, range)
if object.damage then
for _, e in pairs(surface.find_entities_filtered({area = damage_area})) do
damage_entity(e)
end
end
end
p(({'rpg_main.object_spawned', obj_name}), Color.success)
p(({'rpg_main.object_spawned', object.entityName}), Color.success)
Public.remove_mana(player, object.mana_cost)
else
if object.target then -- rockets and such
surface.create_entity({name = obj_name, position = position, force = force, target = target_pos, speed = 1})
p(({'rpg_main.object_spawned', obj_name}), Color.success)
surface.create_entity({name = object.entityName, position = position, force = force, target = target_pos, speed = 1})
p(({'rpg_main.object_spawned', object.entityName}), Color.success)
Public.remove_mana(player, object.mana_cost)
elseif surface.can_place_entity {name = obj_name, position = position} then
elseif surface.can_place_entity {name = object.entityName, position = position} then
if object.biter then
local e = surface.create_entity({name = obj_name, position = position, force = force})
local e = surface.create_entity({name = object.entityName, position = position, force = force})
tame_unit_effects(player, e)
Public.remove_mana(player, object.mana_cost)
elseif object.aoe then
for x = 1, -1, -1 do
for y = 1, -1, -1 do
local pos = {x = position.x + x, y = position.y + y}
if surface.can_place_entity {name = obj_name, position = pos} then
if surface.can_place_entity {name = object.entityName, position = pos} then
if object.mana_cost > rpg_t.mana then
break
end
local e = surface.create_entity({name = obj_name, position = pos, force = force})
local e = surface.create_entity({name = object.entityName, position = pos, force = force})
e.direction = player.character.direction
Public.remove_mana(player, object.mana_cost)
end
end
end
else
local e = surface.create_entity({name = obj_name, position = position, force = force})
local e = surface.create_entity({name = object.entityName, position = position, force = force})
e.direction = player.character.direction
Public.remove_mana(player, object.mana_cost)
end
p(({'rpg_main.object_spawned', obj_name}), Color.success)
p(({'rpg_main.object_spawned', object.entityName}), Color.success)
else
p(({'rpg_main.out_of_reach'}), Color.fail)
return
end
end
local msg = player.name .. ' casted ' .. obj_name .. '. '
local msg = player.name .. ' casted ' .. object.entityName .. '. '
rpg_t.last_spawned = game.tick + object.tick
Public.update_mana(player)
@ -1368,33 +1366,6 @@ local function tick()
end
end
if _DEBUG then
commands.add_command(
'give_xp',
'DEBUG ONLY - if you are seeing this then this map is running on debug-mode.',
function(cmd)
local p
local player = game.player
local param = tonumber(cmd.parameter)
if player then
if player ~= nil then
p = player.print
if not player.admin then
p("[ERROR] You're not admin!", Color.fail)
return
end
if not param then
return
end
p('Distributed ' .. param .. ' of xp.')
Public.give_xp(param)
end
end
end
)
end
Event.add(defines.events.on_pre_player_left_game, on_pre_player_left_game)
Event.add(defines.events.on_player_died, on_player_died)
Event.add(defines.events.on_entity_damaged, on_entity_damaged)

View File

@ -578,7 +578,7 @@ function Public.extra_settings(player)
conjure_label.tooltip = ({
'rpg_settings.magic_item_requirement',
conjure_label.tooltip,
entity.obj_to_create,
entity.entityName,
entity.mana_cost,
entity.level
})
@ -586,7 +586,7 @@ function Public.extra_settings(player)
conjure_label.tooltip = ({
'rpg_settings.magic_entity_requirement',
conjure_label.tooltip,
entity.obj_to_create,
entity.entityName,
entity.mana_cost,
entity.level
})

View File

@ -5,7 +5,7 @@ function Public.conjure_items()
spells[#spells + 1] = {
name = {'entity-name.stone-wall'},
obj_to_create = 'stone-wall',
entityName = 'stone-wall',
level = 10,
type = 'item',
mana_cost = 60,
@ -16,7 +16,7 @@ function Public.conjure_items()
}
spells[#spells + 1] = {
name = {'entity-name.wooden-chest'},
obj_to_create = 'wooden-chest',
entityName = 'wooden-chest',
level = 2,
type = 'item',
mana_cost = 50,
@ -27,7 +27,7 @@ function Public.conjure_items()
}
spells[#spells + 1] = {
name = {'entity-name.iron-chest'},
obj_to_create = 'iron-chest',
entityName = 'iron-chest',
level = 10,
type = 'item',
mana_cost = 110,
@ -38,7 +38,7 @@ function Public.conjure_items()
}
spells[#spells + 1] = {
name = {'entity-name.steel-chest'},
obj_to_create = 'steel-chest',
entityName = 'steel-chest',
level = 15,
type = 'item',
mana_cost = 150,
@ -49,7 +49,7 @@ function Public.conjure_items()
}
spells[#spells + 1] = {
name = {'entity-name.transport-belt'},
obj_to_create = 'transport-belt',
entityName = 'transport-belt',
level = 3,
type = 'item',
mana_cost = 80,
@ -60,7 +60,7 @@ function Public.conjure_items()
}
spells[#spells + 1] = {
name = {'entity-name.fast-transport-belt'},
obj_to_create = 'fast-transport-belt',
entityName = 'fast-transport-belt',
level = 20,
type = 'item',
mana_cost = 110,
@ -71,7 +71,7 @@ function Public.conjure_items()
}
spells[#spells + 1] = {
name = {'entity-name.express-transport-belt'},
obj_to_create = 'express-transport-belt',
entityName = 'express-transport-belt',
level = 60,
type = 'item',
mana_cost = 150,
@ -82,7 +82,7 @@ function Public.conjure_items()
}
spells[#spells + 1] = {
name = {'entity-name.underground-belt'},
obj_to_create = 'underground-belt',
entityName = 'underground-belt',
level = 3,
type = 'item',
mana_cost = 80,
@ -93,7 +93,7 @@ function Public.conjure_items()
}
spells[#spells + 1] = {
name = {'entity-name.fast-underground-belt'},
obj_to_create = 'fast-underground-belt',
entityName = 'fast-underground-belt',
level = 20,
type = 'item',
mana_cost = 110,
@ -104,7 +104,7 @@ function Public.conjure_items()
}
spells[#spells + 1] = {
name = {'entity-name.express-underground-belt'},
obj_to_create = 'express-underground-belt',
entityName = 'express-underground-belt',
level = 60,
type = 'item',
mana_cost = 150,
@ -115,29 +115,29 @@ function Public.conjure_items()
}
spells[#spells + 1] = {
name = {'entity-name.pipe'},
obj_to_create = 'pipe',
entityName = 'pipe',
level = 1,
type = 'item',
mana_cost = 50,
tick = 100,
aoe = false,
aoe = true,
enabled = true,
sprite = 'recipe/pipe'
}
spells[#spells + 1] = {
name = {'entity-name.pipe-to-ground'},
obj_to_create = 'pipe-to-ground',
entityName = 'pipe-to-ground',
level = 1,
type = 'item',
mana_cost = 100,
tick = 100,
aoe = false,
aoe = true,
enabled = true,
sprite = 'recipe/pipe-to-ground'
}
spells[#spells + 1] = {
name = {'entity-name.tree'},
obj_to_create = 'tree-05',
entityName = 'tree-05',
level = 70,
type = 'entity',
mana_cost = 100,
@ -148,7 +148,7 @@ function Public.conjure_items()
}
spells[#spells + 1] = {
name = {'entity-name.sand-rock-big'},
obj_to_create = 'sand-rock-big',
entityName = 'sand-rock-big',
level = 80,
type = 'entity',
mana_cost = 80,
@ -159,7 +159,7 @@ function Public.conjure_items()
}
spells[#spells + 1] = {
name = {'entity-name.small-biter'},
obj_to_create = 'small-biter',
entityName = 'small-biter',
level = 50,
biter = true,
type = 'entity',
@ -170,7 +170,7 @@ function Public.conjure_items()
}
spells[#spells + 1] = {
name = {'entity-name.small-spitter'},
obj_to_create = 'small-spitter',
entityName = 'small-spitter',
level = 50,
biter = true,
type = 'entity',
@ -181,7 +181,7 @@ function Public.conjure_items()
}
spells[#spells + 1] = {
name = {'entity-name.medium-biter'},
obj_to_create = 'medium-biter',
entityName = 'medium-biter',
level = 70,
biter = true,
type = 'entity',
@ -192,7 +192,7 @@ function Public.conjure_items()
}
spells[#spells + 1] = {
name = {'entity-name.medium-spitter'},
obj_to_create = 'medium-spitter',
entityName = 'medium-spitter',
level = 70,
biter = true,
type = 'entity',
@ -203,7 +203,7 @@ function Public.conjure_items()
}
spells[#spells + 1] = {
name = {'entity-name.biter-spawner'},
obj_to_create = 'biter-spawner',
entityName = 'biter-spawner',
level = 100,
biter = true,
type = 'entity',
@ -214,7 +214,7 @@ function Public.conjure_items()
}
spells[#spells + 1] = {
name = {'entity-name.spitter-spawner'},
obj_to_create = 'spitter-spawner',
entityName = 'spitter-spawner',
level = 100,
biter = true,
type = 'entity',
@ -225,7 +225,7 @@ function Public.conjure_items()
}
spells[#spells + 1] = {
name = {'item-name.grenade'},
obj_to_create = 'grenade',
entityName = 'grenade',
target = true,
amount = 1,
damage = true,
@ -239,7 +239,7 @@ function Public.conjure_items()
}
spells[#spells + 1] = {
name = {'item-name.cluster-grenade'},
obj_to_create = 'cluster-grenade',
entityName = 'cluster-grenade',
target = true,
amount = 2,
damage = true,
@ -253,7 +253,7 @@ function Public.conjure_items()
}
spells[#spells + 1] = {
name = {'item-name.rocket'},
obj_to_create = 'rocket',
entityName = 'rocket',
range = 240,
target = true,
amount = 4,
@ -268,7 +268,7 @@ function Public.conjure_items()
}
spells[#spells + 1] = {
name = {'spells.pointy_explosives'},
obj_to_create = 'pointy_explosives',
entityName = 'pointy_explosives',
target = true,
amount = 1,
range = 0,
@ -283,7 +283,7 @@ function Public.conjure_items()
}
spells[#spells + 1] = {
name = {'spells.repair_aoe'},
obj_to_create = 'repair_aoe',
entityName = 'repair_aoe',
target = true,
amount = 1,
range = 50,
@ -298,7 +298,7 @@ function Public.conjure_items()
}
spells[#spells + 1] = {
name = {'spells.acid_stream'},
obj_to_create = 'acid-stream-spitter-big',
entityName = 'acid-stream-spitter-big',
target = true,
amount = 2,
range = 0,
@ -311,11 +311,38 @@ function Public.conjure_items()
enabled = true,
sprite = 'virtual-signal/signal-S'
}
spells[#spells + 1] = {
name = {'spells.tank'},
entityName = 'tank',
amount = 1,
capsule = true,
force = 'player',
level = 1000,
type = 'special',
mana_cost = 10000, -- they who know, will know
tick = 320,
enabled = false,
sprite = 'entity/tank'
}
spells[#spells + 1] = {
name = {'spells.spidertron'},
entityName = 'spidertron',
amount = 1,
capsule = true,
force = 'player',
level = 2000,
type = 'special',
mana_cost = 19500, -- they who know, will know
tick = 320,
enabled = false,
sprite = 'entity/spidertron'
}
spells[#spells + 1] = {
name = {'spells.raw_fish'},
obj_to_create = 'fish',
entityName = 'raw-fish',
target = false,
amount = 4,
capsule = true,
damage = false,
range = 30,
force = 'player',
@ -326,9 +353,25 @@ function Public.conjure_items()
enabled = true,
sprite = 'item/raw-fish'
}
spells[#spells + 1] = {
name = {'spells.dynamites'},
entityName = 'explosives',
target = false,
amount = 2,
capsule = true,
damage = false,
range = 30,
force = 'player',
level = 25,
type = 'special',
mana_cost = 140,
tick = 320,
enabled = true,
sprite = 'item/explosives'
}
spells[#spells + 1] = {
name = {'spells.comfylatron'},
obj_to_create = 'suicidal_comfylatron',
entityName = 'suicidal_comfylatron',
target = false,
amount = 4,
damage = false,
@ -343,7 +386,7 @@ function Public.conjure_items()
}
spells[#spells + 1] = {
name = {'spells.distractor'},
obj_to_create = 'distractor-capsule',
entityName = 'distractor-capsule',
target = true,
amount = 1,
damage = false,
@ -358,7 +401,7 @@ function Public.conjure_items()
}
spells[#spells + 1] = {
name = {'spells.warp'},
obj_to_create = 'warp-gate',
entityName = 'warp-gate',
target = true,
force = 'player',
level = 60,

View File

@ -102,7 +102,7 @@ function Public.reset_table()
this.rpg_extra.surface_name = 'nauvis'
this.rpg_extra.enable_health_and_mana_bars = false
this.rpg_extra.enable_mana = false
this.rpg_extra.mana_limit = 2500
this.rpg_extra.mana_limit = 100000
this.rpg_extra.enable_wave_defense = false
this.rpg_extra.enable_flame_boots = false
this.rpg_extra.enable_explosive_bullets = false
@ -447,7 +447,7 @@ function Public.set_new_spell(tbl)
if not tbl.name then
return error('A spell requires a name. <string>', 2)
end
if not tbl.obj_to_create then
if not tbl.entityName then
return error('A spell requires an object to create. <string>', 2)
end
if not tbl.target then

View File

@ -519,7 +519,10 @@ local function spawn_biter(surface, position, forceSpawn, is_boss_biter)
position = surface.find_non_colliding_position('steel-chest', position, 2, 1)
if not position then
position = old_position
position = surface.find_non_colliding_position('steel-chest', old_position, 4, 1)
if not position then
position = old_position
end
end
local biter = surface.create_entity({name = name, position = position, force = 'enemy'})
@ -1128,6 +1131,13 @@ local function t1()
if paused then
return
end
local enable_grace_time = Public.get('enable_grace_time')
if enable_grace_time and (not enable_grace_time.enabled) then
if not enable_grace_time.set then
Public.set('next_wave', game.tick + 100)
enable_grace_time.set = true
end
end
local next_wave = Public.get('next_wave')
if tick > next_wave then

View File

@ -33,6 +33,10 @@ function Public.reset_wave_defense()
this.nests = {}
this.nest_building_density = 48
this.next_wave = game.tick + 3600 * 15
this.enable_grace_time = {
enabled = true,
set = nil
}
this.side_targets = {}
this.simple_entity_shredding_cost_modifier = 0.009
this.spawn_position = {x = 0, y = 64}
@ -75,15 +79,17 @@ function Public.reset_wave_defense()
this.modified_unit_health = {
current_value = 1.2,
limit_value = 90,
health_increase_per_boss_wave = 0.08
health_increase_per_boss_wave = 0.5 -- wave % 25 == 0 at wave 2k boost is at 41.2
}
this.modified_boss_unit_health = {
current_value = 2.00,
current_value = 2,
limit_value = 500,
health_increase_per_boss_wave = 0.15
health_increase_per_boss_wave = 4 -- wave % 25 == 0 at wave 2k boost is at 322
}
end
--- This gets values from our table
-- @param key <string>
function Public.get(key)
if key then
return this[key]
@ -92,6 +98,10 @@ function Public.get(key)
end
end
--- This sets values to our table
-- use with caution.
-- @param key <string>
-- @param value <string/boolean/int>
function Public.set(key, value)
if key and (value or value == false or value == 'nil') then
if value == 'nil' then
@ -107,23 +117,31 @@ function Public.set(key, value)
end
end
--- Legacy, to be removed
Public.get_table = Public.get
function Public.clear_corpses(value)
if (value or value == false) then
this.clear_corpses = value
end
--- This sets if we should clear dead corpses on ground
-- on each wave we spawn
-- @param <boolean>
function Public.clear_corpses(boolean)
this.clear_corpses = boolean or false
return this.clear_corpses
end
--- This gets the status of the current wave
-- @param <null>
function Public.get_wave()
return this.wave_number
end
--- This gets the status of disable_threat_below_zero
-- @param <null>
function Public.get_disable_threat_below_zero()
return this.disable_threat_below_zero
end
--- This sets if we should disable threat below zero
-- @param <boolean>
function Public.set_disable_threat_below_zero(boolean)
if (boolean or boolean == false) then
this.disable_threat_below_zero = boolean
@ -131,10 +149,15 @@ function Public.set_disable_threat_below_zero(boolean)
return this.disable_threat_below_zero
end
--- This gets the status of alert_boss_wave
-- @param <null>
function Public.get_alert_boss_wave()
return this.get_alert_boss_wave
end
--- This sets if we should alert the players
-- when we spawn a boss wave
-- @param <boolean>
function Public.alert_boss_wave(boolean)
if (boolean or boolean == false) then
this.alert_boss_wave = boolean
@ -142,6 +165,9 @@ function Public.alert_boss_wave(boolean)
return this.alert_boss_wave
end
--- This sets the spawning position of where
-- we will spawn the entities.
-- @param <tbl>
function Public.set_spawn_position(tbl)
if type(tbl) == 'table' then
this.spawn_position = tbl
@ -151,6 +177,9 @@ function Public.set_spawn_position(tbl)
return this.spawn_position
end
--- This sets if we should remove colliding entities
-- when we spawn entities.
-- @param <boolean>
function Public.remove_entities(boolean)
if (boolean or boolean == false) then
this.remove_entities = boolean
@ -158,13 +187,10 @@ function Public.remove_entities(boolean)
return this.remove_entities
end
function Public.increase_health_per_wave(boolean)
if (boolean or boolean == false) then
this.increase_health_per_wave = boolean
end
return this.increase_health_per_wave
end
--- This sets if the threat gui should be present for the players
-- Warning - this creates a lot of entries in the global table
-- and makes save/load heavy.
-- @param <boolean>
function Public.enable_threat_log(boolean)
if (boolean or boolean == false) then
this.enable_threat_log = boolean
@ -172,6 +198,9 @@ function Public.enable_threat_log(boolean)
return this.enable_threat_log
end
--- This sets if we should spawn the unit near collapse
-- That is, if collapse module is enabled
-- @param <boolean>
function Public.check_collapse_position(boolean)
if (boolean or boolean == false) then
this.check_collapse_position = boolean
@ -179,6 +208,8 @@ function Public.check_collapse_position(boolean)
return this.check_collapse_position
end
--- This sets if the units/bosses should try to pick side-targets.
-- @param <boolean>
function Public.enable_side_target(boolean)
if (boolean or boolean == false) then
this.enable_side_target = boolean
@ -186,6 +217,17 @@ function Public.enable_side_target(boolean)
return this.enable_side_target
end
--- This sets if the units health should increase.
-- @param <boolean>
function Public.increase_health_per_wave(boolean)
if (boolean or boolean == false) then
this.increase_health_per_wave = boolean
end
return this.increase_health_per_wave
end
--- This sets if the bosses health should increase.
-- @param <boolean>
function Public.increase_boss_health_per_wave(boolean)
if (boolean or boolean == false) then
this.increase_boss_health_per_wave = boolean
@ -193,6 +235,8 @@ function Public.increase_boss_health_per_wave(boolean)
return this.increase_boss_health_per_wave
end
--- This checks if units are stuck, if they are - act.
-- @param <boolean>
function Public.resolve_pathing(boolean)
if (boolean or boolean == false) then
this.resolve_pathing = boolean
@ -200,6 +244,8 @@ function Public.resolve_pathing(boolean)
return this.resolve_pathing
end
--- Enables non-placeable tiles to be switched to placable-tiles.
-- @param <boolean>
function Public.fill_tiles_so_biter_can_path(boolean)
if (boolean or boolean == false) then
this.fill_tiles_so_biter_can_path = boolean
@ -207,6 +253,8 @@ function Public.fill_tiles_so_biter_can_path(boolean)
return this.fill_tiles_so_biter_can_path
end
--- Sets the wave defense units damage increase.
-- @param <boolean>
function Public.increase_damage_per_wave(boolean)
if (boolean or boolean == false) then
this.increase_damage_per_wave = boolean
@ -214,27 +262,38 @@ function Public.increase_damage_per_wave(boolean)
return this.increase_damage_per_wave
end
--- Sets the wave defense units health at start current.
-- @param <int>
function Public.set_normal_unit_current_health(int)
this.modified_unit_health.current_value = int or 1.2
end
--- Sets the wave defense boss health increment.
-- @param <int>
function Public.set_boss_unit_current_health(int)
this.modified_boss_unit_health.current_value = int or 2
end
--- Sets the wave defense units health at start current.
-- @param <int>
function Public.set_normal_unit_current_per_wave(int)
this.modified_unit_health.health_increase_per_boss_wave = int or 0.08
this.modified_unit_health.health_increase_per_boss_wave = int or 0.5
end
--- Sets the wave defense boss health increment.
-- @param <int>
function Public.set_boss_unit_current_per_wave(int)
this.modified_boss_unit_health.health_increase_per_boss_wave = int or 0.15
this.modified_boss_unit_health.health_increase_per_boss_wave = int or 4
end
--- Pauses the wave defense module
-- @param null
function Public.pause(boolean)
this.paused = boolean or false
end
--- Toggle debug - when you need to troubleshoot.
-- @param <null>
function Public.toggle_debug()
if this.debug then
this.debug = false
@ -246,6 +305,7 @@ function Public.toggle_debug()
end
--- Toggle debug - when you need to troubleshoot.
-- @param <null>
function Public.toggle_debug_health()
if this.debug_health then
this.debug_health = false
@ -256,12 +316,20 @@ function Public.toggle_debug_health()
return this.debug_health
end
local on_init = function()
Public.reset_wave_defense()
--- Toggle grace time, for when you want to waves to start instantly
-- @param <boolean>
function Public.enable_grace_time(boolean)
this.enable_grace_time.enabled = boolean or false
return this.debug_health
end
-- Event.on_nth_tick(30, Public.debug_module)
Event.on_init(on_init)
Event.on_init(
function()
Public.reset_wave_defense()
end
)
return Public

View File

@ -2,6 +2,19 @@ local Public = require 'modules.wave_defense.table'
local Event = require 'utils.event'
local BiterHealthBooster = require 'modules.biter_health_booster_v2'
local math_random = math.random
local Token = require 'utils.token'
local Task = require 'utils.task'
local immunity_spawner =
Token.register(
function(data)
local entity = data.entity
if not entity or not entity.valid then
return
end
entity.destructible = true
end
)
local function is_boss(entity)
local unit_number = entity.unit_number
@ -90,6 +103,9 @@ local function place_nest_near_unit_group()
local modified_boss_unit_health = Public.get('modified_boss_unit_health')
local spawner = unit.surface.create_entity({name = name, position = position, force = unit.force})
spawner.destructible = false
Task.set_timeout_in_ticks(100, immunity_spawner, {entity = spawner})
if boss then
BiterHealthBooster.add_boss_unit(spawner, modified_boss_unit_health.current_value)
else