mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-04-25 12:04:40 +02:00
small fixes
This commit is contained in:
parent
8b6e72bcb1
commit
e85271ef2b
@ -14,6 +14,7 @@ Global.register(
|
|||||||
)
|
)
|
||||||
|
|
||||||
local Public = {}
|
local Public = {}
|
||||||
|
local round = math.round
|
||||||
local floor = math.floor
|
local floor = math.floor
|
||||||
local random = math.random
|
local random = math.random
|
||||||
local abs = math.abs
|
local abs = math.abs
|
||||||
@ -79,6 +80,7 @@ local function spawn_biters(data)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local unit_to_create
|
local unit_to_create
|
||||||
|
WD.wave_defense_set_unit_raffle(h * 0.20)
|
||||||
|
|
||||||
if random(1, 3) == 1 then
|
if random(1, 3) == 1 then
|
||||||
unit_to_create = WD.wave_defense_roll_spitter_name()
|
unit_to_create = WD.wave_defense_roll_spitter_name()
|
||||||
@ -86,10 +88,15 @@ local function spawn_biters(data)
|
|||||||
unit_to_create = WD.wave_defense_roll_biter_name()
|
unit_to_create = WD.wave_defense_roll_biter_name()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not unit_to_create then
|
||||||
|
print('buried_enemies - unit_to_create was nil?')
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local modified_unit_health = WD.get('modified_unit_health')
|
local modified_unit_health = WD.get('modified_unit_health')
|
||||||
local modified_boss_unit_health = WD.get('modified_boss_unit_health')
|
local modified_boss_unit_health = WD.get('modified_boss_unit_health')
|
||||||
|
|
||||||
WD.wave_defense_set_unit_raffle(h * 0.20)
|
local unit_settings = WD.get('unit_settings')
|
||||||
|
|
||||||
local unit = surface.create_entity({name = unit_to_create, position = position})
|
local unit = surface.create_entity({name = unit_to_create, position = position})
|
||||||
max_biters.amount = max_biters.amount + 1
|
max_biters.amount = max_biters.amount + 1
|
||||||
@ -97,7 +104,11 @@ local function spawn_biters(data)
|
|||||||
if random(1, 30) == 1 then
|
if random(1, 30) == 1 then
|
||||||
BiterHealthBooster.add_boss_unit(unit, modified_boss_unit_health.current_value, 0.38)
|
BiterHealthBooster.add_boss_unit(unit, modified_boss_unit_health.current_value, 0.38)
|
||||||
else
|
else
|
||||||
BiterHealthBooster.add_unit(unit, modified_unit_health.current_value)
|
local final_health = round(modified_unit_health.current_value * unit_settings.scale_units_by_health[unit.name], 3)
|
||||||
|
if final_health < 1 then
|
||||||
|
final_health = 1
|
||||||
|
end
|
||||||
|
BiterHealthBooster.add_unit(unit, final_health)
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -124,10 +135,17 @@ local function spawn_worms(data)
|
|||||||
local unit = surface.create_entity({name = unit_to_create, position = position})
|
local unit = surface.create_entity({name = unit_to_create, position = position})
|
||||||
max_biters.amount = max_biters.amount + 1
|
max_biters.amount = max_biters.amount + 1
|
||||||
|
|
||||||
|
local worm_unit_settings = WD.get('worm_unit_settings')
|
||||||
|
|
||||||
if random(1, 30) == 1 then
|
if random(1, 30) == 1 then
|
||||||
BiterHealthBooster.add_boss_unit(unit, modified_boss_unit_health.current_value, 0.38)
|
BiterHealthBooster.add_boss_unit(unit, modified_boss_unit_health.current_value, 0.38)
|
||||||
else
|
else
|
||||||
BiterHealthBooster.add_unit(unit, modified_unit_health.current_value)
|
local final_health = round(modified_unit_health.current_value * worm_unit_settings.scale_units_by_health[unit.name], 3)
|
||||||
|
if final_health < 1 then
|
||||||
|
final_health = 1
|
||||||
|
end
|
||||||
|
|
||||||
|
BiterHealthBooster.add_unit(unit, final_health)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -94,11 +94,10 @@ local function on_player_joined_game(event)
|
|||||||
Gui.call_existing_tab(player, 'Map Info')
|
Gui.call_existing_tab(player, 'Map Info')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Event.add(defines.events.on_player_joined_game, on_player_joined_game)
|
||||||
|
|
||||||
Gui.add_tab_to_gui({name = module_name, caption = 'Map Info', id = create_map_intro_token, admin = false})
|
Gui.add_tab_to_gui({name = module_name, caption = 'Map Info', id = create_map_intro_token, admin = false})
|
||||||
|
|
||||||
Event.add(defines.events.on_player_joined_game, on_player_joined_game)
|
|
||||||
|
|
||||||
Gui.on_click(
|
Gui.on_click(
|
||||||
module_name,
|
module_name,
|
||||||
function(event)
|
function(event)
|
||||||
|
@ -12,6 +12,7 @@ Global.register(
|
|||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
local round = math.round
|
||||||
local floor = math.floor
|
local floor = math.floor
|
||||||
local random = math.random
|
local random = math.random
|
||||||
local abs = math.abs
|
local abs = math.abs
|
||||||
@ -66,6 +67,7 @@ local function spawn_biters(data)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Public.wave_defense_set_unit_raffle(h * 0.20)
|
||||||
|
|
||||||
local unit_to_create
|
local unit_to_create
|
||||||
|
|
||||||
@ -78,14 +80,18 @@ local function spawn_biters(data)
|
|||||||
local modified_unit_health = Public.get('modified_unit_health')
|
local modified_unit_health = Public.get('modified_unit_health')
|
||||||
local modified_boss_unit_health = Public.get('modified_boss_unit_health')
|
local modified_boss_unit_health = Public.get('modified_boss_unit_health')
|
||||||
|
|
||||||
Public.wave_defense_set_unit_raffle(h * 0.20)
|
local unit_settings = Public.get('unit_settings')
|
||||||
|
|
||||||
local unit = surface.create_entity({name = unit_to_create, position = position})
|
local unit = surface.create_entity({name = unit_to_create, position = position})
|
||||||
|
|
||||||
if random(1, 30) == 1 then
|
if random(1, 30) == 1 then
|
||||||
BiterHealthBooster.add_boss_unit(unit, modified_boss_unit_health.current_value, 0.38)
|
BiterHealthBooster.add_boss_unit(unit, modified_boss_unit_health.current_value, 0.38)
|
||||||
else
|
else
|
||||||
BiterHealthBooster.add_unit(unit, modified_unit_health.current_value * 2)
|
local final_health = round(modified_unit_health.current_value * unit_settings.scale_units_by_health[unit.name], 3)
|
||||||
|
if final_health < 1 then
|
||||||
|
final_health = 1
|
||||||
|
end
|
||||||
|
BiterHealthBooster.add_unit(unit, final_health)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -100,11 +106,16 @@ 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_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 unit = surface.create_entity({name = unit_to_create, position = position})
|
||||||
|
local worm_unit_settings = Public.get('worm_unit_settings')
|
||||||
|
|
||||||
if random(1, 30) == 1 then
|
if random(1, 30) == 1 then
|
||||||
BiterHealthBooster.add_boss_unit(unit, modified_boss_unit_health.current_value, 0.38)
|
BiterHealthBooster.add_boss_unit(unit, modified_boss_unit_health.current_value, 0.38)
|
||||||
else
|
else
|
||||||
BiterHealthBooster.add_unit(unit, modified_unit_health.current_value * 2)
|
local final_health = round(modified_unit_health.current_value * worm_unit_settings.scale_units_by_health[unit.name], 3)
|
||||||
|
if final_health < 1 then
|
||||||
|
final_health = 1
|
||||||
|
end
|
||||||
|
BiterHealthBooster.add_unit(unit, final_health)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -135,6 +135,10 @@ function Public.reset_wave_defense()
|
|||||||
this.worm_unit_settings = {
|
this.worm_unit_settings = {
|
||||||
-- note that final health modifier isn't lower than 1
|
-- note that final health modifier isn't lower than 1
|
||||||
scale_units_by_health = {
|
scale_units_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,
|
['small-worm-turret'] = 0.8,
|
||||||
['medium-worm-turret'] = 0.6,
|
['medium-worm-turret'] = 0.6,
|
||||||
['big-worm-turret'] = 0.4,
|
['big-worm-turret'] = 0.4,
|
||||||
|
@ -577,6 +577,7 @@ end
|
|||||||
|
|
||||||
local function draw_main_frame(player)
|
local function draw_main_frame(player)
|
||||||
local tabs = main_gui_tabs
|
local tabs = main_gui_tabs
|
||||||
|
|
||||||
Public.clear_all_active_frames(player)
|
Public.clear_all_active_frames(player)
|
||||||
|
|
||||||
if Public.get_main_frame(player) then
|
if Public.get_main_frame(player) then
|
||||||
@ -584,7 +585,6 @@ local function draw_main_frame(player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local frame, inside_frame = Public.add_main_frame_with_toolbar(player, 'left', main_frame_name, nil, close_button_name, 'Comfy Panel')
|
local frame, inside_frame = Public.add_main_frame_with_toolbar(player, 'left', main_frame_name, nil, close_button_name, 'Comfy Panel')
|
||||||
|
|
||||||
local tabbed_pane = inside_frame.add({type = 'tabbed-pane', name = 'tabbed_pane'})
|
local tabbed_pane = inside_frame.add({type = 'tabbed-pane', name = 'tabbed_pane'})
|
||||||
|
|
||||||
for name, func in pairs(tabs) do
|
for name, func in pairs(tabs) do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user