Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
underworlds
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
underworlds
Commits
05047123
Commit
05047123
authored
7 years ago
by
Duane Robertson
Browse files
Options
Downloads
Patches
Plain Diff
Localize get_perlin_map data.
parent
c99b4852
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mapgen.lua
+0
-12
0 additions, 12 deletions
mapgen.lua
undergen.lua
+10
-1
10 additions, 1 deletion
undergen.lua
with
10 additions
and
13 deletions
mapgen.lua
+
0
−
12
View file @
05047123
...
...
@@ -4,8 +4,6 @@
local
DEBUG
=
false
local
max_depth
=
31000
local
seed_noise
=
{
offset
=
0
,
scale
=
32768
,
seed
=
5202
,
spread
=
{
x
=
80
,
y
=
80
,
z
=
80
},
octaves
=
2
,
persist
=
0
.
4
,
lacunarity
=
2
}
-- This tables looks up nodes that aren't already stored.
...
...
@@ -42,16 +40,6 @@ local function generate(p_minp, p_maxp, seed)
local
area
=
VoxelArea
:
new
({
MinEdge
=
emin
,
MaxEdge
=
emax
})
local
csize
=
vector
.
add
(
vector
.
subtract
(
maxp
,
minp
),
1
)
-- use the same seed (based on perlin noise).
do
local
seed
=
minetest
.
get_perlin
(
seed_noise
):
get2d
({
x
=
minp
.
x
,
y
=
minp
.
z
})
if
not
(
seed
and
type
(
seed
)
==
'number'
)
then
return
end
math.randomseed
(
seed
)
end
local
write
=
false
if
not
underworlds_mod
.
underzones
then
return
...
...
This diff is collapsed.
Click to expand it.
undergen.lua
+
10
−
1
View file @
05047123
...
...
@@ -8,6 +8,7 @@ local max_depth = 31000
local
terrain_noise
=
{
offset
=
15
,
scale
=
10
,
seed
=
3721
,
spread
=
{
x
=
40
,
y
=
40
,
z
=
40
},
octaves
=
3
,
persist
=
1
,
lacunarity
=
2
}
local
terrain_map
underworlds_mod
.
undergen
=
function
(
minp
,
maxp
,
data
,
p2data
,
area
,
node
,
underzone
)
...
...
@@ -19,7 +20,15 @@ underworlds_mod.undergen = function(minp, maxp, data, p2data, area, node, underz
local
map_max
=
{
x
=
csize
.
x
,
y
=
csize
.
y
+
2
,
z
=
csize
.
z
}
local
map_min
=
{
x
=
minp
.
x
,
y
=
minp
.
y
-
1
,
z
=
minp
.
z
}
local
terrain
=
minetest
.
get_perlin_map
(
terrain_noise
,
{
x
=
csize
.
x
,
y
=
csize
.
z
}):
get2dMap_flat
({
x
=
minp
.
x
,
y
=
minp
.
z
})
if
not
terrain_map
then
terrain_map
=
minetest
.
get_perlin_map
(
terrain_noise
,
{
x
=
csize
.
x
,
y
=
csize
.
z
})
if
not
terrain_map
then
return
end
end
local
terrain
=
terrain_map
:
get2dMap_flat
({
x
=
minp
.
x
,
y
=
minp
.
z
})
if
not
terrain
then
return
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