add lua diagnostics to pipeline
This commit is contained in:
parent
ae40dd7232
commit
64d3d559c9
153
api.lua
153
api.lua
|
@ -51,7 +51,9 @@ XBows = {
|
|||
x_bows_show_3d_quiver = minetest.settings:get_bool('x_bows_show_3d_quiver', true)
|
||||
},
|
||||
charge_sound_after_job = {},
|
||||
fallback_quiver = not minetest.global_exists('sfinv') and not minetest.global_exists('unified_inventory') and not minetest.global_exists('i3')
|
||||
fallback_quiver = not minetest.global_exists('sfinv')
|
||||
and not minetest.global_exists('unified_inventory')
|
||||
and not minetest.global_exists('i3')
|
||||
}
|
||||
|
||||
XBows.__index = XBows
|
||||
|
@ -135,7 +137,11 @@ function XBows.reset_charged_bow(self, player, includeWielded)
|
|||
local x_bows_registered_bow_def = self.registered_bows[st_name]
|
||||
local reset = _includeWielded or player:get_wield_index() ~= i
|
||||
|
||||
if not st:is_empty() and x_bows_registered_bow_def and reset and minetest.get_item_group(st_name, 'bow_charged') ~= 0 then
|
||||
if not st:is_empty()
|
||||
and x_bows_registered_bow_def
|
||||
and reset
|
||||
and minetest.get_item_group(st_name, 'bow_charged') ~= 0
|
||||
then
|
||||
local item_meta = st:get_meta()
|
||||
local arrow_itemstack = ItemStack(minetest.deserialize(item_meta:get_string('arrow_itemstack_string')))
|
||||
|
||||
|
@ -144,7 +150,11 @@ function XBows.reset_charged_bow(self, player, includeWielded)
|
|||
if inv:room_for_item('main', { name = arrow_itemstack:get_name() }) then
|
||||
inv:add_item('main', arrow_itemstack:get_name())
|
||||
else
|
||||
minetest.item_drop(ItemStack({name=arrow_itemstack:get_name(), count=1}), player, player:get_pos())
|
||||
minetest.item_drop(
|
||||
ItemStack({ name = arrow_itemstack:get_name(), count = 1 }),
|
||||
player,
|
||||
player:get_pos()
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -176,7 +186,10 @@ function XBows.register_bow(self, name, def, override)
|
|||
def.description = override and def.short_description or (def.description or name)
|
||||
def.custom.uses = def.custom.uses or 150
|
||||
def.groups = mergeTables({ bow = 1, flammable = 1 }, def.groups or {})
|
||||
def.custom.groups_charged = mergeTables({bow_charged = 1, flammable = 1, not_in_creative_inventory = 1}, def.groups or {})
|
||||
def.custom.groups_charged = mergeTables(
|
||||
{ bow_charged = 1, flammable = 1, not_in_creative_inventory = 1 },
|
||||
def.groups or {}
|
||||
)
|
||||
def.custom.strength = def.custom.strength or 30
|
||||
def.custom.allowed_ammunition = def.custom.allowed_ammunition or nil
|
||||
def.custom.sound_load = def.custom.sound_load or 'x_bows_bow_load'
|
||||
|
@ -261,7 +274,11 @@ function XBows.register_bow(self, name, def, override)
|
|||
|
||||
---return arrow
|
||||
if arrow_itemstack and not self:is_creative(dropper:get_player_name()) then
|
||||
minetest.item_drop(ItemStack({name=arrow_itemstack:get_name(), count=1}), dropper, {x=pos.x + 0.5, y=pos.y + 0.5, z=pos.z + 0.5})
|
||||
minetest.item_drop(
|
||||
ItemStack({ name = arrow_itemstack:get_name(), count = 1 }),
|
||||
dropper,
|
||||
{ x = pos.x + 0.5, y = pos.y + 0.5, z = pos.z + 0.5 }
|
||||
)
|
||||
end
|
||||
|
||||
itemstack:set_name(def.custom.name)
|
||||
|
@ -363,16 +380,24 @@ function XBows.register_quiver(self, name, def)
|
|||
def.description = def.description or name
|
||||
def.short_description = def.short_description or name
|
||||
def.groups = mergeTables({ quiver = 1, flammable = 1 }, def.groups or {})
|
||||
def.custom.groups_charged = mergeTables({quiver = 1, quiver_open = 1, flammable = 1, not_in_creative_inventory = 1}, def.groups or {})
|
||||
def.custom.groups_charged = mergeTables({
|
||||
quiver = 1, quiver_open = 1, flammable = 1, not_in_creative_inventory = 1
|
||||
},
|
||||
def.groups or {}
|
||||
)
|
||||
|
||||
if def.custom.faster_arrows then
|
||||
def.description = def.description .. '\n' .. minetest.colorize('#00FF00', S('Faster Arrows') .. ': ' .. (1 / def.custom.faster_arrows) * 100 .. '%')
|
||||
def.short_description = def.short_description .. '\n' .. minetest.colorize('#00FF00', S('Faster Arrows') .. ': ' .. (1 / def.custom.faster_arrows) * 100 .. '%')
|
||||
def.description = def.description .. '\n' .. minetest.colorize('#00FF00', S('Faster Arrows') ..
|
||||
': ' .. (1 / def.custom.faster_arrows) * 100 .. '%')
|
||||
def.short_description = def.short_description .. '\n' .. minetest.colorize('#00FF00', S('Faster Arrows') ..
|
||||
': ' .. (1 / def.custom.faster_arrows) * 100 .. '%')
|
||||
end
|
||||
|
||||
if def.custom.add_damage then
|
||||
def.description = def.description .. '\n' .. minetest.colorize('#FF8080', S('Arrow Damage') .. ': +' .. def.custom.add_damage)
|
||||
def.short_description = def.short_description .. '\n' .. minetest.colorize('#FF8080', S('Arrow Damage') .. ': +' .. def.custom.add_damage)
|
||||
def.description = def.description .. '\n' .. minetest.colorize('#FF8080', S('Arrow Damage') ..
|
||||
': +' .. def.custom.add_damage)
|
||||
def.short_description = def.short_description .. '\n' .. minetest.colorize('#FF8080', S('Arrow Damage') ..
|
||||
': +' .. def.custom.add_damage)
|
||||
end
|
||||
|
||||
self.registered_quivers[def.custom.name] = def
|
||||
|
@ -424,6 +449,10 @@ function XBows.register_quiver(self, name, def)
|
|||
---@param pos Vector
|
||||
---@return ItemStack
|
||||
on_drop = function(itemstack, dropper, pos)
|
||||
if not dropper then
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local replace_item = XBowsQuiver:get_replacement_item(itemstack, 'x_bows:quiver')
|
||||
return minetest.item_drop(replace_item, dropper, pos)
|
||||
end
|
||||
|
@ -489,9 +518,9 @@ function XBows.load(self, itemstack, user, pointed_thing)
|
|||
XBowsQuiver:udate_or_create_hud(user, inv:get_list('x_bows:arrow_inv'))
|
||||
else
|
||||
---no ammo (fake stack)
|
||||
XBowsQuiver:udate_or_create_hud(user, {ItemStack({
|
||||
name = 'x_bows:no_ammo'
|
||||
})})
|
||||
XBowsQuiver:udate_or_create_hud(user, {
|
||||
ItemStack({ name = 'x_bows:no_ammo' })
|
||||
})
|
||||
end
|
||||
|
||||
---find itemstack arrow in players inventory
|
||||
|
@ -544,7 +573,9 @@ function XBows.load(self, itemstack, user, pointed_thing)
|
|||
wielded_item:set_name(v_bow_name .. '_charged')
|
||||
v_user:set_wielded_item(wielded_item)
|
||||
|
||||
if not self:is_creative(v_user:get_player_name()) and v_itemstack_arrow_meta:get_int('is_arrow_from_quiver') ~= 1 then
|
||||
if not self:is_creative(v_user:get_player_name())
|
||||
and v_itemstack_arrow_meta:get_int('is_arrow_from_quiver') ~= 1
|
||||
then
|
||||
v_itemstack_arrow:take_item()
|
||||
v_inv:set_stack('x_bows:arrow_inv', v_itemstack_arrows[1].idx, v_itemstack_arrow)
|
||||
end
|
||||
|
@ -563,7 +594,8 @@ function XBows.load(self, itemstack, user, pointed_thing)
|
|||
end
|
||||
|
||||
---sound plays when charge time reaches full punch interval time
|
||||
table.insert(self.charge_sound_after_job[player_name], minetest.after(_tool_capabilities.full_punch_interval, function(v_user, v_bow_name)
|
||||
table.insert(self.charge_sound_after_job[player_name], minetest.after(_tool_capabilities.full_punch_interval,
|
||||
function(v_user, v_bow_name)
|
||||
local wielded_item = v_user:get_wielded_item()
|
||||
local wielded_item_name = wielded_item:get_name()
|
||||
|
||||
|
@ -625,9 +657,9 @@ function XBows.shoot(self, itemstack, user, pointed_thing)
|
|||
XBowsQuiver:udate_or_create_hud(user, inv:get_list('x_bows:arrow_inv'))
|
||||
else
|
||||
---no ammo (fake stack just for the HUD)
|
||||
XBowsQuiver:udate_or_create_hud(user, {ItemStack({
|
||||
name = 'x_bows:no_ammo'
|
||||
})})
|
||||
XBowsQuiver:udate_or_create_hud(user, {
|
||||
ItemStack({ name = 'x_bows:no_ammo' })
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -954,7 +986,8 @@ function XBowsEntityDef.on_death(self, selfObj, killer)
|
|||
minetest.item_drop(ItemStack(selfObj._arrow_name), nil, vector.round(selfObj._old_pos))
|
||||
end
|
||||
|
||||
--- Function receive a "luaentity" table as `self`. Called on every server tick, after movement and collision processing. `dtime`: elapsed time since last call. `moveresult`: table with collision info (only available if physical=true).
|
||||
--- Function receive a "luaentity" table as `self`. Called on every server tick, after movement and collision processing.
|
||||
---`dtime`: elapsed time since last call. `moveresult`: table with collision info (only available if physical=true).
|
||||
---@param self XBows
|
||||
---@param selfObj EnityCustomAttrDef
|
||||
---@param dtime number
|
||||
|
@ -1049,7 +1082,10 @@ function XBowsEntityDef.on_step(self, selfObj, dtime)
|
|||
and pointed_thing.ref ~= selfObj.object
|
||||
and pointed_thing.ref:get_hp() > 0
|
||||
and (
|
||||
(pointed_thing.ref:is_player() and pointed_thing.ref:get_player_name() ~= selfObj._user:get_player_name())
|
||||
(
|
||||
pointed_thing.ref:is_player()
|
||||
and pointed_thing.ref:get_player_name() ~= selfObj._user:get_player_name()
|
||||
)
|
||||
or (
|
||||
pointed_thing.ref:get_luaentity()
|
||||
and pointed_thing.ref:get_luaentity().physical
|
||||
|
@ -1199,7 +1235,8 @@ function XBowsEntityDef.on_step(self, selfObj, dtime)
|
|||
return
|
||||
end
|
||||
|
||||
---normalize arrow scale when attached to scaled entity (prevents huge arrows when attached to scaled up entity models)
|
||||
---normalize arrow scale when attached to scaled entity
|
||||
---(prevents huge arrows when attached to scaled up entity models)
|
||||
local obj_props = selfObj.object:get_properties()
|
||||
local obj_to_props = pointed_thing.ref:get_properties()
|
||||
local vs = vector.divide(obj_props.visual_size, obj_to_props.visual_size)
|
||||
|
@ -1316,7 +1353,10 @@ function XBowsEntityDef.on_step(self, selfObj, dtime)
|
|||
local projectile_entity = self.registered_arrows[selfObj._arrow_name].custom.projectile_entity
|
||||
|
||||
for _, object in ipairs(minetest.get_objects_inside_radius(pointed_thing.under, 1)) do
|
||||
if not object:is_player() and object:get_luaentity() and object:get_luaentity().name == projectile_entity then
|
||||
if not object:is_player()
|
||||
and object:get_luaentity()
|
||||
and object:get_luaentity().name == projectile_entity
|
||||
then
|
||||
table.insert(children, object)
|
||||
end
|
||||
end
|
||||
|
@ -1373,7 +1413,9 @@ function XBowsEntityDef.on_step(self, selfObj, dtime)
|
|||
selfObj._old_pos = pos
|
||||
end
|
||||
|
||||
---Function receive a "luaentity" table as `self`. Called when somebody punches the object. Note that you probably want to handle most punches using the automatic armor group system. Can return `true` to prevent the default damage mechanism.
|
||||
---Function receive a "luaentity" table as `self`. Called when somebody punches the object.
|
||||
---Note that you probably want to handle most punches using the automatic armor group system.
|
||||
---Can return `true` to prevent the default damage mechanism.
|
||||
---@param self XBows
|
||||
---@param selfObj EnityCustomAttrDef
|
||||
---@param puncher ObjectRef|nil
|
||||
|
@ -1510,6 +1552,7 @@ end
|
|||
---Gets arrow from quiver
|
||||
---@param self XBowsQuiver
|
||||
---@param player ObjectRef
|
||||
---@diagnostic disable-next-line: codestyle-check
|
||||
---@return {["found_arrow_stack"]: ItemStack|nil, ["quiver_id"]: string|nil, ["quiver_name"]: string|nil, ["found_arrow_stack_idx"]: number}
|
||||
function XBowsQuiver.get_itemstack_arrow_from_quiver(self, player)
|
||||
local player_inv = player:get_inventory()
|
||||
|
@ -1591,7 +1634,10 @@ function XBowsQuiver.get_itemstack_arrow_from_quiver(self, player)
|
|||
table.insert(prev_detached_inv_list, detached_inv:get_stack('main', j))
|
||||
|
||||
if not qst:is_empty() and not found_arrow_stack then
|
||||
local is_allowed_ammunition = self:is_allowed_ammunition(wielded_stack:get_name(), qst:get_name())
|
||||
local is_allowed_ammunition = self:is_allowed_ammunition(
|
||||
wielded_stack:get_name(),
|
||||
qst:get_name()
|
||||
)
|
||||
|
||||
if is_allowed_ammunition then
|
||||
quiver_name = st:get_name()
|
||||
|
@ -1990,7 +2036,9 @@ function XBowsQuiver.save(self, inv, player, quiver_is_closed)
|
|||
local quiver_item_name = quiver_is_closed and 'x_bows:quiver' or 'x_bows:quiver_open'
|
||||
local player_quiver_inv_stack = player_inv:get_stack('x_bows:quiver_inv', 1)
|
||||
|
||||
if not player_quiver_inv_stack:is_empty() and player_quiver_inv_stack:get_meta():get_string('quiver_id') == inv_loc.name then
|
||||
if not player_quiver_inv_stack:is_empty()
|
||||
and player_quiver_inv_stack:get_meta():get_string('quiver_id') == inv_loc.name
|
||||
then
|
||||
local st_meta = player_quiver_inv_stack:get_meta()
|
||||
---save inventory items in quiver item meta
|
||||
local string_from_inventory_result = self:get_string_from_inv(inv)
|
||||
|
@ -1998,7 +2046,8 @@ function XBowsQuiver.save(self, inv, player, quiver_is_closed)
|
|||
st_meta:set_string('quiver_items', string_from_inventory_result.inv_string)
|
||||
|
||||
---update description
|
||||
local new_description = player_quiver_inv_stack:get_short_description()..'\n'..string_from_inventory_result.content_description..'\n'
|
||||
local new_description = player_quiver_inv_stack:get_short_description() .. '\n' ..
|
||||
string_from_inventory_result.content_description .. '\n'
|
||||
|
||||
st_meta:set_string('description', new_description)
|
||||
player_inv:set_stack('x_bows:quiver_inv', 1, player_quiver_inv_stack)
|
||||
|
@ -2009,14 +2058,17 @@ function XBowsQuiver.save(self, inv, player, quiver_is_closed)
|
|||
for i, st in ipairs(inv_list) do
|
||||
local st_meta = st:get_meta()
|
||||
|
||||
if not st:is_empty() and st:get_name() == quiver_item_name and st_meta:get_string('quiver_id') == inv_loc.name then
|
||||
if not st:is_empty() and st:get_name() == quiver_item_name
|
||||
and st_meta:get_string('quiver_id') == inv_loc.name
|
||||
then
|
||||
---save inventory items in quiver item meta
|
||||
local string_from_inventory_result = self:get_string_from_inv(inv)
|
||||
|
||||
st_meta:set_string('quiver_items', string_from_inventory_result.inv_string)
|
||||
|
||||
---update description
|
||||
local new_description = st:get_short_description()..'\n'..string_from_inventory_result.content_description..'\n'
|
||||
local new_description = st:get_short_description() .. '\n' ..
|
||||
string_from_inventory_result.content_description .. '\n'
|
||||
|
||||
st_meta:set_string('description', new_description)
|
||||
player_inv:set_stack('main', i, st)
|
||||
|
@ -2037,7 +2089,9 @@ function XBowsQuiver.quiver_can_allow(self, inv, player)
|
|||
local inv_loc = inv:get_location()
|
||||
local player_quiver_inv_stack = player_inv:get_stack('x_bows:quiver_inv', 1)
|
||||
|
||||
if not player_quiver_inv_stack:is_empty() and player_quiver_inv_stack:get_meta():get_string('quiver_id') == inv_loc.name then
|
||||
if not player_quiver_inv_stack:is_empty()
|
||||
and player_quiver_inv_stack:get_meta():get_string('quiver_id') == inv_loc.name
|
||||
then
|
||||
---find quiver in player `quiver_inv` inv list
|
||||
return true
|
||||
elseif player_inv and player_inv:contains_item('main', 'x_bows:quiver_open') then
|
||||
|
@ -2048,7 +2102,9 @@ function XBowsQuiver.quiver_can_allow(self, inv, player)
|
|||
for i, st in ipairs(inv_list) do
|
||||
local st_meta = st:get_meta()
|
||||
|
||||
if not st:is_empty() and st:get_name() == 'x_bows:quiver_open' and st_meta:get_string('quiver_id') == inv_loc.name then
|
||||
if not st:is_empty() and st:get_name() == 'x_bows:quiver_open'
|
||||
and st_meta:get_string('quiver_id') == inv_loc.name
|
||||
then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
@ -2120,7 +2176,9 @@ function XBowsQuiver.sfinv_register_page(self)
|
|||
local x_bows_registered_arrow_def = self.registered_arrows[context._itemstack_arrow:get_name()]
|
||||
|
||||
if x_bows_registered_arrow_def then
|
||||
formspec[#formspec + 1] = 'label[0,1.5;' .. minetest.formspec_escape(context._itemstack_arrow:get_short_description()) .. '\n'.. minetest.formspec_escape(x_bows_registered_arrow_def.custom.description_abilities) ..']'
|
||||
formspec[#formspec + 1] = 'label[0,1.5;' ..
|
||||
minetest.formspec_escape(context._itemstack_arrow:get_short_description()) .. '\n' ..
|
||||
minetest.formspec_escape(x_bows_registered_arrow_def.custom.description_abilities) .. ']'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -2130,7 +2188,8 @@ function XBowsQuiver.sfinv_register_page(self)
|
|||
local quiver_id = st_meta:get_string('quiver_id')
|
||||
|
||||
---description
|
||||
formspec[#formspec + 1] = 'label[3.5,1.5;' .. minetest.formspec_escape(context._itemstack_quiver:get_short_description()) .. ']'
|
||||
formspec[#formspec + 1] = 'label[3.5,1.5;' ..
|
||||
minetest.formspec_escape(context._itemstack_quiver:get_short_description()) .. ']'
|
||||
formspec[#formspec + 1] = 'list[detached:' .. quiver_id .. ';main;4.5,0.5;3,1;]'
|
||||
formspec[#formspec + 1] = 'listring[detached:' .. quiver_id .. ';main]'
|
||||
formspec[#formspec + 1] = 'listring[current_player;main]'
|
||||
|
@ -2187,7 +2246,9 @@ function XBowsQuiver.i3_register_page(self)
|
|||
local x_bows_registered_arrow_def = self.registered_arrows[context._itemstack_arrow:get_name()]
|
||||
|
||||
if x_bows_registered_arrow_def then
|
||||
formspec[#formspec + 1] = 'label[0.5,3;' .. minetest.formspec_escape(context._itemstack_arrow:get_short_description()) .. '\n'.. minetest.formspec_escape(x_bows_registered_arrow_def.custom.description_abilities) ..']'
|
||||
formspec[#formspec + 1] = 'label[0.5,3;' ..
|
||||
minetest.formspec_escape(context._itemstack_arrow:get_short_description()) .. '\n' ..
|
||||
minetest.formspec_escape(x_bows_registered_arrow_def.custom.description_abilities) .. ']'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -2197,7 +2258,8 @@ function XBowsQuiver.i3_register_page(self)
|
|||
local quiver_id = st_meta:get_string('quiver_id')
|
||||
|
||||
---description
|
||||
formspec[#formspec + 1] = 'label[5,3;' .. minetest.formspec_escape(context._itemstack_quiver:get_short_description()) .. ']'
|
||||
formspec[#formspec + 1] = 'label[5,3;' ..
|
||||
minetest.formspec_escape(context._itemstack_quiver:get_short_description()) .. ']'
|
||||
formspec[#formspec + 1] = 'list[detached:' .. quiver_id .. ';main;6.3,1.5;3,1;]'
|
||||
formspec[#formspec + 1] = 'listring[detached:' .. quiver_id .. ';main]'
|
||||
formspec[#formspec + 1] = 'listring[current_player;main]'
|
||||
|
@ -2239,7 +2301,9 @@ function XBowsQuiver.ui_register_page(self)
|
|||
local x_bows_registered_arrow_def = self.registered_arrows[context._itemstack_arrow:get_name()]
|
||||
|
||||
if x_bows_registered_arrow_def then
|
||||
formspec[#formspec + 1] = 'label[0.5,2.5;' .. minetest.formspec_escape(context._itemstack_arrow:get_short_description()) .. '\n'.. minetest.formspec_escape(x_bows_registered_arrow_def.custom.description_abilities) ..']'
|
||||
formspec[#formspec + 1] = 'label[0.5,2.5;' ..
|
||||
minetest.formspec_escape(context._itemstack_arrow:get_short_description()) .. '\n' ..
|
||||
minetest.formspec_escape(x_bows_registered_arrow_def.custom.description_abilities) .. ']'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -2249,7 +2313,8 @@ function XBowsQuiver.ui_register_page(self)
|
|||
local quiver_id = st_meta:get_string('quiver_id')
|
||||
|
||||
---description
|
||||
formspec[#formspec + 1] = 'label[5,2.5;' .. minetest.formspec_escape(context._itemstack_quiver:get_short_description()) .. ']'
|
||||
formspec[#formspec + 1] = 'label[5,2.5;' ..
|
||||
minetest.formspec_escape(context._itemstack_quiver:get_short_description()) .. ']'
|
||||
formspec[#formspec + 1] = unified_inventory.single_slot(6.4, 0.9)
|
||||
formspec[#formspec + 1] = unified_inventory.single_slot(7.65, 0.9)
|
||||
formspec[#formspec + 1] = unified_inventory.single_slot(8.9, 0.9)
|
||||
|
@ -2291,7 +2356,9 @@ function XBowsQuiver.show_3d_quiver(self, player, props)
|
|||
|
||||
---cleanup
|
||||
for index, value in ipairs(textures) do
|
||||
if value == 'x_bows_quiver_blank_mesh.png' or value == 'x_bows_quiver_mesh.png' or value == 'x_bows_quiver_empty_mesh.png' then
|
||||
if value == 'x_bows_quiver_blank_mesh.png' or value == 'x_bows_quiver_mesh.png'
|
||||
or value == 'x_bows_quiver_empty_mesh.png'
|
||||
then
|
||||
table.remove(textures, index)
|
||||
end
|
||||
end
|
||||
|
@ -2350,7 +2417,9 @@ function XBowsQuiver.show_3d_quiver(self, player, props)
|
|||
|
||||
---cleanup
|
||||
for index, value in ipairs(textures) do
|
||||
if value == 'x_bows_quiver_blank_mesh.png' or value == 'x_bows_quiver_mesh.png' or value == 'x_bows_quiver_empty_mesh.png' then
|
||||
if value == 'x_bows_quiver_blank_mesh.png' or value == 'x_bows_quiver_mesh.png'
|
||||
or value == 'x_bows_quiver_empty_mesh.png'
|
||||
then
|
||||
table.remove(textures, index)
|
||||
end
|
||||
end
|
||||
|
@ -2385,7 +2454,9 @@ function XBowsQuiver.hide_3d_quiver(self, player)
|
|||
|
||||
---cleanup
|
||||
for index, value in ipairs(textures) do
|
||||
if value == 'x_bows_quiver_mesh.png' or value == 'x_bows_quiver_blank_mesh.png' or value == 'x_bows_quiver_empty_mesh.png' then
|
||||
if value == 'x_bows_quiver_mesh.png' or value == 'x_bows_quiver_blank_mesh.png'
|
||||
or value == 'x_bows_quiver_empty_mesh.png'
|
||||
then
|
||||
table.remove(textures, index)
|
||||
end
|
||||
end
|
||||
|
@ -2433,7 +2504,9 @@ function XBowsQuiver.hide_3d_quiver(self, player)
|
|||
|
||||
---cleanup
|
||||
for index, value in ipairs(textures) do
|
||||
if value == 'x_bows_quiver_mesh.png' or value == 'x_bows_quiver_blank_mesh.png' or value == 'x_bows_quiver_empty_mesh.png' then
|
||||
if value == 'x_bows_quiver_mesh.png' or value == 'x_bows_quiver_blank_mesh.png'
|
||||
or value == 'x_bows_quiver_empty_mesh.png'
|
||||
then
|
||||
table.remove(textures, index)
|
||||
end
|
||||
end
|
||||
|
|
8
init.lua
8
init.lua
|
@ -311,7 +311,9 @@ minetest.register_globalstep(function(dtime)
|
|||
XBows.player_bow_sneak[player_name] = {}
|
||||
end
|
||||
|
||||
if minetest.get_item_group(wielded_stack_name, 'bow_charged') ~= 0 and not XBows.player_bow_sneak[player_name].sneak then
|
||||
if minetest.get_item_group(wielded_stack_name, 'bow_charged') ~= 0
|
||||
and not XBows.player_bow_sneak[player_name].sneak
|
||||
then
|
||||
--charged weapon
|
||||
if XBows.playerphysics then
|
||||
playerphysics.add_physics_factor(player, 'speed', 'x_bows:bow_charged_speed', 0.25)
|
||||
|
@ -321,7 +323,9 @@ minetest.register_globalstep(function(dtime)
|
|||
|
||||
XBows.player_bow_sneak[player_name].sneak = true
|
||||
player:set_fov(0.9, true, 0.4)
|
||||
elseif minetest.get_item_group(wielded_stack_name, 'bow_charged') == 0 and XBows.player_bow_sneak[player_name].sneak then
|
||||
elseif minetest.get_item_group(wielded_stack_name, 'bow_charged') == 0
|
||||
and XBows.player_bow_sneak[player_name].sneak
|
||||
then
|
||||
if XBows.playerphysics then
|
||||
playerphysics.remove_physics_factor(player, 'speed', 'x_bows:bow_charged_speed')
|
||||
elseif XBows.player_monoids then
|
||||
|
|
|
@ -14,6 +14,15 @@ if (argv.local) {
|
|||
command = 'lua-language-server'
|
||||
}
|
||||
|
||||
// Delete directory recursively
|
||||
try {
|
||||
fs.rmSync(logPath, { recursive: true, force: true })
|
||||
console.log(`Removed folder: ${logPath}`)
|
||||
} catch (err) {
|
||||
console.error(`Error while deleting ${logPath}.`)
|
||||
console.error(err)
|
||||
}
|
||||
|
||||
exec(`${command} --logpath "${logPath}" --check "${checkPath}"`, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.log(`error: ${error.message}`)
|
||||
|
@ -25,6 +34,9 @@ exec(`${command} --logpath "${logPath}" --check "${checkPath}"`, (error, stdout
|
|||
return
|
||||
}
|
||||
|
||||
console.log(`stdout: ${stdout}`)
|
||||
|
||||
if (fs.existsSync('./logs/check.json')) {
|
||||
const rawdata = fs.readFileSync('./logs/check.json')
|
||||
const diagnosticsJson = JSON.parse(rawdata)
|
||||
|
||||
|
@ -36,9 +48,6 @@ exec(`${command} --logpath "${logPath}" --check "${checkPath}"`, (error, stdout
|
|||
})
|
||||
})
|
||||
|
||||
console.log(`stdout: ${stdout}`)
|
||||
|
||||
if (Object.keys(diagnosticsJson).length) {
|
||||
console.error('Fix the errors/warnings above.')
|
||||
process.exit(1)
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
---@field registered_particle_spawners table<string, ParticlespawnerDef|ParticlespawnerDefCustom>
|
||||
---@field registered_entities table<string, XBowsEntityDef>
|
||||
---@field player_bow_sneak table<string, table<string, boolean>>
|
||||
---@field settings {["x_bows_attach_arrows_to_entities"]: boolean, ["x_bows_show_damage_numbers"]: boolean, ["x_bows_show_3d_quiver"]: boolean}
|
||||
---@field settings {["x_bows_attach_arrows_to_entities"]: boolean | nil, ["x_bows_show_damage_numbers"]: boolean | nil, ["x_bows_show_3d_quiver"]: boolean | nil}
|
||||
---@field quiver table Quiver class
|
||||
---@field charge_sound_after_job table<string, JobTable>
|
||||
---@field is_allowed_ammunition fun(self: XBows, weapon_name: string, ammo_name: string): boolean Check if ammunition is allowed to charge this weapon
|
||||
|
|
Ŝarĝante…
Reference in New Issue