You've already forked ComfyFactorio
mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-11-27 22:38:18 +02:00
Fix broken stuff
This commit is contained in:
@@ -61,6 +61,7 @@ globals = {
|
|||||||
'is_loaded',
|
'is_loaded',
|
||||||
'is_loaded_bool',
|
'is_loaded_bool',
|
||||||
'is_game_modded',
|
'is_game_modded',
|
||||||
|
'normalize_path',
|
||||||
'has_space_age',
|
'has_space_age',
|
||||||
'require'
|
'require'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ local function on_player_created(event)
|
|||||||
local player = game.players[event.player_index]
|
local player = game.players[event.player_index]
|
||||||
player.gui.top.style = 'packed_horizontal_flow'
|
player.gui.top.style = 'packed_horizontal_flow'
|
||||||
player.gui.left.style = 'vertical_flow'
|
player.gui.left.style = 'vertical_flow'
|
||||||
player.show_on_map = false -- hide selection on minimap
|
-- player.show_on_map = false -- hide selection on minimap
|
||||||
end
|
end
|
||||||
|
|
||||||
local Event = require 'utils.event'
|
local Event = require 'utils.event'
|
||||||
@@ -263,7 +263,5 @@ Event.add(defines.events.on_player_created, on_player_created)
|
|||||||
|
|
||||||
local loaded = _G.package.loaded
|
local loaded = _G.package.loaded
|
||||||
function require(path)
|
function require(path)
|
||||||
local level_path = '__level__/' .. path
|
return loaded[normalize_path(path)] or error('Can only require files at runtime that have been required in the control stage.', 2)
|
||||||
level_path = string.gsub(level_path, "%.", "/") .. ".lua"
|
|
||||||
return loaded[level_path] or error('Can only require files at runtime that have been required in the control stage.', 2)
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -556,7 +556,6 @@ local set_unit_raffle_token =
|
|||||||
WD.set(
|
WD.set(
|
||||||
'biter_raffle',
|
'biter_raffle',
|
||||||
{
|
{
|
||||||
['small-biter'] = round(3000 - level * 1.75, 6),
|
|
||||||
['mtn-addon-small-piercing-biter-t1'] = round(2500 - level * 1.75, 6),
|
['mtn-addon-small-piercing-biter-t1'] = round(2500 - level * 1.75, 6),
|
||||||
['mtn-addon-small-acid-biter-t1'] = round(2500 - level * 1.75, 6),
|
['mtn-addon-small-acid-biter-t1'] = round(2500 - level * 1.75, 6),
|
||||||
['mtn-addon-small-explosive-biter-t1'] = round(2500 - level * 1.75, 6),
|
['mtn-addon-small-explosive-biter-t1'] = round(2500 - level * 1.75, 6),
|
||||||
@@ -1367,6 +1366,161 @@ local function on_player_cursor_stack_changed(event)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Public.set_xp_yield()
|
||||||
|
RPG.set_rpg_xp_yield({
|
||||||
|
['biter-spawner'] = 64,
|
||||||
|
['spitter-spawner'] = 64,
|
||||||
|
['behemoth-biter'] = 64,
|
||||||
|
['behemoth-spitter'] = 64,
|
||||||
|
['big-biter'] = 8,
|
||||||
|
['big-spitter'] = 8,
|
||||||
|
['medium-biter'] = 4,
|
||||||
|
['medium-spitter'] = 4,
|
||||||
|
['small-biter'] = 1,
|
||||||
|
['small-spitter'] = 1,
|
||||||
|
['small-worm-turret'] = 16,
|
||||||
|
['medium-worm-turret'] = 32,
|
||||||
|
['big-worm-turret'] = 64,
|
||||||
|
['behemoth-worm-turret'] = 128,
|
||||||
|
['mtn-addon-small-piercing-biter-t1'] = 2,
|
||||||
|
['mtn-addon-small-piercing-biter-t2'] = 3,
|
||||||
|
['mtn-addon-small-piercing-biter-t3'] = 4,
|
||||||
|
['mtn-addon-small-acid-biter-t1'] = 2,
|
||||||
|
['mtn-addon-small-acid-biter-t2'] = 3,
|
||||||
|
['mtn-addon-small-acid-biter-t3'] = 4,
|
||||||
|
['mtn-addon-small-explosive-biter-t1'] = 2,
|
||||||
|
['mtn-addon-small-explosive-biter-t2'] = 3,
|
||||||
|
['mtn-addon-small-explosive-biter-t3'] = 4,
|
||||||
|
['mtn-addon-small-poison-biter-t1'] = 2,
|
||||||
|
['mtn-addon-small-poison-biter-t2'] = 3,
|
||||||
|
['mtn-addon-small-poison-biter-t3'] = 4,
|
||||||
|
['mtn-addon-small-fire-biter-t1'] = 2,
|
||||||
|
['mtn-addon-small-fire-biter-t2'] = 3,
|
||||||
|
['mtn-addon-small-fire-biter-t3'] = 4,
|
||||||
|
['mtn-addon-small-piercing-spitter-t1'] = 2,
|
||||||
|
['mtn-addon-small-piercing-spitter-t2'] = 3,
|
||||||
|
['mtn-addon-small-piercing-spitter-t3'] = 4,
|
||||||
|
['mtn-addon-small-acid-spitter-t1'] = 2,
|
||||||
|
['mtn-addon-small-acid-spitter-t2'] = 3,
|
||||||
|
['mtn-addon-small-acid-spitter-t3'] = 4,
|
||||||
|
['mtn-addon-small-explosive-spitter-t1'] = 2,
|
||||||
|
['mtn-addon-small-explosive-spitter-t2'] = 3,
|
||||||
|
['mtn-addon-small-explosive-spitter-t3'] = 4,
|
||||||
|
['mtn-addon-small-poison-spitter-t1'] = 2,
|
||||||
|
['mtn-addon-small-poison-spitter-t2'] = 3,
|
||||||
|
['mtn-addon-small-poison-spitter-t3'] = 4,
|
||||||
|
['mtn-addon-small-fire-spitter-t1'] = 2,
|
||||||
|
['mtn-addon-small-fire-spitter-t2'] = 3,
|
||||||
|
['mtn-addon-small-fire-spitter-t3'] = 4,
|
||||||
|
['mtn-addon-medium-piercing-biter-t1'] = 6,
|
||||||
|
['mtn-addon-medium-piercing-biter-t2'] = 7,
|
||||||
|
['mtn-addon-medium-piercing-biter-t3'] = 8,
|
||||||
|
['mtn-addon-medium-acid-biter-t1'] = 6,
|
||||||
|
['mtn-addon-medium-acid-biter-t2'] = 7,
|
||||||
|
['mtn-addon-medium-acid-biter-t3'] = 8,
|
||||||
|
['mtn-addon-medium-explosive-biter-t1'] = 6,
|
||||||
|
['mtn-addon-medium-explosive-biter-t2'] = 7,
|
||||||
|
['mtn-addon-medium-explosive-biter-t3'] = 8,
|
||||||
|
['mtn-addon-medium-poison-biter-t1'] = 6,
|
||||||
|
['mtn-addon-medium-poison-biter-t2'] = 7,
|
||||||
|
['mtn-addon-medium-poison-biter-t3'] = 8,
|
||||||
|
['mtn-addon-medium-fire-biter-t1'] = 6,
|
||||||
|
['mtn-addon-medium-fire-biter-t2'] = 7,
|
||||||
|
['mtn-addon-medium-fire-biter-t3'] = 8,
|
||||||
|
['mtn-addon-medium-piercing-spitter-t1'] = 6,
|
||||||
|
['mtn-addon-medium-piercing-spitter-t2'] = 7,
|
||||||
|
['mtn-addon-medium-piercing-spitter-t3'] = 8,
|
||||||
|
['mtn-addon-medium-acid-spitter-t1'] = 6,
|
||||||
|
['mtn-addon-medium-acid-spitter-t2'] = 7,
|
||||||
|
['mtn-addon-medium-acid-spitter-t3'] = 8,
|
||||||
|
['mtn-addon-medium-explosive-spitter-t1'] = 6,
|
||||||
|
['mtn-addon-medium-explosive-spitter-t2'] = 7,
|
||||||
|
['mtn-addon-medium-explosive-spitter-t3'] = 8,
|
||||||
|
['mtn-addon-medium-poison-spitter-t1'] = 6,
|
||||||
|
['mtn-addon-medium-poison-spitter-t2'] = 7,
|
||||||
|
['mtn-addon-medium-poison-spitter-t3'] = 8,
|
||||||
|
['mtn-addon-medium-fire-spitter-t1'] = 6,
|
||||||
|
['mtn-addon-medium-fire-spitter-t2'] = 7,
|
||||||
|
['mtn-addon-medium-fire-spitter-t3'] = 8,
|
||||||
|
['mtn-addon-big-piercing-biter-t1'] = 10,
|
||||||
|
['mtn-addon-big-piercing-biter-t2'] = 12,
|
||||||
|
['mtn-addon-big-piercing-biter-t3'] = 14,
|
||||||
|
['mtn-addon-big-acid-biter-t1'] = 10,
|
||||||
|
['mtn-addon-big-acid-biter-t2'] = 12,
|
||||||
|
['mtn-addon-big-acid-biter-t3'] = 14,
|
||||||
|
['mtn-addon-big-explosive-biter-t1'] = 10,
|
||||||
|
['mtn-addon-big-explosive-biter-t2'] = 12,
|
||||||
|
['mtn-addon-big-explosive-biter-t3'] = 14,
|
||||||
|
['mtn-addon-big-poison-biter-t1'] = 10,
|
||||||
|
['mtn-addon-big-poison-biter-t2'] = 12,
|
||||||
|
['mtn-addon-big-poison-biter-t3'] = 14,
|
||||||
|
['mtn-addon-big-fire-biter-t1'] = 10,
|
||||||
|
['mtn-addon-big-fire-biter-t2'] = 12,
|
||||||
|
['mtn-addon-big-fire-biter-t3'] = 14,
|
||||||
|
['mtn-addon-big-piercing-spitter-t1'] = 10,
|
||||||
|
['mtn-addon-big-piercing-spitter-t2'] = 12,
|
||||||
|
['mtn-addon-big-piercing-spitter-t3'] = 14,
|
||||||
|
['mtn-addon-big-acid-spitter-t1'] = 10,
|
||||||
|
['mtn-addon-big-acid-spitter-t2'] = 12,
|
||||||
|
['mtn-addon-big-acid-spitter-t3'] = 14,
|
||||||
|
['mtn-addon-big-explosive-spitter-t1'] = 10,
|
||||||
|
['mtn-addon-big-explosive-spitter-t2'] = 12,
|
||||||
|
['mtn-addon-big-explosive-spitter-t3'] = 14,
|
||||||
|
['mtn-addon-big-poison-spitter-t1'] = 10,
|
||||||
|
['mtn-addon-big-poison-spitter-t2'] = 12,
|
||||||
|
['mtn-addon-big-poison-spitter-t3'] = 14,
|
||||||
|
['mtn-addon-big-fire-spitter-t1'] = 10,
|
||||||
|
['mtn-addon-big-fire-spitter-t2'] = 12,
|
||||||
|
['mtn-addon-big-fire-spitter-t3'] = 14,
|
||||||
|
['mtn-addon-behemoth-piercing-biter-t1'] = 20,
|
||||||
|
['mtn-addon-behemoth-piercing-biter-t2'] = 22,
|
||||||
|
['mtn-addon-behemoth-piercing-biter-t3'] = 24,
|
||||||
|
['mtn-addon-behemoth-acid-biter-t1'] = 20,
|
||||||
|
['mtn-addon-behemoth-acid-biter-t2'] = 22,
|
||||||
|
['mtn-addon-behemoth-acid-biter-t3'] = 24,
|
||||||
|
['mtn-addon-behemoth-explosive-biter-t1'] = 20,
|
||||||
|
['mtn-addon-behemoth-explosive-biter-t2'] = 22,
|
||||||
|
['mtn-addon-behemoth-explosive-biter-t3'] = 24,
|
||||||
|
['mtn-addon-behemoth-poison-biter-t1'] = 20,
|
||||||
|
['mtn-addon-behemoth-poison-biter-t2'] = 22,
|
||||||
|
['mtn-addon-behemoth-poison-biter-t3'] = 24,
|
||||||
|
['mtn-addon-behemoth-fire-biter-t1'] = 20,
|
||||||
|
['mtn-addon-behemoth-fire-biter-t2'] = 22,
|
||||||
|
['mtn-addon-behemoth-fire-biter-t3'] = 24,
|
||||||
|
['mtn-addon-behemoth-piercing-spitter-t1'] = 20,
|
||||||
|
['mtn-addon-behemoth-piercing-spitter-t2'] = 22,
|
||||||
|
['mtn-addon-behemoth-piercing-spitter-t3'] = 24,
|
||||||
|
['mtn-addon-behemoth-acid-spitter-t1'] = 20,
|
||||||
|
['mtn-addon-behemoth-acid-spitter-t2'] = 22,
|
||||||
|
['mtn-addon-behemoth-acid-spitter-t3'] = 24,
|
||||||
|
['mtn-addon-behemoth-explosive-spitter-t1'] = 20,
|
||||||
|
['mtn-addon-behemoth-explosive-spitter-t2'] = 22,
|
||||||
|
['mtn-addon-behemoth-explosive-spitter-t3'] = 24,
|
||||||
|
['mtn-addon-behemoth-poison-spitter-t1'] = 20,
|
||||||
|
['mtn-addon-behemoth-poison-spitter-t2'] = 22,
|
||||||
|
['mtn-addon-behemoth-poison-spitter-t3'] = 24,
|
||||||
|
['mtn-addon-behemoth-fire-spitter-t1'] = 20,
|
||||||
|
['mtn-addon-behemoth-fire-spitter-t2'] = 22,
|
||||||
|
['mtn-addon-behemoth-fire-spitter-t3'] = 24,
|
||||||
|
['mtn-addon-small-explosive-worm-turret'] = 20,
|
||||||
|
['mtn-addon-small-fire-worm-turret'] = 20,
|
||||||
|
['mtn-addon-small-piercing-worm-turret'] = 20,
|
||||||
|
['mtn-addon-small-poison-worm-turret'] = 20,
|
||||||
|
['mtn-addon-small-electric-worm-turret'] = 20,
|
||||||
|
['mtn-addon-medium-explosive-worm-turret'] = 30,
|
||||||
|
['mtn-addon-medium-fire-worm-turret'] = 30,
|
||||||
|
['mtn-addon-medium-piercing-worm-turret'] = 30,
|
||||||
|
['mtn-addon-medium-poison-worm-turret'] = 30,
|
||||||
|
['mtn-addon-medium-electric-worm-turret'] = 30,
|
||||||
|
['mtn-addon-big-explosive-worm-turret'] = 40,
|
||||||
|
['mtn-addon-big-fire-worm-turret'] = 40,
|
||||||
|
['mtn-addon-big-piercing-worm-turret'] = 40,
|
||||||
|
['mtn-addon-big-poison-worm-turret'] = 40,
|
||||||
|
['mtn-addon-big-electric-worm-turret'] = 40,
|
||||||
|
['mtn-addon-giant-worm-turret'] = 80
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
function Public.set_unit_raffle()
|
function Public.set_unit_raffle()
|
||||||
local unit_settings = WD.get('unit_settings')
|
local unit_settings = WD.get('unit_settings')
|
||||||
unit_settings.custom_unit_raffle = set_unit_raffle_token
|
unit_settings.custom_unit_raffle = set_unit_raffle_token
|
||||||
|
|||||||
@@ -801,15 +801,15 @@ function Public.save_car(event)
|
|||||||
kick_players_from_surface(car)
|
kick_players_from_surface(car)
|
||||||
get_player_data(player)
|
get_player_data(player)
|
||||||
|
|
||||||
if car.owner == player.index then
|
if car.owner == player.name then
|
||||||
save_surface(entity, player)
|
save_surface(entity, player)
|
||||||
if not players[player.index].notified then
|
if not players[player.index].notified then
|
||||||
player.print(module_tag .. player.name .. ', the ' .. car.name .. ' surface has been saved.', { color = Color.success })
|
player.print(module_tag .. player.name .. ', the ' .. car.name .. ' surface has been saved.', { color = Color.success })
|
||||||
players[player.index].notified = true
|
players[player.index].notified = true
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local p = game.players[car.owner]
|
local p = game.get_player(car.owner)
|
||||||
if not p then
|
if not p or not p.valid then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1319,7 +1319,7 @@ function Public.create_car(event)
|
|||||||
health = health,
|
health = health,
|
||||||
max = health
|
max = health
|
||||||
},
|
},
|
||||||
owner = player.index,
|
owner = player.name,
|
||||||
owner_name = player.name,
|
owner_name = player.name,
|
||||||
name = ce.name,
|
name = ce.name,
|
||||||
type = ce.type,
|
type = ce.type,
|
||||||
|
|||||||
@@ -472,6 +472,17 @@ local function get_items(player)
|
|||||||
upgrade = false,
|
upgrade = false,
|
||||||
static = false
|
static = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if not Public.is_modded then
|
||||||
|
main_market_items['raw-fish'] = {
|
||||||
|
stack = 1,
|
||||||
|
value = 'coin',
|
||||||
|
price = 20,
|
||||||
|
tooltip = ({ 'item-name.raw-fish' }),
|
||||||
|
upgrade = false,
|
||||||
|
static = false
|
||||||
|
}
|
||||||
|
else
|
||||||
main_market_items['raw-fish'] = {
|
main_market_items['raw-fish'] = {
|
||||||
stack = 1,
|
stack = 1,
|
||||||
value = 'coin',
|
value = 'coin',
|
||||||
@@ -480,6 +491,7 @@ local function get_items(player)
|
|||||||
upgrade = false,
|
upgrade = false,
|
||||||
static = false
|
static = false
|
||||||
}
|
}
|
||||||
|
end
|
||||||
main_market_items['firearm-magazine'] = {
|
main_market_items['firearm-magazine'] = {
|
||||||
stack = 1,
|
stack = 1,
|
||||||
value = 'coin',
|
value = 'coin',
|
||||||
|
|||||||
@@ -442,6 +442,9 @@ function Public.pre_init_task(current_task)
|
|||||||
Public.set_threat_values()
|
Public.set_threat_values()
|
||||||
Public.set_unit_raffle()
|
Public.set_unit_raffle()
|
||||||
Public.set_worm_raffle()
|
Public.set_worm_raffle()
|
||||||
|
if Public.is_modded then
|
||||||
|
Public.set_xp_yield()
|
||||||
|
end
|
||||||
RPG.set_extra('modded_hotkeys', true)
|
RPG.set_extra('modded_hotkeys', true)
|
||||||
|
|
||||||
current_task.message = 'Pre init done!'
|
current_task.message = 'Pre init done!'
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ local valid_container_types = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
local disabled_container_names = {
|
local disabled_container_names = {
|
||||||
['logistic-chest-buffer'] = true
|
['buffer-chest'] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
local function pos_to_key(position)
|
local function pos_to_key(position)
|
||||||
|
|||||||
@@ -319,7 +319,8 @@ local function draw_main_frame(player, location)
|
|||||||
add_gui_description(left_bottom_table, ({ 'rpg_gui.life_name' }), w1, ({ 'rpg_gui.life_tooltip' }))
|
add_gui_description(left_bottom_table, ({ 'rpg_gui.life_name' }), w1, ({ 'rpg_gui.life_tooltip' }))
|
||||||
local health_gui = add_gui_stat(left_bottom_table, floor(player.character.health), w2, ({ 'rpg_gui.life_increase' }))
|
local health_gui = add_gui_stat(left_bottom_table, floor(player.character.health), w2, ({ 'rpg_gui.life_increase' }))
|
||||||
data.health = health_gui
|
data.health = health_gui
|
||||||
add_gui_stat(left_bottom_table, floor(player.character.max_health + player.character_health_bonus + player.force.character_health_bonus), w2, ({ 'rpg_gui.life_maximum' }))
|
local proto_char = prototypes.entity.character.get_max_health('normal')
|
||||||
|
add_gui_stat(left_bottom_table, floor(proto_char + player.character_health_bonus + player.force.character_health_bonus), w2, ({ 'rpg_gui.life_maximum' }))
|
||||||
|
|
||||||
local shield = 0
|
local shield = 0
|
||||||
local shield_max = 0
|
local shield_max = 0
|
||||||
|
|||||||
@@ -526,7 +526,7 @@ spells[#spells + 1] = {
|
|||||||
entityName = 'tree-05',
|
entityName = 'tree-05',
|
||||||
level = 20,
|
level = 20,
|
||||||
type = 'entity',
|
type = 'entity',
|
||||||
mana_cost = 30,
|
mana_cost = 90,
|
||||||
cooldown = 300,
|
cooldown = 300,
|
||||||
aoe = true,
|
aoe = true,
|
||||||
enabled = true,
|
enabled = true,
|
||||||
@@ -541,7 +541,7 @@ spells[#spells + 1] = {
|
|||||||
entityName = 'big-sand-rock',
|
entityName = 'big-sand-rock',
|
||||||
level = 60,
|
level = 60,
|
||||||
type = 'entity',
|
type = 'entity',
|
||||||
mana_cost = 60,
|
mana_cost = 120,
|
||||||
cooldown = 300,
|
cooldown = 300,
|
||||||
aoe = true,
|
aoe = true,
|
||||||
enabled = true,
|
enabled = true,
|
||||||
@@ -653,7 +653,7 @@ spells[#spells + 1] = {
|
|||||||
force = 'player',
|
force = 'player',
|
||||||
level = 10,
|
level = 10,
|
||||||
type = 'item',
|
type = 'item',
|
||||||
mana_cost = 40,
|
mana_cost = 100,
|
||||||
cooldown = 150,
|
cooldown = 150,
|
||||||
enabled = true,
|
enabled = true,
|
||||||
log_spell = true,
|
log_spell = true,
|
||||||
@@ -797,7 +797,7 @@ spells[#spells + 1] = {
|
|||||||
force = 'enemy',
|
force = 'enemy',
|
||||||
level = 40,
|
level = 40,
|
||||||
type = 'item',
|
type = 'item',
|
||||||
mana_cost = 60,
|
mana_cost = 120,
|
||||||
cooldown = 320,
|
cooldown = 320,
|
||||||
enabled = true,
|
enabled = true,
|
||||||
log_spell = true,
|
log_spell = true,
|
||||||
|
|||||||
@@ -454,6 +454,19 @@ function Public.enable_aoe_punch_globally(value)
|
|||||||
return this.rpg_extra.enable_aoe_punch_globally
|
return this.rpg_extra.enable_aoe_punch_globally
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Sets the amount of xp the player gets from killing a specific entity.
|
||||||
|
---@param tbl table
|
||||||
|
function Public.set_rpg_xp_yield(tbl)
|
||||||
|
if not tbl then
|
||||||
|
return error('No table given.', 2)
|
||||||
|
end
|
||||||
|
if not type(tbl) == 'table' then
|
||||||
|
return error('Given parameter is not a table.', 2)
|
||||||
|
end
|
||||||
|
|
||||||
|
this.rpg_extra.rpg_xp_yield = tbl
|
||||||
|
end
|
||||||
|
|
||||||
function Public.tweaked_crafting_items(tbl)
|
function Public.tweaked_crafting_items(tbl)
|
||||||
if not tbl then
|
if not tbl then
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ local function fill_tiles(entity, size)
|
|||||||
Public.debug_print('fill_tiles - filled tiles cause we found non-placable tiles.')
|
Public.debug_print('fill_tiles - filled tiles cause we found non-placable tiles.')
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_spawn_pos()
|
local function get_spawn_pos(spawner)
|
||||||
local surface_index = Public.get('surface_index')
|
local surface_index = Public.get('surface_index')
|
||||||
local surface = game.surfaces[surface_index]
|
local surface = game.surfaces[surface_index]
|
||||||
if not surface then
|
if not surface then
|
||||||
@@ -181,6 +181,7 @@ local function get_spawn_pos()
|
|||||||
local target = Public.get('target')
|
local target = Public.get('target')
|
||||||
|
|
||||||
local inverted = Public.get('inverted')
|
local inverted = Public.get('inverted')
|
||||||
|
if not spawner then
|
||||||
if inverted then
|
if inverted then
|
||||||
if initial_position.y - target.position.y < -10 then
|
if initial_position.y - target.position.y < -10 then
|
||||||
initial_position = { x = initial_position.x, y = initial_position.y + 50 }
|
initial_position = { x = initial_position.x, y = initial_position.y + 50 }
|
||||||
@@ -189,8 +190,14 @@ local function get_spawn_pos()
|
|||||||
initial_position = { x = initial_position.x, y = initial_position.y - 10 }
|
initial_position = { x = initial_position.x, y = initial_position.y - 10 }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local located_position = find_initial_spot(surface, initial_position)
|
local located_position
|
||||||
|
if not spawner then
|
||||||
|
located_position = find_initial_spot(surface, initial_position)
|
||||||
|
else
|
||||||
|
located_position = initial_position
|
||||||
|
end
|
||||||
local valid_position = surface.find_non_colliding_position('stone-furnace', located_position, 32, 1)
|
local valid_position = surface.find_non_colliding_position('stone-furnace', located_position, 32, 1)
|
||||||
local debug = Public.get('debug')
|
local debug = Public.get('debug')
|
||||||
if debug then
|
if debug then
|
||||||
@@ -387,7 +394,7 @@ local function set_group_spawn_position(surface)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
Public.set('spawn_position', { x = position.x, y = position.y })
|
Public.set('spawn_position', { x = position.x, y = position.y })
|
||||||
local spawn_position = get_spawn_pos()
|
local spawn_position = get_spawn_pos(true)
|
||||||
if spawn_position then
|
if spawn_position then
|
||||||
Public.debug_print('set_group_spawn_position -- Changed position to x' .. spawn_position.x .. ' y' .. spawn_position.y .. '.')
|
Public.debug_print('set_group_spawn_position -- Changed position to x' .. spawn_position.x .. ' y' .. spawn_position.y .. '.')
|
||||||
end
|
end
|
||||||
@@ -1323,7 +1330,6 @@ local function spawn_unit_group_simple(fs)
|
|||||||
generated_units.unit_group_pos.positions[unit_group.unique_id] = { 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')
|
||||||
|
|
||||||
|
|
||||||
if not es_settings.generated_units then
|
if not es_settings.generated_units then
|
||||||
es_settings.generated_units = 0
|
es_settings.generated_units = 0
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ local place_nest_near_unit_group = function ()
|
|||||||
local result = cb({ entity = unit, disable_spawn_near_target = disable_spawn_near_target })
|
local result = cb({ entity = unit, disable_spawn_near_target = disable_spawn_near_target })
|
||||||
if result then
|
if result then
|
||||||
Public.debug_print('place_nest_near_unit_group - custom callback returned true')
|
Public.debug_print('place_nest_near_unit_group - custom callback returned true')
|
||||||
-- return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ ServerCommands.query_online_players = Server.query_online_players
|
|||||||
ServerCommands.ban_handler = Server.ban_handler
|
ServerCommands.ban_handler = Server.ban_handler
|
||||||
|
|
||||||
function is_loaded(module)
|
function is_loaded(module)
|
||||||
|
if not module then return end
|
||||||
|
module = normalize_path(module)
|
||||||
local res = _G.package.loaded[module]
|
local res = _G.package.loaded[module]
|
||||||
if res then
|
if res then
|
||||||
return res
|
return res
|
||||||
@@ -52,6 +54,8 @@ function is_loaded(module)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function is_loaded_bool(module)
|
function is_loaded_bool(module)
|
||||||
|
if not module then return end
|
||||||
|
module = normalize_path(module)
|
||||||
local res = _G.package.loaded[module]
|
local res = _G.package.loaded[module]
|
||||||
if res then
|
if res then
|
||||||
return true
|
return true
|
||||||
@@ -89,4 +93,9 @@ function has_space_age()
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function normalize_path(path)
|
||||||
|
local level_path = '__level__/' .. path
|
||||||
|
return string.gsub(level_path, "%.", "/") .. ".lua"
|
||||||
|
end
|
||||||
|
|
||||||
return ServerCommands
|
return ServerCommands
|
||||||
|
|||||||
Reference in New Issue
Block a user