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
619c0238
Commit
619c0238
authored
9 years ago
by
Jean-Patrick Guerrero
Browse files
Options
Downloads
Patches
Plain Diff
Hive : stop timer when stack reaches max honey stack
parent
0422b28d
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
hive.lua
+12
-2
12 additions, 2 deletions
hive.lua
with
12 additions
and
2 deletions
hive.lua
+
12
−
2
View file @
619c0238
local
hive
=
{}
local
honey_max
=
16
function
hive
.
construct
(
pos
)
local
meta
=
minetest
.
get_meta
(
pos
)
...
...
@@ -34,8 +35,11 @@ function hive.timer(pos)
local
maxp
=
vector
.
add
(
pos
,
radius
)
local
flowers
=
minetest
.
find_nodes_in_area_under_air
(
minp
,
maxp
,
"group:flower"
)
if
#
flowers
>
2
and
honey
<
16
then
if
#
flowers
>
2
and
honey
<
honey_max
then
inv
:
add_item
(
"honey"
,
"xdecor:honey"
)
elseif
honey
==
honey_max
then
local
timer
=
minetest
.
get_node_timer
(
pos
)
timer
:
stop
()
return
true
end
return
true
end
...
...
@@ -55,6 +59,12 @@ xdecor.register("hive", {
on_punch
=
function
(
_
,
_
,
puncher
)
puncher
:
set_hp
(
puncher
:
get_hp
()
-
2
)
end
,
allow_metadata_inventory_put
=
function
()
return
0
end
allow_metadata_inventory_put
=
function
()
return
0
end
,
on_metadata_inventory_take
=
function
(
pos
,
_
,
_
,
stack
)
if
stack
:
get_count
()
==
honey_max
then
local
timer
=
minetest
.
get_node_timer
(
pos
)
timer
:
start
(
math.random
(
64
,
128
))
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