1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-03-19 21:10:19 +02:00
ComfyFactorio/modules/shotgun_buff.lua

24 lines
815 B
Lua
Raw Normal View History

2024-10-14 23:46:34 +02:00
local Event = require 'utils.event'
2019-10-25 08:09:39 +02:00
local function on_research_finished(event)
2021-03-24 16:46:00 +01:00
local research = event.research
if string.sub(research.name, 0, 26) ~= 'physical-projectile-damage' then
return
end
local multiplier = 4
if storage.shotgun_shell_damage_research_multiplier then
multiplier = storage.shotgun_shell_damage_research_multiplier
2021-03-24 16:46:00 +01:00
end
local modifier = game.forces[research.force.name].get_ammo_damage_modifier('shotgun-shell')
2024-10-14 23:46:34 +02:00
local proto = prototypes.technology[research.name]
modifier = modifier - proto.effects[3].modifier
modifier = modifier + proto.effects[3].modifier * multiplier
2021-03-24 16:46:00 +01:00
game.forces[research.force.name].set_ammo_damage_modifier('shotgun-shell', modifier)
2019-10-25 08:09:39 +02:00
end
2024-10-14 23:46:34 +02:00
Event.add(defines.events.on_research_finished, on_research_finished)