forked from VoxeLibre/VoxeLibre
Add API documentation, minor fixes
This commit is contained in:
parent
b0b8638a4c
commit
a895292371
|
@ -8,7 +8,7 @@ local adjacents = {
|
|||
}
|
||||
|
||||
local function makegeode(pos,pr)
|
||||
local size = pr:next(4,12)
|
||||
local size = pr:next(2,8)
|
||||
local p1 = vector.offset(pos,-size,-size,-size)
|
||||
local p2 = vector.offset(pos,size,size,size)
|
||||
local nn = minetest.find_nodes_in_area(p1,p2,{"group:material_stone"})
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
# mcl_structures
|
||||
Structure placement API for MCL2.
|
||||
|
||||
## mcl_structures.register_structure(name,structure definition)
|
||||
### structure definition
|
||||
{
|
||||
fill_ratio = OR noise = {},
|
||||
biomes = {},
|
||||
y_min =,
|
||||
y_max =,
|
||||
place_on = {},
|
||||
spawn_by = {},
|
||||
num_spawn_by =
|
||||
flags = (default: "place_center_x, place_center_z, force_placement")
|
||||
(same as decoration def)
|
||||
y_offset =, --can be a number or a function returning a number
|
||||
filenames = {} OR place_func = function(pos,filename)
|
||||
-- filenames can be a list of any schematics accepted by mcl_structures.place_schematic
|
||||
after_place = function(pos)
|
||||
}
|
||||
## mcl_structures.registered_structures
|
||||
Table of the registered structure defintions indexed by name.
|
||||
|
||||
## mcl_structures.place_structure(pos, def, pr)
|
||||
Places a structure using the mapgen placement function
|
||||
|
||||
## mcl_structures.place_schematic(pos, schematic, rotation, replacements, force_placement, flags, after_placement_callback, pr, callback_param)
|
|
@ -72,6 +72,7 @@ function mcl_structures.register_structure(name,def,nospawn) --nospawn means it
|
|||
end)
|
||||
end
|
||||
minetest.register_node(":"..structblock, {drawtype="airlike", walkable = false, pointable = false,groups = sbgroups})
|
||||
def.structblock = structblock
|
||||
mcl_structures.registered_structures[name] = def
|
||||
end
|
||||
|
||||
|
|
|
@ -630,9 +630,8 @@ minetest.register_on_mods_loaded(function()
|
|||
else
|
||||
for n,d in pairs(mcl_structures.registered_structures) do
|
||||
if n == param then
|
||||
mcl_structures.place_structure(pos,d,PseudoRandom(os.clock()))
|
||||
minetest.chat_send_player(name, message)
|
||||
return
|
||||
mcl_structures.place_structure(pos,d,pr)
|
||||
return true,message
|
||||
end
|
||||
end
|
||||
message = S("Error: Unknown structure type. Please use “/spawnstruct <type>”.")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
name = mcl_structures
|
||||
author = Wuzzy
|
||||
description = Structures for MCL2
|
||||
author = Wuzzy, cora
|
||||
description = Structure placement for MCL2
|
||||
depends = mcl_loot
|
||||
|
|
Loading…
Reference in New Issue