1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2026-06-20 16:32:28 +02:00

minor fixes

This commit is contained in:
Gerkiz
2021-11-23 20:28:23 +01:00
parent 85438bb23b
commit 18d126463f
14 changed files with 254 additions and 120 deletions
+40 -10
View File
@@ -287,7 +287,7 @@ local fortress_functions = {
get_actor(event, '[Collapse]', 'has enabled the collapse function. Collapse will occur after wave 100!') get_actor(event, '[Collapse]', 'has enabled the collapse function. Collapse will occur after wave 100!')
else else
Module.collapse_grace = false Module.collapse_grace = false
get_actor(event, '[Collapse]', 'has disabled the collapse function. You must reach zone 2 for collapse to occur!') get_actor(event, '[Collapse]', 'has disabled the collapse function. You must breach the first zone for collapse to occur!')
end end
end, end,
['comfy_panel_spill_items_to_surface'] = function(event) ['comfy_panel_spill_items_to_surface'] = function(event)
@@ -438,7 +438,13 @@ local function build_config_gui(data)
if not poll_table[player.index] then if not poll_table[player.index] then
switch_state = 'left' switch_state = 'left'
end end
add_switch(scroll_pane, switch_state, 'comfy_panel_poll_no_notify_toggle', 'Notify on polls', 'Receive a message when new polls are created and popup the poll.') add_switch(
scroll_pane,
switch_state,
'comfy_panel_poll_no_notify_toggle',
'Notify on polls',
'Receive a message when new polls are created and popup the poll.'
)
scroll_pane.add({type = 'line'}) scroll_pane.add({type = 'line'})
end end
@@ -487,7 +493,13 @@ local function build_config_gui(data)
if bottom_frame and bottom_frame.portable then if bottom_frame and bottom_frame.portable then
switch_state = 'left' switch_state = 'left'
end end
add_switch(scroll_pane, switch_state, 'comfy_panel_portable_button', 'Position - portable', 'Toggle to select if you want the bottom button to be portable or not.') add_switch(
scroll_pane,
switch_state,
'comfy_panel_portable_button',
'Position - portable',
'Toggle to select if you want the bottom button to be portable or not.'
)
scroll_pane.add({type = 'line'}) scroll_pane.add({type = 'line'})
end end
@@ -623,7 +635,13 @@ local function build_config_gui(data)
if full.fullness_enabled then if full.fullness_enabled then
switch_state = 'left' switch_state = 'left'
end end
add_switch(scroll_pane, switch_state, 'comfy_panel_disable_fullness', 'Inventory Fullness', 'Left = Enables inventory fullness.\nRight = Disables inventory fullness.') add_switch(
scroll_pane,
switch_state,
'comfy_panel_disable_fullness',
'Inventory Fullness',
'On = Enables inventory fullness.\nOff = Disables inventory fullness.'
)
scroll_pane.add({type = 'line'}) scroll_pane.add({type = 'line'})
@@ -638,7 +656,7 @@ local function build_config_gui(data)
switch_state, switch_state,
'comfy_panel_offline_players', 'comfy_panel_offline_players',
'Offline Players', 'Offline Players',
'Left = Enables offline player inventory drop.\nRight = Disables offline player inventory drop.' 'On = Enables offline player inventory drop.\nOff = Disables offline player inventory drop.'
) )
scroll_pane.add({type = 'line'}) scroll_pane.add({type = 'line'})
@@ -652,7 +670,7 @@ local function build_config_gui(data)
switch_state, switch_state,
'comfy_panel_collapse_grace', 'comfy_panel_collapse_grace',
'Collapse', 'Collapse',
'Left = Enables collapse after wave 100.\nRight = Disables collapse - you must reach zone 2 for collapse to occur.' 'On = Enables collapse after wave 100.\nOff = Disables collapse - you must breach the first zone for collapse to occur.'
) )
scroll_pane.add({type = 'line'}) scroll_pane.add({type = 'line'})
@@ -666,7 +684,7 @@ local function build_config_gui(data)
switch_state, switch_state,
'comfy_panel_spill_items_to_surface', 'comfy_panel_spill_items_to_surface',
'Spill Ores', 'Spill Ores',
'Left = Enables ore spillage to surface when mining.\nRight = Disables ore spillage to surface when mining.' 'On = Enables ore spillage to surface when mining.\nOff = Disables ore spillage to surface when mining.'
) )
scroll_pane.add({type = 'line'}) scroll_pane.add({type = 'line'})
@@ -674,7 +692,13 @@ local function build_config_gui(data)
if Module.void_or_tile then if Module.void_or_tile then
switch_state = 'left' switch_state = 'left'
end end
add_switch(scroll_pane, switch_state, 'comfy_panel_void_or_tile', 'Void Tiles', 'Left = Changes the tiles to out-of-map.\nRight = Changes the tiles to lab-dark-2') add_switch(
scroll_pane,
switch_state,
'comfy_panel_void_or_tile',
'Void Tiles',
'On = Changes the tiles to out-of-map.\nOff = Changes the tiles to lab-dark-2'
)
scroll_pane.add({type = 'line'}) scroll_pane.add({type = 'line'})
switch_state = 'right' switch_state = 'right'
@@ -686,7 +710,7 @@ local function build_config_gui(data)
switch_state, switch_state,
'comfy_panel_trusted_only_car_tanks', 'comfy_panel_trusted_only_car_tanks',
'Market Purchase', 'Market Purchase',
'Left = Allows only trusted people to buy car/tanks.\nRight = Allows everyone to buy car/tanks.' 'On = Allows only trusted people to buy car/tanks.\nOff = Allows everyone to buy car/tanks.'
) )
scroll_pane.add({type = 'line'}) scroll_pane.add({type = 'line'})
@@ -694,7 +718,13 @@ local function build_config_gui(data)
if Module.allow_decon then if Module.allow_decon then
switch_state = 'left' switch_state = 'left'
end end
add_switch(scroll_pane, switch_state, 'comfy_panel_allow_decon', 'Deconstruct', 'Left = Allows decon on car/tanks/trains.\nRight = Disables decon on car/tanks/trains.') add_switch(
scroll_pane,
switch_state,
'comfy_panel_allow_decon',
'Deconstruct',
'On = Allows decon on car/tanks/trains.\nOff = Disables decon on car/tanks/trains.'
)
scroll_pane.add({type = 'line'}) scroll_pane.add({type = 'line'})
end end
end end
@@ -31,6 +31,29 @@ local scrap = {
[15] = true [15] = true
} }
local clear_breach_text_and_render = function()
local beam1 = WPT.get('zone1_beam1')
if beam1 and beam1.valid then
beam1.destroy()
end
local beam2 = WPT.get('zone1_beam2')
if beam2 and beam2.valid then
beam2.destroy()
end
local zone1_text1 = WPT.get('zone1_text1')
if zone1_text1 then
rendering.set_text(zone1_text1, 'Collapse has started!')
end
local zone1_text2 = WPT.get('zone1_text2')
if zone1_text2 then
rendering.set_text(zone1_text2, 'Collapse has started!')
end
local zone1_text3 = WPT.get('zone1_text3')
if zone1_text3 then
rendering.set_text(zone1_text3, 'Collapse has started!')
end
end
local collapse_message = local collapse_message =
Token.register( Token.register(
function(data) function(data)
@@ -243,6 +266,7 @@ local function distance(player)
end end
if not Collapse.start_now() then if not Collapse.start_now() then
clear_breach_text_and_render()
Collapse.start_now(true) Collapse.start_now(true)
local data = { local data = {
position = Collapse.get_position() position = Collapse.get_position()
+10 -10
View File
@@ -203,7 +203,7 @@ local function do_magic_crafters()
if entity.get_output_inventory().can_insert({name = data.item, count = fcount}) then if entity.get_output_inventory().can_insert({name = data.item, count = fcount}) then
entity.get_output_inventory().insert {name = data.item, count = fcount} entity.get_output_inventory().insert {name = data.item, count = fcount}
entity.products_finished = entity.products_finished + fcount entity.products_finished = entity.products_finished + fcount
data.last_tick = tick - (count - fcount) / rate data.last_tick = round(tick - (count - fcount) / rate)
end end
end end
end end
@@ -366,9 +366,9 @@ local function add_magic_crafter_output(entity, output, distance)
local fluidbox_index = output.fluidbox_index local fluidbox_index = output.fluidbox_index
local data = { local data = {
entity = entity, entity = entity,
last_tick = game.tick, last_tick = round(game.tick),
base_rate = rate, base_rate = round(rate, 8),
rate = rate, rate = round(rate, 8),
item = output.item, item = output.item,
fluidbox_index = fluidbox_index fluidbox_index = fluidbox_index
} }
@@ -929,17 +929,17 @@ function Public.set_difficulty()
end end
if Diff.name == "I'm too young to die" then if Diff.name == "I'm too young to die" then
wave_defense_table.wave_interval = 3600 - player_count * 60 wave_defense_table.wave_interval = 4600 - player_count * 60
if wave_defense_table.wave_interval < 1800 or threat_check then if wave_defense_table.wave_interval < 1800 or threat_check then
wave_defense_table.wave_interval = 1800 wave_defense_table.wave_interval = 1800
end end
elseif Diff.name == 'Hurt me plenty' then elseif Diff.name == 'Hurt me plenty' then
wave_defense_table.wave_interval = 2600 - player_count * 60 wave_defense_table.wave_interval = 3600 - player_count * 60
if wave_defense_table.wave_interval < 1500 or threat_check then if wave_defense_table.wave_interval < 1500 or threat_check then
wave_defense_table.wave_interval = 1500 wave_defense_table.wave_interval = 1500
end end
elseif Diff.name == 'Ultra-violence' then elseif Diff.name == 'Ultra-violence' then
wave_defense_table.wave_interval = 1600 - player_count * 60 wave_defense_table.wave_interval = 2600 - player_count * 60
if wave_defense_table.wave_interval < 1100 or threat_check then if wave_defense_table.wave_interval < 1100 or threat_check then
wave_defense_table.wave_interval = 1100 wave_defense_table.wave_interval = 1100
end end
@@ -1128,8 +1128,8 @@ function Public.boost_difficulty()
WPT.set('bonus_xp_on_join', 500) WPT.set('bonus_xp_on_join', 500)
WD.set('next_wave', game.tick + 3600 * 15) WD.set('next_wave', game.tick + 3600 * 15)
WPT.set('spidertron_unlocked_at_zone', 10) WPT.set('spidertron_unlocked_at_zone', 10)
WD.set_normal_unit_current_health(1.2) WD.set_normal_unit_current_health(1.0)
WD.set_normal_unit_current_per_wave(0.5) WD.set_normal_unit_current_per_wave(0.3)
WD.set_boss_unit_current_health(2) WD.set_boss_unit_current_health(2)
WD.set_boss_unit_current_per_wave(3) WD.set_boss_unit_current_per_wave(3)
WPT.set('difficulty_set', true) WPT.set('difficulty_set', true)
@@ -1146,7 +1146,7 @@ function Public.boost_difficulty()
WD.set('next_wave', game.tick + 3600 * 8) WD.set('next_wave', game.tick + 3600 * 8)
WPT.set('spidertron_unlocked_at_zone', 8) WPT.set('spidertron_unlocked_at_zone', 8)
WD.set_normal_unit_current_health(1.6) WD.set_normal_unit_current_health(1.6)
WD.set_normal_unit_current_per_wave(0.8) WD.set_normal_unit_current_per_wave(0.5)
WD.set_boss_unit_current_health(3) WD.set_boss_unit_current_health(3)
WD.set_boss_unit_current_per_wave(5) WD.set_boss_unit_current_per_wave(5)
WPT.set('difficulty_set', true) WPT.set('difficulty_set', true)
+5 -3
View File
@@ -4,6 +4,8 @@ local ICT = require 'maps.mountain_fortress_v3.ic.table'
local Functions = require 'maps.mountain_fortress_v3.ic.functions' local Functions = require 'maps.mountain_fortress_v3.ic.functions'
local Gui = require 'maps.mountain_fortress_v3.ic.gui' local Gui = require 'maps.mountain_fortress_v3.ic.gui'
local round = math.round
local function validate_player(player) local function validate_player(player)
if not player then if not player then
return false return false
@@ -142,7 +144,7 @@ local function draw_minimap(player, surface, position)
name = 'minimap_frame', name = 'minimap_frame',
position = position, position = position,
surface_index = surface.index, surface_index = surface.index,
zoom = player_data.zoom, zoom = round(player_data.zoom),
tooltip = 'LMB: Increase zoom level.\nRMB: Decrease zoom level.\nMMB: Toggle camera size.' tooltip = 'LMB: Increase zoom level.\nRMB: Decrease zoom level.\nMMB: Toggle camera size.'
} }
) )
@@ -197,7 +199,7 @@ function Public.toggle_minimap(event)
if player_data.zoom < 0.07 then if player_data.zoom < 0.07 then
player_data.zoom = 0.07 player_data.zoom = 0.07
end end
element.zoom = player_data.zoom element.zoom = round(player_data.zoom)
return return
end end
if event.button == defines.mouse_button_type.left then if event.button == defines.mouse_button_type.left then
@@ -205,7 +207,7 @@ function Public.toggle_minimap(event)
if player_data.zoom > 2 then if player_data.zoom > 2 then
player_data.zoom = 2 player_data.zoom = 2
end end
element.zoom = player_data.zoom element.zoom = round(player_data.zoom)
return return
end end
if event.button == defines.mouse_button_type.middle then if event.button == defines.mouse_button_type.middle then
+20 -5
View File
@@ -16,10 +16,10 @@ Public.level_width = WPT.level_width
local worm_level_modifier = 0.19 local worm_level_modifier = 0.19
local start_ground_tiles = { local start_ground_tiles = {
'hazard-concrete-left', 'dirt-1',
'hazard-concrete-right', 'grass-1',
'brown-refined-concrete', 'grass-2',
'concrete' 'dirt-2'
} }
local wagon_raffle = { local wagon_raffle = {
@@ -315,9 +315,17 @@ local function wall(p, data)
if not alert_zone_1 then if not alert_zone_1 then
local x_min = -WPT.level_width / 2 local x_min = -WPT.level_width / 2
local x_max = WPT.level_width / 2 local x_max = WPT.level_width / 2
WPT.set(
'zone1_beam1',
surface.create_entity({name = 'electric-beam', position = {x_min, p.y}, source = {x_min, p.y}, target = {x_max, p.y}}) surface.create_entity({name = 'electric-beam', position = {x_min, p.y}, source = {x_min, p.y}, target = {x_max, p.y}})
)
WPT.set(
'zone1_beam2',
surface.create_entity({name = 'electric-beam', position = {x_min, p.y}, source = {x_min, p.y}, target = {x_max, p.y}}) surface.create_entity({name = 'electric-beam', position = {x_min, p.y}, source = {x_min, p.y}, target = {x_max, p.y}})
)
WPT.set('alert_zone_1', true) WPT.set('alert_zone_1', true)
WPT.set(
'zone1_text1',
rendering.draw_text { rendering.draw_text {
text = 'Breaching the far side wall will start collapse.', text = 'Breaching the far side wall will start collapse.',
surface = surface, surface = surface,
@@ -328,6 +336,9 @@ local function wall(p, data)
alignment = 'center', alignment = 'center',
scale_with_zoom = false scale_with_zoom = false
} }
)
WPT.set(
'zone1_text2',
rendering.draw_text { rendering.draw_text {
text = 'Breaching the far side wall will start collapse', text = 'Breaching the far side wall will start collapse',
surface = surface, surface = surface,
@@ -338,6 +349,9 @@ local function wall(p, data)
alignment = 'center', alignment = 'center',
scale_with_zoom = false scale_with_zoom = false
} }
)
WPT.set(
'zone1_text3',
rendering.draw_text { rendering.draw_text {
text = 'Breaching the far side wall will start collapse', text = 'Breaching the far side wall will start collapse',
surface = surface, surface = surface,
@@ -348,6 +362,7 @@ local function wall(p, data)
alignment = 'center', alignment = 'center',
scale_with_zoom = false scale_with_zoom = false
} }
)
end end
end end
else else
@@ -2407,7 +2422,7 @@ local function border_chunk(p, data)
entities[#entities + 1] = {name = trees[random(1, #trees)], position = pos} entities[#entities + 1] = {name = trees[random(1, #trees)], position = pos}
end end
local noise = get_perlin('dungeons', pos, 14882) local noise = get_perlin('dungeons', pos, data.seed)
local index = floor(noise * 32) % 4 + 1 local index = floor(noise * 32) % 4 + 1
tiles[#tiles + 1] = {name = start_ground_tiles[index], position = pos} tiles[#tiles + 1] = {name = start_ground_tiles[index], position = pos}
-5
View File
@@ -57,9 +57,4 @@ local function on_init()
script.on_event(defines.events.on_player_main_inventory_changed, check_burden) script.on_event(defines.events.on_player_main_inventory_changed, check_burden)
end end
local function on_load()
script.on_event(defines.events.on_player_main_inventory_changed, check_burden)
end
Event.on_init(on_init) Event.on_init(on_init)
Event.on_load(on_load)
+3 -3
View File
@@ -167,7 +167,7 @@ local function add_to_global_pool(amount, personal_tax)
fee = amount * 0.3 fee = amount * 0.3
end end
rpg_extra.global_pool = rpg_extra.global_pool + fee rpg_extra.global_pool = round(rpg_extra.global_pool + fee, 8)
return amount - fee return amount - fee
end end
@@ -718,7 +718,7 @@ function Public.rpg_reset_player(player, one_time_reset)
} }
) )
rpg_t.points_left = old_points_left + total rpg_t.points_left = old_points_left + total
rpg_t.xp = old_xp rpg_t.xp = round(old_xp)
rpg_t.level = old_level rpg_t.level = old_level
else else
Public.set_new_player_tbl( Public.set_new_player_tbl(
@@ -817,7 +817,7 @@ function Public.gain_xp(player, amount, added_to_pool, text)
end end
rpg_t.xp = round(rpg_t.xp + amount, 3) rpg_t.xp = round(rpg_t.xp + amount, 3)
rpg_t.xp_since_last_floaty_text = rpg_t.xp_since_last_floaty_text + amount rpg_t.xp_since_last_floaty_text = round(rpg_t.xp_since_last_floaty_text + amount)
if not experience_levels[rpg_t.level + 1] then if not experience_levels[rpg_t.level + 1] then
return return
+22 -13
View File
@@ -24,6 +24,7 @@ local sub = string.sub
local round = math.round local round = math.round
local floor = math.floor local floor = math.floor
local random = math.random local random = math.random
local sqrt = math.sqrt
local abs = math.abs local abs = math.abs
local function log_one_punch(callback) local function log_one_punch(callback)
@@ -749,7 +750,7 @@ local function on_entity_damaged(event)
{ {
name = 'flying-text', name = 'flying-text',
position = entity.position, position = entity.position,
text = '' .. math.floor(damage), text = '' .. floor(damage),
color = {255, 0, 0} color = {255, 0, 0}
} }
) )
@@ -758,7 +759,7 @@ local function on_entity_damaged(event)
damage = damage * random(100, 125) * 0.01 damage = damage * random(100, 125) * 0.01
cause.player.create_local_flying_text( cause.player.create_local_flying_text(
{ {
text = math.floor(damage), text = floor(damage),
position = entity.position, position = entity.position,
color = {150, 150, 150}, color = {150, 150, 150},
time_to_live = 90, time_to_live = 90,
@@ -923,26 +924,28 @@ local function on_pre_player_mined_item(event)
end end
local rpg_t = Public.get_value_from_player(player.index) local rpg_t = Public.get_value_from_player(player.index)
if rpg_t.last_mined_entity_position.x == event.entity.position.x and rpg_t.last_mined_entity_position.y == event.entity.position.y then if rpg_t.last_mined_entity_position.x == entity.position.x and rpg_t.last_mined_entity_position.y == entity.position.y then
return return
end end
rpg_t.last_mined_entity_position.x = entity.position.x rpg_t.last_mined_entity_position.x = entity.position.x
rpg_t.last_mined_entity_position.y = entity.position.y rpg_t.last_mined_entity_position.y = entity.position.y
local distance_multiplier = math.floor(math.sqrt(entity.position.x ^ 2 + entity.position.y ^ 2)) * 0.0005 + 1 local distance_multiplier = floor(sqrt(entity.position.x ^ 2 + entity.position.y ^ 2)) * 0.0005 + 1
local xp_modifier_when_mining = Public.get('rpg_extra').xp_modifier_when_mining
local xp_amount local xp_amount
if entity.type == 'resource' then if entity.type == 'resource' then
xp_amount = 0.5 * distance_multiplier xp_amount = 0.9 * distance_multiplier
else else
xp_amount = (1.5 + event.entity.prototype.max_health * 0.0035) * distance_multiplier xp_amount = (1.5 + entity.prototype.max_health * xp_modifier_when_mining) * distance_multiplier
end end
if player.gui.screen[main_frame_name] then if player.gui.screen[main_frame_name] then
local f = player.gui.screen[main_frame_name] local f = player.gui.screen[main_frame_name]
local data = Gui.get_data(f) local data = Gui.get_data(f)
if data.exp_gui and data.exp_gui.valid then if data.exp_gui and data.exp_gui.valid then
data.exp_gui.caption = math.floor(rpg_t.xp) data.exp_gui.caption = floor(rpg_t.xp)
end end
end end
@@ -969,7 +972,8 @@ local function on_player_crafted_item(event)
local item = event.item_stack local item = event.item_stack
local amount = 0.30 * random(1, 2) local amount = 0.40 * random(1, 2)
local recipe = event.recipe
if tweaked_crafting_items_enabled then if tweaked_crafting_items_enabled then
if item and item.valid then if item and item.valid then
@@ -979,7 +983,9 @@ local function on_player_crafted_item(event)
end end
end end
Public.gain_xp(player, event.recipe.energy * amount) local final_xp = recipe.energy * amount
Public.gain_xp(player, final_xp)
Public.reward_mana(player, amount) Public.reward_mana(player, amount)
end end
@@ -1067,7 +1073,11 @@ local function damage_entity(e)
return return
end end
e.surface.create_entity({name = 'water-splash', position = e.position}) if not e.destructible then
return
end
e.surface.create_entity({name = 'ground-explosion', position = e.position})
if e.type == 'entity-ghost' then if e.type == 'entity-ghost' then
e.destroy() e.destroy()
@@ -1203,8 +1213,7 @@ local function on_player_used_capsule(event)
target_pos = {position.x, position.y} target_pos = {position.x, position.y}
elseif projectile_types[object.entityName] then elseif projectile_types[object.entityName] then
local coord_modifier = get_near_coord_modifier(projectile_types[object.entityName].max_range) 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 = {position.x + coord_modifier.x, position.y + coord_modifier.y}
target_pos = proj_pos
end end
local range local range
@@ -1273,7 +1282,7 @@ local function on_player_used_capsule(event)
left_top = {x = position.x - 2, y = position.y - 2}, left_top = {x = position.x - 2, y = position.y - 2},
right_bottom = {x = position.x + 2, y = position.y + 2} right_bottom = {x = position.x + 2, y = position.y + 2}
} }
create_projectile(surface, object.entityName, position, force, target_pos, range) create_projectile(surface, projectile_types[object.entityName].name, position, force, target_pos, range)
if object.damage then if object.damage then
for _, e in pairs(surface.find_entities_filtered({area = damage_area})) do for _, e in pairs(surface.find_entities_filtered({area = damage_area})) do
damage_entity(e) damage_entity(e)
+84 -27
View File
@@ -6,7 +6,7 @@ function Public.conjure_items()
spells[#spells + 1] = { spells[#spells + 1] = {
name = {'entity-name.stone-wall'}, name = {'entity-name.stone-wall'},
entityName = 'stone-wall', entityName = 'stone-wall',
level = 10, level = 1,
type = 'item', type = 'item',
mana_cost = 60, mana_cost = 60,
tick = 100, tick = 100,
@@ -17,7 +17,7 @@ function Public.conjure_items()
spells[#spells + 1] = { spells[#spells + 1] = {
name = {'entity-name.wooden-chest'}, name = {'entity-name.wooden-chest'},
entityName = 'wooden-chest', entityName = 'wooden-chest',
level = 2, level = 1,
type = 'item', type = 'item',
mana_cost = 50, mana_cost = 50,
tick = 100, tick = 100,
@@ -39,7 +39,7 @@ function Public.conjure_items()
spells[#spells + 1] = { spells[#spells + 1] = {
name = {'entity-name.steel-chest'}, name = {'entity-name.steel-chest'},
entityName = 'steel-chest', entityName = 'steel-chest',
level = 15, level = 30,
type = 'item', type = 'item',
mana_cost = 150, mana_cost = 150,
tick = 300, tick = 300,
@@ -50,7 +50,7 @@ function Public.conjure_items()
spells[#spells + 1] = { spells[#spells + 1] = {
name = {'entity-name.transport-belt'}, name = {'entity-name.transport-belt'},
entityName = 'transport-belt', entityName = 'transport-belt',
level = 3, level = 1,
type = 'item', type = 'item',
mana_cost = 80, mana_cost = 80,
tick = 100, tick = 100,
@@ -61,7 +61,7 @@ function Public.conjure_items()
spells[#spells + 1] = { spells[#spells + 1] = {
name = {'entity-name.fast-transport-belt'}, name = {'entity-name.fast-transport-belt'},
entityName = 'fast-transport-belt', entityName = 'fast-transport-belt',
level = 20, level = 10,
type = 'item', type = 'item',
mana_cost = 110, mana_cost = 110,
tick = 200, tick = 200,
@@ -72,7 +72,7 @@ function Public.conjure_items()
spells[#spells + 1] = { spells[#spells + 1] = {
name = {'entity-name.express-transport-belt'}, name = {'entity-name.express-transport-belt'},
entityName = 'express-transport-belt', entityName = 'express-transport-belt',
level = 60, level = 30,
type = 'item', type = 'item',
mana_cost = 150, mana_cost = 150,
tick = 300, tick = 300,
@@ -83,7 +83,7 @@ function Public.conjure_items()
spells[#spells + 1] = { spells[#spells + 1] = {
name = {'entity-name.underground-belt'}, name = {'entity-name.underground-belt'},
entityName = 'underground-belt', entityName = 'underground-belt',
level = 3, level = 1,
type = 'item', type = 'item',
mana_cost = 80, mana_cost = 80,
tick = 100, tick = 100,
@@ -94,7 +94,7 @@ function Public.conjure_items()
spells[#spells + 1] = { spells[#spells + 1] = {
name = {'entity-name.fast-underground-belt'}, name = {'entity-name.fast-underground-belt'},
entityName = 'fast-underground-belt', entityName = 'fast-underground-belt',
level = 20, level = 10,
type = 'item', type = 'item',
mana_cost = 110, mana_cost = 110,
tick = 200, tick = 200,
@@ -105,7 +105,7 @@ function Public.conjure_items()
spells[#spells + 1] = { spells[#spells + 1] = {
name = {'entity-name.express-underground-belt'}, name = {'entity-name.express-underground-belt'},
entityName = 'express-underground-belt', entityName = 'express-underground-belt',
level = 60, level = 30,
type = 'item', type = 'item',
mana_cost = 150, mana_cost = 150,
tick = 300, tick = 300,
@@ -138,7 +138,7 @@ function Public.conjure_items()
spells[#spells + 1] = { spells[#spells + 1] = {
name = {'entity-name.tree'}, name = {'entity-name.tree'},
entityName = 'tree-05', entityName = 'tree-05',
level = 70, level = 30,
type = 'entity', type = 'entity',
mana_cost = 100, mana_cost = 100,
tick = 350, tick = 350,
@@ -149,7 +149,7 @@ function Public.conjure_items()
spells[#spells + 1] = { spells[#spells + 1] = {
name = {'entity-name.sand-rock-big'}, name = {'entity-name.sand-rock-big'},
entityName = 'sand-rock-big', entityName = 'sand-rock-big',
level = 80, level = 60,
type = 'entity', type = 'entity',
mana_cost = 80, mana_cost = 80,
tick = 350, tick = 350,
@@ -160,7 +160,7 @@ function Public.conjure_items()
spells[#spells + 1] = { spells[#spells + 1] = {
name = {'entity-name.small-biter'}, name = {'entity-name.small-biter'},
entityName = 'small-biter', entityName = 'small-biter',
level = 50, level = 30,
biter = true, biter = true,
type = 'entity', type = 'entity',
mana_cost = 55, mana_cost = 55,
@@ -171,7 +171,7 @@ function Public.conjure_items()
spells[#spells + 1] = { spells[#spells + 1] = {
name = {'entity-name.small-spitter'}, name = {'entity-name.small-spitter'},
entityName = 'small-spitter', entityName = 'small-spitter',
level = 50, level = 30,
biter = true, biter = true,
type = 'entity', type = 'entity',
mana_cost = 55, mana_cost = 55,
@@ -182,7 +182,7 @@ function Public.conjure_items()
spells[#spells + 1] = { spells[#spells + 1] = {
name = {'entity-name.medium-biter'}, name = {'entity-name.medium-biter'},
entityName = 'medium-biter', entityName = 'medium-biter',
level = 70, level = 60,
biter = true, biter = true,
type = 'entity', type = 'entity',
mana_cost = 100, mana_cost = 100,
@@ -193,7 +193,7 @@ function Public.conjure_items()
spells[#spells + 1] = { spells[#spells + 1] = {
name = {'entity-name.medium-spitter'}, name = {'entity-name.medium-spitter'},
entityName = 'medium-spitter', entityName = 'medium-spitter',
level = 70, level = 60,
biter = true, biter = true,
type = 'entity', type = 'entity',
mana_cost = 100, mana_cost = 100,
@@ -223,6 +223,21 @@ function Public.conjure_items()
enabled = false, enabled = false,
sprite = 'entity/spitter-spawner' sprite = 'entity/spitter-spawner'
} }
spells[#spells + 1] = {
name = {'item-name.shotgun-shell'},
entityName = 'shotgun-shell',
target = true,
amount = 1,
damage = true,
force = 'player',
level = 10,
type = 'item',
mana_cost = 40,
tick = 150,
enabled = true,
sprite = 'recipe/shotgun-shell'
}
spells[#spells + 1] = { spells[#spells + 1] = {
name = {'item-name.grenade'}, name = {'item-name.grenade'},
entityName = 'grenade', entityName = 'grenade',
@@ -231,8 +246,8 @@ function Public.conjure_items()
damage = true, damage = true,
force = 'player', force = 'player',
level = 30, level = 30,
type = 'special', type = 'item',
mana_cost = 150, mana_cost = 100,
tick = 150, tick = 150,
enabled = true, enabled = true,
sprite = 'recipe/grenade' sprite = 'recipe/grenade'
@@ -245,12 +260,54 @@ function Public.conjure_items()
damage = true, damage = true,
force = 'player', force = 'player',
level = 50, level = 50,
type = 'special', type = 'item',
mana_cost = 250, mana_cost = 225,
tick = 200, tick = 200,
enabled = true, enabled = true,
sprite = 'recipe/cluster-grenade' sprite = 'recipe/cluster-grenade'
} }
spells[#spells + 1] = {
name = {'item-name.cannon-shell'},
entityName = 'cannon-shell',
target = true,
amount = 1,
damage = true,
force = 'player',
level = 30,
type = 'item',
mana_cost = 125,
tick = 150,
enabled = true,
sprite = 'recipe/cannon-shell'
}
spells[#spells + 1] = {
name = {'item-name.explosive-cannon-shell'},
entityName = 'explosive-cannon-shell',
target = true,
amount = 2,
damage = true,
force = 'player',
level = 50,
type = 'item',
mana_cost = 250,
tick = 200,
enabled = true,
sprite = 'recipe/explosive-cannon-shell'
}
spells[#spells + 1] = {
name = {'item-name.uranium-cannon-shell'},
entityName = 'uranium-cannon-shell',
target = true,
amount = 2,
damage = true,
force = 'player',
level = 70,
type = 'item',
mana_cost = 400,
tick = 200,
enabled = true,
sprite = 'recipe/uranium-cannon-shell'
}
spells[#spells + 1] = { spells[#spells + 1] = {
name = {'item-name.rocket'}, name = {'item-name.rocket'},
entityName = 'rocket', entityName = 'rocket',
@@ -260,7 +317,7 @@ function Public.conjure_items()
damage = true, damage = true,
force = 'enemy', force = 'enemy',
level = 40, level = 40,
type = 'special', type = 'item',
mana_cost = 60, mana_cost = 60,
tick = 320, tick = 320,
enabled = true, enabled = true,
@@ -289,9 +346,9 @@ function Public.conjure_items()
range = 50, range = 50,
damage = false, damage = false,
force = 'player', force = 'player',
level = 50, level = 45,
type = 'special', type = 'special',
mana_cost = 200, mana_cost = 150,
tick = 100, tick = 100,
enabled = true, enabled = true,
sprite = 'recipe/repair-pack' sprite = 'recipe/repair-pack'
@@ -304,9 +361,9 @@ function Public.conjure_items()
range = 0, range = 0,
damage = true, damage = true,
force = 'player', force = 'player',
level = 70, level = 50,
type = 'special', type = 'special',
mana_cost = 90, mana_cost = 70,
tick = 100, tick = 100,
enabled = true, enabled = true,
sprite = 'virtual-signal/signal-S' sprite = 'virtual-signal/signal-S'
@@ -357,7 +414,7 @@ function Public.conjure_items()
name = {'spells.dynamites'}, name = {'spells.dynamites'},
entityName = 'explosives', entityName = 'explosives',
target = false, target = false,
amount = 2, amount = 3,
capsule = true, capsule = true,
damage = false, damage = false,
range = 30, range = 30,
@@ -379,7 +436,7 @@ function Public.conjure_items()
force = 'player', force = 'player',
level = 60, level = 60,
type = 'special', type = 'special',
mana_cost = 250, mana_cost = 150,
tick = 320, tick = 320,
enabled = true, enabled = true,
sprite = 'entity/compilatron' sprite = 'entity/compilatron'
@@ -394,7 +451,7 @@ function Public.conjure_items()
force = 'player', force = 'player',
level = 50, level = 50,
type = 'special', type = 'special',
mana_cost = 340, mana_cost = 220,
tick = 320, tick = 320,
enabled = true, enabled = true,
sprite = 'recipe/distractor-capsule' sprite = 'recipe/distractor-capsule'
+1
View File
@@ -108,6 +108,7 @@ function Public.reset_table()
this.rpg_extra.enable_explosive_bullets = false this.rpg_extra.enable_explosive_bullets = false
this.rpg_extra.enable_explosive_bullets_globally = false this.rpg_extra.enable_explosive_bullets_globally = false
this.rpg_extra.mana_per_tick = 0.1 this.rpg_extra.mana_per_tick = 0.1
this.rpg_extra.xp_modifier_when_mining = 0.0045
this.rpg_extra.force_mana_per_tick = false this.rpg_extra.force_mana_per_tick = false
this.rpg_extra.enable_stone_path = false this.rpg_extra.enable_stone_path = false
this.rpg_extra.enable_auto_allocate = false this.rpg_extra.enable_auto_allocate = false
+7 -5
View File
@@ -1,6 +1,8 @@
local Public = require 'modules.wave_defense.table' local Public = require 'modules.wave_defense.table'
local BiterHealthBooster = require 'modules.biter_health_booster_v2' local BiterHealthBooster = require 'modules.biter_health_booster_v2'
local floor = math.floor
local function create_gui(player) local function create_gui(player)
local frame = player.gui.top.add({type = 'frame', name = 'wave_defense'}) local frame = player.gui.top.add({type = 'frame', name = 'wave_defense'})
frame.style.maximal_height = 37 frame.style.maximal_height = 37
@@ -59,7 +61,7 @@ local function get_threat_gain()
if past_index < 1 then if past_index < 1 then
past_index = 1 past_index = 1
end end
local gain = math.floor((threat_log[threat_log_index] - threat_log[past_index]) / 15) local gain = floor((threat_log[threat_log_index] - threat_log[past_index]) / 15)
return gain return gain
end end
@@ -85,14 +87,14 @@ function Public.update_gui(player)
gui.wave_number.caption = wave_number gui.wave_number.caption = wave_number
if wave_number == 0 then if wave_number == 0 then
gui.label.caption = {'wave_defense.gui_1'} gui.label.caption = {'wave_defense.gui_1'}
gui.wave_number.caption = math.floor((next_wave - game.tick) / 60) + 1 gui.wave_number.caption = floor((next_wave - game.tick) / 60) + 1
end end
local interval = next_wave - last_wave local interval = next_wave - last_wave
gui.progressbar.value = 1 - (next_wave - game.tick) / interval gui.progressbar.value = 1 - (next_wave - game.tick) / interval
gui.threat.caption = {'wave_defense.gui_3'} gui.threat.caption = {'wave_defense.gui_3'}
gui.threat.tooltip = {'wave_defense.tooltip_1', biter_health_boost * 100, max_active_biters} gui.threat.tooltip = {'wave_defense.tooltip_1', biter_health_boost * 100, max_active_biters}
gui.threat_value.caption = math.floor(threat) gui.threat_value.caption = floor(threat)
gui.threat_value.tooltip = { gui.threat_value.tooltip = {
'wave_defense.tooltip_1', 'wave_defense.tooltip_1',
biter_health_boost * 100, biter_health_boost * 100,
@@ -109,14 +111,14 @@ function Public.update_gui(player)
if gain >= 0 then if gain >= 0 then
gui.threat_gains.caption = ' (+' .. gain .. ')' gui.threat_gains.caption = ' (+' .. gain .. ')'
local g = 255 - math.floor(gain / d) local g = 255 - floor(gain / d)
if g < 0 then if g < 0 then
g = 0 g = 0
end end
gui.threat_gains.style.font_color = {255, g, 0} gui.threat_gains.style.font_color = {255, g, 0}
else else
gui.threat_gains.caption = ' (' .. gain .. ')' gui.threat_gains.caption = ' (' .. gain .. ')'
local r = 255 - math.floor(math.abs(gain) / d) local r = 255 - floor(math.abs(gain) / d)
if r < 0 then if r < 0 then
r = 0 r = 0
end end
+1 -4
View File
@@ -517,13 +517,10 @@ local function spawn_biter(surface, position, forceSpawn, is_boss_biter)
local old_position = position local old_position = position
position = surface.find_non_colliding_position('steel-chest', position, 2, 1) position = surface.find_non_colliding_position('steel-chest', position, 3, 1)
if not position then
position = surface.find_non_colliding_position('steel-chest', old_position, 4, 1)
if not position then if not position then
position = old_position position = old_position
end end
end
local biter = surface.create_entity({name = name, position = position, force = 'enemy'}) local biter = surface.create_entity({name = name, position = position, force = 'enemy'})
biter.ai_settings.allow_destroy_when_commands_fail = true biter.ai_settings.allow_destroy_when_commands_fail = true
+1 -1
View File
@@ -32,7 +32,7 @@ function Public.reset_wave_defense()
this.max_biter_age = 3600 * 60 this.max_biter_age = 3600 * 60
this.nests = {} this.nests = {}
this.nest_building_density = 48 this.nest_building_density = 48
this.next_wave = game.tick + 3600 * 15 this.next_wave = game.tick + 3600 * 20
this.enable_grace_time = { this.enable_grace_time = {
enabled = true, enabled = true,
set = nil set = nil
+3 -1
View File
@@ -4,6 +4,8 @@
local Event = require 'utils.event' local Event = require 'utils.event'
local Global = require 'utils.global' local Global = require 'utils.global'
local round = math.round
local this = { local this = {
modifiers = {}, modifiers = {},
disabled_modifier = {} disabled_modifier = {}
@@ -72,7 +74,7 @@ function Public.update_player_modifiers(player)
if disabled_modifiers and disabled_modifiers[k] then if disabled_modifiers and disabled_modifiers[k] then
player[modifier] = 0 player[modifier] = 0
else else
player[modifier] = sum_value player[modifier] = round(sum_value, 8)
end end
end end
end end