mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 03:25:23 +09:00
Update all code styles
This commit is contained in:
@@ -12,21 +12,21 @@ Event.add(defines.events.on_entity_damaged, function(event)
|
||||
local damage = math.floor(event.original_damage_amount)
|
||||
local health = math.floor(entity.health)
|
||||
local health_percentage = entity.get_health_ratio()
|
||||
local text_colour = {r=1-health_percentage, g=health_percentage, b=0}
|
||||
local text_colour = { r = 1 - health_percentage, g = health_percentage, b = 0 }
|
||||
|
||||
-- Gets the location of the text
|
||||
local size = entity.get_radius()
|
||||
if size < 1 then size = 1 end
|
||||
local r = (math.random()-0.5)*size*config.damage_location_variance
|
||||
local r = (math.random() - 0.5) * size * config.damage_location_variance
|
||||
local p = entity.position
|
||||
local position = {x=p.x+r, y=p.y-size}
|
||||
local position = { x = p.x + r, y = p.y - size }
|
||||
|
||||
-- Sets the message
|
||||
local message
|
||||
if entity.name == 'character' and config.show_player_health then
|
||||
message = {'damage-popup.player-health', health}
|
||||
elseif entity.name ~= 'character' and cause and cause.name == 'character' and config.show_player_damage then
|
||||
message = {'damage-popup.player-damage', damage}
|
||||
if entity.name == "character" and config.show_player_health then
|
||||
message = { "damage-popup.player-health", health }
|
||||
elseif entity.name ~= "character" and cause and cause.name == "character" and config.show_player_damage then
|
||||
message = { "damage-popup.player-damage", damage }
|
||||
end
|
||||
|
||||
-- Outputs the message as floating text
|
||||
@@ -38,5 +38,4 @@ Event.add(defines.events.on_entity_damaged, function(event)
|
||||
text_colour
|
||||
)
|
||||
end
|
||||
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user