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
c1638590
Commit
c1638590
authored
11 years ago
by
kwolekr
Browse files
Options
Downloads
Patches
Plain Diff
Schematic: Add force_placement parameter to minetest.place_structure API
parent
3570f3e3
Branches
Branches containing commit
Tags
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
-1
3 additions, 1 deletion
doc/lua_api.txt
src/mapgen.cpp
+2
-2
2 additions, 2 deletions
src/mapgen.cpp
src/mapgen.h
+1
-1
1 addition, 1 deletion
src/mapgen.h
src/script/lua_api/l_mapgen.cpp
+6
-3
6 additions, 3 deletions
src/script/lua_api/l_mapgen.cpp
with
12 additions
and
7 deletions
doc/lua_api.txt
+
3
−
1
View file @
c1638590
...
...
@@ -1595,11 +1595,13 @@ minetest.create_schematic(p1, p2, probability_list, filename, slice_prob_list)
^ If slice probability list is nil, no slice probabilities are applied.
^ Saves schematic in the Minetest Schematic format to filename.
minetest.place_schematic(pos, schematic, rotation, replacements)
minetest.place_schematic(pos, schematic, rotation, replacements
, force_placement
)
^ Place the schematic specified by schematic (see: Schematic specifier) at pos.
^ Rotation can be "0", "90", "180", "270", or "random".
^ If the rotation parameter is omitted, the schematic is not rotated.
^ replacements = {{"oldname", "convert_to"}, ...}
^ force_placement is a boolean indicating whether nodes other than air and
^ ignore are replaced by the schematic
Random:
minetest.get_connected_players() -> list of ObjectRefs
...
...
This diff is collapsed.
Click to expand it.
src/mapgen.cpp
+
2
−
2
View file @
c1638590
...
...
@@ -652,7 +652,7 @@ void DecoSchematic::blitToVManip(v3s16 p, ManualMapVoxelManipulator *vm,
}
void
DecoSchematic
::
placeStructure
(
Map
*
map
,
v3s16
p
)
{
void
DecoSchematic
::
placeStructure
(
Map
*
map
,
v3s16
p
,
bool
force_placement
)
{
assert
(
schematic
!=
NULL
);
ManualMapVoxelManipulator
*
vm
=
new
ManualMapVoxelManipulator
(
map
);
...
...
@@ -673,7 +673,7 @@ void DecoSchematic::placeStructure(Map *map, v3s16 p) {
v3s16
bp2
=
getNodeBlockPos
(
p
+
s
-
v3s16
(
1
,
1
,
1
));
vm
->
initialEmerge
(
bp1
,
bp2
);
blitToVManip
(
p
,
vm
,
rot
,
true
);
blitToVManip
(
p
,
vm
,
rot
,
force_placement
);
std
::
map
<
v3s16
,
MapBlock
*>
lighting_modified_blocks
;
std
::
map
<
v3s16
,
MapBlock
*>
modified_blocks
;
...
...
This diff is collapsed.
Click to expand it.
src/mapgen.h
+
1
−
1
View file @
c1638590
...
...
@@ -313,7 +313,7 @@ class DecoSchematic : public Decoration {
void
saveSchematicFile
(
INodeDefManager
*
ndef
);
bool
getSchematicFromMap
(
Map
*
map
,
v3s16
p1
,
v3s16
p2
);
void
placeStructure
(
Map
*
map
,
v3s16
p
);
void
placeStructure
(
Map
*
map
,
v3s16
p
,
bool
force_placement
);
void
applyProbabilities
(
v3s16
p0
,
std
::
vector
<
std
::
pair
<
v3s16
,
u8
>
>
*
plist
,
std
::
vector
<
std
::
pair
<
s16
,
u8
>
>
*
splist
);
...
...
This diff is collapsed.
Click to expand it.
src/script/lua_api/l_mapgen.cpp
+
6
−
3
View file @
c1638590
...
...
@@ -599,9 +599,8 @@ int ModApiMapgen::l_place_schematic(lua_State *L)
dschem
.
rotation
=
(
Rotation
)
rot
;
if
(
lua_istable
(
L
,
4
))
{
int
index
=
4
;
lua_pushnil
(
L
);
while
(
lua_next
(
L
,
index
)
!=
0
)
{
while
(
lua_next
(
L
,
4
)
!=
0
)
{
// key at index -2 and value at index -1
lua_rawgeti
(
L
,
-
1
,
1
);
std
::
string
replace_from
=
lua_tostring
(
L
,
-
1
);
...
...
@@ -615,6 +614,10 @@ int ModApiMapgen::l_place_schematic(lua_State *L)
}
}
bool
force_placement
=
true
;
if
(
lua_isboolean
(
L
,
5
))
force_placement
=
lua_toboolean
(
L
,
5
);
if
(
!
dschem
.
filename
.
empty
())
{
if
(
!
dschem
.
loadSchematicFile
())
{
errorstream
<<
"place_schematic: failed to load schematic file '"
...
...
@@ -624,7 +627,7 @@ int ModApiMapgen::l_place_schematic(lua_State *L)
dschem
.
resolveNodeNames
(
ndef
);
}
dschem
.
placeStructure
(
map
,
p
);
dschem
.
placeStructure
(
map
,
p
,
force_placement
);
return
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