mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-01-24 03:47:58 +02:00
Merge pull request #283 from ComfyFactory/mtn
mtn v3 - small fix to higher diff
This commit is contained in:
commit
665a4d5d4a
@ -182,9 +182,33 @@ local function hurt_players_outside_of_aura()
|
||||
if entity.name == 'character' then
|
||||
game.print(player.name .. messages[random(1, #messages)], {r = 200, g = 0, b = 0})
|
||||
end
|
||||
if entity.valid then
|
||||
entity.die()
|
||||
end
|
||||
else
|
||||
local armor_inventory = player.get_inventory(defines.inventory.character_armor)
|
||||
if not armor_inventory.valid then
|
||||
return
|
||||
end
|
||||
local armor = armor_inventory[1]
|
||||
if not armor.valid_for_read then
|
||||
return
|
||||
end
|
||||
local grid = armor.grid
|
||||
if not grid or not grid.valid then
|
||||
return
|
||||
end
|
||||
local equip = grid.equipment
|
||||
for _, piece in pairs(equip) do
|
||||
if piece.valid then
|
||||
piece.energy = 0
|
||||
if piece.shield and piece.shield.valid then
|
||||
piece.shield = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
entity.damage(1, 'enemy')
|
||||
if entity.valid then
|
||||
entity.health = entity.health - (max_health / 25)
|
||||
if entity.health <= 0 then
|
||||
if entity.name == 'character' then
|
||||
@ -199,6 +223,7 @@ local function hurt_players_outside_of_aura()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local function give_passive_xp(data)
|
||||
local xp_floating_text_color = {r = 188, g = 201, b = 63}
|
||||
local visuals_delay = 1800
|
||||
|
@ -109,9 +109,11 @@ function Public.iter_connected_players(callback)
|
||||
local players = game.connected_players
|
||||
for i = 1, #players do
|
||||
local player = players[i]
|
||||
if player and player.valid then
|
||||
callback(player)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- Iterates over all players
|
||||
---@param callback function
|
||||
@ -119,9 +121,11 @@ function Public.iter_players(callback)
|
||||
local players = game.players
|
||||
for i = 1, #players do
|
||||
local player = players[i]
|
||||
if player and player.valid then
|
||||
callback(player)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Public.cast_bool(var)
|
||||
if var then
|
||||
|
Loading…
x
Reference in New Issue
Block a user