mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-01-08 00:39:30 +02:00
fortress
This commit is contained in:
parent
15a193d7ed
commit
0dd0a232bc
@ -177,7 +177,7 @@ local function hidden_biter(entity)
|
||||
local m = 1 / level_depth
|
||||
m = m * d
|
||||
|
||||
if math_random(1, 256) == 1 then
|
||||
if math_random(1, 64) == 1 then
|
||||
BiterHealthBooster.add_boss_unit(unit, m * 15 + 1, 0.38)
|
||||
else
|
||||
BiterHealthBooster.add_unit(unit, m * 2.5 + 1)
|
||||
|
23
modules/pistol_buffs.lua
Normal file
23
modules/pistol_buffs.lua
Normal file
@ -0,0 +1,23 @@
|
||||
|
||||
|
||||
local event = require 'utils.event'
|
||||
|
||||
|
||||
local function on_entity_damaged(event)
|
||||
if not event.cause then return end
|
||||
if event.cause.name ~= "character" then return end
|
||||
if event.damage_type.name ~= "physical" then return end
|
||||
|
||||
local player = event.cause
|
||||
if player.shooting_state.state == defines.shooting.not_shooting then return end
|
||||
local weapon = player.get_inventory(defines.inventory.character_guns)[player.selected_gun_index]
|
||||
local ammo = player.get_inventory(defines.inventory.character_ammo)[player.selected_gun_index]
|
||||
game.print(weapon.valid_for_read)
|
||||
game.print(ammo.valid_for_read)
|
||||
if not weapon.valid_for_read or not ammo.valid_for_read then return end
|
||||
if weapon.name ~= "pistol" then return end
|
||||
if ammo.name ~= "firearm-magazine" and ammo ~= "piercing-rounds-magazine" and ammo ~= "uranium-rounds-magazine" then return end
|
||||
event.entity.damage(event.final_damage_amount * 4, player.force, "physical")
|
||||
end
|
||||
|
||||
event.add(defines.events.on_entity_damaged, on_entity_damaged)
|
@ -12,12 +12,12 @@ local biological_target_types = {
|
||||
["unit"] = true,
|
||||
["player"] = true,
|
||||
["turret"] = true,
|
||||
["unit-spawner"] = true
|
||||
["unit-spawner"] = true
|
||||
}
|
||||
|
||||
local function create_visuals(source_entity, target_entity)
|
||||
if not additional_visual_effects then return end
|
||||
local surface = target_entity.surface
|
||||
local surface = target_entity.surface
|
||||
surface.create_entity({name = "water-splash", position = target_entity.position})
|
||||
if biological_target_types[target_entity.type] then
|
||||
surface.create_entity({name = "blood-explosion-big", position = target_entity.position})
|
||||
@ -34,16 +34,16 @@ local function create_visuals(source_entity, target_entity)
|
||||
surface.create_entity({name = "fire-flame", position = target_entity.position})
|
||||
end
|
||||
for x = -3, 3, 1 do
|
||||
for y = -3, 3, 1 do
|
||||
for y = -3, 3, 1 do
|
||||
if math_random(1, 3) == 1 then
|
||||
surface.create_trivial_smoke({name="smoke-fast", position={target_entity.position.x + (x * 0.35), target_entity.position.y + (y * 0.35)}})
|
||||
surface.create_trivial_smoke({name="smoke-fast", position={target_entity.position.x + (x * 0.35), target_entity.position.y + (y * 0.35)}})
|
||||
end
|
||||
if math_random(1, 5) == 1 then
|
||||
surface.create_trivial_smoke({name="train-smoke", position={target_entity.position.x + (x * 0.35), target_entity.position.y + (y * 0.35)}})
|
||||
surface.create_trivial_smoke({name="train-smoke", position={target_entity.position.x + (x * 0.35), target_entity.position.y + (y * 0.35)}})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function do_splash_damage_around_entity(source_entity, player)
|
||||
@ -61,36 +61,37 @@ local function do_splash_damage_around_entity(source_entity, player)
|
||||
local surface = entity.surface
|
||||
surface.create_entity({name = "railgun-beam", position = source_entity.position, source = source_entity.position, target = entity.position})
|
||||
surface.create_entity({name = "water-splash", position = entity.position})
|
||||
if biological_target_types[entity.type] then
|
||||
surface.create_entity({name = "blood-fountain", position = entity.position})
|
||||
if biological_target_types[entity.type] then
|
||||
surface.create_entity({name = "blood-fountain", position = entity.position})
|
||||
end
|
||||
end
|
||||
local damage = math_random(math.ceil((damage_min * research_damage_bonus) / 16), math.ceil((damage_max * research_damage_bonus) / 16))
|
||||
entity.damage(damage, player.force, "physical")
|
||||
local damage = math_random(math.ceil((damage_min * research_damage_bonus) / 16), math.ceil((damage_max * research_damage_bonus) / 16))
|
||||
entity.damage(damage, player.force, "physical")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function on_entity_damaged(event)
|
||||
local function on_entity_damaged(event)
|
||||
if not event.cause then return end
|
||||
if event.cause.name ~= "character" then return end
|
||||
if event.damage_type.name ~= "physical" then return end
|
||||
if event.original_damage_amount ~= 100 then return end
|
||||
|
||||
|
||||
local player = event.cause
|
||||
if player.shooting_state.state == defines.shooting.not_shooting then return end
|
||||
local selected_weapon = player.get_inventory(defines.inventory.character_guns)[player.selected_gun_index]
|
||||
if not selected_weapon.valid_for_read then return end
|
||||
if selected_weapon.name ~= "railgun" then return end
|
||||
|
||||
|
||||
create_visuals(event.cause, event.entity)
|
||||
|
||||
|
||||
do_splash_damage_around_entity(event.entity, player)
|
||||
|
||||
|
||||
event.entity.health = event.entity.health + event.final_damage_amount
|
||||
|
||||
local research_damage_bonus = player.force.get_ammo_damage_modifier("laser-turret") + 1
|
||||
|
||||
local research_damage_bonus = player.force.get_ammo_damage_modifier("laser-turret") + 1
|
||||
local damage = math_random(math.ceil(damage_min * research_damage_bonus), math.ceil(damage_max * research_damage_bonus))
|
||||
event.entity.damage(damage, player.force, "physical")
|
||||
event.entity.damage(damage, player.force, "physical")
|
||||
end
|
||||
|
||||
event.add(defines.events.on_entity_damaged, on_entity_damaged)
|
||||
event.add(defines.events.on_entity_damaged, on_entity_damaged)
|
||||
|
Loading…
Reference in New Issue
Block a user