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
9ec33f34
Commit
9ec33f34
authored
10 years ago
by
PilzAdam
Browse files
Options
Downloads
Patches
Plain Diff
Set param2 to 1 if player places leaves
parent
2c2edfad
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
game_api.txt
+4
-0
4 additions, 0 deletions
game_api.txt
mods/default/functions.lua
+6
-0
6 additions, 0 deletions
mods/default/functions.lua
mods/default/nodes.lua
+3
-0
3 additions, 0 deletions
mods/default/nodes.lua
with
13 additions
and
0 deletions
game_api.txt
+
4
−
0
View file @
9ec33f34
...
...
@@ -206,5 +206,9 @@ the node can be without decaying.
If param2 of the node is ~= 0, the node will always be preserved. Thus, if
the player places a node of that kind, you will want to set param2=1 or so.
The function default.after_place_leaves can be set as after_place_node of a node
to set param2 to 1 if the player places the node (should not be used for nodes
that use param2 otherwise (e.g. facedir)).
If the node is in the leafdecay_drop group then it will always be dropped as an
item.
This diff is collapsed.
Click to expand it.
mods/default/functions.lua
+
6
−
0
View file @
9ec33f34
...
...
@@ -244,6 +244,12 @@ minetest.register_globalstep(function(dtime)
math.floor
(
dtime
*
finds_per_second
)
end
)
default
.
after_place_leaves
=
function
(
pos
,
placer
,
itemstack
,
pointed_thing
)
local
node
=
minetest
.
get_node
(
pos
)
node
.
param2
=
1
minetest
.
set_node
(
pos
,
node
)
end
minetest
.
register_abm
({
nodenames
=
{
"group:leafdecay"
},
neighbors
=
{
"air"
,
"group:liquid"
},
...
...
This diff is collapsed.
Click to expand it.
mods/default/nodes.lua
+
3
−
0
View file @
9ec33f34
...
...
@@ -277,6 +277,7 @@ minetest.register_node("default:jungleleaves", {
}
},
sounds
=
default
.
node_sound_leaves_defaults
(),
after_place_node
=
default
.
after_place_leaves
,
})
minetest
.
register_node
(
"default:junglesapling"
,
{
...
...
@@ -341,6 +342,7 @@ minetest.register_node("default:leaves", {
}
},
sounds
=
default
.
node_sound_leaves_defaults
(),
after_place_node
=
default
.
after_place_leaves
,
})
minetest
.
register_node
(
"default:cactus"
,
{
...
...
@@ -1505,6 +1507,7 @@ minetest.register_node("default:pine_needles",{
}
},
sounds
=
default
.
node_sound_leaves_defaults
(),
after_place_node
=
default
.
after_place_leaves
,
})
minetest
.
register_node
(
"default:pine_sapling"
,
{
...
...
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