Place schematic (on vmanip): Enable use of 'place center' flags
For 'place schematic' and 'place schematic on vmanip' APIs. Fix 'place center' code to properly centre schematics. Fix some comments.
This commit is contained in:
@@ -1529,7 +1529,8 @@ int ModApiMapgen::l_create_schematic(lua_State *L)
|
||||
}
|
||||
|
||||
|
||||
// place_schematic(p, schematic, rotation, replacement)
|
||||
// place_schematic(p, schematic, rotation,
|
||||
// replacements, force_placement, flagstring)
|
||||
int ModApiMapgen::l_place_schematic(lua_State *L)
|
||||
{
|
||||
MAP_LOCK_REQUIRED;
|
||||
@@ -1565,12 +1566,19 @@ int ModApiMapgen::l_place_schematic(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
schem->placeOnMap(map, p, 0, (Rotation)rot, force_placement);
|
||||
//// Read flags
|
||||
u32 flags = 0;
|
||||
read_flags(L, 6, flagdesc_deco, &flags, NULL);
|
||||
|
||||
schem->placeOnMap(map, p, flags, (Rotation)rot, force_placement);
|
||||
|
||||
lua_pushboolean(L, true);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// place_schematic_on_vmanip(vm, p, schematic, rotation,
|
||||
// replacements, force_placement, flagstring)
|
||||
int ModApiMapgen::l_place_schematic_on_vmanip(lua_State *L)
|
||||
{
|
||||
NO_MAP_LOCK_REQUIRED;
|
||||
@@ -1606,13 +1614,18 @@ int ModApiMapgen::l_place_schematic_on_vmanip(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//// Read flags
|
||||
u32 flags = 0;
|
||||
read_flags(L, 7, flagdesc_deco, &flags, NULL);
|
||||
|
||||
bool schematic_did_fit = schem->placeOnVManip(
|
||||
vm, p, 0, (Rotation)rot, force_placement);
|
||||
vm, p, flags, (Rotation)rot, force_placement);
|
||||
|
||||
lua_pushboolean(L, schematic_did_fit);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
// serialize_schematic(schematic, format, options={...})
|
||||
int ModApiMapgen::l_serialize_schematic(lua_State *L)
|
||||
{
|
||||
|
||||
@@ -70,10 +70,10 @@ class ModApiMapgen : public ModApiBase
|
||||
// get_noiseparam_defaults(name)
|
||||
static int l_get_noiseparams(lua_State *L);
|
||||
|
||||
// set_gen_notify(flagstring)
|
||||
// set_gen_notify(flags, {deco_id_table})
|
||||
static int l_set_gen_notify(lua_State *L);
|
||||
|
||||
// set_gen_notify(flagstring)
|
||||
// get_gen_notify()
|
||||
static int l_get_gen_notify(lua_State *L);
|
||||
|
||||
// register_biome({lots of stuff})
|
||||
@@ -109,11 +109,12 @@ class ModApiMapgen : public ModApiBase
|
||||
// create_schematic(p1, p2, probability_list, filename)
|
||||
static int l_create_schematic(lua_State *L);
|
||||
|
||||
// place_schematic(p, schematic, rotation, replacements, force_placement)
|
||||
// place_schematic(p, schematic, rotation,
|
||||
// replacements, force_placement, flagstring)
|
||||
static int l_place_schematic(lua_State *L);
|
||||
|
||||
// place_schematic_on_vmanip(vm, p, schematic,
|
||||
// rotation, replacements, force_placement)
|
||||
// place_schematic_on_vmanip(vm, p, schematic, rotation,
|
||||
// replacements, force_placement, flagstring)
|
||||
static int l_place_schematic_on_vmanip(lua_State *L);
|
||||
|
||||
// serialize_schematic(schematic, format, options={...})
|
||||
|
||||
Reference in New Issue
Block a user