1
0
mirror of https://gitlab.com/echoes91/spears.git synced 2024-11-13 13:20:19 +01:00

Update file functions.lua

This commit is contained in:
Echoes 2024-02-07 21:52:24 +00:00
parent 57c840451c
commit 60c0656cd1

View File

@ -15,10 +15,10 @@ function spears_throw (itemstack, player, pointed_thing)
local check_node = spears_check_node(node.name)
if check_node == nil then
return false
elseif check_node == SPEARS_NODE_CRACKY then
elseif check_node == 'cracky' then
minetest.sound_play("default_metal_footstep", {pos = pointed_a}, true)
return false
elseif check_node == SPEARS_NODE_STICKY then
elseif check_node == 'sticky' then
local spear_object = minetest.add_entity(vector.divide(vector.add(vector.multiply(pointed_a, 2), pointed_b), 3), spear)
spear_object:set_rotation(rotation)
spear_object:get_luaentity()._wear = wear
@ -80,7 +80,7 @@ function spears_set_entity(spear_type, base_damage, toughness)
if self._stickpos ~= nil then -- Spear is stuck
local node = minetest.get_node(self._stickpos)
local check_node = spears_check_node(node.name)
if check_node ~= SPEARS_NODE_STICKY then -- Fall when node is removed
if check_node ~= 'sticky' then -- Fall when node is removed
self.object:remove()
minetest.add_item(pos, {name='spears:spear_' .. spear_type, wear = wear})
return false
@ -107,7 +107,7 @@ function spears_set_entity(spear_type, base_damage, toughness)
-- Hit a node?
local node = minetest.get_node(spearhead_pos)
local check_node = spears_check_node(node.name)
if check_node == SPEARS_NODE_UNKNOWN then
if check_node == nil then
self.object:remove()
minetest.add_item(pos, {name='spears:spear_' .. spear_type, wear = wear})
elseif check_node ~= 'through' then