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
0b77588e
Commit
0b77588e
authored
11 years ago
by
PilzAdam
Browse files
Options
Downloads
Patches
Plain Diff
Allow multiple 'wherein' nodes in oredef
parent
06cdce1e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/mapgen.cpp
+14
-13
14 additions, 13 deletions
src/mapgen.cpp
src/mapgen.h
+2
-3
2 additions, 3 deletions
src/mapgen.h
src/script/lua_api/luaapi.cpp
+15
-1
15 additions, 1 deletion
src/script/lua_api/luaapi.cpp
with
31 additions
and
17 deletions
src/mapgen.cpp
+
14
−
13
View file @
0b77588e
...
@@ -91,18 +91,17 @@ void Ore::resolveNodeNames(INodeDefManager *ndef) {
...
@@ -91,18 +91,17 @@ void Ore::resolveNodeNames(INodeDefManager *ndef) {
if
(
ore
==
CONTENT_IGNORE
)
{
if
(
ore
==
CONTENT_IGNORE
)
{
errorstream
<<
"Ore::resolveNodeNames: ore node '"
errorstream
<<
"Ore::resolveNodeNames: ore node '"
<<
ore_name
<<
"' not defined"
;
<<
ore_name
<<
"' not defined"
;
ore
=
CONTENT_AIR
;
ore
=
CONTENT_AIR
;
wherein
=
CONTENT_AIR
;
wherein
.
push_back
(
CONTENT_AIR
);
return
;
}
}
}
}
if
(
wherein
==
CONTENT_IGNORE
)
{
for
(
size_t
i
=
0
;
i
!=
wherein_names
.
size
();
i
++
)
{
wherein
=
ndef
->
getId
(
wherein_name
);
std
::
string
name
=
wherein_names
[
i
];
if
(
wherein
==
CONTENT_IGNORE
)
{
content_t
c
=
ndef
->
getId
(
name
);
errorstream
<<
"Ore::resolveNodeNames: wherein node '"
if
(
c
!=
CONTENT_IGNORE
)
{
<<
wherein_name
<<
"' not defined"
;
wherein
.
push_back
(
c
);
ore
=
CONTENT_AIR
;
wherein
=
CONTENT_AIR
;
}
}
}
}
}
}
...
@@ -161,8 +160,9 @@ void OreScatter::generate(ManualMapVoxelManipulator *vm, int seed,
...
@@ -161,8 +160,9 @@ void OreScatter::generate(ManualMapVoxelManipulator *vm, int seed,
continue
;
continue
;
u32
i
=
vm
->
m_area
.
index
(
x0
+
x1
,
y0
+
y1
,
z0
+
z1
);
u32
i
=
vm
->
m_area
.
index
(
x0
+
x1
,
y0
+
y1
,
z0
+
z1
);
if
(
vm
->
m_data
[
i
].
getContent
()
==
wherein
)
for
(
size_t
ii
=
0
;
ii
<
wherein
.
size
();
ii
++
)
vm
->
m_data
[
i
]
=
n_ore
;
if
(
vm
->
m_data
[
i
].
getContent
()
==
wherein
[
ii
])
vm
->
m_data
[
i
]
=
n_ore
;
}
}
}
}
}
}
...
@@ -199,8 +199,9 @@ void OreSheet::generate(ManualMapVoxelManipulator *vm, int seed,
...
@@ -199,8 +199,9 @@ void OreSheet::generate(ManualMapVoxelManipulator *vm, int seed,
if
(
!
vm
->
m_area
.
contains
(
i
))
if
(
!
vm
->
m_area
.
contains
(
i
))
continue
;
continue
;
if
(
vm
->
m_data
[
i
].
getContent
()
==
wherein
)
for
(
size_t
ii
=
0
;
ii
<
wherein
.
size
();
ii
++
)
vm
->
m_data
[
i
]
=
n_ore
;
if
(
vm
->
m_data
[
i
].
getContent
()
==
wherein
[
ii
])
vm
->
m_data
[
i
]
=
n_ore
;
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/mapgen.h
+
2
−
3
View file @
0b77588e
...
@@ -149,9 +149,9 @@ enum OreType {
...
@@ -149,9 +149,9 @@ enum OreType {
class
Ore
{
class
Ore
{
public:
public:
std
::
string
ore_name
;
std
::
string
ore_name
;
std
::
string
wherein_name
;
std
::
vector
<
std
::
string
>
wherein_name
s
;
content_t
ore
;
content_t
ore
;
content_t
wherein
;
// the node to be replaced
std
::
vector
<
content_t
>
wherein
;
// the node to be replaced
u32
clust_scarcity
;
// ore cluster has a 1-in-clust_scarcity chance of appearing at a node
u32
clust_scarcity
;
// ore cluster has a 1-in-clust_scarcity chance of appearing at a node
s16
clust_num_ores
;
// how many ore nodes are in a chunk
s16
clust_num_ores
;
// how many ore nodes are in a chunk
s16
clust_size
;
// how large (in nodes) a chunk of ore is
s16
clust_size
;
// how large (in nodes) a chunk of ore is
...
@@ -165,7 +165,6 @@ class Ore {
...
@@ -165,7 +165,6 @@ class Ore {
Ore
()
{
Ore
()
{
ore
=
CONTENT_IGNORE
;
ore
=
CONTENT_IGNORE
;
wherein
=
CONTENT_IGNORE
;
np
=
NULL
;
np
=
NULL
;
noise
=
NULL
;
noise
=
NULL
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/script/lua_api/luaapi.cpp
+
15
−
1
View file @
0b77588e
...
@@ -672,7 +672,6 @@ int ModApiBasic::l_register_ore(lua_State *L)
...
@@ -672,7 +672,6 @@ int ModApiBasic::l_register_ore(lua_State *L)
ore
->
ore_name
=
getstringfield_default
(
L
,
index
,
"ore"
,
""
);
ore
->
ore_name
=
getstringfield_default
(
L
,
index
,
"ore"
,
""
);
ore
->
ore_param2
=
(
u8
)
getintfield_default
(
L
,
index
,
"ore_param2"
,
0
);
ore
->
ore_param2
=
(
u8
)
getintfield_default
(
L
,
index
,
"ore_param2"
,
0
);
ore
->
wherein_name
=
getstringfield_default
(
L
,
index
,
"wherein"
,
""
);
ore
->
clust_scarcity
=
getintfield_default
(
L
,
index
,
"clust_scarcity"
,
1
);
ore
->
clust_scarcity
=
getintfield_default
(
L
,
index
,
"clust_scarcity"
,
1
);
ore
->
clust_num_ores
=
getintfield_default
(
L
,
index
,
"clust_num_ores"
,
1
);
ore
->
clust_num_ores
=
getintfield_default
(
L
,
index
,
"clust_num_ores"
,
1
);
ore
->
clust_size
=
getintfield_default
(
L
,
index
,
"clust_size"
,
0
);
ore
->
clust_size
=
getintfield_default
(
L
,
index
,
"clust_size"
,
0
);
...
@@ -681,6 +680,21 @@ int ModApiBasic::l_register_ore(lua_State *L)
...
@@ -681,6 +680,21 @@ int ModApiBasic::l_register_ore(lua_State *L)
ore
->
flags
=
getflagsfield
(
L
,
index
,
"flags"
,
flagdesc_ore
);
ore
->
flags
=
getflagsfield
(
L
,
index
,
"flags"
,
flagdesc_ore
);
ore
->
nthresh
=
getfloatfield_default
(
L
,
index
,
"noise_threshhold"
,
0.
);
ore
->
nthresh
=
getfloatfield_default
(
L
,
index
,
"noise_threshhold"
,
0.
);
lua_getfield
(
L
,
index
,
"wherein"
);
if
(
lua_istable
(
L
,
-
1
))
{
int
i
=
lua_gettop
(
L
);
lua_pushnil
(
L
);
while
(
lua_next
(
L
,
i
)
!=
0
)
{
ore
->
wherein_names
.
push_back
(
lua_tostring
(
L
,
-
1
));
lua_pop
(
L
,
1
);
}
}
else
if
(
lua_isstring
(
L
,
-
1
))
{
ore
->
wherein_names
.
push_back
(
lua_tostring
(
L
,
-
1
));
}
else
{
ore
->
wherein_names
.
push_back
(
""
);
}
lua_pop
(
L
,
1
);
lua_getfield
(
L
,
index
,
"noise_params"
);
lua_getfield
(
L
,
index
,
"noise_params"
);
ore
->
np
=
read_noiseparams
(
L
,
-
1
);
ore
->
np
=
read_noiseparams
(
L
,
-
1
);
lua_pop
(
L
,
1
);
lua_pop
(
L
,
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