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
c455ba9b
Commit
c455ba9b
authored
12 years ago
by
PilzAdam
Browse files
Options
Downloads
Patches
Plain Diff
Fix dry shrubs being placed in cacti and fix incorrect comments
parent
165da934
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mods/default/mapgen.lua
+11
-6
11 additions, 6 deletions
mods/default/mapgen.lua
with
11 additions
and
6 deletions
mods/default/mapgen.lua
+
11
−
6
View file @
c455ba9b
...
...
@@ -257,11 +257,11 @@ minetest.register_on_generated(function(minp, maxp, seed)
local
z0
=
minp
.
z
+
math.floor
((
divz
+
0
)
*
divlen
)
local
x1
=
minp
.
x
+
math.floor
((
divx
+
1
)
*
divlen
)
local
z1
=
minp
.
z
+
math.floor
((
divz
+
1
)
*
divlen
)
-- Determine
cactu
s amount from perlin noise
local
cactus
_amount
=
math.floor
(
perlin1
:
get2d
({
x
=
x0
,
y
=
z0
})
*
5
+
0
)
-- Find random positions for
cactu
s based on this random
-- Determine
dry shrub
s amount from perlin noise
local
shrub
_amount
=
math.floor
(
perlin1
:
get2d
({
x
=
x0
,
y
=
z0
})
*
5
+
0
)
-- Find random positions for
dry shrub
s based on this random
local
pr
=
PseudoRandom
(
seed
+
1
)
for
i
=
0
,
cactus
_amount
do
for
i
=
0
,
shrub
_amount
do
local
x
=
pr
:
next
(
x0
,
x1
)
local
z
=
pr
:
next
(
z0
,
z1
)
-- Find ground level (0...15)
...
...
@@ -272,9 +272,14 @@ minetest.register_on_generated(function(minp, maxp, seed)
break
end
end
-- If desert sand, make
cactus
-- If desert sand, make
dry shrub
if
ground_y
and
minetest
.
env
:
get_node
({
x
=
x
,
y
=
ground_y
,
z
=
z
}).
name
==
"default:desert_sand"
then
minetest
.
env
:
set_node
({
x
=
x
,
y
=
ground_y
+
1
,
z
=
z
},
{
name
=
"default:dry_shrub"
})
local
p
=
{
x
=
x
,
y
=
ground_y
+
1
,
z
=
z
}
local
nn
=
minetest
.
env
:
get_node
(
p
).
name
if
minetest
.
registered_nodes
[
nn
]
and
minetest
.
registered_nodes
[
nn
].
buildable_to
then
minetest
.
env
:
set_node
(
p
,
{
name
=
"default:dry_shrub"
})
end
end
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