Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bows
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
bows
Compare revisions
cb9ec2c5a5b0a0a39bb445454d5774d107b4f2cc to 2eb55a45a3d9fea3144ee010544969a51510ee93
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
Illuna-Minetest/bows
Select target project
No results found
2eb55a45a3d9fea3144ee010544969a51510ee93
Select Git revision
Branches
master
Swap
Target
Illuna-Minetest/bows
Select target project
Illuna-Minetest/bows
1 result
cb9ec2c5a5b0a0a39bb445454d5774d107b4f2cc
Select Git revision
Branches
master
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (3)
Add README.md
· bd662fa1
Milan
authored
5 years ago
bd662fa1
merge patch by jackdavidson
· bb81e3db
Milan
authored
5 years ago
bb81e3db
Merge branch 'master' of
https://git.tchncs.de/Illuna-Minetest/bows
into HEAD
· 2eb55a45
Milan
authored
5 years ago
2eb55a45
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+1
-0
1 addition, 0 deletions
README.md
arrow.lua
+18
-4
18 additions, 4 deletions
arrow.lua
with
19 additions
and
4 deletions
README.md
0 → 100644
View file @
2eb55a45
This is a fork of https://forum.minetest.net/viewtopic.php?t=14384
\ No newline at end of file
This diff is collapsed.
Click to expand it.
arrow.lua
View file @
2eb55a45
...
...
@@ -2,9 +2,18 @@ bows.nothing=function(self,target,hp,user,lastpos)
return
self
end
bows
.
is_in_entity
=
function
(
self
,
ob
)
local
collisionbox
=
ob
:
get_properties
().
collisionbox
return
(
collisionbox
[
1
]
+
ob
:
get_pos
().
x
<=
self
.
object
:
get_pos
().
x
and
collisionbox
[
2
]
+
ob
:
get_pos
().
y
<=
self
.
object
:
get_pos
().
y
and
collisionbox
[
3
]
+
ob
:
get_pos
().
z
<=
self
.
object
:
get_pos
().
z
and
collisionbox
[
4
]
+
ob
:
get_pos
().
x
>=
self
.
object
:
get_pos
().
x
and
collisionbox
[
5
]
+
ob
:
get_pos
().
y
>=
self
.
object
:
get_pos
().
y
and
collisionbox
[
6
]
+
ob
:
get_pos
().
z
>=
self
.
object
:
get_pos
().
z
)
end
bows
.
on_hit_object
=
function
(
self
,
target
,
hp
,
user
,
lastpos
)
target
:
set_hp
(
target
:
get_hp
()
-
hp
)
target
:
punch
(
user
,
1
,
"default:sword_wood"
,
nil
)
target
:
punch
(
user
,
2
,{
full_punch_interval
=
1
.
0
,
damage_groups
=
{
fleshy
=
hp
}},
"default:sword_wood"
,
nil
)
if
target
:
get_hp
()
>
0
then
local
pos
=
self
.
object
:
getpos
()
local
opos
=
target
:
getpos
()
...
...
@@ -121,8 +130,13 @@ minetest.register_entity("bows:arrow",{
self
.
x
=
pos
.
x
self
.
y
=
pos
.
y
self
.
z
=
pos
.
z
for
i
,
ob
in
pairs
(
minetest
.
get_objects_inside_radius
(
pos
,
1
))
do
if
ob
and
((
bows
.
pvp
and
ob
:
is_player
()
and
ob
:
get_player_name
()
~=
self
.
user
:
get_player_name
())
or
(
ob
:
get_luaentity
()
and
ob
:
get_luaentity
().
physical
and
ob
:
get_luaentity
().
bow_arrow
==
nil
and
ob
:
get_luaentity
().
name
~=
"__builtin:item"
))
then
for
i
,
ob
in
pairs
(
minetest
.
get_objects_inside_radius
(
pos
,
3
))
do
if
ob
and
((
bows
.
pvp
and
ob
:
is_player
()
and
ob
:
get_player_name
()
~=
self
.
user
:
get_player_name
())
or
(
ob
:
get_luaentity
()
and
ob
:
get_luaentity
().
physical
and
ob
:
get_luaentity
().
bow_arrow
==
nil
and
ob
:
get_luaentity
().
name
~=
"__builtin:item"
))
and
bows
.
is_in_entity
(
self
,
ob
)
then
self
.
object
:
setvelocity
({
x
=
0
,
y
=
0
,
z
=
0
})
self
.
object
:
setacceleration
({
x
=
0
,
y
=
0
,
z
=
0
})
self
.
stuck
=
true
...
...
This diff is collapsed.
Click to expand it.