1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-08 00:39:30 +02:00
ComfyFactorio/modules/pistol_buffs.lua

22 lines
932 B
Lua
Raw Normal View History

2020-04-08 21:29:51 +02:00
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]
if not weapon.valid_for_read or not ammo.valid_for_read then return end
if weapon.name ~= "pistol" then return end
2020-04-10 01:29:49 +02:00
if ammo.name ~= "firearm-magazine" and ammo.name ~= "piercing-rounds-magazine" and ammo.name ~= "uranium-rounds-magazine" then return end
2020-04-08 21:29:51 +02:00
event.entity.damage(event.final_damage_amount * 4, player.force, "physical")
end
event.add(defines.events.on_entity_damaged, on_entity_damaged)