Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
minetest_game
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
minetest_game
Commits
efd09022
Commit
efd09022
authored
5 years ago
by
HybridDog
Committed by
Paramat
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fire: Document flammable group, a little code cleanup
parent
dfe6fd65
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
game_api.txt
+2
-0
2 additions, 0 deletions
game_api.txt
mods/fire/init.lua
+12
-11
12 additions, 11 deletions
mods/fire/init.lua
with
14 additions
and
11 deletions
game_api.txt
+
2
−
0
View file @
efd09022
...
...
@@ -362,6 +362,8 @@ The farming API allows you to easily register plants and hoes.
Fire API
--------
Add group flammable when registering a node to make fire seek for it.
Add it to an item to make it burn up when dropped in lava or fire.
New node def property:
`on_burn(pos)`
...
...
This diff is collapsed.
Click to expand it.
mods/fire/init.lua
+
12
−
11
View file @
efd09022
...
...
@@ -320,7 +320,7 @@ if fire_enabled then
interval
=
7
,
chance
=
12
,
catch_up
=
false
,
action
=
function
(
pos
,
node
,
active_object_count
,
active_object_count_wider
)
action
=
function
(
pos
)
local
p
=
minetest
.
find_node_near
(
pos
,
1
,
{
"air"
})
if
p
then
minetest
.
set_node
(
p
,
{
name
=
"fire:basic_flame"
})
...
...
@@ -337,17 +337,18 @@ if fire_enabled then
interval
=
5
,
chance
=
18
,
catch_up
=
false
,
action
=
function
(
pos
,
node
,
active_object_count
,
active_object_count_wider
)
action
=
function
(
pos
)
local
p
=
minetest
.
find_node_near
(
pos
,
1
,
{
"group:flammable"
})
if
p
then
local
flammable_node
=
minetest
.
get_node
(
p
)
local
def
=
minetest
.
registered_nodes
[
flammable_node
.
name
]
if
def
.
on_burn
then
def
.
on_burn
(
p
)
else
minetest
.
remove_node
(
p
)
minetest
.
check_for_falling
(
p
)
end
if
not
p
then
return
end
local
flammable_node
=
minetest
.
get_node
(
p
)
local
def
=
minetest
.
registered_nodes
[
flammable_node
.
name
]
if
def
.
on_burn
then
def
.
on_burn
(
p
)
else
minetest
.
remove_node
(
p
)
minetest
.
check_for_falling
(
p
)
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