1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-02-09 13:37:02 +02:00

minor changes

This commit is contained in:
Gerkiz 2020-05-10 00:34:22 +02:00
parent a67b50263d
commit f8e8f27ef3
2 changed files with 37 additions and 20 deletions

View File

@ -47,9 +47,7 @@ local function check_burden(event)
player_modifiers[player.index].character_running_speed_modifier['randomness'] = 0.3 - fullness
player_modifiers[player.index].character_mining_speed_modifier['randomess'] = 0.3 - fullness
Modifier.update_player_modifiers(player)
if fullness >= 0.3 and fullness <= 0.305 then
player.print('You feel all of a sudden burden.', Color.yellow)
elseif fullness >= 0.5 and fullness <= 0.505 then
if fullness >= 0.5 and fullness <= 0.501 then
player.print('Maybe you should drop some of that inventory to lessen the burden.', Color.red)
end
end

View File

@ -1,22 +1,41 @@
local event = require 'utils.event'
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
if not event.cause then
return
end
if not event.cause.valid 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
if ammo.name ~= "firearm-magazine" and ammo.name ~= "piercing-rounds-magazine" and ammo.name ~= "uranium-rounds-magazine" then return end
if not event.entity.valid then return end
event.entity.damage(event.final_damage_amount * 4, player.force, "impact", player)
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
if
ammo.name ~= 'firearm-magazine' and ammo.name ~= 'piercing-rounds-magazine' and
ammo.name ~= 'uranium-rounds-magazine'
then
return
end
if not event.entity.valid then
return
end
event.entity.damage(event.final_damage_amount * 4, player.force, 'impact', player)
end
event.add(defines.events.on_entity_damaged, on_entity_damaged)
Event.add(defines.events.on_entity_damaged, on_entity_damaged)