Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xdecor
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
xdecor
Commits
480e55ed
Commit
480e55ed
authored
8 years ago
by
Tim
Browse files
Options
Downloads
Patches
Plain Diff
Fix rope protection handling and get rid of a global callback.
parent
0bba88c7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
rope.lua
+9
-8
9 additions, 8 deletions
rope.lua
with
9 additions
and
8 deletions
rope.lua
+
9
−
8
View file @
480e55ed
local
rope
=
{}
-- Code by Mirko K. (modified by Temperest, Wulfsdad and kilbith) (License: GPL).
minetest
.
register_on_punchnode
(
function
(
pos
,
oldnode
,
digger
)
if
oldnode
.
name
==
"xdecor:rope"
then
rope
:
remove
(
pos
,
oldnode
,
digger
,
"xdecor:rope"
)
end
end
)
function
rope
.
place
(
itemstack
,
placer
,
pointed_thing
)
if
pointed_thing
.
type
==
"node"
then
local
pos
=
pointed_thing
.
above
...
...
@@ -27,7 +21,7 @@ function rope.place(itemstack, placer, pointed_thing)
return
itemstack
end
function
rope
:
remove
(
pos
,
oldnode
,
digger
,
rope_name
)
function
rope
.
remove
(
pos
,
oldnode
,
digger
,
rope_name
)
local
num
=
0
local
below
=
{
x
=
pos
.
x
,
y
=
pos
.
y
,
z
=
pos
.
z
}
local
digger_inv
=
digger
:
get_inventory
()
...
...
@@ -52,5 +46,12 @@ xdecor.register("rope", {
inventory_image
=
"xdecor_rope_inv.png"
,
wield_image
=
"xdecor_rope_inv.png"
,
selection_box
=
xdecor
.
pixelbox
(
8
,
{{
3
,
0
,
3
,
2
,
8
,
2
}}),
on_place
=
rope
.
place
on_place
=
rope
.
place
,
on_punch
=
function
(
pos
,
node
,
puncher
,
pointed_thing
)
local
player_name
=
puncher
:
get_player_name
()
if
not
minetest
.
is_protected
(
pos
,
player_name
)
or
minetest
.
get_player_privs
(
player_name
).
protection_bypass
then
rope
.
remove
(
pos
,
node
,
puncher
,
"xdecor:rope"
)
end
end
})
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