mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-29 21:47:08 +02:00
Feat: remove compilatron and rename group_number -> unique_id
This commit is contained in:
parent
752e18def5
commit
053e7aea37
locale
maps
biter_battles_v2
cave_miner_v2
crab_defender
journey
junkyard_pvp
mountain_fortress_v2
mountain_fortress_v3
pitch_black
scrap_towny_ffa
stone_maze
modules
utils
@ -7,7 +7,6 @@ mana_casting_too_fast=There was a lot more to magic, as __1__ quickly found out,
|
|||||||
low_level=You lack the level to cast this spell.
|
low_level=You lack the level to cast this spell.
|
||||||
not_inside_pos=You wave your wand but realize that it´s out of reach.
|
not_inside_pos=You wave your wand but realize that it´s out of reach.
|
||||||
no_mana=You don´t have enough mana to cast this spell.
|
no_mana=You don´t have enough mana to cast this spell.
|
||||||
suicidal_comfylatron=You wave your wand and __1__ is on the run!
|
|
||||||
detonate_chest=You wave your wand and chesty makes big BOOM!
|
detonate_chest=You wave your wand and chesty makes big BOOM!
|
||||||
detonate_chest_failed=You wave your wand but no not enough explosives were found inside the chest!
|
detonate_chest_failed=You wave your wand but no not enough explosives were found inside the chest!
|
||||||
repair_aoe=You wave your wand and repaired __1__ entities!
|
repair_aoe=You wave your wand and repaired __1__ entities!
|
||||||
|
@ -7,7 +7,6 @@ mana_casting_too_fast=Как быстро выяснил __1__, в магии б
|
|||||||
low_level=Вам не хватает уровня для произнесения этого заклинания.
|
low_level=Вам не хватает уровня для произнесения этого заклинания.
|
||||||
not_inside_pos=Вы машете палочкой, но понимаете, что это вне досягаемости.
|
not_inside_pos=Вы машете палочкой, но понимаете, что это вне досягаемости.
|
||||||
no_mana=У вас недостаточно маны для сотворения этого заклинания.
|
no_mana=У вас недостаточно маны для сотворения этого заклинания.
|
||||||
suicidal_comfylatron=Вы машете палочкой, и __1__ в бегах!
|
|
||||||
detonate_chest=Вы взмахиваете палочкой, и сундук делает большой БУМ!
|
detonate_chest=Вы взмахиваете палочкой, и сундук делает большой БУМ!
|
||||||
detonate_chest_failed=Вы взмахиваете палочкой, но внутри сундука не было обнаружено достаточно взрывчатки!
|
detonate_chest_failed=Вы взмахиваете палочкой, но внутри сундука не было обнаружено достаточно взрывчатки!
|
||||||
repair_aoe=Вы взмахнули палочкой и починили __1__ сущностей!
|
repair_aoe=Вы взмахнули палочкой и починили __1__ сущностей!
|
||||||
|
@ -7,7 +7,6 @@ mana_casting_too_fast= __1__ 魔法还有很多, 像 __2__ 迅速创建出, 然
|
|||||||
low_level=等级不够.
|
low_level=等级不够.
|
||||||
not_inside_pos=你挥动你的魔杖, 但意识到它不能达到.
|
not_inside_pos=你挥动你的魔杖, 但意识到它不能达到.
|
||||||
no_mana=你没有足够的魔力.
|
no_mana=你没有足够的魔力.
|
||||||
suicidal_comfylatron=您挥舞着魔杖,__1__在运行!
|
|
||||||
warped_ok=回城给自己造成了一些伤害.
|
warped_ok=回城给自己造成了一些伤害.
|
||||||
object_spawned= 正在施法!.\n 你挥动你的魔杖和 __1__ 出现.
|
object_spawned= 正在施法!.\n 你挥动你的魔杖和 __1__ 出现.
|
||||||
out_of_reach=无法在给指定位置创建物体.
|
out_of_reach=无法在给指定位置创建物体.
|
||||||
|
@ -433,7 +433,7 @@ local function create_attack_group(surface, force_name, biter_force_name)
|
|||||||
|
|
||||||
send_group(unit_group, force_name, side_target)
|
send_group(unit_group, force_name, side_target)
|
||||||
|
|
||||||
storage.unit_groups[unit_group.group_number] = unit_group
|
storage.unit_groups[unit_groupunique_id] = unit_group
|
||||||
end
|
end
|
||||||
|
|
||||||
Public.pre_main_attack = function ()
|
Public.pre_main_attack = function ()
|
||||||
|
@ -486,24 +486,6 @@ Public.mining_events = {
|
|||||||
128,
|
128,
|
||||||
'Worms'
|
'Worms'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
function (cave_miner, entity, player_index)
|
|
||||||
local position = entity.position
|
|
||||||
local surface = entity.surface
|
|
||||||
surface.create_entity({ name = 'compilatron', position = position, force = 'player' })
|
|
||||||
end,
|
|
||||||
64,
|
|
||||||
'Friendly Compilatron'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
function (cave_miner, entity, player_index)
|
|
||||||
local position = entity.position
|
|
||||||
local surface = entity.surface
|
|
||||||
surface.create_entity({ name = 'compilatron', position = position, force = 'enemy' })
|
|
||||||
end,
|
|
||||||
128,
|
|
||||||
'Enemy Compilatron'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
function (cave_miner, entity, player_index)
|
function (cave_miner, entity, player_index)
|
||||||
local position = entity.position
|
local position = entity.position
|
||||||
|
@ -718,8 +718,8 @@ local biter_attack_wave = function ()
|
|||||||
unit_groups[i] = surface.create_unit_group({ position = { x = x_raffle[i], y = y_raffle[i] } })
|
unit_groups[i] = surface.create_unit_group({ position = { x = x_raffle[i], y = y_raffle[i] } })
|
||||||
local unit_group = unit_groups[i]
|
local unit_group = unit_groups[i]
|
||||||
if unit_group and unit_group.valid then
|
if unit_group and unit_group.valid then
|
||||||
if not this.unit_groups[unit_group.group_number] then
|
if not this.unit_groups[unit_groupunique_id] then
|
||||||
this.unit_groups[unit_group.group_number] = unit_group
|
this.unit_groups[unit_groupunique_id] = unit_group
|
||||||
end
|
end
|
||||||
Task.set_timeout_in_ticks(i, spawn_biters_token, { attack_wave_threat = this.attack_wave_threat, unit_group = unit_group, surface = surface, biter_pool = biter_pool })
|
Task.set_timeout_in_ticks(i, spawn_biters_token, { attack_wave_threat = this.attack_wave_threat, unit_group = unit_group, surface = surface, biter_pool = biter_pool })
|
||||||
end
|
end
|
||||||
@ -729,8 +729,8 @@ local biter_attack_wave = function ()
|
|||||||
unit_groups[i] = surface.create_unit_group({ position = { x = x_raffle[i], y = y_raffle[i] } })
|
unit_groups[i] = surface.create_unit_group({ position = { x = x_raffle[i], y = y_raffle[i] } })
|
||||||
local unit_group = unit_groups[i]
|
local unit_group = unit_groups[i]
|
||||||
if unit_group and unit_group.valid then
|
if unit_group and unit_group.valid then
|
||||||
if not this.unit_groups[unit_group.group_number] then
|
if not this.unit_groups[unit_groupunique_id] then
|
||||||
this.unit_groups[unit_group.group_number] = unit_group
|
this.unit_groups[unit_groupunique_id] = unit_group
|
||||||
end
|
end
|
||||||
Task.set_timeout_in_ticks(i, spawn_biters_token, { attack_wave_threat = this.attack_wave_threat, unit_group = unit_group, surface = surface, biter_pool = biter_pool })
|
Task.set_timeout_in_ticks(i, spawn_biters_token, { attack_wave_threat = this.attack_wave_threat, unit_group = unit_group, surface = surface, biter_pool = biter_pool })
|
||||||
end
|
end
|
||||||
|
@ -729,10 +729,11 @@ function Public.draw_mothership(journey)
|
|||||||
protect(chest, false)
|
protect(chest, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
for _ = 1, 3, 1 do
|
-- removed for 1.2/2.0
|
||||||
local comp = surface.create_entity({ name = 'compilatron', position = Constants.mothership_teleporter_position, force = 'player' })
|
-- for _ = 1, 3, 1 do
|
||||||
comp.destructible = false
|
-- local comp = surface.create_entity({ name = 'compilatron', position = Constants.mothership_teleporter_position, force = 'player' })
|
||||||
end
|
-- comp.destructible = false
|
||||||
|
-- end
|
||||||
Public.draw_gui(journey)
|
Public.draw_gui(journey)
|
||||||
surface.daytime = 0.5
|
surface.daytime = 0.5
|
||||||
|
|
||||||
|
@ -141,14 +141,10 @@ local scrap_entities = {
|
|||||||
'crash-site-assembling-machine-1-broken',
|
'crash-site-assembling-machine-1-broken',
|
||||||
'crash-site-assembling-machine-2-broken',
|
'crash-site-assembling-machine-2-broken',
|
||||||
'crash-site-lab-broken',
|
'crash-site-lab-broken',
|
||||||
'medium-ship-wreck',
|
'crash-site-spaceship-wreck-medium-1',
|
||||||
'small-ship-wreck',
|
'crash-site-spaceship-wreck-medium-1',
|
||||||
'medium-ship-wreck',
|
'crash-site-spaceship-wreck-medium-2',
|
||||||
'small-ship-wreck',
|
'crash-site-spaceship-wreck-medium-2',
|
||||||
'medium-ship-wreck',
|
|
||||||
'small-ship-wreck',
|
|
||||||
'medium-ship-wreck',
|
|
||||||
'small-ship-wreck',
|
|
||||||
'crash-site-chest-1',
|
'crash-site-chest-1',
|
||||||
'crash-site-chest-2',
|
'crash-site-chest-2',
|
||||||
'crash-site-chest-1',
|
'crash-site-chest-1',
|
||||||
|
@ -240,15 +240,10 @@ local scrap_entities = {
|
|||||||
'crash-site-assembling-machine-2-broken',
|
'crash-site-assembling-machine-2-broken',
|
||||||
'crash-site-assembling-machine-1-broken',
|
'crash-site-assembling-machine-1-broken',
|
||||||
'crash-site-assembling-machine-2-broken',
|
'crash-site-assembling-machine-2-broken',
|
||||||
'crash-site-lab-broken',
|
'crash-site-spaceship-wreck-medium-1',
|
||||||
'medium-ship-wreck',
|
'crash-site-spaceship-wreck-medium-1',
|
||||||
'small-ship-wreck',
|
'crash-site-spaceship-wreck-medium-1',
|
||||||
'medium-ship-wreck',
|
'crash-site-spaceship-wreck-medium-1',
|
||||||
'small-ship-wreck',
|
|
||||||
'medium-ship-wreck',
|
|
||||||
'small-ship-wreck',
|
|
||||||
'medium-ship-wreck',
|
|
||||||
'small-ship-wreck',
|
|
||||||
'crash-site-chest-1',
|
'crash-site-chest-1',
|
||||||
'crash-site-chest-2',
|
'crash-site-chest-2',
|
||||||
'crash-site-chest-1',
|
'crash-site-chest-1',
|
||||||
|
@ -139,7 +139,7 @@ local function on_entity_died(event)
|
|||||||
end
|
end
|
||||||
if not Public.get('final_battle') then
|
if not Public.get('final_battle') then
|
||||||
if entities_that_earn_coins[cause.name] then
|
if entities_that_earn_coins[cause.name] then
|
||||||
event.entity.surface.spill_item_stack(cause.position, { name = 'coin', count = coin_count }, true)
|
event.entity.surface.spill_item_stack({ position = cause.position, stack = { name = 'coin', count = coin_count }, enable_looted = true })
|
||||||
reward_has_been_given = true
|
reward_has_been_given = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -150,7 +150,7 @@ local function on_entity_died(event)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if reward_has_been_given == false then
|
if reward_has_been_given == false then
|
||||||
event.entity.surface.spill_item_stack(event.entity.position, { name = 'coin', count = coin_count }, true)
|
event.entity.surface.spill_item_stack({ position = event.entity.position, stack = { name = 'coin', count = coin_count }, enable_looted = true })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -126,6 +126,7 @@ Commands.new('mtn_reverse_map', 'Usable only for admins - reverses the map!')
|
|||||||
Public.set_stateful_settings('reversed', not reversed)
|
Public.set_stateful_settings('reversed', not reversed)
|
||||||
Discord.send_notification_raw(scenario_name, player.name .. ' reversed the map.')
|
Discord.send_notification_raw(scenario_name, player.name .. ' reversed the map.')
|
||||||
Public.reset_map()
|
Public.reset_map()
|
||||||
|
log(serpent.block('resetting map'))
|
||||||
game.print(mapkeeper .. player.name .. ', has reverse the map and reset the game!',
|
game.print(mapkeeper .. player.name .. ', has reverse the map and reset the game!',
|
||||||
{ r = 0.98, g = 0.66, b = 0.22 })
|
{ r = 0.98, g = 0.66, b = 0.22 })
|
||||||
player.print('Map reversed.')
|
player.print('Map reversed.')
|
||||||
|
@ -38,12 +38,12 @@ local function get_position(data)
|
|||||||
data.xv = data.xv + 1
|
data.xv = data.xv + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
data.position = {x = (data.top_x + data.xv), y = (data.top_y + data.yv)}
|
data.position = { x = (data.top_x + data.xv), y = (data.top_y + data.yv) }
|
||||||
end
|
end
|
||||||
|
|
||||||
local function do_tile_inner(tiles, tile, pos)
|
local function do_tile_inner(tiles, tile, pos)
|
||||||
if type(tile) == 'string' then
|
if type(tile) == 'string' then
|
||||||
tiles[#tiles + 1] = {name = tile, position = pos}
|
tiles[#tiles + 1] = { name = tile, position = pos }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ local function do_row(row, data, shape)
|
|||||||
|
|
||||||
for x = top_x, top_x + 31 do
|
for x = top_x, top_x + 31 do
|
||||||
data.x = x
|
data.x = x
|
||||||
local pos = {data.x, data.y}
|
local pos = { data.x, data.y }
|
||||||
|
|
||||||
get_position(data)
|
get_position(data)
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ local function do_row(row, data, shape)
|
|||||||
|
|
||||||
local hidden_tile = tile.hidden_tile
|
local hidden_tile = tile.hidden_tile
|
||||||
if hidden_tile then
|
if hidden_tile then
|
||||||
data.hidden_tiles[#data.hidden_tiles + 1] = {tile = hidden_tile, position = pos}
|
data.hidden_tiles[#data.hidden_tiles + 1] = { tile = hidden_tile, position = pos }
|
||||||
end
|
end
|
||||||
|
|
||||||
local entities = tile.entities
|
local entities = tile.entities
|
||||||
@ -143,11 +143,11 @@ local function do_place_treasure(data)
|
|||||||
end
|
end
|
||||||
if
|
if
|
||||||
surface.count_entities_filtered {
|
surface.count_entities_filtered {
|
||||||
area = {{e.position.x - 2, e.position.y - 2}, {e.position.x + 2, e.position.y + 2}},
|
area = { { e.position.x - 2, e.position.y - 2 }, { e.position.x + 2, e.position.y + 2 } },
|
||||||
name = 'market',
|
name = 'market',
|
||||||
limit = 1
|
limit = 1
|
||||||
} == 0
|
} == 0
|
||||||
then
|
then
|
||||||
Public.add_loot(surface, e.position, e.chest)
|
Public.add_loot(surface, e.position, e.chest)
|
||||||
else
|
else
|
||||||
Public.add_loot(surface, e.position, e.chest, true)
|
Public.add_loot(surface, e.position, e.chest, true)
|
||||||
@ -169,11 +169,11 @@ local function do_place_markets(data)
|
|||||||
local pos = markets[random(1, #markets)]
|
local pos = markets[random(1, #markets)]
|
||||||
if
|
if
|
||||||
surface.count_entities_filtered {
|
surface.count_entities_filtered {
|
||||||
area = {{pos.x - 96, pos.y - 96}, {pos.x + 96, pos.y + 96}},
|
area = { { pos.x - 96, pos.y - 96 }, { pos.x + 96, pos.y + 96 } },
|
||||||
name = 'market',
|
name = 'market',
|
||||||
limit = 1
|
limit = 1
|
||||||
} == 0
|
} == 0
|
||||||
then
|
then
|
||||||
local market = Public.mountain_market(surface, pos, abs(pos.y) * 0.004)
|
local market = Public.mountain_market(surface, pos, abs(pos.y) * 0.004)
|
||||||
market.destructible = false
|
market.destructible = false
|
||||||
end
|
end
|
||||||
@ -202,12 +202,12 @@ local function do_place_decoratives(data)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
if regen_decoratives then
|
if regen_decoratives then
|
||||||
surface.regenerate_decorative(nil, {{data.top_x / 32, data.top_y / 32}})
|
surface.regenerate_decorative(nil, { { data.top_x / 32, data.top_y / 32 } })
|
||||||
end
|
end
|
||||||
|
|
||||||
local dec = data.decoratives
|
local dec = data.decoratives
|
||||||
if #dec > 0 then
|
if #dec > 0 then
|
||||||
surface.create_decoratives({check_collision = true, decoratives = dec})
|
surface.create_decoratives({ check_collision = true, decoratives = dec })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -223,11 +223,11 @@ local function do_place_buildings(data)
|
|||||||
local p = e.position
|
local p = e.position
|
||||||
if
|
if
|
||||||
surface.count_entities_filtered {
|
surface.count_entities_filtered {
|
||||||
area = {{p.x - 32, p.y - 32}, {p.x + 32, p.y + 32}},
|
area = { { p.x - 32, p.y - 32 }, { p.x + 32, p.y + 32 } },
|
||||||
type = e.e_type,
|
type = e.e_type,
|
||||||
limit = 1
|
limit = 1
|
||||||
} == 0
|
} == 0
|
||||||
then
|
then
|
||||||
e.create_build_effect_smoke = false
|
e.create_build_effect_smoke = false
|
||||||
entity = surface.create_entity(e)
|
entity = surface.create_entity(e)
|
||||||
if entity and entity.valid then
|
if entity and entity.valid then
|
||||||
@ -240,7 +240,7 @@ local function do_place_buildings(data)
|
|||||||
if e.callback then
|
if e.callback then
|
||||||
local c = e.callback.callback
|
local c = e.callback.callback
|
||||||
if c then
|
if c then
|
||||||
local d = {callback_data = e.callback.data}
|
local d = { callback_data = e.callback.data }
|
||||||
if not d then
|
if not d then
|
||||||
callback = Task.get(c)
|
callback = Task.get(c)
|
||||||
callback(entity)
|
callback(entity)
|
||||||
@ -260,7 +260,7 @@ local function wintery(ent, extra_lights)
|
|||||||
if not winter_mode then
|
if not winter_mode then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
local colors = {{255, 0, 0}, {0, 255, 0}, {0, 0, 255}}
|
local colors = { { 255, 0, 0 }, { 0, 255, 0 }, { 0, 0, 255 } }
|
||||||
local function add_light(e)
|
local function add_light(e)
|
||||||
local color = colors[math.random(1, 3)]
|
local color = colors[math.random(1, 3)]
|
||||||
local scale = extra_lights or 1
|
local scale = extra_lights or 1
|
||||||
@ -274,7 +274,7 @@ local function wintery(ent, extra_lights)
|
|||||||
oriented = false,
|
oriented = false,
|
||||||
color = color,
|
color = color,
|
||||||
target = e,
|
target = e,
|
||||||
target_offset = {0, -0.5},
|
target_offset = { 0, -0.5 },
|
||||||
surface = e.surface
|
surface = e.surface
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -332,7 +332,7 @@ local function do_place_entities(data)
|
|||||||
if not c then
|
if not c then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local d = {callback_data = e.callback.data}
|
local d = { callback_data = e.callback.data }
|
||||||
if not d then
|
if not d then
|
||||||
callback = Task.get(c)
|
callback = Task.get(c)
|
||||||
callback(entity)
|
callback(entity)
|
||||||
@ -369,7 +369,7 @@ local function do_place_entities(data)
|
|||||||
if e.callback then
|
if e.callback then
|
||||||
local c = e.callback.callback
|
local c = e.callback.callback
|
||||||
if c then
|
if c then
|
||||||
local d = {callback_data = e.callback.data}
|
local d = { callback_data = e.callback.data }
|
||||||
if not d then
|
if not d then
|
||||||
callback = Task.get(c)
|
callback = Task.get(c)
|
||||||
callback(entity)
|
callback(entity)
|
||||||
@ -391,13 +391,13 @@ local function run_chart_update(data)
|
|||||||
if not surface or not surface.valid then
|
if not surface or not surface.valid then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if game.forces.player.is_chunk_charted(surface, {x, y}) then
|
if game.forces.player.is_chunk_charted(surface, { x, y }) then
|
||||||
-- Don't use full area, otherwise adjacent chunks get charted
|
-- Don't use full area, otherwise adjacent chunks get charted
|
||||||
game.forces.player.chart(
|
game.forces.player.chart(
|
||||||
surface,
|
surface,
|
||||||
{
|
{
|
||||||
{data.top_x, data.top_y},
|
{ data.top_x, data.top_y },
|
||||||
{data.top_x + 1, data.top_y + 1}
|
{ data.top_x + 1, data.top_y + 1 }
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -494,6 +494,9 @@ local function validate_index()
|
|||||||
|
|
||||||
local icw_table = ICW.get_table()
|
local icw_table = ICW.get_table()
|
||||||
local icw_locomotive = Public.get('icw_locomotive')
|
local icw_locomotive = Public.get('icw_locomotive')
|
||||||
|
if not icw_locomotive or not icw_locomotive.valid then
|
||||||
|
return
|
||||||
|
end
|
||||||
local loco_surface = icw_locomotive.surface
|
local loco_surface = icw_locomotive.surface
|
||||||
local unit_surface = locomotive.unit_number
|
local unit_surface = locomotive.unit_number
|
||||||
local locomotive_surface = game.surfaces[icw_table.wagons[unit_surface].surface.index]
|
local locomotive_surface = game.surfaces[icw_table.wagons[unit_surface].surface.index]
|
||||||
@ -834,6 +837,9 @@ function Public.transfer_pollution()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local icw_locomotive = Public.get('icw_locomotive')
|
local icw_locomotive = Public.get('icw_locomotive')
|
||||||
|
if not icw_locomotive or not icw_locomotive.valid then
|
||||||
|
return
|
||||||
|
end
|
||||||
local surface = icw_locomotive.surface
|
local surface = icw_locomotive.surface
|
||||||
if not surface or not surface.valid then
|
if not surface or not surface.valid then
|
||||||
return
|
return
|
||||||
|
@ -302,6 +302,8 @@ function Public.reset_map()
|
|||||||
end
|
end
|
||||||
|
|
||||||
game.speed = 1
|
game.speed = 1
|
||||||
|
surface.destroy_decoratives({ name = "brown-cup", invert = true })
|
||||||
|
surface.destroy_decoratives({ name = "small-sand-rock", invert = true })
|
||||||
|
|
||||||
Task.set_queue_speed(16)
|
Task.set_queue_speed(16)
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ local this = {
|
|||||||
|
|
||||||
Global.register(
|
Global.register(
|
||||||
this,
|
this,
|
||||||
function(tbl)
|
function (tbl)
|
||||||
this = tbl
|
this = tbl
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
@ -21,22 +21,22 @@ function Public.create_surface()
|
|||||||
['width'] = zone_settings.zone_width,
|
['width'] = zone_settings.zone_width,
|
||||||
['water'] = 0.001,
|
['water'] = 0.001,
|
||||||
['starting_area'] = 1,
|
['starting_area'] = 1,
|
||||||
['cliff_settings'] = {cliff_elevation_interval = 0, cliff_elevation_0 = 0},
|
['cliff_settings'] = { cliff_elevation_interval = 0, cliff_elevation_0 = 0 },
|
||||||
['default_enable_all_autoplace_controls'] = true,
|
['default_enable_all_autoplace_controls'] = true,
|
||||||
['autoplace_settings'] = {
|
['autoplace_settings'] = {
|
||||||
['entity'] = {treat_missing_as_default = false},
|
['entity'] = { treat_missing_as_default = false },
|
||||||
['tile'] = {
|
['tile'] = {
|
||||||
settings = {
|
settings = {
|
||||||
['deepwater'] = {frequency = 1, size = 0, richness = 1},
|
['deepwater'] = { frequency = 1, size = 0, richness = 1 },
|
||||||
['deepwater-green'] = {frequency = 1, size = 0, richness = 1},
|
['deepwater-green'] = { frequency = 1, size = 0, richness = 1 },
|
||||||
['water'] = {frequency = 1, size = 0, richness = 1},
|
['water'] = { frequency = 1, size = 0, richness = 1 },
|
||||||
['water-green'] = {frequency = 1, size = 0, richness = 1},
|
['water-green'] = { frequency = 1, size = 0, richness = 1 },
|
||||||
['water-mud'] = {frequency = 1, size = 0, richness = 1},
|
['water-mud'] = { frequency = 1, size = 0, richness = 1 },
|
||||||
['water-shallow'] = {frequency = 1, size = 0, richness = 1}
|
['water-shallow'] = { frequency = 1, size = 0, richness = 1 }
|
||||||
},
|
},
|
||||||
treat_missing_as_default = true
|
treat_missing_as_default = true
|
||||||
},
|
},
|
||||||
['decorative'] = {treat_missing_as_default = true}
|
['decorative'] = { treat_missing_as_default = false }
|
||||||
},
|
},
|
||||||
property_expression_names = {
|
property_expression_names = {
|
||||||
cliffiness = 0,
|
cliffiness = 0,
|
||||||
|
@ -71,14 +71,14 @@ local tree_raffle = {
|
|||||||
local size_of_tree_raffle = #tree_raffle
|
local size_of_tree_raffle = #tree_raffle
|
||||||
|
|
||||||
local scrap_entities = {
|
local scrap_entities = {
|
||||||
'medium-ship-wreck',
|
'crash-site-spaceship-wreck-small-1',
|
||||||
'small-ship-wreck',
|
'crash-site-spaceship-wreck-small-6',
|
||||||
'medium-ship-wreck',
|
'crash-site-spaceship-wreck-small-1',
|
||||||
'small-ship-wreck',
|
'crash-site-spaceship-wreck-small-6',
|
||||||
'medium-ship-wreck',
|
'crash-site-spaceship-wreck-small-1',
|
||||||
'small-ship-wreck',
|
'crash-site-spaceship-wreck-small-6',
|
||||||
'medium-ship-wreck',
|
'crash-site-spaceship-wreck-small-1',
|
||||||
'small-ship-wreck'
|
'crash-site-spaceship-wreck-small-6'
|
||||||
}
|
}
|
||||||
|
|
||||||
local scrap_entities_index = #scrap_entities
|
local scrap_entities_index = #scrap_entities
|
||||||
@ -2814,6 +2814,18 @@ local function border_chunk(p, data)
|
|||||||
local tiles = data.tiles
|
local tiles = data.tiles
|
||||||
local surface = data.surface
|
local surface = data.surface
|
||||||
|
|
||||||
|
local game_decoratives = prototypes.decorative
|
||||||
|
local dec_tbl = {}
|
||||||
|
local taken = 0
|
||||||
|
|
||||||
|
for _, decorative in pairs(game_decoratives) do
|
||||||
|
taken = taken + 1
|
||||||
|
dec_tbl[#dec_tbl + 1] = decorative.name
|
||||||
|
if taken > 4 then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local pos = p
|
local pos = p
|
||||||
|
|
||||||
if data.reversed then
|
if data.reversed then
|
||||||
@ -2850,26 +2862,15 @@ local function border_chunk(p, data)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if random(1, abs(pos.y) + 3) == 1 then
|
|
||||||
decoratives[#decoratives + 1] = {
|
for _, decorative in pairs(dec_tbl) do
|
||||||
name = 'small-rock',
|
if random(1, abs(pos.y) + 3) == 1 then
|
||||||
position = pos,
|
decoratives[#decoratives + 1] = {
|
||||||
amount = random(1, 32)
|
name = decorative,
|
||||||
}
|
position = pos,
|
||||||
end
|
amount = random(1, 32)
|
||||||
if random(1, abs(pos.y) + 2) == 1 then
|
}
|
||||||
decoratives[#decoratives + 1] = {
|
end
|
||||||
name = 'tiny-rock',
|
|
||||||
position = pos,
|
|
||||||
amount = random(1, 32)
|
|
||||||
}
|
|
||||||
end
|
|
||||||
if random(1, abs(pos.y) + 1) == 1 then
|
|
||||||
decoratives[#decoratives + 1] = {
|
|
||||||
name = 'tiny-rock-cluster',
|
|
||||||
position = pos,
|
|
||||||
amount = random(1, 32)
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -70,8 +70,8 @@ function Public.fleeing_biteys(entity, cause)
|
|||||||
local unit_group = unit.unit_group
|
local unit_group = unit.unit_group
|
||||||
if unit_group then
|
if unit_group then
|
||||||
if unit_group.valid then
|
if unit_group.valid then
|
||||||
if not unit_groups[unit_group.group_number] then
|
if not unit_groups[unit_groupunique_id] then
|
||||||
unit_groups[unit_group.group_number] = unit_group
|
unit_groups[unit_groupunique_id] = unit_group
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -21,8 +21,6 @@ local pollution_index = {
|
|||||||
['biter-spawner'] = {min = 0.5, max = 2.5},
|
['biter-spawner'] = {min = 0.5, max = 2.5},
|
||||||
['spitter-spawner'] = {min = 0.5, max = 2.5},
|
['spitter-spawner'] = {min = 0.5, max = 2.5},
|
||||||
['mineable-wreckage'] = {min = 0.1, max = 0.1},
|
['mineable-wreckage'] = {min = 0.1, max = 0.1},
|
||||||
['small-ship-wreck'] = {min = 0.1, max = 0.1},
|
|
||||||
['medium-ship-wreck'] = {min = 0.1, max = 0.1},
|
|
||||||
['crash-site-spaceship-wreck-small-1'] = {min = 0.1, max = 0.1},
|
['crash-site-spaceship-wreck-small-1'] = {min = 0.1, max = 0.1},
|
||||||
['crash-site-spaceship-wreck-small-2'] = {min = 0.1, max = 0.1},
|
['crash-site-spaceship-wreck-small-2'] = {min = 0.1, max = 0.1},
|
||||||
['crash-site-spaceship-wreck-small-3'] = {min = 0.1, max = 0.1},
|
['crash-site-spaceship-wreck-small-3'] = {min = 0.1, max = 0.1},
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
local Public = {}
|
local Public = {}
|
||||||
|
|
||||||
local scrapable = {
|
local scrapable = {
|
||||||
-- simple entity
|
|
||||||
['small-ship-wreck'] = true,
|
|
||||||
['medium-ship-wreck'] = true,
|
|
||||||
-- simple entity with owner
|
|
||||||
['crash-site-spaceship-wreck-small-1'] = true,
|
['crash-site-spaceship-wreck-small-1'] = true,
|
||||||
['crash-site-spaceship-wreck-small-2'] = true,
|
['crash-site-spaceship-wreck-small-2'] = true,
|
||||||
['crash-site-spaceship-wreck-small-3'] = true,
|
['crash-site-spaceship-wreck-small-3'] = true,
|
||||||
|
@ -59,7 +59,7 @@ function get_ammo()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local special_scraps = { 'crash-site-assembling-machine-1-broken', 'crash-site-assembling-machine-2-broken', 'crash-site-lab-broken', 'medium-ship-wreck' }
|
local special_scraps = { 'crash-site-assembling-machine-1-broken', 'crash-site-assembling-machine-2-broken', 'crash-site-lab-broken' }
|
||||||
function get_scrap()
|
function get_scrap()
|
||||||
if math.random(1, 128) == 1 then
|
if math.random(1, 128) == 1 then
|
||||||
return special_scraps[math.random(1, 4)]
|
return special_scraps[math.random(1, 4)]
|
||||||
|
@ -694,7 +694,7 @@ end
|
|||||||
|
|
||||||
local function on_unit_group_created(event)
|
local function on_unit_group_created(event)
|
||||||
if event and event.group and event.group.valid then
|
if event and event.group and event.group.valid then
|
||||||
storage.biter_command.active_unit_groups[event.group.group_number] = { id = event.group.group_number, group = event.group }
|
storage.biter_command.active_unit_groups[event.groupunique_id] = { id = event.groupunique_id, group = event.group }
|
||||||
refresh_panel()
|
refresh_panel()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -702,7 +702,7 @@ end
|
|||||||
local function on_unit_removed_from_group(event)
|
local function on_unit_removed_from_group(event)
|
||||||
if event and event.group and event.group.valid then
|
if event and event.group and event.group.valid then
|
||||||
if #event.group.members == 1 then
|
if #event.group.members == 1 then
|
||||||
storage.biter_command.active_unit_groups[event.group.group_number] = nil
|
storage.biter_command.active_unit_groups[event.groupunique_id] = nil
|
||||||
refresh_panel()
|
refresh_panel()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -33,18 +33,6 @@ local main_frame_name = Public.main_frame_name
|
|||||||
local spell_gui_frame_name = Public.spell_gui_frame_name
|
local spell_gui_frame_name = Public.spell_gui_frame_name
|
||||||
local cooldown_indicator_name = Public.cooldown_indicator_name
|
local cooldown_indicator_name = Public.cooldown_indicator_name
|
||||||
|
|
||||||
local travelings = {
|
|
||||||
'bzzZZrrt',
|
|
||||||
'WEEEeeeeeee',
|
|
||||||
'out of my way son',
|
|
||||||
'on my way',
|
|
||||||
'i need to leave',
|
|
||||||
'comfylatron seeking target',
|
|
||||||
'gotta go fast',
|
|
||||||
'gas gas gas',
|
|
||||||
'comfylatron coming through'
|
|
||||||
}
|
|
||||||
|
|
||||||
local restore_crafting_boost_token =
|
local restore_crafting_boost_token =
|
||||||
Token.register(
|
Token.register(
|
||||||
function (event)
|
function (event)
|
||||||
@ -58,34 +46,6 @@ local restore_crafting_boost_token =
|
|||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
local desync =
|
|
||||||
Token.register(
|
|
||||||
function (data)
|
|
||||||
local entity = data.entity
|
|
||||||
if not entity or not entity.valid then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local surface = data.surface
|
|
||||||
local fake_shooter = surface.create_entity({ name = 'character', position = entity.position, force = 'enemy' })
|
|
||||||
for _ = 1, 3 do
|
|
||||||
surface.create_entity(
|
|
||||||
{
|
|
||||||
name = 'explosive-rocket',
|
|
||||||
position = entity.position,
|
|
||||||
force = 'enemy',
|
|
||||||
speed = 1,
|
|
||||||
max_range = 1,
|
|
||||||
target = entity,
|
|
||||||
source = fake_shooter
|
|
||||||
}
|
|
||||||
)
|
|
||||||
end
|
|
||||||
if fake_shooter and fake_shooter.valid then
|
|
||||||
fake_shooter.destroy()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
)
|
|
||||||
|
|
||||||
local function create_healthbar(player, size)
|
local function create_healthbar(player, size)
|
||||||
return rendering.draw_sprite(
|
return rendering.draw_sprite(
|
||||||
{
|
{
|
||||||
@ -322,58 +282,6 @@ function Public.repair_aoe(player, position)
|
|||||||
return count
|
return count
|
||||||
end
|
end
|
||||||
|
|
||||||
function Public.suicidal_comfylatron(pos, surface)
|
|
||||||
local str = travelings[random(1, #travelings)]
|
|
||||||
local symbols = { '', '!', '!', '!!', '..' }
|
|
||||||
str = str .. symbols[random(1, #symbols)]
|
|
||||||
local text = str
|
|
||||||
local e =
|
|
||||||
surface.create_entity(
|
|
||||||
{
|
|
||||||
name = 'compilatron',
|
|
||||||
position = { x = pos.x, y = pos.y + 2 },
|
|
||||||
force = 'neutral'
|
|
||||||
}
|
|
||||||
)
|
|
||||||
surface.create_entity(
|
|
||||||
{
|
|
||||||
name = 'compi-speech-bubble',
|
|
||||||
position = e.position,
|
|
||||||
source = e,
|
|
||||||
text = text,
|
|
||||||
lifetime = 30
|
|
||||||
}
|
|
||||||
)
|
|
||||||
local nearest_player_unit = surface.find_nearest_enemy({ position = e.position, max_distance = 512, force = 'player' })
|
|
||||||
|
|
||||||
if nearest_player_unit and nearest_player_unit.active and nearest_player_unit.force.name ~= 'player' then
|
|
||||||
e.set_command(
|
|
||||||
{
|
|
||||||
type = defines.command.attack,
|
|
||||||
target = nearest_player_unit,
|
|
||||||
distraction = defines.distraction.none
|
|
||||||
}
|
|
||||||
)
|
|
||||||
local data = {
|
|
||||||
entity = e,
|
|
||||||
surface = surface
|
|
||||||
}
|
|
||||||
Task.set_timeout_in_ticks(600, desync, data)
|
|
||||||
else
|
|
||||||
e.surface.create_entity({ name = 'medium-explosion', position = e.position })
|
|
||||||
e.surface.create_entity(
|
|
||||||
{
|
|
||||||
name = 'compi-speech-bubble',
|
|
||||||
position = e.position,
|
|
||||||
text = 'DeSyyNC - no target found!',
|
|
||||||
source = e,
|
|
||||||
lifetime = 30
|
|
||||||
}
|
|
||||||
)
|
|
||||||
e.die()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function Public.validate_player(player)
|
function Public.validate_player(player)
|
||||||
if not player then
|
if not player then
|
||||||
return false
|
return false
|
||||||
|
@ -1022,37 +1022,6 @@ spells[#spells + 1] = {
|
|||||||
return insert_onto(data)
|
return insert_onto(data)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
spells[#spells + 1] = {
|
|
||||||
name = {'spells.comfylatron'},
|
|
||||||
entityName = 'suicidal_comfylatron',
|
|
||||||
target = false,
|
|
||||||
amount = 4,
|
|
||||||
damage = false,
|
|
||||||
range = 30,
|
|
||||||
force = 'player',
|
|
||||||
level = 60,
|
|
||||||
type = 'special',
|
|
||||||
mana_cost = 150,
|
|
||||||
enforce_cooldown = true,
|
|
||||||
cooldown = 150,
|
|
||||||
enabled = true,
|
|
||||||
log_spell = true,
|
|
||||||
sprite = 'entity/compilatron',
|
|
||||||
tooltip = 'Spawns a suicide comfylatron',
|
|
||||||
callback = function(data)
|
|
||||||
local self = data.self
|
|
||||||
local player = data.player
|
|
||||||
Public.register_cooldown_for_spell(player)
|
|
||||||
|
|
||||||
local position = data.position
|
|
||||||
local surface = data.surface
|
|
||||||
|
|
||||||
Public.suicidal_comfylatron(position, surface)
|
|
||||||
Public.cast_spell(player)
|
|
||||||
Public.remove_mana(player, self.mana_cost)
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
}
|
|
||||||
spells[#spells + 1] = {
|
spells[#spells + 1] = {
|
||||||
name = {'spells.distractor'},
|
name = {'spells.distractor'},
|
||||||
entityName = 'distractor-capsule',
|
entityName = 'distractor-capsule',
|
||||||
|
@ -814,22 +814,22 @@ local function reform_group(group)
|
|||||||
new_group.add_member(biter)
|
new_group.add_member(biter)
|
||||||
end
|
end
|
||||||
Public.debug_print('Creating new unit group, because old one was stuck.')
|
Public.debug_print('Creating new unit group, because old one was stuck.')
|
||||||
generated_units.unit_groups[new_group.group_number] = new_group
|
generated_units.unit_groups[new_group.unique_id] = new_group
|
||||||
local unit_groups_size = Public.get('unit_groups_size')
|
local unit_groups_size = Public.get('unit_groups_size')
|
||||||
Public.set('unit_groups_size', unit_groups_size + 1)
|
Public.set('unit_groups_size', unit_groups_size + 1)
|
||||||
|
|
||||||
return new_group
|
return new_group
|
||||||
else
|
else
|
||||||
Public.debug_print('Destroying stuck group.')
|
Public.debug_print('Destroying stuck group.')
|
||||||
if generated_units.unit_groups[group.group_number] then
|
if generated_units.unit_groups[group.unique_id] then
|
||||||
if generated_units.unit_group_last_command[group.group_number] then
|
if generated_units.unit_group_last_command[group.unique_id] then
|
||||||
generated_units.unit_group_last_command[group.group_number] = nil
|
generated_units.unit_group_last_command[group.unique_id] = nil
|
||||||
end
|
end
|
||||||
local positions = generated_units.unit_group_pos.positions
|
local positions = generated_units.unit_group_pos.positions
|
||||||
if positions[group.group_number] then
|
if positions[group.unique_id] then
|
||||||
positions[group.group_number] = nil
|
positions[group.unique_id] = nil
|
||||||
end
|
end
|
||||||
table.remove(generated_units.unit_groups, group.group_number)
|
table.remove(generated_units.unit_groups, group.unique_id)
|
||||||
local unit_groups_size = Public.get('unit_groups_size')
|
local unit_groups_size = Public.get('unit_groups_size')
|
||||||
Public.set('unit_groups_size', unit_groups_size - 1)
|
Public.set('unit_groups_size', unit_groups_size - 1)
|
||||||
end
|
end
|
||||||
@ -972,12 +972,12 @@ local function command_to_main_target(group, bypass)
|
|||||||
local generated_units = Public.get('generated_units')
|
local generated_units = Public.get('generated_units')
|
||||||
local unit_group_command_delay = Public.get('unit_group_command_delay')
|
local unit_group_command_delay = Public.get('unit_group_command_delay')
|
||||||
if not bypass then
|
if not bypass then
|
||||||
if not generated_units.unit_group_last_command[group.group_number] then
|
if not generated_units.unit_group_last_command[group.unique_id] then
|
||||||
generated_units.unit_group_last_command[group.group_number] = game.tick - (unit_group_command_delay + 1)
|
generated_units.unit_group_last_command[group.unique_id] = game.tick - (unit_group_command_delay + 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
if generated_units.unit_group_last_command[group.group_number] then
|
if generated_units.unit_group_last_command[group.unique_id] then
|
||||||
if generated_units.unit_group_last_command[group.group_number] + unit_group_command_delay > game.tick then
|
if generated_units.unit_group_last_command[group.unique_id] + unit_group_command_delay > game.tick then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1015,19 +1015,19 @@ local function command_to_main_target(group, bypass)
|
|||||||
)
|
)
|
||||||
Public.debug_print('get_main_command - sent commands')
|
Public.debug_print('get_main_command - sent commands')
|
||||||
if valid(group) then
|
if valid(group) then
|
||||||
generated_units.unit_group_last_command[group.group_number] = game.tick
|
generated_units.unit_group_last_command[group.unique_id] = game.tick
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function command_to_side_target(group)
|
local function command_to_side_target(group)
|
||||||
local generated_units = Public.get('generated_units')
|
local generated_units = Public.get('generated_units')
|
||||||
local unit_group_command_delay = Public.get('unit_group_command_delay')
|
local unit_group_command_delay = Public.get('unit_group_command_delay')
|
||||||
if not generated_units.unit_group_last_command[group.group_number] then
|
if not generated_units.unit_group_last_command[group.unique_id] then
|
||||||
generated_units.unit_group_last_command[group.group_number] = game.tick - (unit_group_command_delay + 1)
|
generated_units.unit_group_last_command[group.unique_id] = game.tick - (unit_group_command_delay + 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
if generated_units.unit_group_last_command[group.group_number] then
|
if generated_units.unit_group_last_command[group.unique_id] then
|
||||||
if generated_units.unit_group_last_command[group.group_number] + unit_group_command_delay > game.tick then
|
if generated_units.unit_group_last_command[group.unique_id] + unit_group_command_delay > game.tick then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1050,7 +1050,7 @@ local function command_to_side_target(group)
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
generated_units.unit_group_last_command[group.group_number] = game.tick
|
generated_units.unit_group_last_command[group.unique_id] = game.tick
|
||||||
end
|
end
|
||||||
|
|
||||||
local function give_side_commands_to_group()
|
local function give_side_commands_to_group()
|
||||||
@ -1175,12 +1175,12 @@ local function spawn_unit_group(fs, only_bosses)
|
|||||||
|
|
||||||
local generated_units = Public.get('generated_units')
|
local generated_units = Public.get('generated_units')
|
||||||
|
|
||||||
local unit_group = surface.create_unit_group({ position = spawn_position, force = force })
|
local unit_group = surface.create_unit_group({ position = spawn_position, force = force }) --[[@as UnitGroup]]
|
||||||
|
|
||||||
event_data.unit_group = unit_group
|
event_data.unit_group = unit_group
|
||||||
|
|
||||||
generated_units.unit_group_pos.index = generated_units.unit_group_pos.index + 1
|
generated_units.unit_group_pos.index = generated_units.unit_group_pos.index + 1
|
||||||
generated_units.unit_group_pos.positions[unit_group.group_number] = { position = unit_group.position, index = 0 }
|
generated_units.unit_group_pos.positions[unit_group.unique_id] = { position = unit_group.position, index = 0 }
|
||||||
local average_unit_group_size = Public.get('average_unit_group_size')
|
local average_unit_group_size = Public.get('average_unit_group_size')
|
||||||
local unit_settings = Public.get('unit_settings')
|
local unit_settings = Public.get('unit_settings')
|
||||||
event_data.unit_settings = unit_settings
|
event_data.unit_settings = unit_settings
|
||||||
@ -1248,7 +1248,7 @@ local function spawn_unit_group(fs, only_bosses)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
generated_units.unit_groups[unit_group.group_number] = unit_group
|
generated_units.unit_groups[unit_group.unique_id] = unit_group
|
||||||
local unit_groups_size = Public.get('unit_groups_size')
|
local unit_groups_size = Public.get('unit_groups_size')
|
||||||
Public.set('unit_groups_size', unit_groups_size + 1)
|
Public.set('unit_groups_size', unit_groups_size + 1)
|
||||||
if random(1, 2) == 1 then
|
if random(1, 2) == 1 then
|
||||||
@ -1292,7 +1292,7 @@ local function spawn_unit_group_simple(fs)
|
|||||||
|
|
||||||
|
|
||||||
generated_units.unit_group_pos.index = generated_units.unit_group_pos.index + 1
|
generated_units.unit_group_pos.index = generated_units.unit_group_pos.index + 1
|
||||||
generated_units.unit_group_pos.positions[unit_group.group_number] = { position = unit_group.position, index = 0 }
|
generated_units.unit_group_pos.positions[unit_group.unique_id] = { position = unit_group.position, index = 0 }
|
||||||
local unit_settings = Public.get('unit_settings')
|
local unit_settings = Public.get('unit_settings')
|
||||||
|
|
||||||
|
|
||||||
@ -1320,7 +1320,7 @@ local function spawn_unit_group_simple(fs)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
generated_units.unit_groups[unit_group.group_number] = unit_group
|
generated_units.unit_groups[unit_group.unique_id] = unit_group
|
||||||
local unit_groups_size = Public.get('unit_groups_size')
|
local unit_groups_size = Public.get('unit_groups_size')
|
||||||
Public.set('unit_groups_size', unit_groups_size + 1)
|
Public.set('unit_groups_size', unit_groups_size + 1)
|
||||||
if random(1, 2) == 1 then
|
if random(1, 2) == 1 then
|
||||||
@ -1347,17 +1347,17 @@ local function check_group_positions()
|
|||||||
if group.state == defines.group_state.finished then
|
if group.state == defines.group_state.finished then
|
||||||
return command_to_main_target(group, true)
|
return command_to_main_target(group, true)
|
||||||
end
|
end
|
||||||
if ugp[group.group_number] then
|
if ugp[group.unique_id] then
|
||||||
local success = is_position_near(group.position, ugp[group.group_number].position)
|
local success = is_position_near(group.position, ugp[group.unique_id].position)
|
||||||
if success then
|
if success then
|
||||||
ugp[group.group_number].index = ugp[group.group_number].index + 1
|
ugp[group.unique_id].index = ugp[group.unique_id].index + 1
|
||||||
if ugp[group.group_number].index >= 2 then
|
if ugp[group.unique_id].index >= 2 then
|
||||||
command_to_main_target(group, true)
|
command_to_main_target(group, true)
|
||||||
fill_tiles(group, 30)
|
fill_tiles(group, 30)
|
||||||
remove_rocks(group)
|
remove_rocks(group)
|
||||||
remove_trees(group)
|
remove_trees(group)
|
||||||
if valid(group) and ugp[group.group_number].index >= 4 then
|
if valid(group) and ugp[group.unique_id].index >= 4 then
|
||||||
generated_units.unit_group_pos.positions[group.group_number] = nil
|
generated_units.unit_group_pos.positions[group.unique_id] = nil
|
||||||
reform_group(group)
|
reform_group(group)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -73,7 +73,7 @@ local place_nest_near_unit_group = function ()
|
|||||||
local disable_spawn_near_target = Public.get('disable_spawn_near_target')
|
local disable_spawn_near_target = Public.get('disable_spawn_near_target')
|
||||||
|
|
||||||
local generated_units = Public.get('generated_units')
|
local generated_units = Public.get('generated_units')
|
||||||
local group = generated_units.unit_groups[random_group.group_number]
|
local group = generated_units.unit_groups[random_groupunique_id]
|
||||||
if not group then
|
if not group then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -234,7 +234,7 @@ function Public.build_worm()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
local generated_units = Public.get('generated_units')
|
local generated_units = Public.get('generated_units')
|
||||||
local group = generated_units.unit_groups[random_group.group_number]
|
local group = generated_units.unit_groups[random_groupunique_id]
|
||||||
if not group then
|
if not group then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -110,8 +110,8 @@ market.logistic = {
|
|||||||
['pump'] = { value = 16, rarity = 4 },
|
['pump'] = { value = 16, rarity = 4 },
|
||||||
['logistic-robot'] = { value = 28, rarity = 5 },
|
['logistic-robot'] = { value = 28, rarity = 5 },
|
||||||
['construction-robot'] = { value = 28, rarity = 3 },
|
['construction-robot'] = { value = 28, rarity = 3 },
|
||||||
['active-chest-provider'] = { value = 128, rarity = 7 },
|
['active-provider-chest'] = { value = 128, rarity = 7 },
|
||||||
['passive-chest-provider'] = { value = 128, rarity = 6 },
|
['passive-provider-chest'] = { value = 128, rarity = 6 },
|
||||||
['storage-chest'] = { value = 128, rarity = 6 },
|
['storage-chest'] = { value = 128, rarity = 6 },
|
||||||
['buffer-chest'] = { value = 128, rarity = 7 },
|
['buffer-chest'] = { value = 128, rarity = 7 },
|
||||||
['requester-chest'] = { value = 128, rarity = 7 },
|
['requester-chest'] = { value = 128, rarity = 7 },
|
||||||
|
@ -52,8 +52,8 @@ local item_worths = {
|
|||||||
['tank'] = 4096,
|
['tank'] = 4096,
|
||||||
['logistic-robot'] = 256,
|
['logistic-robot'] = 256,
|
||||||
['construction-robot'] = 256,
|
['construction-robot'] = 256,
|
||||||
['active-chest-provider'] = 256,
|
['active-provider-chest'] = 256,
|
||||||
['passive-chest-provider'] = 256,
|
['passive-provider-chest'] = 256,
|
||||||
['storage-chest'] = 256,
|
['storage-chest'] = 256,
|
||||||
['buffer-chest'] = 512,
|
['buffer-chest'] = 512,
|
||||||
['requester-chest'] = 512,
|
['requester-chest'] = 512,
|
||||||
|
@ -12,7 +12,7 @@ local this = {
|
|||||||
|
|
||||||
Global.register(
|
Global.register(
|
||||||
this,
|
this,
|
||||||
function(t)
|
function (t)
|
||||||
this = t
|
this = t
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
@ -52,29 +52,29 @@ local sections = {
|
|||||||
|
|
||||||
local check_bottom_buttons_token =
|
local check_bottom_buttons_token =
|
||||||
Task.register(
|
Task.register(
|
||||||
function(event)
|
function (event)
|
||||||
local player_index = event.player_index
|
local player_index = event.player_index
|
||||||
local player = game.get_player(player_index)
|
local player = game.get_player(player_index)
|
||||||
if not player or not player.valid then
|
if not player or not player.valid then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local player_data, storage_data = get_player_data(player)
|
local player_data, storage_data = get_player_data(player)
|
||||||
if not player_data or not storage_data or not next(storage_data) then
|
if not player_data or not storage_data or not next(storage_data) then
|
||||||
destroy_frame(player)
|
destroy_frame(player)
|
||||||
remove_player(player.index)
|
remove_player(player.index)
|
||||||
return
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
)
|
||||||
)
|
|
||||||
|
|
||||||
remove_player = function(index)
|
remove_player = function (index)
|
||||||
this.players[index] = nil
|
this.players[index] = nil
|
||||||
this.storage[index] = nil
|
this.storage[index] = nil
|
||||||
this.bottom_quickbar_button[index] = nil
|
this.bottom_quickbar_button[index] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
get_player_data = function(player, remove_user_data)
|
get_player_data = function (player, remove_user_data)
|
||||||
if remove_user_data then
|
if remove_user_data then
|
||||||
this.players[player.index] = nil
|
this.players[player.index] = nil
|
||||||
this.storage[player.index] = nil
|
this.storage[player.index] = nil
|
||||||
@ -106,13 +106,13 @@ local function refresh_inner_frames(player)
|
|||||||
|
|
||||||
local main_frame = player_data.frame
|
local main_frame = player_data.frame
|
||||||
|
|
||||||
local horizontal_flow = main_frame.add {type = 'flow', direction = 'horizontal'}
|
local horizontal_flow = main_frame.add { type = 'flow', direction = 'horizontal' }
|
||||||
horizontal_flow.style.horizontal_spacing = 0
|
horizontal_flow.style.horizontal_spacing = 0
|
||||||
|
|
||||||
for row_index, row_index_data in pairs(storage_data) do
|
for row_index, row_index_data in pairs(storage_data) do
|
||||||
if row_index_data and type(row_index_data) == 'table' then
|
if row_index_data and type(row_index_data) == 'table' then
|
||||||
local section_row_index = player_data.section[row_index]
|
local section_row_index = player_data.section[row_index]
|
||||||
local vertical_flow = horizontal_flow.add {type = 'flow', direction = 'vertical'}
|
local vertical_flow = horizontal_flow.add { type = 'flow', direction = 'vertical' }
|
||||||
vertical_flow.style.vertical_spacing = 0
|
vertical_flow.style.vertical_spacing = 0
|
||||||
|
|
||||||
if not section_row_index then
|
if not section_row_index then
|
||||||
@ -131,12 +131,12 @@ local function refresh_inner_frames(player)
|
|||||||
|
|
||||||
section_row_index[row_selection] =
|
section_row_index[row_selection] =
|
||||||
section_row_index.inner_frame.add {
|
section_row_index.inner_frame.add {
|
||||||
type = 'sprite-button',
|
type = 'sprite-button',
|
||||||
sprite = row_selection_data.sprite,
|
sprite = row_selection_data.sprite,
|
||||||
name = row_selection_data.name,
|
name = row_selection_data.name,
|
||||||
tooltip = row_selection_data.tooltip or '',
|
tooltip = row_selection_data.tooltip or '',
|
||||||
style = 'quick_bar_page_button'
|
style = 'quick_bar_page_button'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -144,16 +144,16 @@ end
|
|||||||
|
|
||||||
local refresh_inner_frames_token =
|
local refresh_inner_frames_token =
|
||||||
Task.register(
|
Task.register(
|
||||||
function(event)
|
function (event)
|
||||||
local player_index = event.player_index
|
local player_index = event.player_index
|
||||||
local player = game.get_player(player_index)
|
local player = game.get_player(player_index)
|
||||||
if not player or not player.valid then
|
if not player or not player.valid then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
refresh_inner_frames(player)
|
refresh_inner_frames(player)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
---Adds a new inner frame to the bottom frame
|
---Adds a new inner frame to the bottom frame
|
||||||
-- local BottomFrame = require 'utils.gui.bottom_frame'
|
-- local BottomFrame = require 'utils.gui.bottom_frame'
|
||||||
@ -217,10 +217,10 @@ local function add_inner_frame(data)
|
|||||||
player_data.row_selection = player_data.row_selection + 1
|
player_data.row_selection = player_data.row_selection + 1
|
||||||
player_data.row_selection_added = player_data.row_selection_added + 1
|
player_data.row_selection_added = player_data.row_selection_added + 1
|
||||||
player_data.row_selection = player_data.row_selection > 2 and 1 or player_data.row_selection
|
player_data.row_selection = player_data.row_selection > 2 and 1 or player_data.row_selection
|
||||||
Task.priority_delay(2, refresh_inner_frames_token, {player_index = player.index})
|
Task.priority_delay(2, refresh_inner_frames_token, { player_index = player.index })
|
||||||
end
|
end
|
||||||
|
|
||||||
destroy_frame = function(player)
|
destroy_frame = function (player)
|
||||||
local gui = player.gui
|
local gui = player.gui
|
||||||
local frame = gui.screen[main_frame_name]
|
local frame = gui.screen[main_frame_name]
|
||||||
if frame and frame.valid then
|
if frame and frame.valid then
|
||||||
@ -245,10 +245,10 @@ local function create_frame(player, alignment, location, data)
|
|||||||
|
|
||||||
frame =
|
frame =
|
||||||
player.gui.screen.add {
|
player.gui.screen.add {
|
||||||
type = 'frame',
|
type = 'frame',
|
||||||
name = main_frame_name,
|
name = main_frame_name,
|
||||||
direction = alignment
|
direction = alignment
|
||||||
}
|
}
|
||||||
|
|
||||||
if data.visible ~= nil then
|
if data.visible ~= nil then
|
||||||
if data.visible then
|
if data.visible then
|
||||||
@ -266,9 +266,9 @@ local function create_frame(player, alignment, location, data)
|
|||||||
|
|
||||||
local inner_frame =
|
local inner_frame =
|
||||||
frame.add {
|
frame.add {
|
||||||
type = 'frame',
|
type = 'frame',
|
||||||
direction = alignment
|
direction = alignment
|
||||||
}
|
}
|
||||||
inner_frame.style = 'quick_bar_inner_panel'
|
inner_frame.style = 'quick_bar_inner_panel'
|
||||||
|
|
||||||
frame.location = location
|
frame.location = location
|
||||||
@ -288,12 +288,12 @@ local function create_frame(player, alignment, location, data)
|
|||||||
data.section_data = data.section_data or {}
|
data.section_data = data.section_data or {}
|
||||||
data.alignment = alignment
|
data.alignment = alignment
|
||||||
|
|
||||||
Task.priority_delay(5, check_bottom_buttons_token, {player_index = player.index})
|
Task.priority_delay(5, check_bottom_buttons_token, { player_index = player.index })
|
||||||
|
|
||||||
return frame
|
return frame
|
||||||
end
|
end
|
||||||
|
|
||||||
set_location = function(player, state)
|
set_location = function (player, state)
|
||||||
local data = get_player_data(player)
|
local data = get_player_data(player)
|
||||||
local alignment = 'vertical'
|
local alignment = 'vertical'
|
||||||
|
|
||||||
@ -328,7 +328,7 @@ set_location = function(player, state)
|
|||||||
alignment = 'horizontal'
|
alignment = 'horizontal'
|
||||||
else
|
else
|
||||||
location = {
|
location = {
|
||||||
x = (resolution.width / 2) - ((54 + -528) * scale),
|
x = (resolution.width / 2) - ((54 + -689) * scale),
|
||||||
y = (resolution.height - (96 * scale))
|
y = (resolution.height - (96 * scale))
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -340,7 +340,7 @@ set_location = function(player, state)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
Event.raise(Public.events.bottom_quickbar_location_changed, {player_index = player.index, data = data})
|
Event.raise(Public.events.bottom_quickbar_location_changed, { player_index = player.index, data = data })
|
||||||
|
|
||||||
data.state = state
|
data.state = state
|
||||||
create_frame(player, alignment, location, data)
|
create_frame(player, alignment, location, data)
|
||||||
@ -459,7 +459,7 @@ end
|
|||||||
|
|
||||||
Event.add(
|
Event.add(
|
||||||
defines.events.on_player_joined_game,
|
defines.events.on_player_joined_game,
|
||||||
function(event)
|
function (event)
|
||||||
if this.activate_custom_buttons then
|
if this.activate_custom_buttons then
|
||||||
local player = game.get_player(event.player_index)
|
local player = game.get_player(event.player_index)
|
||||||
local data = get_player_data(player)
|
local data = get_player_data(player)
|
||||||
@ -470,7 +470,7 @@ Event.add(
|
|||||||
|
|
||||||
Event.add(
|
Event.add(
|
||||||
defines.events.on_player_display_resolution_changed,
|
defines.events.on_player_display_resolution_changed,
|
||||||
function(event)
|
function (event)
|
||||||
if this.activate_custom_buttons then
|
if this.activate_custom_buttons then
|
||||||
local player = game.get_player(event.player_index)
|
local player = game.get_player(event.player_index)
|
||||||
local data = get_player_data(player)
|
local data = get_player_data(player)
|
||||||
@ -481,7 +481,7 @@ Event.add(
|
|||||||
|
|
||||||
Event.add(
|
Event.add(
|
||||||
defines.events.on_player_display_scale_changed,
|
defines.events.on_player_display_scale_changed,
|
||||||
function(event)
|
function (event)
|
||||||
local player = game.get_player(event.player_index)
|
local player = game.get_player(event.player_index)
|
||||||
if this.activate_custom_buttons then
|
if this.activate_custom_buttons then
|
||||||
local data = get_player_data(player)
|
local data = get_player_data(player)
|
||||||
@ -492,7 +492,7 @@ Event.add(
|
|||||||
|
|
||||||
Event.add(
|
Event.add(
|
||||||
defines.events.on_pre_player_left_game,
|
defines.events.on_pre_player_left_game,
|
||||||
function(event)
|
function (event)
|
||||||
local player = game.get_player(event.player_index)
|
local player = game.get_player(event.player_index)
|
||||||
destroy_frame(player)
|
destroy_frame(player)
|
||||||
if this.activate_custom_buttons then
|
if this.activate_custom_buttons then
|
||||||
@ -503,7 +503,7 @@ Event.add(
|
|||||||
|
|
||||||
Event.add(
|
Event.add(
|
||||||
defines.events.on_player_left_game,
|
defines.events.on_player_left_game,
|
||||||
function(event)
|
function (event)
|
||||||
local player = game.get_player(event.player_index)
|
local player = game.get_player(event.player_index)
|
||||||
destroy_frame(player)
|
destroy_frame(player)
|
||||||
if this.activate_custom_buttons then
|
if this.activate_custom_buttons then
|
||||||
@ -514,7 +514,7 @@ Event.add(
|
|||||||
|
|
||||||
Event.add(
|
Event.add(
|
||||||
defines.events.on_pre_player_died,
|
defines.events.on_pre_player_died,
|
||||||
function(event)
|
function (event)
|
||||||
if this.activate_custom_buttons then
|
if this.activate_custom_buttons then
|
||||||
local player = game.get_player(event.player_index)
|
local player = game.get_player(event.player_index)
|
||||||
destroy_frame(player)
|
destroy_frame(player)
|
||||||
@ -524,7 +524,7 @@ Event.add(
|
|||||||
|
|
||||||
Event.add(
|
Event.add(
|
||||||
defines.events.on_player_respawned,
|
defines.events.on_player_respawned,
|
||||||
function(event)
|
function (event)
|
||||||
if this.activate_custom_buttons then
|
if this.activate_custom_buttons then
|
||||||
local player = game.get_player(event.player_index)
|
local player = game.get_player(event.player_index)
|
||||||
local data = get_player_data(player)
|
local data = get_player_data(player)
|
||||||
@ -535,14 +535,14 @@ Event.add(
|
|||||||
|
|
||||||
Event.add(
|
Event.add(
|
||||||
defines.events.on_player_removed,
|
defines.events.on_player_removed,
|
||||||
function(event)
|
function (event)
|
||||||
remove_player(event.player_index)
|
remove_player(event.player_index)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
Event.add(
|
Event.add(
|
||||||
Public.events.bottom_quickbar_respawn_raise,
|
Public.events.bottom_quickbar_respawn_raise,
|
||||||
function(event)
|
function (event)
|
||||||
if not event or not event.player_index then
|
if not event or not event.player_index then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -557,7 +557,7 @@ Event.add(
|
|||||||
|
|
||||||
Event.add(
|
Event.add(
|
||||||
Public.events.bottom_quickbar_location_changed,
|
Public.events.bottom_quickbar_location_changed,
|
||||||
function(event)
|
function (event)
|
||||||
if not event or not event.player_index then
|
if not event or not event.player_index then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -106,7 +106,7 @@ Public.raw_print = raw_print
|
|||||||
local function output_data(primary, secondary)
|
local function output_data(primary, secondary)
|
||||||
local secs = server_time.secs
|
local secs = server_time.secs
|
||||||
if secs == nil then
|
if secs == nil then
|
||||||
return false
|
return raw_print(primary .. (secondary or ''))
|
||||||
end
|
end
|
||||||
|
|
||||||
secondary = type(secondary) == 'table' and '' or secondary
|
secondary = type(secondary) == 'table' and '' or secondary
|
||||||
|
@ -10,23 +10,12 @@ local scrap_entities = {
|
|||||||
'crash-site-assembling-machine-1-broken',
|
'crash-site-assembling-machine-1-broken',
|
||||||
'crash-site-assembling-machine-2-broken',
|
'crash-site-assembling-machine-2-broken',
|
||||||
'crash-site-lab-broken',
|
'crash-site-lab-broken',
|
||||||
'medium-ship-wreck',
|
|
||||||
'small-ship-wreck',
|
|
||||||
'crash-site-chest-1',
|
'crash-site-chest-1',
|
||||||
'crash-site-chest-2',
|
'crash-site-chest-2',
|
||||||
'crash-site-chest-1',
|
'crash-site-chest-1',
|
||||||
'crash-site-chest-2',
|
'crash-site-chest-2',
|
||||||
'crash-site-chest-1',
|
'crash-site-chest-1',
|
||||||
'crash-site-chest-2',
|
'crash-site-chest-2',
|
||||||
'big-ship-wreck-1',
|
|
||||||
'big-ship-wreck-2',
|
|
||||||
'big-ship-wreck-3',
|
|
||||||
'big-ship-wreck-1',
|
|
||||||
'big-ship-wreck-2',
|
|
||||||
'big-ship-wreck-3',
|
|
||||||
'big-ship-wreck-1',
|
|
||||||
'big-ship-wreck-2',
|
|
||||||
'big-ship-wreck-3'
|
|
||||||
}
|
}
|
||||||
local scrap_entities_index = #scrap_entities
|
local scrap_entities_index = #scrap_entities
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user