Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
illuna-minetest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
illuna-minetest
Commits
e3badd70
Commit
e3badd70
authored
12 years ago
by
kwolekr
Browse files
Options
Downloads
Patches
Plain Diff
Make saplings only grow on dirt or grass, make jungle tree trunks only replace air
parent
6823ce99
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/content_abm.cpp
+17
-2
17 additions, 2 deletions
src/content_abm.cpp
src/treegen.cpp
+18
-10
18 additions, 10 deletions
src/treegen.cpp
with
35 additions
and
12 deletions
src/content_abm.cpp
+
17
−
2
View file @
e3badd70
...
...
@@ -94,7 +94,17 @@ class RemoveGrassABM : public ActiveBlockModifier
class
MakeTreesFromSaplingsABM
:
public
ActiveBlockModifier
{
private:
content_t
c_junglesapling
;
content_t
c_dirt
;
content_t
c_dirt_with_grass
;
public:
MakeTreesFromSaplingsABM
(
ServerEnvironment
*
env
,
INodeDefManager
*
nodemgr
)
{
c_junglesapling
=
nodemgr
->
getId
(
"junglesapling"
);
c_dirt
=
nodemgr
->
getId
(
"mapgen_dirt"
);
c_dirt_with_grass
=
nodemgr
->
getId
(
"mapgen_dirt_with_grass"
);
}
virtual
std
::
set
<
std
::
string
>
getTriggerContents
()
{
std
::
set
<
std
::
string
>
s
;
...
...
@@ -112,7 +122,12 @@ class MakeTreesFromSaplingsABM : public ActiveBlockModifier
INodeDefManager
*
ndef
=
env
->
getGameDef
()
->
ndef
();
ServerMap
*
map
=
&
env
->
getServerMap
();
bool
is_jungle_tree
=
n
.
getContent
()
==
ndef
->
getId
(
"junglesapling"
);
MapNode
n_below
=
map
->
getNodeNoEx
(
p
-
v3s16
(
0
,
1
,
0
));
if
(
n_below
.
getContent
()
!=
c_dirt
&&
n_below
.
getContent
()
!=
c_dirt_with_grass
)
return
;
bool
is_jungle_tree
=
n
.
getContent
()
==
c_junglesapling
;
actionstream
<<
"A "
<<
(
is_jungle_tree
?
"jungle "
:
""
)
<<
"sapling grows into a tree at "
...
...
@@ -187,7 +202,7 @@ void add_legacy_abms(ServerEnvironment *env, INodeDefManager *nodedef)
{
env
->
addActiveBlockModifier
(
new
GrowGrassABM
());
env
->
addActiveBlockModifier
(
new
RemoveGrassABM
());
env
->
addActiveBlockModifier
(
new
MakeTreesFromSaplingsABM
());
env
->
addActiveBlockModifier
(
new
MakeTreesFromSaplingsABM
(
env
,
nodedef
));
if
(
g_settings
->
getBool
(
"liquid_finite"
))
env
->
addActiveBlockModifier
(
new
LiquidFlowABM
(
env
,
nodedef
));
}
This diff is collapsed.
Click to expand it.
src/treegen.cpp
+
18
−
10
View file @
e3badd70
...
...
@@ -528,19 +528,27 @@ void make_jungletree(VoxelManipulator &vmanip, v3s16 p0,
continue
;
v3s16
p1
=
p0
+
v3s16
(
x
,
0
,
z
);
v3s16
p2
=
p0
+
v3s16
(
x
,
-
1
,
z
);
if
(
vmanip
.
m_area
.
contains
(
p2
)
&&
vmanip
.
m_data
[
vmanip
.
m_area
.
index
(
p2
)]
==
CONTENT_AIR
)
vmanip
.
m_data
[
vmanip
.
m_area
.
index
(
p2
)]
=
treenode
;
else
if
(
vmanip
.
m_area
.
contains
(
p1
))
vmanip
.
m_data
[
vmanip
.
m_area
.
index
(
p1
)]
=
treenode
;
u32
vi1
=
vmanip
.
m_area
.
index
(
p1
);
u32
vi2
=
vmanip
.
m_area
.
index
(
p2
);
if
(
vmanip
.
m_area
.
contains
(
p2
)
&&
vmanip
.
m_data
[
vi2
].
getContent
()
==
CONTENT_AIR
)
vmanip
.
m_data
[
vi2
]
=
treenode
;
else
if
(
vmanip
.
m_area
.
contains
(
p1
)
&&
vmanip
.
m_data
[
vi1
].
getContent
()
==
CONTENT_AIR
)
vmanip
.
m_data
[
vi1
]
=
treenode
;
}
vmanip
.
m_data
[
vmanip
.
m_area
.
index
(
p0
)]
=
treenode
;
s16
trunk_h
=
pr
.
range
(
8
,
12
);
v3s16
p1
=
p0
;
for
(
s16
ii
=
0
;
ii
<
trunk_h
;
ii
++
)
for
(
s16
ii
=
0
;
ii
<
trunk_h
;
ii
++
)
{
if
(
vmanip
.
m_area
.
contains
(
p1
))
vmanip
.
m_data
[
vmanip
.
m_area
.
index
(
p1
)]
=
treenode
;
if
(
vmanip
.
m_area
.
contains
(
p1
))
{
u32
vi
=
vmanip
.
m_area
.
index
(
p1
);
if
(
vmanip
.
m_data
[
vi
].
getContent
()
==
CONTENT_AIR
)
vmanip
.
m_data
[
vi
]
=
treenode
;
}
p1
.
Y
++
;
}
...
...
@@ -593,8 +601,8 @@ void make_jungletree(VoxelManipulator &vmanip, v3s16 p0,
if
(
vmanip
.
m_area
.
contains
(
p
)
==
false
)
continue
;
u32
vi
=
vmanip
.
m_area
.
index
(
p
);
if
(
vmanip
.
m_data
[
vi
].
getContent
()
!=
CONTENT_AIR
&&
vmanip
.
m_data
[
vi
].
getContent
()
!=
CONTENT_IGNORE
)
if
(
vmanip
.
m_data
[
vi
].
getContent
()
!=
CONTENT_AIR
&&
vmanip
.
m_data
[
vi
].
getContent
()
!=
CONTENT_IGNORE
)
continue
;
u32
i
=
leaves_a
.
index
(
x
,
y
,
z
);
if
(
leaves_d
[
i
]
==
1
)
...
...
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