1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-05-13 21:56:29 +02:00

tweaks and fix

This commit is contained in:
MewMew 2019-10-10 21:33:54 +02:00
parent 649e36977e
commit 242710bba0
6 changed files with 82 additions and 62 deletions

View File

@ -62,6 +62,8 @@ require "modules.floaty_chat"
--require "maps.fish_defender.main"
--require "maps.fish_defender_v1.fish_defender"
--require "maps.biter_battles_v2.main"
require "maps.mountain_fortress_v2.main"
--require "maps.mountain_fortress"
--require "maps.island_troopers.main"
--require "maps.tank_conquest.tank_conquest"
--require "maps.territorial_control"
@ -89,8 +91,6 @@ require "modules.floaty_chat"
--require "maps.choppy"
--require "maps.tank_battles"
--require "maps.spiral_troopers"
require "maps.mountain_fortress_v2.main"
--require "maps.mountain_fortress"
--require "maps.refactor-io"
--require "maps.stoneblock"
--require "maps.deep_jungle"

View File

@ -2,7 +2,6 @@ local event = require 'utils.event'
require "modules.spawners_contain_acid"
require "modules.spawners_contain_biters"
require "modules.dynamic_landfill"
require "modules.dangerous_goods"
require "modules.satellite_score"
require "modules.splice_double"

View File

@ -14,6 +14,23 @@ function locomotive_spawn(surface, position)
global.locomotive_cargo.operable = false
end
local function fish_tag()
if not global.locomotive_cargo then return end
if not global.locomotive_cargo.valid then return end
if global.locomotive_tag then
if global.locomotive_tag.valid then
if global.locomotive_tag.position.x == global.locomotive_cargo.position.x and global.locomotive_tag.position.y == global.locomotive_cargo.position.y then return end
global.locomotive_tag.destroy()
end
end
global.locomotive_tag = global.locomotive_cargo.force.add_chart_tag(
global.locomotive_cargo.surface,
{icon = {type = 'item', name = 'raw-fish'},
position = global.locomotive_cargo.position,
text = " "
})
end
local function accelerate()
local driver = global.locomotive.get_driver()
if driver then return end
@ -85,6 +102,7 @@ local function tick()
if not global.locomotive.valid then return end
--constant_speed()
if game.tick % 30 == 0 then
fish_tag()
accelerate()
if game.tick % 1800 == 0 then
--force_nearby_units_to_attack()

View File

@ -142,7 +142,7 @@ local function biters_chew_rocks_faster(event)
end
local function hidden_biter(entity)
wave_defense_set_biter_raffle(math.sqrt(entity.position.x ^ 2, entity.position.y ^ 2) * 0.65)
wave_defense_set_biter_raffle(math.sqrt(entity.position.x ^ 2 + entity.position.y ^ 2) * 0.45)
entity.surface.create_entity({name = wave_defense_roll_biter_name(), position = entity.position})
end

View File

@ -10,10 +10,10 @@ local rock_yield = {
local rock_mining_chance_weights = {
{"iron-ore", 25},
{"copper-ore",18},
{"coal",14},
{"stone",10},
{"uranium-ore",3}
{"copper-ore",17},
{"coal",13},
{"stone",9},
{"uranium-ore",2}
}
local texts = {
@ -92,63 +92,66 @@ end
local function on_player_mined_entity(event)
local entity = event.entity
if not entity.valid then return end
if rock_yield[entity.name] then
event.buffer.clear()
local ore = ore_raffle[math_random(1, #ore_raffle)]
local player = game.players[event.player_index]
local inventory = player.get_inventory(defines.inventory.character_main)
if not inventory.can_insert({name = ore, count = 1}) then
local e = entity.surface.create_entity({name = entity.name, position = entity.position})
e.health = entity.health
player.print("Inventory full.", {200, 200, 200})
return
end
local count = get_amount(entity)
entity.surface.create_entity({name = "flying-text", position = entity.position, text = "+" .. count .. " [img=item/" .. ore .. "]", color = {r = 200, g = 160, b = 30}})
create_particles(entity.surface, particles[ore], entity.position, 64, game.players[event.player_index].position)
if count > max_spill then
entity.surface.spill_item_stack(entity.position,{name = ore, count = max_spill}, true)
count = count - max_spill
local inserted_count = player.insert({name = ore, count = count})
count = count - inserted_count
if count > 0 then
entity.surface.spill_item_stack(entity.position,{name = ore, count = count}, true)
end
else
entity.surface.spill_item_stack(entity.position,{name = ore, count = count}, true)
end
if not rock_yield[entity.name] then return end
event.buffer.clear()
local ore = ore_raffle[math_random(1, #ore_raffle)]
local player = game.players[event.player_index]
local inventory = player.get_inventory(defines.inventory.character_main)
if not inventory.can_insert({name = ore, count = 1}) then
local e = entity.surface.create_entity({name = entity.name, position = entity.position})
e.health = entity.health
player.print("Inventory full.", {200, 200, 200})
return
end
local count = get_amount(entity)
local position = {x = entity.position.x, y = entity.position.y}
player.surface.create_entity({name = "flying-text", position = position, text = "+" .. count .. " [img=item/" .. ore .. "]", color = {r = 200, g = 160, b = 30}})
create_particles(player.surface, particles[ore], position, 64, player.position)
entity.destroy()
if count > max_spill then
player.surface.spill_item_stack(position,{name = ore, count = max_spill}, true)
count = count - max_spill
local inserted_count = player.insert({name = ore, count = count})
count = count - inserted_count
if count > 0 then
player.surface.spill_item_stack(position,{name = ore, count = count}, true)
end
else
player.surface.spill_item_stack(position,{name = ore, count = count}, true)
end
end
local function on_entity_died(event)
local entity = event.entity
if not entity.valid then return end
if not entity.valid then return end
if not rock_yield[entity.name] then return end
if rock_yield[entity.name] then
local surface = entity.surface
local amount = get_amount(entity)
amount = math.ceil(amount * 0.1)
if event.cause then
if event.cause.valid then
if event.cause.force.index == 2 then
amount = math_random(2, 6)
end
local surface = entity.surface
local ore = ore_raffle[math_random(1, #ore_raffle)]
local pos = {entity.position.x, entity.position.y}
create_particles(surface, particles[ore], pos, 16)
if event.cause then
if event.cause.valid then
if event.cause.force.index == 2 then
entity.destroy()
return
end
end
end
end
if amount > 16 then amount = 16 end
local ore = ore_raffle[math_random(1, #ore_raffle)]
local pos = {entity.position.x, entity.position.y}
entity.destroy()
surface.spill_item_stack(pos,{name = ore, count = amount}, true)
create_particles(surface, particles[ore], pos, 16)
end
local amount = get_amount(entity)
amount = math.ceil(amount * 0.1)
if amount > 16 then amount = 16 end
entity.destroy()
surface.spill_item_stack(pos,{name = ore, count = amount}, true)
end
local event = require 'utils.event'

View File

@ -364,7 +364,7 @@ function reset_wave_defense()
active_biters = {},
unit_groups = {},
unit_group_last_command = {},
unit_group_command_delay = 3600 * 5,
unit_group_command_delay = 3600 * 15,
unit_group_command_step_length = 48,
max_group_size = 192,
max_active_unit_groups = 8,
@ -382,11 +382,11 @@ function reset_wave_defense()
game_lost = false,
threat = 0,
simple_entity_shredding_count_modifier = 0.0003,
simple_entity_shredding_cost_modifier = 0.01, --threat cost for one health
nest_building_density = 32, --lower values = more dense building
nest_building_chance = 16, --high value = less chance
simple_entity_shredding_cost_modifier = 0.005, --threat cost for one health
nest_building_density = 64, --lower values = more dense building
nest_building_chance = 8, --high value = less chance
worm_building_density = 8, --lower values = more dense building
worm_building_chance = 4, --high value = less chance
worm_building_chance = 2, --high value = less chance
}
end