mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-02-09 13:37:02 +02:00
tweaks and features
This commit is contained in:
parent
ec6b43acf0
commit
6b0f7a0c51
40
chatbot.lua
40
chatbot.lua
@ -1,30 +1,36 @@
|
||||
local event = require 'utils.event'
|
||||
local session = require 'utils.session_data'
|
||||
local message_color = {r = 0.5, g = 0.3, b = 1}
|
||||
local font_color = {r = 150, g = 100, b = 255, a = 255}
|
||||
local font = "default-game"
|
||||
|
||||
local brain = {
|
||||
[1] = {"Our Discord server is at https://getcomfy.eu/discord"},
|
||||
[2] = {"Need an admin? Type @Mods in game chat to notify moderators,", "or put a message in the discord help channel."}
|
||||
[1] = {"Our Discord server is at: https://getcomfy.eu/discord"},
|
||||
[2] = {"Need an admin? Type @Mods in game chat to notify moderators,", "or put a message in the discord help channel."},
|
||||
[3] = {"Scenario repository for download:", "https://github.com/M3wM3w/ComfyFactorio"},
|
||||
}
|
||||
|
||||
local links = {
|
||||
["discord"] = brain[1],
|
||||
["admin"] = brain[2],
|
||||
["administrator"] = brain[2],
|
||||
["mod"] = brain[2],
|
||||
["moderator"] = brain[2],
|
||||
["grief"] = brain[2],
|
||||
["troll"] = brain[2],
|
||||
["trolling"] = brain[2],
|
||||
["stealing"] = brain[2],
|
||||
["stole"] = brain[2],
|
||||
["griefer"] = brain[2],
|
||||
["greifer"] = brain[2]
|
||||
["admin"] = brain[2],
|
||||
["administrator"] = brain[2],
|
||||
["discord"] = brain[1],
|
||||
["download"] = brain[3],
|
||||
["github"] = brain[3],
|
||||
["greifer"] = brain[2],
|
||||
["grief"] = brain[2],
|
||||
["griefer"] = brain[2],
|
||||
["griefing"] = brain[2],
|
||||
["mod"] = brain[2],
|
||||
["moderator"] = brain[2],
|
||||
["scenario"] = brain[3],
|
||||
["stealing"] = brain[2],
|
||||
["stole"] = brain[2],
|
||||
["troll"] = brain[2],
|
||||
["trolling"] = brain[2],
|
||||
}
|
||||
|
||||
local function on_player_created(event)
|
||||
local player = game.players[event.player_index]
|
||||
player.print("Join the comfy discord >> getcomfy.eu/discord", message_color)
|
||||
player.print("[font=" .. font .. "]" .. "Join the comfy discord >> getcomfy.eu/discord" .. "[/font]", font_color)
|
||||
end
|
||||
|
||||
commands.add_command(
|
||||
@ -124,7 +130,7 @@ local function process_bot_answers(event)
|
||||
if links[word] then
|
||||
local player = game.players[event.player_index]
|
||||
for _, bot_answer in pairs(links[word]) do
|
||||
player.print(bot_answer, message_color)
|
||||
player.print("[font=" .. font .. "]" .. bot_answer .. "[/font]", font_color)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
@ -23,7 +23,7 @@ market.ammo = {
|
||||
["artillery-shell"] = {value = 64, rarity = 7},
|
||||
["rocket"] = {value = 4, rarity = 3},
|
||||
["explosive-rocket"] = {value = 12, rarity = 5},
|
||||
["atomic-bomb"] = {value = 5000, rarity = 10},
|
||||
["atomic-bomb"] = {value = 10000, rarity = 10},
|
||||
["flamethrower-ammo"] = {value = 20, rarity = 6},
|
||||
["explosives"] = {value = 2, rarity = 1},
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ local starting_items = {['pistol'] = 1, ['firearm-magazine'] = 16, ['rail'] = 16
|
||||
local function get_gen_settings()
|
||||
local map = {
|
||||
["seed"] = math.random(1, 1000000),
|
||||
["width"] = 1280,
|
||||
["width"] = 1536,
|
||||
["water"] = 0.001,
|
||||
["starting_area"] = 1,
|
||||
["cliff_settings"] = {cliff_elevation_interval = 0, cliff_elevation_0 = 0},
|
||||
@ -72,6 +72,11 @@ function reset_map()
|
||||
global.active_surface.request_to_generate_chunks({0,0}, 2)
|
||||
global.active_surface.force_generate_chunk_requests()
|
||||
|
||||
for x = -768 + 32, 768 - 32, 32 do
|
||||
global.active_surface.request_to_generate_chunks({x, 96}, 1)
|
||||
global.active_surface.force_generate_chunk_requests()
|
||||
end
|
||||
|
||||
game.map_settings.enemy_evolution.destroy_factor = 0
|
||||
game.map_settings.enemy_evolution.pollution_factor = 0
|
||||
game.map_settings.enemy_evolution.time_factor = 0
|
||||
@ -106,6 +111,22 @@ local function protect_train(event)
|
||||
end
|
||||
end
|
||||
|
||||
local function neutral_force_player_damage_resistance(event)
|
||||
if event.entity.force.index ~= 3 then return end -- Neutral Force
|
||||
if event.cause then
|
||||
if event.cause.valid then
|
||||
if event.cause.force.index == 2 then -- Enemy Force
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
if event.entity.health <= event.final_damage_amount then
|
||||
event.entity.die("neutral")
|
||||
return
|
||||
end
|
||||
event.entity.health = event.entity.health + (event.final_damage_amount * 0.5)
|
||||
end
|
||||
|
||||
local function biters_chew_rocks_faster(event)
|
||||
if event.entity.force.index ~= 3 then return end --Neutral Force
|
||||
if not event.cause then return end
|
||||
@ -156,12 +177,15 @@ end
|
||||
local function on_entity_damaged(event)
|
||||
if not event.entity.valid then return end
|
||||
protect_train(event)
|
||||
|
||||
if not event.entity.health then return end
|
||||
biters_chew_rocks_faster(event)
|
||||
neutral_force_player_damage_resistance(event)
|
||||
end
|
||||
|
||||
local function on_research_finished(event)
|
||||
event.research.force.character_inventory_slots_bonus = game.forces.player.mining_drill_productivity_bonus * 50 -- +5 Slots / level
|
||||
local mining_speed_bonus = game.forces.player.mining_drill_productivity_bonus * 2.5 -- +25% speed / level
|
||||
local mining_speed_bonus = game.forces.player.mining_drill_productivity_bonus * 5 -- +50% speed / level
|
||||
if event.research.force.technologies["steel-axe"].researched then mining_speed_bonus = mining_speed_bonus + 1 end -- +100% speed for steel-axe research
|
||||
event.research.force.manual_mining_speed_modifier = mining_speed_bonus
|
||||
end
|
||||
@ -182,7 +206,9 @@ local function on_player_joined_game(event)
|
||||
end
|
||||
|
||||
local function on_init(surface)
|
||||
global.rocks_yield_ore_distance_modifier = 0.1
|
||||
global.rocks_yield_ore_maximum_amount = 250
|
||||
global.rocks_yield_ore_base_amount = 50
|
||||
global.rocks_yield_ore_distance_modifier = 0.04
|
||||
reset_map()
|
||||
end
|
||||
|
||||
|
@ -61,7 +61,7 @@ local function process_rock_chunk_position(p, seed, tiles, entities, markets, tr
|
||||
--Market Spots
|
||||
if noise_cave_ponds < -0.80 then
|
||||
tiles[#tiles + 1] = {name = "grass-" .. math_random(1, 3), position = p}
|
||||
if math_random(1,64) == 1 then markets[#markets + 1] = p end
|
||||
if math_random(1,32) == 1 then markets[#markets + 1] = p end
|
||||
if math_random(1,32) == 1 then entities[#entities + 1] = {name = "tree-0" .. math_random(1, 9), position=p} end
|
||||
return
|
||||
end
|
||||
@ -71,7 +71,7 @@ local function process_rock_chunk_position(p, seed, tiles, entities, markets, tr
|
||||
if no_rocks < 0.08 and no_rocks > -0.08 then
|
||||
if small_caves > 0.20 then
|
||||
tiles[#tiles + 1] = {name = "dirt-" .. math.floor(noise_cave_ponds * 32) % 7 + 1, position = p}
|
||||
if math_random(1,320) == 1 then entities[#entities + 1] = {name = "crude-oil", position = p, amount = math.abs(p.y) * 500} end
|
||||
if math_random(1,500) == 1 then entities[#entities + 1] = {name = "crude-oil", position = p, amount = math.abs(p.y) * 500} end
|
||||
if math_random(1,96) == 1 then
|
||||
wave_defense_set_worm_raffle(math.abs(p.y) * 0.5)
|
||||
entities[#entities + 1] = {name = wave_defense_roll_worm_name(), position = p, force = "enemy"}
|
||||
@ -235,16 +235,15 @@ end
|
||||
local function process_chunk(surface, left_top)
|
||||
if not surface then return end
|
||||
if not surface.valid then return end
|
||||
if left_top.x >= 640 then return end
|
||||
if left_top.x < -640 then return end
|
||||
--game.forces.player.chart(surface, {{left_top.x, left_top.y},{left_top.x + 31, left_top.y + 31}})
|
||||
if left_top.x >= 768 then return end
|
||||
if left_top.x < -768 then return end
|
||||
if left_top.y > 0 then game.forces.player.chart(surface, {{left_top.x, left_top.y},{left_top.x + 31, left_top.y + 31}}) end
|
||||
if left_top.y == 64 and left_top.x == 64 then
|
||||
local p = global.locomotive.position
|
||||
for _, entity in pairs(surface.find_entities_filtered({area = {{p.x - 3, p.y - 4},{p.x + 3, p.y + 8}}, force = "neutral"})) do entity.destroy() end
|
||||
end
|
||||
if left_top.y < 0 then rock_chunk(surface, left_top) return end
|
||||
if left_top.y > 128 then out_of_map(surface, left_top) return end
|
||||
--if left_top.y > 64 or left_top.x > 480 or left_top.x < -512 then biter_chunk(surface, left_top) return end
|
||||
if left_top.y > 96 then out_of_map(surface, left_top) return end
|
||||
if left_top.y > 64 then biter_chunk(surface, left_top) return end
|
||||
if left_top.y >= 0 then border_chunk(surface, left_top) return end
|
||||
end
|
||||
@ -263,5 +262,5 @@ local function on_chunk_generated(event)
|
||||
end
|
||||
|
||||
local event = require 'utils.event'
|
||||
event.on_nth_tick(8, process_chunk_queue)
|
||||
event.on_nth_tick(5, process_chunk_queue)
|
||||
event.add(defines.events.on_chunk_generated, on_chunk_generated)
|
@ -81,7 +81,7 @@ local function get_amount(entity)
|
||||
local amount = base_amount + (distance_to_center * distance_modifier)
|
||||
if amount > maximum_amount then amount = maximum_amount end
|
||||
|
||||
local m = (75 + math_random(0, 50)) * 0.01
|
||||
local m = (70 + math_random(0, 60)) * 0.01
|
||||
|
||||
amount = math.floor(amount * rock_yield[entity.name] * m)
|
||||
if amount < 1 then amount = 1 end
|
||||
@ -136,7 +136,7 @@ local function on_entity_died(event)
|
||||
if event.cause then
|
||||
if event.cause.valid then
|
||||
if event.cause.force.index == 2 then
|
||||
amount = math_random(4, 6)
|
||||
amount = math_random(4, 8)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -287,14 +287,14 @@ function reset_wave_defense()
|
||||
unit_groups = {},
|
||||
unit_group_last_command = {},
|
||||
unit_group_command_delay = 3600 * 5,
|
||||
unit_group_command_step_length = 96,
|
||||
unit_group_command_step_length = 64,
|
||||
max_group_size = 256,
|
||||
max_active_unit_groups = 6,
|
||||
max_active_biters = 256 * 6,
|
||||
max_active_unit_groups = 8,
|
||||
max_active_biters = 1280,
|
||||
max_biter_age = 3600 * 60,
|
||||
active_unit_group_count = 0,
|
||||
active_biter_count = 0,
|
||||
get_random_close_spawner_attempts = 2,
|
||||
get_random_close_spawner_attempts = 3,
|
||||
spawn_position = {x = 0, y = 64},
|
||||
last_wave = game.tick,
|
||||
next_wave = game.tick + 3600 * 5,
|
||||
@ -303,7 +303,7 @@ function reset_wave_defense()
|
||||
game_lost = false,
|
||||
threat = 0,
|
||||
simple_entity_shredding_count_modifier = 0.0003,
|
||||
simple_entity_shredding_cost_modifier = 0.005, --threat cost for one health
|
||||
simple_entity_shredding_cost_modifier = 0.01, --threat cost for one health
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -22,7 +22,7 @@ local acid_nova_entities = {
|
||||
|
||||
local function acid_nova(entity)
|
||||
if not acid_nova_entities[entity.name] then return end
|
||||
if global.wave_defense.threat < 100000 then return end
|
||||
if global.wave_defense.threat < 25000 then return end
|
||||
if math_random(1, 16) ~= 1 then return end
|
||||
for _ = 1, acid_nova_entities[entity.name].amount, 1 do
|
||||
local i = math_random(1, #acid_nova_entities[entity.name].vectors)
|
||||
|
Loading…
x
Reference in New Issue
Block a user