mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2024-12-30 23:17:53 +02:00
More fixes
This commit is contained in:
parent
56cc74f6b1
commit
4a0a9c42b3
@ -156,6 +156,12 @@ local check_distance_between_player_and_locomotive = function(player)
|
||||
return
|
||||
end
|
||||
|
||||
local breached_wall = Public.get('breached_wall')
|
||||
|
||||
if breached_wall < 3 then
|
||||
return
|
||||
end
|
||||
|
||||
local collapse_position = Collapse.get_position()
|
||||
local adjusted_zones = Public.get('adjusted_zones')
|
||||
|
||||
@ -456,7 +462,11 @@ local function on_player_changed_position(event)
|
||||
return
|
||||
end
|
||||
|
||||
if player.position.y < -100 or player.position.y < 100 then
|
||||
if player.position.y > -100 and player.position.y < -100 then
|
||||
return
|
||||
end
|
||||
|
||||
if player.position.y > 100 and player.position.y < 100 then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -122,6 +122,9 @@ local function spawn_worms(data)
|
||||
end
|
||||
|
||||
local unit_to_create = WD.wave_defense_roll_worm_name()
|
||||
if not unit_to_create then
|
||||
return
|
||||
end
|
||||
|
||||
local surface = data.surface
|
||||
if not (surface and surface.valid) then
|
||||
@ -148,7 +151,7 @@ local function spawn_worms(data)
|
||||
end
|
||||
end
|
||||
|
||||
function Public.buried_biter(surface, position)
|
||||
function Public.buried_biter(surface, position, count)
|
||||
if not (surface and surface.valid) then
|
||||
return
|
||||
end
|
||||
@ -162,6 +165,10 @@ function Public.buried_biter(surface, position)
|
||||
return
|
||||
end
|
||||
|
||||
if not count then
|
||||
count = 1
|
||||
end
|
||||
|
||||
for t = 1, 60, 1 do
|
||||
if not this[game.tick + t] then
|
||||
this[game.tick + t] = {}
|
||||
@ -173,10 +180,21 @@ function Public.buried_biter(surface, position)
|
||||
}
|
||||
|
||||
if t == 60 then
|
||||
this[game.tick + t][#this[game.tick + t] + 1] = {
|
||||
callback = 'spawn_biters',
|
||||
data = {surface = surface, position = {x = position.x, y = position.y}}
|
||||
}
|
||||
if count == 1 then
|
||||
this[game.tick + t][#this[game.tick + t] + 1] = {
|
||||
callback = 'spawn_biters',
|
||||
data = {surface = surface, position = {x = position.x, y = position.y}, count = count or 1}
|
||||
}
|
||||
else
|
||||
local tick = 2
|
||||
for _ = 1, count do
|
||||
this[game.tick + t][#this[game.tick + t] + 1 + tick] = {
|
||||
callback = 'spawn_biters',
|
||||
data = {surface = surface, position = {x = position.x, y = position.y}, count = count or 1}
|
||||
}
|
||||
tick = tick + 2
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -147,7 +147,7 @@ commands.add_command(
|
||||
this.reset_are_you_sure = nil
|
||||
|
||||
Discord.send_notification_raw(scenario_name, player.name .. ' completed all the quest via command.')
|
||||
Public.stateful.set_stateful('objectives_completed_count', 5)
|
||||
Public.stateful.set_stateful('objectives_completed_count', 6)
|
||||
game.print(mapkeeper .. player.name .. ', has forced completed all quests!', {r = 0.98, g = 0.66, b = 0.22})
|
||||
else
|
||||
local this = Public.get()
|
||||
@ -160,7 +160,54 @@ commands.add_command(
|
||||
this.reset_are_you_sure = nil
|
||||
log('Quests completed.')
|
||||
Discord.send_notification_raw(scenario_name, 'Server completed all the quest via command')
|
||||
Public.stateful.set_stateful('objectives_completed_count', 5)
|
||||
Public.stateful.set_stateful('objectives_completed_count', 6)
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
commands.add_command(
|
||||
'reverse_map',
|
||||
'Usable only for admins - reverses the map!',
|
||||
function()
|
||||
local player = game.player
|
||||
|
||||
if player and player.valid then
|
||||
if not player.admin then
|
||||
player.print("[ERROR] You're not admin!", Color.fail)
|
||||
return
|
||||
end
|
||||
|
||||
local this = Public.get()
|
||||
if not this.reset_are_you_sure then
|
||||
this.reset_are_you_sure = true
|
||||
player.print('[WARNING] This command will reverse the map and soft-reset!', Color.warning)
|
||||
return
|
||||
end
|
||||
|
||||
this.reset_are_you_sure = nil
|
||||
|
||||
local reversed = Public.get_stateful_settings('reversed')
|
||||
Public.set_stateful_settings('reversed', not reversed)
|
||||
|
||||
Discord.send_notification_raw(scenario_name, player.name .. ' reversed the map.')
|
||||
Public.reset_map()
|
||||
game.print(mapkeeper .. player.name .. ', has reverse the map and reset the game!', {r = 0.98, g = 0.66, b = 0.22})
|
||||
else
|
||||
local this = Public.get()
|
||||
if not this.reset_are_you_sure then
|
||||
this.reset_are_you_sure = true
|
||||
log('[WARNING] This command will reverse the map and soft-reset!')
|
||||
return
|
||||
end
|
||||
|
||||
this.reset_are_you_sure = nil
|
||||
|
||||
local reversed = Public.get_stateful_settings('reversed')
|
||||
Public.set_stateful_settings('reversed', not reversed)
|
||||
|
||||
Discord.send_notification_raw(scenario_name, 'script has reversed the map.')
|
||||
Public.reset_map()
|
||||
game.print(mapkeeper .. 'script, has reverse the map and reset the game!', {r = 0.98, g = 0.66, b = 0.22})
|
||||
end
|
||||
end
|
||||
)
|
||||
|
@ -404,9 +404,6 @@ local function angry_tree(entity, cause, player)
|
||||
return
|
||||
end
|
||||
|
||||
if abs(entity.position.y) < zone_settings.zone_depth then
|
||||
return
|
||||
end
|
||||
if random(1, 6) == 1 then
|
||||
Public.buried_biter(entity.surface, entity.position)
|
||||
end
|
||||
@ -1101,7 +1098,7 @@ local function on_entity_died(event)
|
||||
return
|
||||
end
|
||||
if random(1, 32) == 1 then
|
||||
Public.buried_biter(entity.surface, entity.position)
|
||||
Public.buried_biter(entity.surface, entity.position, 6)
|
||||
entity.destroy()
|
||||
return
|
||||
end
|
||||
|
@ -29,6 +29,7 @@ local this = {
|
||||
magic_crafters = {index = 1},
|
||||
magic_fluid_crafters = {index = 1},
|
||||
art_table = {index = 1},
|
||||
editor_mode = {},
|
||||
starting_items = {
|
||||
['pistol'] = {
|
||||
count = 1
|
||||
@ -48,6 +49,14 @@ local this = {
|
||||
}
|
||||
}
|
||||
|
||||
local exit_editor_mode_token =
|
||||
Task.register(
|
||||
function(event)
|
||||
local player_index = event.player_index
|
||||
this.editor_mode[player_index] = nil
|
||||
end
|
||||
)
|
||||
|
||||
local random_respawn_messages = {
|
||||
'The doctors stitched you up as best they could.',
|
||||
'Ow! Your right leg hurts.',
|
||||
@ -1472,7 +1481,14 @@ function Public.on_pre_player_toggled_map_editor(event)
|
||||
return
|
||||
end
|
||||
|
||||
if this.editor_mode[player.index] then
|
||||
return
|
||||
end
|
||||
|
||||
this.editor_mode[player.index] = true
|
||||
|
||||
player.toggle_map_editor()
|
||||
Task.set_timeout_in_ticks(5, exit_editor_mode_token, {player_index = player.index})
|
||||
end
|
||||
|
||||
function Public.on_player_changed_position(event)
|
||||
|
@ -1233,7 +1233,7 @@ function Public.reset_stateful(refresh_gui, clear_buffs)
|
||||
this.buffs_collected = {}
|
||||
end
|
||||
this.enemies_boosted = false
|
||||
this.tasks_required_to_win = 5
|
||||
this.tasks_required_to_win = 6
|
||||
|
||||
this.selected_objectives = get_random_objectives()
|
||||
if this.test_mode then
|
||||
@ -1312,6 +1312,8 @@ function Public.reset_stateful(refresh_gui, clear_buffs)
|
||||
Task.set_timeout_in_ticks_alert(delay, {text = message})
|
||||
end
|
||||
|
||||
Public.set('coin_amount', Diff.index)
|
||||
|
||||
local t = {
|
||||
['randomized_zone'] = this.objectives.randomized_zone,
|
||||
['randomized_wave'] = this.objectives.randomized_wave
|
||||
|
@ -525,7 +525,7 @@ function Public.create_char(data)
|
||||
end
|
||||
|
||||
local count = count_active_characters(data.player_index)
|
||||
if count >= 5 then
|
||||
if count and count >= 5 then
|
||||
return false
|
||||
end
|
||||
|
||||
|
@ -275,7 +275,7 @@ spells[#spells + 1] = {
|
||||
level = 1,
|
||||
type = 'item',
|
||||
mana_cost = 30,
|
||||
cooldown = 100,
|
||||
cooldown = 70,
|
||||
aoe = true,
|
||||
enabled = true,
|
||||
sprite = 'recipe/stone-wall',
|
||||
@ -290,7 +290,7 @@ spells[#spells + 1] = {
|
||||
level = 1,
|
||||
type = 'item',
|
||||
mana_cost = 40,
|
||||
cooldown = 100,
|
||||
cooldown = 70,
|
||||
aoe = true,
|
||||
enabled = true,
|
||||
sprite = 'recipe/wooden-chest',
|
||||
@ -305,7 +305,7 @@ spells[#spells + 1] = {
|
||||
level = 10,
|
||||
type = 'item',
|
||||
mana_cost = 50,
|
||||
cooldown = 200,
|
||||
cooldown = 70,
|
||||
aoe = true,
|
||||
enabled = true,
|
||||
sprite = 'recipe/iron-chest',
|
||||
@ -320,7 +320,7 @@ spells[#spells + 1] = {
|
||||
level = 30,
|
||||
type = 'item',
|
||||
mana_cost = 100,
|
||||
cooldown = 300,
|
||||
cooldown = 70,
|
||||
aoe = true,
|
||||
enabled = true,
|
||||
sprite = 'recipe/steel-chest',
|
||||
@ -335,7 +335,7 @@ spells[#spells + 1] = {
|
||||
level = 1,
|
||||
type = 'item',
|
||||
mana_cost = 30,
|
||||
cooldown = 100,
|
||||
cooldown = 70,
|
||||
aoe = true,
|
||||
enabled = true,
|
||||
sprite = 'recipe/transport-belt',
|
||||
@ -350,7 +350,7 @@ spells[#spells + 1] = {
|
||||
level = 10,
|
||||
type = 'item',
|
||||
mana_cost = 50,
|
||||
cooldown = 200,
|
||||
cooldown = 70,
|
||||
aoe = true,
|
||||
enabled = true,
|
||||
sprite = 'recipe/fast-transport-belt',
|
||||
@ -362,10 +362,10 @@ spells[#spells + 1] = {
|
||||
spells[#spells + 1] = {
|
||||
name = {'entity-name.express-transport-belt'},
|
||||
entityName = 'express-transport-belt',
|
||||
level = 30,
|
||||
level = 20,
|
||||
type = 'item',
|
||||
mana_cost = 80,
|
||||
cooldown = 300,
|
||||
cooldown = 70,
|
||||
aoe = true,
|
||||
enabled = true,
|
||||
sprite = 'recipe/express-transport-belt',
|
||||
@ -380,7 +380,7 @@ spells[#spells + 1] = {
|
||||
level = 1,
|
||||
type = 'item',
|
||||
mana_cost = 30,
|
||||
cooldown = 100,
|
||||
cooldown = 70,
|
||||
aoe = true,
|
||||
enabled = true,
|
||||
sprite = 'recipe/underground-belt',
|
||||
@ -395,7 +395,7 @@ spells[#spells + 1] = {
|
||||
level = 10,
|
||||
type = 'item',
|
||||
mana_cost = 50,
|
||||
cooldown = 200,
|
||||
cooldown = 70,
|
||||
aoe = true,
|
||||
enabled = true,
|
||||
sprite = 'recipe/fast-underground-belt',
|
||||
@ -407,10 +407,10 @@ spells[#spells + 1] = {
|
||||
spells[#spells + 1] = {
|
||||
name = {'entity-name.express-underground-belt'},
|
||||
entityName = 'express-underground-belt',
|
||||
level = 30,
|
||||
level = 20,
|
||||
type = 'item',
|
||||
mana_cost = 80,
|
||||
cooldown = 300,
|
||||
cooldown = 70,
|
||||
aoe = true,
|
||||
enabled = true,
|
||||
sprite = 'recipe/express-underground-belt',
|
||||
@ -440,7 +440,7 @@ spells[#spells + 1] = {
|
||||
level = 1,
|
||||
type = 'item',
|
||||
mana_cost = 60,
|
||||
cooldown = 100,
|
||||
cooldown = 70,
|
||||
aoe = true,
|
||||
enabled = true,
|
||||
sprite = 'recipe/pipe-to-ground',
|
||||
@ -452,10 +452,10 @@ spells[#spells + 1] = {
|
||||
spells[#spells + 1] = {
|
||||
name = {'entity-name.tree'},
|
||||
entityName = 'tree-05',
|
||||
level = 30,
|
||||
level = 20,
|
||||
type = 'entity',
|
||||
mana_cost = 30,
|
||||
cooldown = 350,
|
||||
cooldown = 300,
|
||||
aoe = true,
|
||||
enabled = true,
|
||||
sprite = 'entity/tree-05',
|
||||
@ -470,7 +470,7 @@ spells[#spells + 1] = {
|
||||
level = 60,
|
||||
type = 'entity',
|
||||
mana_cost = 60,
|
||||
cooldown = 350,
|
||||
cooldown = 300,
|
||||
aoe = true,
|
||||
enabled = true,
|
||||
sprite = 'entity/sand-rock-big',
|
||||
|
@ -41,14 +41,14 @@ commands.add_command(
|
||||
end
|
||||
|
||||
if param == 'spawn' then
|
||||
Public.spawn_unit_group(true, true)
|
||||
Public.spawn_unit_group({true}, true)
|
||||
p(module_name .. ' wave spawned!')
|
||||
return
|
||||
end
|
||||
|
||||
if param == 'next' then
|
||||
Public.set_next_wave()
|
||||
Public.spawn_unit_group(true, true)
|
||||
Public.spawn_unit_group({true}, true)
|
||||
p(module_name .. ' wave spawned!')
|
||||
return
|
||||
end
|
||||
@ -57,7 +57,7 @@ commands.add_command(
|
||||
for _ = 1, 50 do
|
||||
Public.set_next_wave()
|
||||
end
|
||||
Public.spawn_unit_group(true, true)
|
||||
Public.spawn_unit_group({true}, true)
|
||||
p(module_name .. ' wave spawned!')
|
||||
return
|
||||
end
|
||||
@ -66,7 +66,7 @@ commands.add_command(
|
||||
for _ = 1, 1500 do
|
||||
Public.set_next_wave()
|
||||
end
|
||||
Public.spawn_unit_group(true, true)
|
||||
Public.spawn_unit_group({true}, true)
|
||||
p(module_name .. ' wave spawned!')
|
||||
return
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user