From bc39becfcc4aebddc5b37969084873f237793072 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Tue, 6 Nov 2018 20:45:43 +0000 Subject: [PATCH] Floored damage in DamagePopup --- modules/DamagePopup/control.lua | 2 +- modules/HealthIndicator/control.lua | 47 ---------------------------- modules/HealthIndicator/softmod.json | 19 ----------- 3 files changed, 1 insertion(+), 67 deletions(-) delete mode 100644 modules/HealthIndicator/control.lua delete mode 100644 modules/HealthIndicator/softmod.json diff --git a/modules/DamagePopup/control.lua b/modules/DamagePopup/control.lua index 0d58802a..a2194913 100644 --- a/modules/DamagePopup/control.lua +++ b/modules/DamagePopup/control.lua @@ -36,7 +36,7 @@ Event.register(defines.events.on_entity_damaged, function(event) entity.surface.create_entity{ name="flying-text", color=defines.textcolor.med, - text='-'..damage, + text='-'..math.floor(damage), -- cooldude2606 added floor for damage ammount position=entity.position } end diff --git a/modules/HealthIndicator/control.lua b/modules/HealthIndicator/control.lua deleted file mode 100644 index 7da0b504..00000000 --- a/modules/HealthIndicator/control.lua +++ /dev/null @@ -1,47 +0,0 @@ ---- In game text float to desplay health to other players. --- @module HealthIndicator@1.0.1 --- @author Ps7cho (converted by Cooldude2606) --- @license https://opensource.org/licenses/MIT --- @alais ThisModule - --- Module Require -local Game = require('FactorioStdLib.Game@^0.8.0') - --- Local Varibles -local green = 200 -- above this makes text green -local yellow = 100 -- above this makes text yellow - --- Module Define -local module_verbose = false -local ThisModule = {} - --- Global Define -local global = global() - --- Event Handlers Define -script.on_event(defines.events.on_entity_damaged, function(event) - if event.entity.name ~= 'player' then return end - local player = Game.get_player(event.entity.player) - if player.character then - if player.character.health == nil then return end - local index = player.index - local health = math.ceil(player.character.health) - if global[index] == nil then global[index] = health end - if global[index] ~= health then - if health < global[index] then - local text = health..' (-'..math.floor(event.final_damage_amount)..')' - if health > green then - player.surface.create_entity{name="flying-text", color={b = 0.2, r= 0.1, g = 1, a = 0.8}, text=text, position= {player.position.x, player.position.y-2}} - elseif health > yellow then - player.surface.create_entity{name="flying-text", color={r = 1, g = 1, b = 0}, text=text, position= {player.position.x, player.position.y-2}} - else - player.surface.create_entity{name="flying-text", color={b = 0.1, r= 1, g = 0, a = 0.8}, text=text, position= {player.position.x, player.position.y-2}} - end - end - global[index] = health - end - end -end) - --- Module Return -return ThisModule \ No newline at end of file diff --git a/modules/HealthIndicator/softmod.json b/modules/HealthIndicator/softmod.json deleted file mode 100644 index 3aca69f7..00000000 --- a/modules/HealthIndicator/softmod.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "HealthIndicator", - "version": "1.0.1", - "type": "Module", - "description": "In game text float to desplay health to other players.", - "location": "", - "keywords": [ - "Health", - "Overlay", - "Text", - "Damage" - ], - "author": " Ps7cho (converted by Cooldude2606)", - "contact": "Discord: Cooldude2606#5241", - "license": "https://opensource.org/licenses/MIT", - "dependencies": { - "FactorioStdLib.Game": "^0.8.0" - } -} \ No newline at end of file