Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
minetest_game
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
minetest_game
Commits
8f85ca57
Commit
8f85ca57
authored
7 years ago
by
paramat
Committed by
paramat
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Intersects_protection(): Remove from Minetest Game
Add compatibility code with deprecation warning.
parent
496a1a24
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
mods/default/functions.lua
+0
-40
0 additions, 40 deletions
mods/default/functions.lua
mods/default/legacy.lua
+7
-0
7 additions, 0 deletions
mods/default/legacy.lua
mods/default/trees.lua
+1
-1
1 addition, 1 deletion
mods/default/trees.lua
with
8 additions
and
41 deletions
mods/default/functions.lua
+
0
−
40
View file @
8f85ca57
...
...
@@ -497,46 +497,6 @@ minetest.register_abm({
})
--
-- Checks if specified volume intersects a protected volume
--
function
default
.
intersects_protection
(
minp
,
maxp
,
player_name
,
interval
)
-- 'interval' is the largest allowed interval for the 3D lattice of checks
-- Compute the optimal float step 'd' for each axis so that all corners and
-- borders are checked. 'd' will be smaller or equal to 'interval'.
-- Subtracting 1e-4 ensures that the max co-ordinate will be reached by the
-- for loop (which might otherwise not be the case due to rounding errors).
local
d
=
{}
for
_
,
c
in
pairs
({
"x"
,
"y"
,
"z"
})
do
if
maxp
[
c
]
>
minp
[
c
]
then
d
[
c
]
=
(
maxp
[
c
]
-
minp
[
c
])
/
math.ceil
((
maxp
[
c
]
-
minp
[
c
])
/
interval
)
-
1e-4
elseif
maxp
[
c
]
==
minp
[
c
]
then
d
[
c
]
=
1
-- Any value larger than 0 to avoid division by zero
else
-- maxp[c] < minp[c], print error and treat as protection intersected
minetest
.
log
(
"error"
,
"maxp < minp in 'default.intersects_protection()'"
)
return
true
end
end
for
zf
=
minp
.
z
,
maxp
.
z
,
d
.
z
do
local
z
=
math.floor
(
zf
+
0
.
5
)
for
yf
=
minp
.
y
,
maxp
.
y
,
d
.
y
do
local
y
=
math.floor
(
yf
+
0
.
5
)
for
xf
=
minp
.
x
,
maxp
.
x
,
d
.
x
do
local
x
=
math.floor
(
xf
+
0
.
5
)
if
minetest
.
is_protected
({
x
=
x
,
y
=
y
,
z
=
z
},
player_name
)
then
return
true
end
end
end
end
return
false
end
--
-- Coral death near air
--
...
...
This diff is collapsed.
Click to expand it.
mods/default/legacy.lua
+
7
−
0
View file @
8f85ca57
...
...
@@ -37,3 +37,10 @@ end
-- Chests
default
.
register_chest
=
default
.
chest
.
register_chest
-- Check for a volume intersecting protection
function
default
.
intersects_protection
(
minp
,
maxp
,
player_name
,
interval
)
minetest
.
log
(
"warning"
,
"default.intersects_protection() is "
..
"deprecated, use minetest.intersects_protection() instead."
)
minetest
.
intersects_protection
(
minp
,
maxp
,
player_name
,
interval
)
end
This diff is collapsed.
Click to expand it.
mods/default/trees.lua
+
1
−
1
View file @
8f85ca57
...
...
@@ -490,7 +490,7 @@ function default.sapling_on_place(itemstack, placer, pointed_thing,
return
itemstack
end
-- Check tree volume for protection
if
defaul
t
.
intersects_protection
(
if
minetes
t
.
intersects_protection
(
vector
.
add
(
pos
,
minp_relative
),
vector
.
add
(
pos
,
maxp_relative
),
player_name
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment