Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
loud_walking
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
loud_walking
Commits
fb89aa62
Commit
fb89aa62
authored
9 years ago
by
Duane Robertson
Browse files
Options
Downloads
Patches
Plain Diff
Add decorations.
Using simple random checks.
parent
e195b2c6
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
depends.txt
+1
-0
1 addition, 0 deletions
depends.txt
init.lua
+18
-6
18 additions, 6 deletions
init.lua
mapgen.lua
+29
-0
29 additions, 0 deletions
mapgen.lua
with
48 additions
and
6 deletions
depends.txt
+
1
−
0
View file @
fb89aa62
default
flowers
This diff is collapsed.
Click to expand it.
init.lua
+
18
−
6
View file @
fb89aa62
...
...
@@ -25,12 +25,15 @@ if default then
if
default
.
register_blobs
then
default
.
register_blobs
()
end
--if default.register_biomes then
-- default.register_biomes()
--end
--if default.register_decorations then
-- default.register_decorations()
--end
if
default
.
register_biomes
then
default
.
register_biomes
()
end
if
default
.
register_decorations
then
default
.
register_decorations
()
end
if
flowers
.
register_decorations
then
flowers
.
register_decorations
()
end
end
...
...
@@ -82,3 +85,12 @@ dofile(loud_walking.path .. "/mapgen.lua")
minetest
.
register_on_newplayer
(
loud_walking
.
respawn
)
minetest
.
register_on_respawnplayer
(
loud_walking
.
respawn
)
minetest
.
register_on_generated
(
loud_walking
.
generate
)
local
function
deco_list
()
for
i
,
deco
in
pairs
(
minetest
.
registered_decorations
)
do
print
(
dump
(
deco
))
end
end
--deco_list()
This diff is collapsed.
Click to expand it.
mapgen.lua
+
29
−
0
View file @
fb89aa62
...
...
@@ -128,6 +128,29 @@ local function get_biome(px, pz)
return
"deciduous_forest"
end
local
function
get_decoration
(
biome
)
for
i
,
deco
in
pairs
(
minetest
.
registered_decorations
)
do
local
biome_match
=
false
if
deco
.
biomes
then
for
_
,
b
in
pairs
(
deco
.
biomes
)
do
if
biome
==
b
then
biome_match
=
true
end
end
else
biome_match
=
true
end
if
biome_match
and
deco
.
deco_type
==
"simple"
then
if
deco
.
fill_ratio
and
math.random
(
1000
)
<
deco
.
fill_ratio
*
1000
then
return
deco
.
decoration
elseif
math.random
(
1000
)
<
10
then
return
deco
.
decoration
end
end
end
end
function
loud_walking
.
generate
(
p_minp
,
p_maxp
,
seed
)
minp
,
maxp
=
p_minp
,
p_maxp
...
...
@@ -209,6 +232,12 @@ function loud_walking.generate(p_minp, p_maxp, seed)
write
=
true
end
in_cave
=
false
elseif
not
in_cave
and
dy
==
terr
+
41
then
local
deco
=
get_decoration
(
biome
)
if
deco
then
data
[
ivm
]
=
node
(
deco
)
end
write
=
true
elseif
dy
>
terr
+
40
then
data
[
ivm
]
=
node
(
"air"
)
in_cave
=
false
...
...
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