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
7b7cd408
Commit
7b7cd408
authored
9 years ago
by
Jean-Patrick Guerrero
Browse files
Options
Downloads
Patches
Plain Diff
Itemframe: fix previous commit
parent
c7e77cbf
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
itemframe.lua
+11
-11
11 additions, 11 deletions
itemframe.lua
with
11 additions
and
11 deletions
itemframe.lua
+
11
−
11
View file @
7b7cd408
local
tmp
,
itemframe
=
{}
,
{}
local
tmp
=
{}
screwdriver
=
screwdriver
or
{}
function
itemframe
:
remove_item
(
pos
,
node
)
local
function
remove_item
(
pos
,
node
)
local
objs
=
minetest
.
get_objects_inside_radius
(
pos
,
0
.
5
)
if
not
objs
then
return
end
...
...
@@ -18,8 +18,8 @@ local facedir = {
{
x
=
0
,
y
=
0
,
z
=-
1
},{
x
=-
1
,
y
=
0
,
z
=
0
}
}
function
itemframe
:
update_item
(
pos
,
node
)
self
:
remove_item
(
pos
,
node
)
local
function
update_item
(
pos
,
node
)
remove_item
(
pos
,
node
)
local
meta
=
minetest
.
get_meta
(
pos
)
local
itemstring
=
meta
:
get_string
(
"item"
)
local
posad
=
facedir
[
node
.
param2
]
...
...
@@ -36,14 +36,14 @@ function itemframe:update_item(pos, node)
entity
:
setyaw
(
yaw
)
end
function
itemframe
:
drop_item
(
pos
,
node
)
local
function
drop_item
(
pos
,
node
)
local
meta
=
minetest
.
get_meta
(
pos
)
local
item
=
meta
:
get_string
(
"item"
)
if
item
==
""
then
return
end
minetest
.
add_item
(
pos
,
item
)
meta
:
set_string
(
"item"
,
""
)
self
:
remove_item
(
pos
,
node
)
remove_item
(
pos
,
node
)
end
minetest
.
register_entity
(
"xdecor:f_item"
,
{
...
...
@@ -100,10 +100,10 @@ xdecor.register("frame", {
local
owner
=
meta
:
get_string
(
"owner"
)
if
player
~=
owner
or
not
itemstack
then
return
end
itemframe
:
drop_item
(
pos
,
node
)
drop_item
(
pos
,
node
)
local
itemstring
=
itemstack
:
take_item
():
to_string
()
meta
:
set_string
(
"item"
,
itemstring
)
itemframe
:
update_item
(
pos
,
node
)
update_item
(
pos
,
node
)
return
itemstack
end
,
...
...
@@ -113,7 +113,7 @@ xdecor.register("frame", {
local
owner
=
meta
:
get_string
(
"owner"
)
if
player
~=
owner
then
return
end
itemframe
:
drop_item
(
pos
,
node
)
drop_item
(
pos
,
node
)
end
,
can_dig
=
function
(
pos
,
player
)
local
meta
=
minetest
.
get_meta
(
pos
)
...
...
@@ -122,7 +122,7 @@ xdecor.register("frame", {
return
player
and
pname
==
owner
end
,
after_destruct
=
itemframe
:
remove_item
(
pos
,
node
)
after_destruct
=
remove_item
})
minetest
.
register_abm
({
...
...
@@ -131,6 +131,6 @@ minetest.register_abm({
action
=
function
(
pos
,
node
)
local
num
=
#
minetest
.
get_objects_inside_radius
(
pos
,
0
.
5
)
if
num
>
0
then
return
end
itemframe
:
update_item
(
pos
,
node
)
update_item
(
pos
,
node
)
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