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
06c3a6f4
Commit
06c3a6f4
authored
9 years ago
by
kilbith
Browse files
Options
Downloads
Patches
Plain Diff
Enchant table : Add a book entity over the table
parent
a64dbfca
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
enchanting.lua
+33
-0
33 additions, 0 deletions
enchanting.lua
textures/xdecor_book_open.png
+0
-0
0 additions, 0 deletions
textures/xdecor_book_open.png
with
33 additions
and
0 deletions
enchanting.lua
+
33
−
0
View file @
06c3a6f4
...
...
@@ -110,6 +110,29 @@ function enchanting.construct(pos)
local
inv
=
meta
:
get_inventory
()
inv
:
set_size
(
"tool"
,
1
)
inv
:
set_size
(
"mese"
,
1
)
minetest
.
add_entity
({
x
=
pos
.
x
,
y
=
pos
.
y
+
0
.
85
,
z
=
pos
.
z
},
"xdecor:book_open"
)
local
timer
=
minetest
.
get_node_timer
(
pos
)
timer
:
start
(
15
.
0
)
end
function
enchanting
.
destruct
(
pos
)
for
_
,
obj
in
pairs
(
minetest
.
get_objects_inside_radius
(
pos
,
0
.
9
))
do
if
obj
and
obj
:
get_luaentity
()
and
obj
:
get_luaentity
().
name
==
"xdecor:book_open"
then
obj
:
remove
()
break
end
end
end
function
enchanting
.
timer
(
pos
)
local
node
=
minetest
.
get_node
(
pos
)
local
num
=
#
minetest
.
get_objects_inside_radius
(
pos
,
0
.
9
)
if
num
==
0
then
minetest
.
add_entity
({
x
=
pos
.
x
,
y
=
pos
.
y
+
0
.
85
,
z
=
pos
.
z
},
"xdecor:book_open"
)
end
return
true
end
xdecor
.
register
(
"enchantment_table"
,
{
...
...
@@ -121,7 +144,9 @@ xdecor.register("enchantment_table", {
sounds
=
default
.
node_sound_stone_defaults
(),
on_rotate
=
screwdriver
.
rotate_simple
,
can_dig
=
enchanting
.
dig
,
on_timer
=
enchanting
.
timer
,
on_construct
=
enchanting
.
construct
,
on_destruct
=
enchanting
.
destruct
,
on_receive_fields
=
enchanting
.
fields
,
on_metadata_inventory_put
=
enchanting
.
on_put
,
on_metadata_inventory_take
=
enchanting
.
on_take
,
...
...
@@ -129,6 +154,14 @@ xdecor.register("enchantment_table", {
allow_metadata_inventory_move
=
function
()
return
0
end
})
minetest
.
register_entity
(
"xdecor:book_open"
,
{
visual
=
"sprite"
,
visual_size
=
{
x
=
0
.
75
,
y
=
0
.
75
},
collisionbox
=
{
0
},
physical
=
false
,
textures
=
{
"xdecor_book_open.png"
}
})
local
function
cap
(
S
)
return
S
:
gsub
(
"^%l"
,
string.upper
)
end
function
enchanting
:
register_tools
(
mod
,
def
)
...
...
This diff is collapsed.
Click to expand it.
textures/xdecor_book_open.png
0 → 100644
+
0
−
0
View file @
06c3a6f4
242 B
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