add visible damage points

This commit is contained in:
Juraj Vajda 2022-10-30 19:39:07 -04:00
parent a775d3d74c
commit 94292e6ac5
13 changed files with 16 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

Before

Width:  |  Height:  |  Size: 80 B

After

Width:  |  Height:  |  Size: 80 B

View File

Before

Width:  |  Height:  |  Size: 80 B

After

Width:  |  Height:  |  Size: 80 B

View File

Before

Width:  |  Height:  |  Size: 85 B

After

Width:  |  Height:  |  Size: 85 B

View File

Before

Width:  |  Height:  |  Size: 81 B

After

Width:  |  Height:  |  Size: 81 B

View File

Before

Width:  |  Height:  |  Size: 91 B

After

Width:  |  Height:  |  Size: 91 B

View File

Before

Width:  |  Height:  |  Size: 83 B

After

Width:  |  Height:  |  Size: 83 B

View File

Before

Width:  |  Height:  |  Size: 85 B

After

Width:  |  Height:  |  Size: 85 B

View File

Before

Width:  |  Height:  |  Size: 81 B

After

Width:  |  Height:  |  Size: 81 B

View File

Before

Width:  |  Height:  |  Size: 80 B

After

Width:  |  Height:  |  Size: 80 B

View File

Before

Width:  |  Height:  |  Size: 86 B

After

Width:  |  Height:  |  Size: 86 B

View File

@ -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