Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Illuna-Minetest
bows
Commits
2aa82e65
Commit
2aa82e65
authored
Dec 16, 2021
by
Milan
Browse files
punch api update: basic crash fix
parent
2eb55a45
Changes
2
Hide whitespace changes
Inline
Side-by-side
arrow.lua
View file @
2aa82e65
...
...
@@ -13,7 +13,7 @@ bows.is_in_entity=function(self,ob)
end
bows
.
on_hit_object
=
function
(
self
,
target
,
hp
,
user
,
lastpos
)
target
:
punch
(
user
,
2
,{
full_punch_interval
=
1
.
0
,
damage_groups
=
{
fleshy
=
hp
}},
"default:sword_wood"
,
nil
)
target
:
punch
(
user
,
2
,{
full_punch_interval
=
1
.
0
,
damage_groups
=
{
fleshy
=
hp
}},
nil
)
if
target
:
get_hp
()
>
0
then
local
pos
=
self
.
object
:
getpos
()
local
opos
=
target
:
getpos
()
...
...
@@ -54,9 +54,9 @@ end
bows
.
arrow_remove
=
function
(
self
)
if
self
.
object
:
get_attach
()
then
self
.
object
:
set_detach
()
end
if
self
.
target
then
self
.
target
:
punch
(
self
.
object
,
{
full_punch_interval
=
1
,
damage_groups
=
{
fleshy
=
4
}},
"default:bronze_pick"
,
nil
)
end
if
self
.
target
then
self
.
target
:
punch
(
self
.
object
,
1
.
0
,
{
full_punch_interval
=
1
,
damage_groups
=
{
fleshy
=
4
}},
nil
)
end
self
.
object
:
set_hp
(
0
)
self
.
object
:
punch
(
self
.
object
,
{
full_punch_interval
=
1
.
0
,
damage_groups
=
{
fleshy
=
4
}},
"bows:bow_wood"
,
nil
)
self
.
object
:
punch
(
self
.
object
,
1
.
0
,
{
full_punch_interval
=
1
.
0
,
damage_groups
=
{
fleshy
=
4
}},
nil
)
return
self
end
...
...
items_functions.lua
View file @
2aa82e65
...
...
@@ -20,7 +20,7 @@ bows.arrow_toxic=function(self,target,hp,user,lastpos)
bows
.
arrow_remove
(
self
)
return
self
end
target
:
punch
(
user
,
3
,{
full_punch_interval
=
1
.
0
,
damage_groups
=
{
fleshy
=
4
}},
"default:sword_wood"
,
nil
)
target
:
punch
(
user
,
3
,{
full_punch_interval
=
1
.
0
,
damage_groups
=
{
fleshy
=
4
}},
nil
)
local
rnd
=
math.random
(
1
,
10
)
if
rnd
~=
4
and
target
:
get_hp
()
>
0
then
minetest
.
after
(
math.random
(
0
.
5
,
2
),
function
(
self
,
target
,
hp
,
user
,
lastpos
)
...
...
@@ -88,4 +88,4 @@ bows.arrow_rainbow_step=function(self,dtime,user,pos,lastpos)
maxsize
=
9
,
texture
=
"bows_rainbow.png"
,
})
end
\ No newline at end of file
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment