From 94292e6ac53b37d98ceab8c28a84bfaee2fa5b8e Mon Sep 17 00:00:00 2001 From: Juraj Vajda Date: Sun, 30 Oct 2022 19:39:07 -0400 Subject: [PATCH] add visible damage points --- README.md | 10 ++++++++++ api.lua | 8 +++++--- textures/{dmg_0.png => x_bows_dmg_0.png} | Bin textures/{dmg_1.png => x_bows_dmg_1.png} | Bin textures/{dmg_2.png => x_bows_dmg_2.png} | Bin textures/{dmg_3.png => x_bows_dmg_3.png} | Bin textures/{dmg_4.png => x_bows_dmg_4.png} | Bin textures/{dmg_5.png => x_bows_dmg_5.png} | Bin textures/{dmg_6.png => x_bows_dmg_6.png} | Bin textures/{dmg_7.png => x_bows_dmg_7.png} | Bin textures/{dmg_8.png => x_bows_dmg_8.png} | Bin textures/{dmg_9.png => x_bows_dmg_9.png} | Bin types/xbows.type.lua | 1 + 13 files changed, 16 insertions(+), 3 deletions(-) rename textures/{dmg_0.png => x_bows_dmg_0.png} (100%) rename textures/{dmg_1.png => x_bows_dmg_1.png} (100%) rename textures/{dmg_2.png => x_bows_dmg_2.png} (100%) rename textures/{dmg_3.png => x_bows_dmg_3.png} (100%) rename textures/{dmg_4.png => x_bows_dmg_4.png} (100%) rename textures/{dmg_5.png => x_bows_dmg_5.png} (100%) rename textures/{dmg_6.png => x_bows_dmg_6.png} (100%) rename textures/{dmg_7.png => x_bows_dmg_7.png} (100%) rename textures/{dmg_8.png => x_bows_dmg_8.png} (100%) rename textures/{dmg_9.png => x_bows_dmg_9.png} (100%) diff --git a/README.md b/README.md index aa3f7a4..cdc3f2a 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,16 @@ Modified by SaKeL: - x_bows_quiver_empty_mesh.png - x_bows_quiver_blank_mesh.png - x_bows_quiver_slot.png +- x_bows_dmg_0.png +- x_bows_dmg_1.png +- x_bows_dmg_2.png +- x_bows_dmg_3.png +- x_bows_dmg_4.png +- x_bows_dmg_5.png +- x_bows_dmg_6.png +- x_bows_dmg_7.png +- x_bows_dmg_8.png +- x_bows_dmg_9.png ### Sounds diff --git a/api.lua b/api.lua index 1ac5493..11303a6 100644 --- a/api.lua +++ b/api.lua @@ -2379,13 +2379,15 @@ function XBowsQuiver.hide_3d_quiver(self, player) end end +---string split to characters +---@param str string +---@return string[] | nil local function split(str) if #str > 0 then return str:sub(1,1), split(str:sub(2)) end end ----Show damage numbers function XBows.show_damage_numbers(self, pos, damage, is_crit) if not pos or not self.settings.x_bows_show_damage_numbers then return @@ -2399,9 +2401,9 @@ function XBows.show_damage_numbers(self, pos, damage, is_crit) for i, value in ipairs(results) do if i == 1 then - texture = texture .. '[combine:' .. 7 * #results .. 'x' .. 9 * #results .. ':0,0=dmg_' .. value .. '.png' + texture = texture .. '[combine:' .. 7 * #results .. 'x' .. 9 * #results .. ':0,0=x_bows_dmg_' .. value .. '.png' else - texture = texture .. ':' .. dmg_nr_offset .. ',0=dmg_' .. value .. '.png' + texture = texture .. ':' .. dmg_nr_offset .. ',0=x_bows_dmg_' .. value .. '.png' end dmg_nr_offset = dmg_nr_offset + 7 diff --git a/textures/dmg_0.png b/textures/x_bows_dmg_0.png similarity index 100% rename from textures/dmg_0.png rename to textures/x_bows_dmg_0.png diff --git a/textures/dmg_1.png b/textures/x_bows_dmg_1.png similarity index 100% rename from textures/dmg_1.png rename to textures/x_bows_dmg_1.png diff --git a/textures/dmg_2.png b/textures/x_bows_dmg_2.png similarity index 100% rename from textures/dmg_2.png rename to textures/x_bows_dmg_2.png diff --git a/textures/dmg_3.png b/textures/x_bows_dmg_3.png similarity index 100% rename from textures/dmg_3.png rename to textures/x_bows_dmg_3.png diff --git a/textures/dmg_4.png b/textures/x_bows_dmg_4.png similarity index 100% rename from textures/dmg_4.png rename to textures/x_bows_dmg_4.png diff --git a/textures/dmg_5.png b/textures/x_bows_dmg_5.png similarity index 100% rename from textures/dmg_5.png rename to textures/x_bows_dmg_5.png diff --git a/textures/dmg_6.png b/textures/x_bows_dmg_6.png similarity index 100% rename from textures/dmg_6.png rename to textures/x_bows_dmg_6.png diff --git a/textures/dmg_7.png b/textures/x_bows_dmg_7.png similarity index 100% rename from textures/dmg_7.png rename to textures/x_bows_dmg_7.png diff --git a/textures/dmg_8.png b/textures/x_bows_dmg_8.png similarity index 100% rename from textures/dmg_8.png rename to textures/x_bows_dmg_8.png diff --git a/textures/dmg_9.png b/textures/x_bows_dmg_9.png similarity index 100% rename from textures/dmg_9.png rename to textures/x_bows_dmg_9.png diff --git a/types/xbows.type.lua b/types/xbows.type.lua index 81ecbdc..d89e2b5 100644 --- a/types/xbows.type.lua +++ b/types/xbows.type.lua @@ -32,6 +32,7 @@ ---@field open_quiver fun(self: XBowsQuiver, itemstack: ItemStack, user: ObjectRef): ItemStack Open quiver ---@field uuid fun(): string Creates UUID ---@field fallback_quiver boolean If no invenotory mod is detected then fallback solution will be used +---@field show_damage_numbers fun(self: XBows, pos: Vector, damaga: number, is_crit?: boolean): nil Builds textures and shows textures in particle spawner ---XBowsQuiver class extended from XBows