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
56093b66
Commit
56093b66
authored
11 years ago
by
kwolekr
Browse files
Options
Downloads
Patches
Plain Diff
Decoration: Change divlen to sidelen
parent
0a8519a2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
doc/lua_api.txt
+3
-2
3 additions, 2 deletions
doc/lua_api.txt
src/mapgen.cpp
+8
-2
8 additions, 2 deletions
src/mapgen.cpp
src/mapgen.h
+1
-1
1 addition, 1 deletion
src/mapgen.h
src/script/lua_api/luaapi.cpp
+3
-3
3 additions, 3 deletions
src/script/lua_api/luaapi.cpp
with
15 additions
and
8 deletions
doc/lua_api.txt
+
3
−
2
View file @
56093b66
...
...
@@ -1875,8 +1875,9 @@ Decoration definition (register_decoration)
deco_type = "simple", -- See "Decoration types"
place_on = "default:dirt_with_grass",
^ Node that decoration can be placed on
divlen = 8,
^ Number of divisions made in the chunk being generated
sidelen = 8,
^ Size of divisions made in the chunk being generated.
^ If the chunk size is not evenly divisible by sidelen, sidelen is made equal to the chunk size.
fill_ratio = 0.02,
^ Ratio of the area to be uniformly filled by the decoration.
^ Used only if noise_params is not specified.
...
...
This diff is collapsed.
Click to expand it.
src/mapgen.cpp
+
8
−
2
View file @
56093b66
...
...
@@ -232,8 +232,14 @@ void Decoration::placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) {
int
carea_size
=
nmax
.
X
-
nmin
.
X
+
1
;
// Divide area into parts
s16
sidelen
=
carea_size
/
divlen
;
float
area
=
sidelen
*
sidelen
;
if
(
carea_size
%
sidelen
)
{
errorstream
<<
"Decoration::placeDeco: chunk size is not divisible by "
"sidelen; setting sidelen to "
<<
carea_size
<<
std
::
endl
;
sidelen
=
carea_size
;
}
s16
divlen
=
carea_size
/
sidelen
;
int
area
=
sidelen
*
sidelen
;
for
(
s16
z0
=
0
;
z0
<
divlen
;
z0
++
)
for
(
s16
x0
=
0
;
x0
<
divlen
;
x0
++
)
{
...
...
This diff is collapsed.
Click to expand it.
src/mapgen.h
+
1
−
1
View file @
56093b66
...
...
@@ -199,7 +199,7 @@ class Decoration {
int
mapseed
;
std
::
string
place_on_name
;
content_t
c_place_on
;
s16
div
len
;
s16
side
len
;
float
fill_ratio
;
NoiseParams
*
np
;
...
...
This diff is collapsed.
Click to expand it.
src/script/lua_api/luaapi.cpp
+
3
−
3
View file @
56093b66
...
...
@@ -683,7 +683,7 @@ int ModApiBasic::l_register_decoration(lua_State *L)
deco
->
c_place_on
=
CONTENT_IGNORE
;
deco
->
place_on_name
=
getstringfield_default
(
L
,
index
,
"place_on"
,
"ignore"
);
deco
->
div
len
=
getintfield_default
(
L
,
index
,
"
div
len"
,
8
);
deco
->
side
len
=
getintfield_default
(
L
,
index
,
"
side
len"
,
8
);
deco
->
fill_ratio
=
getfloatfield_default
(
L
,
index
,
"fill_ratio"
,
0.02
);
lua_getfield
(
L
,
index
,
"noise_params"
);
...
...
@@ -749,8 +749,8 @@ int ModApiBasic::l_register_decoration(lua_State *L)
break
;
}
}
if
(
deco
->
div
len
<=
0
)
{
errorstream
<<
"register_decoration:
div
len must be "
if
(
deco
->
side
len
<=
0
)
{
errorstream
<<
"register_decoration:
side
len must be "
"greater than 0"
<<
std
::
endl
;
delete
deco
;
return
0
;
...
...
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