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
28d9e747
Commit
28d9e747
authored
9 years ago
by
Jean-Patrick Guerrero
Browse files
Options
Downloads
Patches
Plain Diff
Revert "Convert cauldrons & itemframe ABMs to node timers"
This reverts commit
7c647948
.
parent
22e06a66
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cooking.lua
+54
-62
54 additions, 62 deletions
cooking.lua
itemframe.lua
+9
-10
9 additions, 10 deletions
itemframe.lua
with
63 additions
and
72 deletions
cooking.lua
+
54
−
62
View file @
28d9e747
...
...
@@ -43,30 +43,16 @@ xdecor.register("cauldron_idle", {
on_rotate
=
screwdriver
.
rotate_simple
,
tiles
=
{
"xdecor_cauldron_top_idle.png"
,
"xdecor_cauldron_sides.png"
},
drop
=
"xdecor:cauldron_empty"
,
infotext
=
"Cauldron (idle)"
,
collision_box
=
xdecor
.
pixelbox
(
16
,
cauldron_cbox
),
on_rightclick
=
fill_water_bucket
,
on_construct
=
function
(
pos
)
local
meta
=
minetest
.
get_meta
(
pos
)
local
timer
=
minetest
.
get_node_timer
(
pos
)
meta
:
set_string
(
"infotext"
,
"Cauldron (idle)"
)
timer
:
start
(
10
.
0
)
end
,
on_timer
=
function
(
pos
)
local
below_node
=
{
x
=
pos
.
x
,
y
=
pos
.
y
-
1
,
z
=
pos
.
z
}
if
not
minetest
.
get_node
(
below_node
).
name
:
find
(
"fire"
)
then
timer
:
stop
()
return
end
minetest
.
set_node
(
pos
,
{
name
=
"xdecor:cauldron_boiling_water"
})
return
true
end
on_rightclick
=
fill_water_bucket
})
xdecor
.
register
(
"cauldron_boiling_water"
,
{
groups
=
{
cracky
=
2
,
oddly_breakable_by_hand
=
1
,
not_in_creative_inventory
=
1
},
on_rotate
=
screwdriver
.
rotate_simple
,
drop
=
"xdecor:cauldron_empty"
,
infotext
=
"Cauldron (active) - Drop foods inside to make a soup"
,
damage_per_second
=
2
,
tiles
=
{
{
name
=
"xdecor_cauldron_top_anim_boiling_water.png"
,
...
...
@@ -74,51 +60,7 @@ xdecor.register("cauldron_boiling_water", {
"xdecor_cauldron_sides.png"
},
collision_box
=
xdecor
.
pixelbox
(
16
,
cauldron_cbox
),
on_rightclick
=
fill_water_bucket
,
on_construct
=
function
(
pos
)
local
meta
=
minetest
.
get_meta
(
pos
)
local
timer
=
minetest
.
get_node_timer
(
pos
)
meta
:
set_string
(
"infotext"
,
"Cauldron (active) - Drop some foods inside to make a soup"
)
timer
:
start
(
3
.
0
)
end
,
on_timer
=
function
(
pos
)
local
timer
=
minetest
.
get_node_timer
(
pos
)
local
objs
=
minetest
.
get_objects_inside_radius
(
pos
,
0
.
5
)
if
not
objs
then
timer
:
stop
()
return
end
local
ingredients
=
{}
for
_
,
obj
in
pairs
(
objs
)
do
if
obj
and
obj
:
get_luaentity
()
then
local
itemstring
=
obj
:
get_luaentity
().
itemstring
:
match
(
":([%w_]+)"
)
if
not
next
(
ingredients
)
then
for
_
,
rep
in
pairs
(
ingredients
)
do
if
itemstring
==
rep
then
return
end
end
end
for
_
,
ing
in
pairs
(
ingredients_list
)
do
if
itemstring
and
itemstring
:
find
(
ing
)
then
ingredients
[
#
ingredients
+
1
]
=
itemstring
end
end
end
end
if
#
ingredients
>=
2
then
for
_
,
obj
in
pairs
(
objs
)
do
if
obj
and
obj
:
get_luaentity
()
then
obj
:
remove
()
end
end
minetest
.
set_node
(
pos
,
{
name
=
"xdecor:cauldron_soup"
})
end
local
node_under
=
{
x
=
pos
.
x
,
y
=
pos
.
y
-
1
,
z
=
pos
.
z
}
if
not
minetest
.
get_node
(
node_under
).
name
:
find
(
"fire"
)
then
minetest
.
set_node
(
pos
,
{
name
=
"xdecor:cauldron_idle"
})
end
return
true
end
on_rightclick
=
fill_water_bucket
})
xdecor
.
register
(
"cauldron_soup"
,
{
...
...
@@ -157,3 +99,53 @@ xdecor.register("cauldron_soup", {
end
})
minetest
.
register_abm
({
nodenames
=
{
"xdecor:cauldron_idle"
},
interval
=
15
,
chance
=
1
,
action
=
function
(
pos
,
node
)
local
below_node
=
{
x
=
pos
.
x
,
y
=
pos
.
y
-
1
,
z
=
pos
.
z
}
if
minetest
.
get_node
(
below_node
).
name
:
find
(
"fire"
)
then
minetest
.
set_node
(
pos
,
{
name
=
"xdecor:cauldron_boiling_water"
,
param2
=
node
.
param2
})
end
end
})
minetest
.
register_abm
({
nodenames
=
{
"xdecor:cauldron_boiling_water"
},
interval
=
5
,
chance
=
1
,
action
=
function
(
pos
,
node
)
local
objs
=
minetest
.
get_objects_inside_radius
(
pos
,
0
.
5
)
if
not
objs
then
return
end
local
ingredients
=
{}
for
_
,
obj
in
pairs
(
objs
)
do
if
obj
and
obj
:
get_luaentity
()
then
local
itemstring
=
obj
:
get_luaentity
().
itemstring
:
match
(
":([%w_]+)"
)
if
not
next
(
ingredients
)
then
for
_
,
rep
in
pairs
(
ingredients
)
do
if
itemstring
==
rep
then
return
end
end
end
for
_
,
ing
in
pairs
(
ingredients_list
)
do
if
itemstring
and
itemstring
:
find
(
ing
)
then
ingredients
[
#
ingredients
+
1
]
=
itemstring
end
end
end
end
if
#
ingredients
>=
2
then
for
_
,
obj
in
pairs
(
objs
)
do
if
obj
and
obj
:
get_luaentity
()
then
obj
:
remove
()
end
end
minetest
.
set_node
(
pos
,
{
name
=
"xdecor:cauldron_soup"
,
param2
=
node
.
param2
})
end
local
node_under
=
{
x
=
pos
.
x
,
y
=
pos
.
y
-
1
,
z
=
pos
.
z
}
if
not
minetest
.
get_node
(
node_under
).
name
:
find
(
"fire"
)
then
minetest
.
set_node
(
pos
,
{
name
=
"xdecor:cauldron_idle"
,
param2
=
node
.
param2
})
end
end
})
This diff is collapsed.
Click to expand it.
itemframe.lua
+
9
−
10
View file @
28d9e747
...
...
@@ -90,19 +90,9 @@ xdecor.register("frame", {
"xdecor_wood.png"
,
"xdecor_wood.png"
,
"xdecor_wood.png"
,
"xdecor_wood.png"
,
"xdecor_wood.png"
,
"xdecor_frame.png"
},
on_timer
=
function
(
pos
)
local
timer
=
minetest
.
get_node_timer
(
pos
)
local
num
=
#
minetest
.
get_objects_inside_radius
(
pos
,
0
.
5
)
if
num
>
0
then
timer
:
stop
()
return
end
update_item
(
pos
,
node
)
return
true
end
,
after_place_node
=
function
(
pos
,
placer
,
itemstack
)
local
meta
=
minetest
.
get_meta
(
pos
)
local
name
=
placer
:
get_player_name
()
local
timer
=
minetest
.
get_node_timer
(
pos
)
timer
:
start
(
15
.
0
)
meta
:
set_string
(
"owner"
,
name
)
meta
:
set_string
(
"infotext"
,
"Item Frame (owned by "
..
name
..
")"
)
...
...
@@ -142,3 +132,12 @@ xdecor.register("frame", {
after_destruct
=
remove_item
})
minetest
.
register_abm
({
nodenames
=
{
"xdecor:frame"
},
interval
=
15
,
chance
=
1
,
action
=
function
(
pos
,
node
)
local
num
=
#
minetest
.
get_objects_inside_radius
(
pos
,
0
.
5
)
if
num
>
0
then
return
end
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