1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-04 00:15:45 +02:00

new modules

This commit is contained in:
MewMew 2019-02-19 04:31:55 +01:00
parent 1b6e0923f6
commit 4ed364fdcf
9 changed files with 97 additions and 102 deletions

View File

@ -30,7 +30,7 @@ require "score"
-----------------------------
---- enable maps here ----
require "maps.biter_battles"
--require "maps.biter_battles"
--require "maps.cave_miner"
--require "maps.labyrinth"
--require "maps.spooky_forest"
@ -39,7 +39,7 @@ require "maps.biter_battles"
--require "maps.tank_battles"
--require "maps.spiral_troopers"
--require "maps.fish_defender"
--require "maps.mountain_fortress"
require "maps.mountain_fortress"
--require "maps.stoneblock"
--require "maps.deep_jungle"
--require "maps.crossing"

View File

@ -1107,6 +1107,30 @@ local function clear_corpses()
end
end
local function send_near_biter_to_silo()
game.surfaces["surface"].set_multi_command({
command={
type=defines.command.attack,
target=global.rocket_silo["north"],
distraction=defines.distraction.none
},
unit_count = 8,
force = "enemy",
unit_search_distance=64
})
game.surfaces["surface"].set_multi_command({
command={
type=defines.command.attack,
target=global.rocket_silo["south"],
distraction=defines.distraction.none
},
unit_count = 8,
force = "enemy",
unit_search_distance=64
})
end
local function on_tick(event)
if global.rocket_silo_destroyed then
@ -1148,7 +1172,8 @@ local function on_tick(event)
local c = math.round(global.biter_rage["north"], 0)
if c > 999 then c = 999 end
biter_attack_silo("north", c)
end
end
send_near_biter_to_silo()
refresh_gui()
return
end
@ -1157,7 +1182,8 @@ local function on_tick(event)
local c = math.round(global.biter_rage["south"], 0)
if c > 999 then c = 999 end
biter_attack_silo("south", c)
end
end
send_near_biter_to_silo()
refresh_gui()
return
end

View File

@ -1,6 +1,5 @@
-- fish defender -- by mewmew --
local event = require 'utils.event'
require "maps.fish_defender_map_intro"
require "maps.modules.rocket_launch_always_yields_science"
require "maps.modules.launch_fish_to_win"
@ -10,7 +9,11 @@ require "maps.modules.dynamic_landfill"
require "maps.modules.teleporting_worms"
require "maps.modules.custom_death_messages"
require "maps.modules.splice_double"
require "maps.modules.spitters_spit_biters"
require "maps.modules.biters_double_hp"
require "maps.modules.custom_death_messages"
local event = require 'utils.event'
local map_functions = require "maps.tools.map_functions"
local math_random = math.random
local insert = table.insert
@ -528,7 +531,14 @@ local function biter_attack_wave()
else
global.wave_count = global.wave_count + 1
end
local modifier = 0.003
game.forces.enemy.set_ammo_damage_modifier("melee", global.wave_count * modifier)
game.forces.enemy.set_ammo_damage_modifier("biological", global.wave_count * modifier)
game.forces.enemy.set_ammo_damage_modifier("artillery-shell", global.wave_count * modifier)
game.forces.enemy.set_ammo_damage_modifier("flamethrower", global.wave_count * modifier)
game.forces.enemy.set_ammo_damage_modifier("laser-turret", global.wave_count * modifier)
if global.wave_count % 50 == 0 then
global.attack_wave_threat = global.wave_count * 6
spawn_boss_units(surface)
@ -545,7 +555,7 @@ local function biter_attack_wave()
if game.forces.enemy.evolution_factor == 1 then
if not global.endgame_modifier then
global.endgame_modifier = 1
game.print("Endgame enemy evolution reached. Biter damage is rising...", {r = 0.7, g = 0.1, b = 0.1})
game.print("Endgame enemy evolution reached.", {r = 0.7, g = 0.1, b = 0.1})
else
global.endgame_modifier = global.endgame_modifier + 1
end
@ -901,36 +911,7 @@ local function on_entity_died(event)
end
end
local function on_entity_damaged(event)
if event.cause then
if event.cause.valid then
if event.cause.name == "big-spitter" then
local surface = event.cause.surface
local area = {{event.entity.position.x - 3, event.entity.position.y - 3}, {event.entity.position.x + 3, event.entity.position.y + 3}}
if surface.count_entities_filtered({area = area, name = "small-biter", limit = 3}) < 3 then
local pos = surface.find_non_colliding_position("small-biter", event.entity.position, 4, 0.5)
if pos then surface.create_entity({name = "small-biter", position = pos}) end
end
end
if event.cause.name == "behemoth-spitter" then
local surface = event.cause.surface
local area = {{event.entity.position.x - 3, event.entity.position.y - 3}, {event.entity.position.x + 3, event.entity.position.y + 3}}
if surface.count_entities_filtered({area = area, name = "medium-biter", limit = 3}) < 3 then
local pos = surface.find_non_colliding_position("medium-biter", event.entity.position, 4, 0.5)
if pos then surface.create_entity({name = "medium-biter", position = pos}) end
end
end
if event.cause.force.name == "enemy" then
if global.endgame_modifier then
event.entity.health = event.entity.health - (event.final_damage_amount * global.endgame_modifier * 0.002)
if event.entity.health <= 0 then event.entity.die() end
end
end
end
end
local function on_entity_damaged(event)
if event.entity.valid then
if event.entity.name == "market" then
if event.cause then

View File

@ -5,7 +5,7 @@ local event = require 'utils.event'
local function on_entity_damaged(event)
if not event.entity.valid then return end
if math.random(1,2) == 1 then return end
if event.entity.force.name ~= "enemy" then return end
if event.entity.type ~= "unit" then return end
event.entity.health = event.entity.health + event.final_damage_amount
end

View File

@ -51,7 +51,7 @@ local function on_player_mined_entity(event)
local pos = {x = entity.position.x + p.x, y = entity.position.y + p.y}
local tile = entity.surface.get_tile(pos)
if not tile.collides_with("player-layer") then
if replacement_tiles[tile.name] and math_random(1,3) ~= 1 then
if replacement_tiles[tile.name] and math_random(1,3) == 1 then
insert(tiles, {name = replacement_tiles[tile.name], position = pos})
end
end

View File

@ -10,7 +10,7 @@ local healing_amount = {
local function heal_rocks()
for key, rock in pairs(global.damaged_rocks) do
if rock.last_damage + 3600 < game.tick then
if rock.last_damage + 54000 < game.tick then
if rock.entity then
if rock.entity.valid then
rock.entity.health = rock.entity.health + healing_amount[rock.entity.name]

View File

@ -1,46 +0,0 @@
-- sushi mode WIP -- this will make full belts without a valid output overflow and spill their items
local event = require 'utils.event'
local valid_types = {
["underground-belt"] = true,
["splitter"] = true,
["transport-belt"] = true,
}
local function process_belt(entity)
end
local function on_built_entity(event)
if not global.sushi then global.sushi = {} end
if valid_types[event.entity.type] then
global.sushi[tostring(event.entity.position.x) .. "," .. tostring(event.entity.position.y)] = event.entity
end
end
local function on_player_mined_entity(event)
if valid_types[event.entity.type] then
local area = {{event.entity.position.x - 2, event.entity.position.y - 2},{event.entity.position.x + 2, event.entity.position.y + 2}}
local entities = event.entity.surface.find_entities_filtered({area = area, type = valid_types})
for _, e in pairs(entities) do
global.sushi[tostring(e.position.x) .. "," .. tostring(e.position.y)] = e
end
end
end
local function on_robot_mined_entity(event)
on_player_mined_entity(event)
end
local function on_tick(event)
if not global.sushi then return end
for _, sushi in pairs(global.sushi) do
process_belt(sushi)
end
end
event.add(defines.events.on_tick, on_tick)
event.add(defines.events.on_built_entity, on_built_entity)
event.add(defines.events.on_robot_mined_entity, on_robot_mined_entity)
event.add(defines.events.on_player_mined_entity, on_player_mined_entity)

View File

@ -1,15 +1,19 @@
-- mountain digger fortress -- by mewmew --
require "maps.modules.satellite_score"
require "maps.modules.backpack_research"
require "maps.modules.biters_double_damage"
require "maps.modules.biters_double_hp"
require "maps.modules.biters_yield_coins"
require "maps.modules.dynamic_landfill"
require "maps.modules.dynamic_player_spawn"
require "maps.modules.backpack_research"
require "maps.modules.explosive_biters"
require "maps.modules.rocks_broken_paint_tiles"
require "maps.modules.rocks_heal_over_time"
require "maps.modules.rocks_yield_ore_veins"
require "maps.modules.rocks_yield_ore"
require "maps.modules.biters_yield_coins"
require "maps.modules.explosive_biters"
require "maps.modules.satellite_score"
require "maps.modules.spawners_contain_biters"
require "maps.modules.spitters_spit_biters"
require "maps.modules.splice_double"
local event = require 'utils.event'
@ -130,14 +134,14 @@ local function on_player_joined_game(event)
game.map_settings.pollution.enabled = true
game.map_settings.enemy_expansion.enabled = true
game.map_settings.enemy_evolution.destroy_factor = 0.004
game.map_settings.enemy_evolution.destroy_factor = 0.005
game.map_settings.enemy_evolution.time_factor = 0.00002
game.map_settings.enemy_evolution.pollution_factor = 0.00003
game.map_settings.enemy_evolution.pollution_factor = 0.00004
game.map_settings.enemy_expansion.max_expansion_distance = 15
game.map_settings.enemy_expansion.settler_group_min_size = 15
game.map_settings.enemy_expansion.settler_group_max_size = 30
game.map_settings.enemy_expansion.min_expansion_cooldown = 1800
game.map_settings.enemy_expansion.max_expansion_cooldown = 3600
game.map_settings.enemy_expansion.settler_group_min_size = 8
game.map_settings.enemy_expansion.settler_group_max_size = 16
game.map_settings.enemy_expansion.min_expansion_cooldown = 3600
game.map_settings.enemy_expansion.max_expansion_cooldown = 7200
surface.ticks_per_day = surface.ticks_per_day * 2
game.forces.player.manual_mining_speed_modifier = 1.75
@ -438,6 +442,29 @@ local function on_marked_for_deconstruction(event)
end
end
local function on_tick(event)
if game.tick % 3600 ~= 1 then return end
if math_random(1,8) ~= 1 then return end
local surface = game.surfaces["mountain_fortress"]
local target = surface.find_entities_filtered({force = "player"})
if not target[1] then return end
target = target[math_random(1, #target)]
surface.set_multi_command({
command={
type=defines.command.attack_area,
destination=target.position,
radius=16,
distraction=defines.distraction.by_anything
},
unit_count = math_random(6,10),
force = "enemy",
unit_search_distance=1024
})
end
event.add(defines.events.on_tick, on_tick)
event.add(defines.events.on_chunk_charted, on_chunk_charted)
event.add(defines.events.on_entity_damaged, on_entity_damaged)
event.add(defines.events.on_marked_for_deconstruction, on_marked_for_deconstruction)

View File

@ -14,6 +14,7 @@ require "maps.modules.splice_double"
require "maps.modules.spitters_spit_biters"
require "maps.modules.biters_double_hp"
require "maps.modules.biters_double_damage"
require "maps.modules.flashlight_toggle_button"
local event = require 'utils.event'
local math_random = math.random
@ -69,12 +70,15 @@ local function secret_shop(pos, surface)
{price = {{"coin", math_random(300,500)}}, offer = {type = 'give-item', item = 'express-loader'}},
{price = {{"coin", math_random(100,200)}}, offer = {type = 'give-item', item = 'locomotive'}},
{price = {{"coin", math_random(75,150)}}, offer = {type = 'give-item', item = 'cargo-wagon'}},
{price = {{"coin", math_random(2,4)}}, offer = {type = 'give-item', item = 'rail'}},
{price = {{"coin", math_random(20,40)}}, offer = {type = 'give-item', item = 'train-stop'}},
{price = {{"coin", math_random(2,3)}}, offer = {type = 'give-item', item = 'rail'}},
--{price = {{"coin", math_random(20,40)}}, offer = {type = 'give-item', item = 'train-stop'}},
{price = {{"coin", math_random(4,12)}}, offer = {type = 'give-item', item = 'small-lamp'}},
{price = {{"coin", math_random(80,160)}}, offer = {type = 'give-item', item = 'car'}},
{price = {{"coin", math_random(300,600)}}, offer = {type = 'give-item', item = 'electric-furnace'}},
{price = {{"coin", math_random(300,600)}}, offer = {type = 'give-item', item = "assembling-machine-3"}},
--{price = {{"coin", math_random(300,600)}}, offer = {type = 'give-item', item = "assembling-machine-3"}},
{price = {{"coin", math_random(80,160)}}, offer = {type = 'give-item', item = 'effectivity-module'}},
{price = {{"coin", math_random(80,160)}}, offer = {type = 'give-item', item = 'productivity-module'}},
{price = {{"coin", math_random(80,160)}}, offer = {type = 'give-item', item = 'speed-module'}},
{price = {{"coin", math_random(5,10)}}, offer = {type = 'give-item', item = 'raw-wood', count = 50}},
{price = {{"coin", math_random(5,10)}}, offer = {type = 'give-item', item = 'iron-ore', count = 50}},
@ -95,7 +99,7 @@ local function secret_shop(pos, surface)
local market = surface.create_entity {name = "market", position = pos}
market.destructible = false
for i = 1, math.random(6, 8), 1 do
for i = 1, math.random(8, 10), 1 do
market.add_market_item(secret_market_items[i])
end
end
@ -135,10 +139,13 @@ local function on_player_joined_game(event)
game.map_settings.enemy_expansion.max_expansion_distance = 15
game.map_settings.enemy_expansion.settler_group_min_size = 15
game.map_settings.enemy_expansion.settler_group_max_size = 30
game.map_settings.enemy_expansion.min_expansion_cooldown = 1800
game.map_settings.enemy_expansion.max_expansion_cooldown = 3600
game.map_settings.enemy_expansion.min_expansion_cooldown = 7200
game.map_settings.enemy_expansion.max_expansion_cooldown = 10800
surface.ticks_per_day = surface.ticks_per_day * 2
surface.daytime = 0.5
surface.freeze_daytime = 1
game.forces.player.manual_mining_speed_modifier = 1.75
global.surface_init_done = true