schematics.lua 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. ---@meta
  2. ---Schematics
  3. -------------
  4. -- Create a schematic from the volume of map specified
  5. -- by the box formed by `p1` and `p2`.
  6. --
  7. -- - Apply the specified probability and per-node force-place to the specified
  8. -- nodes according to the `probability_list`.
  9. -- - Apply the specified probability to the specified horizontal slices according
  10. -- to the `slice_prob_list`.
  11. -- - Saves schematic in the Minetest Schematic format to `filename`.
  12. ---@param p1 mt.Vector
  13. ---@param p2 mt.Vector
  14. ---@param probability_list mt.SchematicProbability[]
  15. ---@param filename string
  16. ---@param slice_prob_list mt.SchematicSliceProbability[]|nil
  17. function minetest.create_schematic(p1, p2, probability_list, filename, slice_prob_list) end
  18. -- Place the schematic specified by schematic at `pos`.
  19. --
  20. -- - If the `rotation` parameter is omitted, the schematic is not rotated.
  21. -- - Returns nil if the schematic could not be loaded.
  22. -- - **Warning**: Once you have loaded a schematic from a file, it will be
  23. -- cached. Future calls will always use the cached version and the replacement
  24. -- list defined for it, regardless of whether the file or the replacement list
  25. -- parameter have changed. The only way to load the file anew is to restart the
  26. -- server.
  27. ---@param pos mt.Vector
  28. ---@param schematic mt.SchematicSpec
  29. ---@param rotation "0"|"90"|"180"|"270"|"random"
  30. ---@param replacements {[string]: string}|nil
  31. ---@param force_placement boolean|nil Nodes other than `air` and `ignore` are replaced by the schematic.
  32. ---@param flags {place_center_x:boolean, place_center_y:boolean, place_center_z:boolean}|nil
  33. function minetest.place_schematic(pos, schematic, rotation, replacements, force_placement, flags) end
  34. -- Return the serialized schematic specified by schematic.
  35. ---@param schematic mt.SchematicSpec
  36. ---@param format mt.SchematicFormat
  37. ---@param options mt.SchematicSerializeOptions
  38. ---@return string
  39. function minetest.serialize_schematic(schematic, format, options) end
  40. -- Returns a Lua table representing the schematic.
  41. ---@param schematic mt.SchematicSpec
  42. ---@param options mt.SchematicReadOptions
  43. ---@return mt.SchematicSpec
  44. function minetest.read_schematic(schematic, options) end