You've already forked ComfyFactorio
mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-09-16 09:06:21 +02:00
tweaks to several files
This commit is contained in:
@@ -266,7 +266,6 @@ local function process_chunk(area)
|
||||
local seed = game.surfaces[1].map_gen_settings.seed
|
||||
local surface = game.surfaces['nauvis']
|
||||
|
||||
|
||||
for _, e in pairs(surface.find_entities_filtered({area = area})) do
|
||||
process_entity(e)
|
||||
end
|
||||
@@ -328,7 +327,6 @@ local function process_chunk_queue()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function get_ore_from_entpos(entity)
|
||||
local seed = game.surfaces[1].map_gen_settings.seed
|
||||
local noise_forest_location = get_noise('forest_location', entity.position, seed)
|
||||
@@ -345,7 +343,9 @@ local function get_ore_from_entpos(entity)
|
||||
end
|
||||
|
||||
local function on_chunk_generated(event)
|
||||
if game.surfaces.nauvis.index ~= event.surface.index then return end
|
||||
if game.surfaces.nauvis.index ~= event.surface.index then
|
||||
return
|
||||
end
|
||||
local area = event.area
|
||||
|
||||
if game.tick == 0 then
|
||||
@@ -737,7 +737,7 @@ local on_init = function()
|
||||
T.main_caption_color = {r = 0, g = 120, b = 0}
|
||||
T.sub_caption_color = {r = 255, g = 0, b = 255}
|
||||
global.chunk_queue = {}
|
||||
game.difficulty_settings.recipe_difficulty = 4
|
||||
game.difficulty_settings.technology_price_multiplier = 4
|
||||
end
|
||||
|
||||
Event.on_init(on_init)
|
||||
|
@@ -995,33 +995,33 @@ local market_kill_visuals = function()
|
||||
|
||||
local m = 32
|
||||
local m2 = m * 0.005
|
||||
if get_active_version >= is_branch_18 then
|
||||
for i = 1, 1024, 1 do
|
||||
surface.create_particle(
|
||||
{
|
||||
name = 'branch-particle',
|
||||
position = this.market.position,
|
||||
frame_speed = 0.1,
|
||||
vertical_speed = 0.1,
|
||||
height = 0.1,
|
||||
movement = {m2 - (math.random(0, m) * 0.01), m2 - (math.random(0, m) * 0.01)}
|
||||
}
|
||||
)
|
||||
end
|
||||
else
|
||||
for i = 1, 1024, 1 do
|
||||
surface.create_entity(
|
||||
{
|
||||
name = 'branch-particle',
|
||||
position = this.market.position,
|
||||
frame_speed = 0.1,
|
||||
vertical_speed = 0.1,
|
||||
height = 0.1,
|
||||
movement = {m2 - (math.random(0, m) * 0.01), m2 - (math.random(0, m) * 0.01)}
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
-- if get_active_version >= is_branch_18 then
|
||||
-- for i = 1, 1024, 1 do
|
||||
-- surface.create_particle(
|
||||
-- {
|
||||
-- name = 'branch-particle',
|
||||
-- position = this.market.position,
|
||||
-- frame_speed = 0.1,
|
||||
-- vertical_speed = 0.1,
|
||||
-- height = 0.1,
|
||||
-- movement = {m2 - (math.random(0, m) * 0.01), m2 - (math.random(0, m) * 0.01)}
|
||||
-- }
|
||||
-- )
|
||||
-- end
|
||||
-- else
|
||||
-- for i = 1, 1024, 1 do
|
||||
-- surface.create_entity(
|
||||
-- {
|
||||
-- name = 'branch-particle',
|
||||
-- position = this.market.position,
|
||||
-- frame_speed = 0.1,
|
||||
-- vertical_speed = 0.1,
|
||||
-- height = 0.1,
|
||||
-- movement = {m2 - (math.random(0, m) * 0.01), m2 - (math.random(0, m) * 0.01)}
|
||||
-- }
|
||||
-- )
|
||||
-- end
|
||||
-- end
|
||||
for x = -5, 5, 0.5 do
|
||||
for y = -5, 5, 0.5 do
|
||||
if math_random(1, 2) == 1 then
|
||||
|
@@ -1,6 +1,8 @@
|
||||
local Public = {}
|
||||
|
||||
local ICW = require 'maps.mountain_fortress_v3.icw.table'
|
||||
local Color = require 'utils.color_presets'
|
||||
local Session = require 'utils.datastore.session_data'
|
||||
|
||||
local random = math.random
|
||||
|
||||
@@ -723,76 +725,83 @@ end
|
||||
|
||||
function Public.teleport_players_around(icw)
|
||||
for _, player in pairs(game.connected_players) do
|
||||
if not validate_player(player) then
|
||||
return
|
||||
end
|
||||
if validate_player(player) then
|
||||
local trusted = Session.get_trusted_table()
|
||||
|
||||
if player.surface.find_entity('player-port', player.position) then
|
||||
local door = player.surface.find_entity('player-port', player.position)
|
||||
if door and door.valid then
|
||||
local doors = icw.doors
|
||||
local wagons = icw.wagons
|
||||
if player.surface.find_entity('player-port', player.position) then
|
||||
local door = player.surface.find_entity('player-port', player.position)
|
||||
if door and door.valid then
|
||||
local doors = icw.doors
|
||||
local wagons = icw.wagons
|
||||
|
||||
local wagon = false
|
||||
if doors[door.unit_number] then
|
||||
wagon = wagons[doors[door.unit_number]]
|
||||
end
|
||||
if wagons[door.unit_number] then
|
||||
wagon = wagons[door.unit_number]
|
||||
end
|
||||
if not wagon then
|
||||
return
|
||||
end
|
||||
|
||||
local player_data = get_player_data(icw, player)
|
||||
if player_data.state then
|
||||
player_data.state = player_data.state - 1
|
||||
if player_data.state == 0 then
|
||||
player_data.state = nil
|
||||
local wagon = false
|
||||
if doors[door.unit_number] then
|
||||
wagon = wagons[doors[door.unit_number]]
|
||||
end
|
||||
if wagons[door.unit_number] then
|
||||
wagon = wagons[door.unit_number]
|
||||
end
|
||||
if not wagon then
|
||||
return
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if wagon.entity.surface.name ~= player.surface.name then
|
||||
local surface = wagon.entity.surface
|
||||
local x_vector = (door.position.x / math.abs(door.position.x)) * 2
|
||||
local position = {wagon.entity.position.x + x_vector, wagon.entity.position.y}
|
||||
local surface_position = surface.find_non_colliding_position('character', position, 128, 0.5)
|
||||
if wagon.entity.type == 'locomotive' then
|
||||
player.teleport(surface_position, surface)
|
||||
player_data.state = 2
|
||||
player.driving = true
|
||||
Public.kill_minimap(player)
|
||||
local player_data = get_player_data(icw, player)
|
||||
if player_data.state then
|
||||
player_data.state = player_data.state - 1
|
||||
if player_data.state == 0 then
|
||||
player_data.state = nil
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if wagon.entity.surface.name ~= player.surface.name then
|
||||
local surface = wagon.entity.surface
|
||||
local x_vector = (door.position.x / math.abs(door.position.x)) * 2
|
||||
local position = {wagon.entity.position.x + x_vector, wagon.entity.position.y}
|
||||
local surface_position = surface.find_non_colliding_position('character', position, 128, 0.5)
|
||||
if wagon.entity.type == 'locomotive' then
|
||||
if not trusted[player.name] and not player.admin then
|
||||
player.teleport(surface_position, surface)
|
||||
player.driving = false
|
||||
Public.kill_minimap(player)
|
||||
player.print('Wooops - you slipped out of the driver seat!', Color.warning)
|
||||
else
|
||||
player.teleport(surface_position, surface)
|
||||
player_data.state = 2
|
||||
player.driving = true
|
||||
Public.kill_minimap(player)
|
||||
end
|
||||
else
|
||||
player.teleport(surface_position, surface)
|
||||
Public.kill_minimap(player)
|
||||
end
|
||||
player_data.surface = surface.index
|
||||
elseif wagon.entity.type == 'locomotive' and player.driving then
|
||||
player.driving = false
|
||||
else
|
||||
player.teleport(surface_position, surface)
|
||||
Public.kill_minimap(player)
|
||||
local surface = wagon.surface
|
||||
local area = wagon.area
|
||||
local x_vector = door.position.x - player.position.x
|
||||
local position
|
||||
if x_vector > 0 then
|
||||
position = {
|
||||
area.left_top.x + 0.5,
|
||||
area.left_top.y + ((area.right_bottom.y - area.left_top.y) * 0.5)
|
||||
}
|
||||
else
|
||||
position = {
|
||||
area.right_bottom.x - 0.5,
|
||||
area.left_top.y + ((area.right_bottom.y - area.left_top.y) * 0.5)
|
||||
}
|
||||
end
|
||||
local p = surface.find_non_colliding_position('character', position, 128, 0.5)
|
||||
if p then
|
||||
player.teleport(p, surface)
|
||||
else
|
||||
player.teleport(position, surface)
|
||||
end
|
||||
player_data.surface = surface.index
|
||||
end
|
||||
player_data.surface = surface.index
|
||||
elseif wagon.entity.type == 'locomotive' and player.driving then
|
||||
player.driving = false
|
||||
else
|
||||
local surface = wagon.surface
|
||||
local area = wagon.area
|
||||
local x_vector = door.position.x - player.position.x
|
||||
local position
|
||||
if x_vector > 0 then
|
||||
position = {
|
||||
area.left_top.x + 0.5,
|
||||
area.left_top.y + ((area.right_bottom.y - area.left_top.y) * 0.5)
|
||||
}
|
||||
else
|
||||
position = {
|
||||
area.right_bottom.x - 0.5,
|
||||
area.left_top.y + ((area.right_bottom.y - area.left_top.y) * 0.5)
|
||||
}
|
||||
end
|
||||
local p = surface.find_non_colliding_position('character', position, 128, 0.5)
|
||||
if p then
|
||||
player.teleport(p, surface)
|
||||
else
|
||||
player.teleport(position, surface)
|
||||
end
|
||||
player_data.surface = surface.index
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -87,56 +87,74 @@ function Public.add_player_to_permission_group(player, group, forced)
|
||||
return
|
||||
end
|
||||
|
||||
if not game.permissions.get_group('locomotive') then
|
||||
local locomotive_group = game.permissions.create_group('locomotive')
|
||||
locomotive_group.set_allows_action(defines.input_action.cancel_craft, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.edit_permission_group, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.import_permissions_string, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.delete_permission_group, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.add_permission_group, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.admin_action, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.drop_item, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.place_equipment, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.take_equipment, false)
|
||||
end
|
||||
|
||||
if not game.permissions.get_group('plebs') then
|
||||
local plebs_group = game.permissions.create_group('plebs')
|
||||
plebs_group.set_allows_action(defines.input_action.edit_permission_group, false)
|
||||
plebs_group.set_allows_action(defines.input_action.import_permissions_string, false)
|
||||
plebs_group.set_allows_action(defines.input_action.delete_permission_group, false)
|
||||
plebs_group.set_allows_action(defines.input_action.add_permission_group, false)
|
||||
plebs_group.set_allows_action(defines.input_action.admin_action, false)
|
||||
end
|
||||
|
||||
if not game.permissions.get_group('not_trusted') then
|
||||
local not_trusted = game.permissions.create_group('not_trusted')
|
||||
not_trusted.set_allows_action(defines.input_action.cancel_craft, false)
|
||||
not_trusted.set_allows_action(defines.input_action.edit_permission_group, false)
|
||||
not_trusted.set_allows_action(defines.input_action.import_permissions_string, false)
|
||||
not_trusted.set_allows_action(defines.input_action.delete_permission_group, false)
|
||||
not_trusted.set_allows_action(defines.input_action.add_permission_group, false)
|
||||
not_trusted.set_allows_action(defines.input_action.admin_action, false)
|
||||
not_trusted.set_allows_action(defines.input_action.drop_item, false)
|
||||
not_trusted.set_allows_action(defines.input_action.place_equipment, false)
|
||||
not_trusted.set_allows_action(defines.input_action.take_equipment, false)
|
||||
not_trusted.set_allows_action(defines.input_action.disconnect_rolling_stock, false)
|
||||
not_trusted.set_allows_action(defines.input_action.connect_rolling_stock, false)
|
||||
end
|
||||
|
||||
if enable_permission_group_disconnect then
|
||||
local locomotive_group = game.permissions.get_group('locomotive')
|
||||
local plebs_group = game.permissions.create_group('plebs')
|
||||
if locomotive_group then
|
||||
locomotive_group.set_allows_action(defines.input_action.disconnect_rolling_stock, true)
|
||||
end
|
||||
if plebs_group then
|
||||
plebs_group.set_allows_action(defines.input_action.disconnect_rolling_stock, true)
|
||||
end
|
||||
else
|
||||
local locomotive_group = game.permissions.get_group('locomotive')
|
||||
local plebs_group = game.permissions.create_group('plebs')
|
||||
if locomotive_group then
|
||||
locomotive_group.set_allows_action(defines.input_action.disconnect_rolling_stock, false)
|
||||
end
|
||||
if plebs_group then
|
||||
plebs_group.set_allows_action(defines.input_action.disconnect_rolling_stock, false)
|
||||
end
|
||||
end
|
||||
|
||||
local not_trusted = game.permissions.get_group('not_trusted')
|
||||
if playtime < 5184000 then -- 24 hours
|
||||
if not not_trusted then
|
||||
not_trusted = game.permissions.create_group('not_trusted')
|
||||
not_trusted.set_allows_action(defines.input_action.cancel_craft, false)
|
||||
not_trusted.set_allows_action(defines.input_action.edit_permission_group, false)
|
||||
not_trusted.set_allows_action(defines.input_action.import_permissions_string, false)
|
||||
not_trusted.set_allows_action(defines.input_action.delete_permission_group, false)
|
||||
not_trusted.set_allows_action(defines.input_action.add_permission_group, false)
|
||||
not_trusted.set_allows_action(defines.input_action.admin_action, false)
|
||||
not_trusted.set_allows_action(defines.input_action.drop_item, false)
|
||||
not_trusted.set_allows_action(defines.input_action.place_equipment, false)
|
||||
not_trusted.set_allows_action(defines.input_action.take_equipment, false)
|
||||
not_trusted.set_allows_action(defines.input_action.disconnect_rolling_stock, false)
|
||||
not_trusted.set_allows_action(defines.input_action.connect_rolling_stock, false)
|
||||
end
|
||||
not_trusted = game.permissions.get_group('not_trusted')
|
||||
local not_trusted = game.permissions.get_group('not_trusted')
|
||||
not_trusted.add_player(player)
|
||||
else
|
||||
if group == 'locomotive' then
|
||||
local locomotive_group = game.permissions.get_group('locomotive')
|
||||
if not locomotive_group then
|
||||
locomotive_group = game.permissions.create_group('locomotive')
|
||||
locomotive_group.set_allows_action(defines.input_action.cancel_craft, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.edit_permission_group, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.import_permissions_string, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.delete_permission_group, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.add_permission_group, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.admin_action, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.drop_item, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.place_equipment, false)
|
||||
locomotive_group.set_allows_action(defines.input_action.take_equipment, false)
|
||||
-- locomotive_group.set_allows_action(defines.input_action.disconnect_rolling_stock, false)
|
||||
-- locomotive_group.set_allows_action(defines.input_action.connect_rolling_stock, false)
|
||||
end
|
||||
|
||||
locomotive_group = game.permissions.get_group('locomotive')
|
||||
locomotive_group.add_player(player)
|
||||
elseif group == 'plebs' then
|
||||
local plebs_group = game.permissions.get_group('plebs')
|
||||
|
||||
plebs_group.add_player(player)
|
||||
elseif group == 'default' then
|
||||
local default_group = game.permissions.get_group('Default')
|
||||
|
||||
@@ -188,7 +206,7 @@ local function property_boost(data)
|
||||
end
|
||||
end
|
||||
else
|
||||
Public.add_player_to_permission_group(player, 'default', true)
|
||||
Public.add_player_to_permission_group(player, 'plebs', true)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1506,7 +1524,7 @@ local function on_player_changed_surface(event)
|
||||
if string.sub(player.surface.name, 0, #map_name) ~= map_name then
|
||||
return Public.add_player_to_permission_group(player, 'locomotive')
|
||||
else
|
||||
return Public.add_player_to_permission_group(player, 'default')
|
||||
return Public.add_player_to_permission_group(player, 'plebs')
|
||||
end
|
||||
end
|
||||
|
||||
|
@@ -322,7 +322,7 @@ function Public.reset_map()
|
||||
Entities.set_scores()
|
||||
AntiGrief.log_tree_harvest(true)
|
||||
AntiGrief.whitelist_types('tree', true)
|
||||
AntiGrief.enable_capsule_warning(true)
|
||||
AntiGrief.enable_capsule_warning(false)
|
||||
AntiGrief.enable_damage_warning(false)
|
||||
AntiGrief.enable_capsule_cursor_warning(false)
|
||||
AntiGrief.enable_jail(true)
|
||||
@@ -365,7 +365,7 @@ function Public.reset_map()
|
||||
wave_defense_table.spawn_position = {x = 0, y = 100}
|
||||
WD.alert_boss_wave(true)
|
||||
WD.clear_corpses(false)
|
||||
WD.remove_entities(true)
|
||||
WD.remove_entities(false)
|
||||
WD.enable_threat_log(true)
|
||||
WD.check_collapse_position(true)
|
||||
|
||||
@@ -376,9 +376,6 @@ function Public.reset_map()
|
||||
surface.force_generate_chunk_requests()
|
||||
end
|
||||
|
||||
surface.ticks_per_day = surface.ticks_per_day * 2
|
||||
surface.brightness_visual_weights = {1, 0, 0, 0}
|
||||
|
||||
game.forces.player.set_spawn_position({-27, 25}, surface)
|
||||
|
||||
Task.start_queue()
|
||||
|
@@ -40,8 +40,8 @@ end
|
||||
local group_size_modifier_raffle_size = #group_size_modifier_raffle
|
||||
|
||||
local function debug_print(msg)
|
||||
local this = WD.get_table()
|
||||
if not this.debug then
|
||||
local debug = WD.get('debug')
|
||||
if not debug then
|
||||
return
|
||||
end
|
||||
print('WaveDefense: ' .. msg)
|
||||
@@ -148,7 +148,7 @@ local function create_tiles(entity)
|
||||
end
|
||||
|
||||
local function is_unit_valid(biter)
|
||||
local this = WD.get_table()
|
||||
local this = WD.get()
|
||||
if not biter.entity then
|
||||
debug_print('is_unit_valid - unit destroyed - does no longer exist')
|
||||
return false
|
||||
@@ -169,7 +169,7 @@ local function is_unit_valid(biter)
|
||||
end
|
||||
|
||||
local function refresh_active_unit_threat()
|
||||
local this = WD.get_table()
|
||||
local this = WD.get()
|
||||
debug_print('refresh_active_unit_threat - current value ' .. this.active_biter_threat)
|
||||
local active_biter_threat = 0
|
||||
for k, biter in pairs(this.active_biters) do
|
||||
@@ -184,7 +184,7 @@ local function refresh_active_unit_threat()
|
||||
end
|
||||
|
||||
local function time_out_biters()
|
||||
local this = WD.get_table()
|
||||
local this = WD.get()
|
||||
for k, biter in pairs(this.active_biters) do
|
||||
if not is_unit_valid(biter) then
|
||||
this.active_biter_count = this.active_biter_count - 1
|
||||
@@ -204,7 +204,7 @@ local function time_out_biters()
|
||||
end
|
||||
|
||||
local function get_random_close_spawner(surface)
|
||||
local this = WD.get_table()
|
||||
local this = WD.get()
|
||||
local spawners = surface.find_entities_filtered({type = 'unit-spawner', force = 'enemy'})
|
||||
if not spawners[1] then
|
||||
return false
|
||||
@@ -242,7 +242,7 @@ local function get_random_character(this)
|
||||
end
|
||||
|
||||
local function set_main_target()
|
||||
local this = WD.get_table()
|
||||
local this = WD.get()
|
||||
if this.target then
|
||||
if this.target.valid then
|
||||
return
|
||||
@@ -265,7 +265,7 @@ local function set_main_target()
|
||||
end
|
||||
|
||||
local function set_group_spawn_position(surface)
|
||||
local this = WD.get_table()
|
||||
local this = WD.get()
|
||||
local spawner = get_random_close_spawner(surface)
|
||||
if not spawner then
|
||||
return
|
||||
@@ -282,7 +282,7 @@ local function set_group_spawn_position(surface)
|
||||
end
|
||||
|
||||
local function set_enemy_evolution()
|
||||
local this = WD.get_table()
|
||||
local this = WD.get()
|
||||
local evolution_factor = this.wave_number * 0.001
|
||||
local biter_health_boost = 1
|
||||
--local damage_increase = 0
|
||||
@@ -305,7 +305,7 @@ local function set_enemy_evolution()
|
||||
end
|
||||
|
||||
local function can_units_spawn()
|
||||
local this = WD.get_table()
|
||||
local this = WD.get()
|
||||
if this.threat <= 0 then
|
||||
debug_print('can_units_spawn - threat too low')
|
||||
return false
|
||||
@@ -322,7 +322,7 @@ local function can_units_spawn()
|
||||
end
|
||||
|
||||
local function get_active_unit_groups_count()
|
||||
local this = WD.get_table()
|
||||
local this = WD.get()
|
||||
local count = 0
|
||||
for _, g in pairs(this.unit_groups) do
|
||||
if g.valid then
|
||||
@@ -338,7 +338,7 @@ local function get_active_unit_groups_count()
|
||||
end
|
||||
|
||||
local function spawn_biter(surface, is_boss_biter)
|
||||
local this = WD.get_table()
|
||||
local this = WD.get()
|
||||
if not is_boss_biter then
|
||||
if not can_units_spawn() then
|
||||
return
|
||||
@@ -371,7 +371,7 @@ local function spawn_biter(surface, is_boss_biter)
|
||||
end
|
||||
|
||||
local function set_next_wave()
|
||||
local this = WD.get_table()
|
||||
local this = WD.get()
|
||||
this.wave_number = this.wave_number + 1
|
||||
|
||||
local threat_gain = this.wave_number * this.threat_gain_multiplier
|
||||
@@ -409,7 +409,7 @@ local function set_next_wave()
|
||||
end
|
||||
|
||||
local function reform_group(group)
|
||||
local this = WD.get_table()
|
||||
local this = WD.get()
|
||||
local group_position = {x = group.position.x, y = group.position.y}
|
||||
local step_length = this.unit_group_command_step_length
|
||||
local position = group.surface.find_non_colliding_position('biter-spawner', group_position, step_length, 4)
|
||||
@@ -430,7 +430,7 @@ local function reform_group(group)
|
||||
end
|
||||
|
||||
local function get_commmands(group)
|
||||
local this = WD.get_table()
|
||||
local this = WD.get()
|
||||
local commands = {}
|
||||
local group_position = {x = group.position.x, y = group.position.y}
|
||||
local step_length = this.unit_group_command_step_length
|
||||
@@ -591,7 +591,7 @@ local function get_commmands(group)
|
||||
end
|
||||
|
||||
local function command_unit_group(group, wd)
|
||||
local this = WD.get_table()
|
||||
local this = WD.get()
|
||||
if not this.unit_group_last_command[group.group_number] then
|
||||
this.unit_group_last_command[group.group_number] = game.tick - (this.unit_group_command_delay + 1)
|
||||
end
|
||||
@@ -617,18 +617,12 @@ local function command_unit_group(group, wd)
|
||||
commands = get_commmands(group)
|
||||
}
|
||||
)
|
||||
if group and group.valid then
|
||||
if wd.remove_entities then
|
||||
create_tiles(group)
|
||||
end
|
||||
group.start_moving()
|
||||
end
|
||||
|
||||
this.unit_group_last_command[group.group_number] = game.tick
|
||||
end
|
||||
|
||||
local function give_commands_to_unit_groups()
|
||||
local this = WD.get_table()
|
||||
local this = WD.get()
|
||||
if #this.unit_groups == 0 then
|
||||
return
|
||||
end
|
||||
@@ -648,7 +642,7 @@ local function give_commands_to_unit_groups()
|
||||
end
|
||||
|
||||
local function spawn_unit_group()
|
||||
local this = WD.get_table()
|
||||
local this = WD.get()
|
||||
if not can_units_spawn() then
|
||||
return
|
||||
end
|
||||
@@ -714,7 +708,7 @@ local function spawn_unit_group()
|
||||
end
|
||||
|
||||
local function log_threat()
|
||||
local this = WD.get_table()
|
||||
local this = WD.get()
|
||||
this.threat_log_index = this.threat_log_index + 1
|
||||
this.threat_log[this.threat_log_index] = this.threat
|
||||
if this.threat_log_index > 900 then
|
||||
@@ -723,7 +717,7 @@ local function log_threat()
|
||||
end
|
||||
|
||||
local function clear_tables()
|
||||
local this = WD.get_table()
|
||||
local this = WD.get()
|
||||
this.unit_group_last_command = {}
|
||||
end
|
||||
|
||||
@@ -740,7 +734,7 @@ local tick_tasks = {
|
||||
}
|
||||
|
||||
local function on_tick()
|
||||
local this = WD.get_table()
|
||||
local this = WD.get()
|
||||
if this.game_lost then
|
||||
return
|
||||
end
|
||||
|
@@ -77,6 +77,8 @@ Public.get_table = Public.get
|
||||
function Public.clear_corpses(value)
|
||||
if value then
|
||||
this.clear_corpses = value
|
||||
else
|
||||
this.clear_corpses = false
|
||||
end
|
||||
return this.clear_corpses
|
||||
end
|
||||
@@ -88,6 +90,8 @@ end
|
||||
function Public.alert_boss_wave(value)
|
||||
if value then
|
||||
this.alert_boss_wave = value
|
||||
else
|
||||
this.alert_boss_wave = false
|
||||
end
|
||||
return this.alert_boss_wave
|
||||
end
|
||||
@@ -95,6 +99,8 @@ end
|
||||
function Public.remove_entities(value)
|
||||
if value then
|
||||
this.remove_entities = value
|
||||
else
|
||||
this.remove_entities = false
|
||||
end
|
||||
return this.remove_entities
|
||||
end
|
||||
@@ -102,6 +108,8 @@ end
|
||||
function Public.enable_threat_log(value)
|
||||
if value then
|
||||
this.enable_threat_log = value
|
||||
else
|
||||
this.enable_threat_log = false
|
||||
end
|
||||
return this.enable_threat_log
|
||||
end
|
||||
@@ -109,6 +117,8 @@ end
|
||||
function Public.check_collapse_position(value)
|
||||
if value then
|
||||
this.check_collapse_position = value
|
||||
else
|
||||
this.check_collapse_position = false
|
||||
end
|
||||
return this.check_collapse_position
|
||||
end
|
||||
|
@@ -2,13 +2,10 @@ local Token = require 'utils.token'
|
||||
local Color = require 'utils.color_presets'
|
||||
local Server = require 'utils.server'
|
||||
local Event = require 'utils.event'
|
||||
local Print = require('utils.print_override')
|
||||
local raw_print = Print.raw_print
|
||||
|
||||
local color_data_set = 'colors'
|
||||
local set_data = Server.set_data
|
||||
local try_get_data = Server.try_get_data
|
||||
local error_offline = '[ERROR] Datastore is offline.'
|
||||
|
||||
local Public = {}
|
||||
|
||||
@@ -50,7 +47,6 @@ local fetch =
|
||||
function Public.fetch(key)
|
||||
local secs = Server.get_current_time()
|
||||
if secs == nil then
|
||||
raw_print(error_offline)
|
||||
return
|
||||
else
|
||||
try_get_data(color_data_set, key, fetch)
|
||||
@@ -84,7 +80,6 @@ Event.add(
|
||||
|
||||
local secs = Server.get_current_time()
|
||||
if not secs then
|
||||
raw_print(error_offline)
|
||||
return
|
||||
end
|
||||
|
||||
|
@@ -2,13 +2,10 @@ local Token = require 'utils.token'
|
||||
local Color = require 'utils.color_presets'
|
||||
local Server = require 'utils.server'
|
||||
local Event = require 'utils.event'
|
||||
local Print = require('utils.print_override')
|
||||
local raw_print = Print.raw_print
|
||||
|
||||
local message_dataset = 'regulars'
|
||||
local set_data = Server.set_data
|
||||
local try_get_data = Server.try_get_data
|
||||
local error_offline = '[ERROR] Datastore is offline.'
|
||||
|
||||
local Public = {}
|
||||
|
||||
@@ -36,7 +33,6 @@ function Public.fetch(key)
|
||||
if not player or not player.valid then
|
||||
return
|
||||
end
|
||||
raw_print(error_offline)
|
||||
return
|
||||
else
|
||||
try_get_data(message_dataset, key, fetch)
|
||||
@@ -54,7 +50,6 @@ commands.add_command(
|
||||
|
||||
local secs = Server.get_current_time()
|
||||
if not secs then
|
||||
raw_print(error_offline)
|
||||
return
|
||||
end
|
||||
|
||||
|
@@ -2,13 +2,10 @@ local Token = require 'utils.token'
|
||||
local Color = require 'utils.color_presets'
|
||||
local Server = require 'utils.server'
|
||||
local Event = require 'utils.event'
|
||||
local Print = require('utils.print_override')
|
||||
local raw_print = Print.raw_print
|
||||
|
||||
local tag_dataset = 'tags'
|
||||
local set_data = Server.set_data
|
||||
local try_get_data = Server.try_get_data
|
||||
local error_offline = '[ERROR] Datastore is offline.'
|
||||
|
||||
local Public = {}
|
||||
|
||||
@@ -37,7 +34,6 @@ end
|
||||
function Public.fetch(key)
|
||||
local secs = Server.get_current_time()
|
||||
if not secs then
|
||||
raw_print(error_offline)
|
||||
return
|
||||
else
|
||||
try_get_data(tag_dataset, key, fetch)
|
||||
@@ -55,7 +51,6 @@ commands.add_command(
|
||||
|
||||
local secs = Server.get_current_time()
|
||||
if not secs then
|
||||
raw_print(error_offline)
|
||||
return
|
||||
end
|
||||
|
||||
|
@@ -2,13 +2,10 @@ local Token = require 'utils.token'
|
||||
local Color = require 'utils.color_presets'
|
||||
local Server = require 'utils.server'
|
||||
local Event = require 'utils.event'
|
||||
local Print = require('utils.print_override')
|
||||
local raw_print = Print.raw_print
|
||||
|
||||
local quickbar_dataset = 'quickbar'
|
||||
local set_data = Server.set_data
|
||||
local try_get_data = Server.try_get_data
|
||||
local error_offline = '[ERROR] Datastore is offline.'
|
||||
|
||||
local Public = {}
|
||||
|
||||
@@ -40,7 +37,6 @@ function Public.fetch(key)
|
||||
if not player or not player.valid then
|
||||
return
|
||||
end
|
||||
raw_print(error_offline)
|
||||
return
|
||||
else
|
||||
try_get_data(quickbar_dataset, key, fetch)
|
||||
@@ -58,7 +54,6 @@ commands.add_command(
|
||||
|
||||
local secs = Server.get_current_time()
|
||||
if not secs then
|
||||
raw_print(error_offline)
|
||||
return
|
||||
end
|
||||
|
||||
|
@@ -8,7 +8,6 @@ local Print = require('utils.print_override')
|
||||
local raw_print = Print.raw_print
|
||||
|
||||
local session_data_set = 'sessions'
|
||||
local error_offline = '[ERROR] Datastore is offline.'
|
||||
local session = {}
|
||||
local online_track = {}
|
||||
local trusted = {}
|
||||
@@ -105,7 +104,6 @@ function Public.try_dl_data(key)
|
||||
key = tostring(key)
|
||||
local secs = Server.get_current_time()
|
||||
if secs == nil then
|
||||
raw_print(error_offline)
|
||||
session[key] = game.players[key].online_time
|
||||
return
|
||||
else
|
||||
@@ -119,7 +117,6 @@ function Public.try_ul_data(key)
|
||||
key = tostring(key)
|
||||
local secs = Server.get_current_time()
|
||||
if secs == nil then
|
||||
raw_print(error_offline)
|
||||
return
|
||||
else
|
||||
try_get_data(session_data_set, key, try_upload_data)
|
||||
|
Reference in New Issue
Block a user