Compare commits
2 Commits
236f912882
...
604250ff8b
Author | SHA1 | Date |
---|---|---|
Pascal Abresch | 604250ff8b | |
Pascal Abresch | a48eeb1e24 |
|
@ -1,3 +1,5 @@
|
||||||
|
local orion_api_enable_half_slabs = minetest.settings:get_bool("orion_api_enable_half_slabs")
|
||||||
|
|
||||||
function shallow_copy(table)
|
function shallow_copy(table)
|
||||||
local newTable = {}
|
local newTable = {}
|
||||||
for key, value in pairs(table) do
|
for key, value in pairs(table) do
|
||||||
|
@ -22,7 +24,15 @@ local placeCombinedNode = function(position, secondNode)
|
||||||
end
|
end
|
||||||
|
|
||||||
local onPlace = function(itemstack, placer, pointed_thing)
|
local onPlace = function(itemstack, placer, pointed_thing)
|
||||||
if not pointed_thing.type == "node" then return minetest.item_place(itemstack, player, pointed_thing) end
|
if pointed_thing.type == "node" and orion_api_enable_half_slabs then
|
||||||
|
return on_place_half_slabs(itemstack, placer, pointed_thing)
|
||||||
|
else
|
||||||
|
return minetest.item_place(itemstack, player, pointed_thing)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local on_place_half_slabs = function(itemstack, placer, pointed_thing)
|
||||||
local under = pointed_thing.under
|
local under = pointed_thing.under
|
||||||
local above = pointed_thing.above
|
local above = pointed_thing.above
|
||||||
if above.y == under.y +1 then -- looking from above
|
if above.y == under.y +1 then -- looking from above
|
||||||
|
@ -132,10 +142,28 @@ end
|
||||||
|
|
||||||
|
|
||||||
orion.register_slab_node = function(name, definition)
|
orion.register_slab_node = function(name, definition)
|
||||||
minetest.register_node(name, definition)
|
if not orion_api_enable_half_slabs then
|
||||||
|
minetest.register_node(name, definition)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local normalDef = shallow_copy(definition)
|
||||||
|
local normalDefTiles = shallow_copy(definition.tiles)
|
||||||
|
if #normalDef.tiles == 1 then
|
||||||
|
normalDef["tiles"][2] = normalDefTiles[1]
|
||||||
|
normalDef["tiles"][3] = normalDefTiles[1]
|
||||||
|
normalDef["tiles"][4] = normalDefTiles[1]
|
||||||
|
normalDef["tiles"][5] = normalDefTiles[1] .. "^[transformR180"
|
||||||
|
normalDef["tiles"][6] = normalDefTiles[1]
|
||||||
|
end
|
||||||
|
minetest.register_node(name, normalDef)
|
||||||
|
|
||||||
|
|
||||||
local lowerDef = shallow_copy(definition)
|
local lowerDef = shallow_copy(definition)
|
||||||
local upperDef = shallow_copy(definition)
|
local upperDef = shallow_copy(definition)
|
||||||
|
|
||||||
|
local lowerDefTiles = shallow_copy(lowerDef.tiles)
|
||||||
lowerDef["paramtype"] = "light"
|
lowerDef["paramtype"] = "light"
|
||||||
lowerDef["description"] = lowerDef["description"] or "" .. " (lower)"
|
lowerDef["description"] = lowerDef["description"] or "" .. " (lower)"
|
||||||
lowerDef["drawtype"] = "nodebox"
|
lowerDef["drawtype"] = "nodebox"
|
||||||
|
@ -143,6 +171,14 @@ orion.register_slab_node = function(name, definition)
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-0.50, -0.50, -0.50, 0.50, 0.00, 0.50} }
|
fixed = {-0.50, -0.50, -0.50, 0.50, 0.00, 0.50} }
|
||||||
lowerDef["on_place"] = onPlace
|
lowerDef["on_place"] = onPlace
|
||||||
|
lowerDef["tiles"][1] = "[combine:128x128:0,-64=".. lowerDefTiles[1] .. "\\^[resize\\:128x128:0,64=".. lowerDefTiles[1] .. "\\^[resize\\:128x128"
|
||||||
|
if #lowerDefTiles == 1 then
|
||||||
|
lowerDef["tiles"][2] = lowerDefTiles[1]
|
||||||
|
lowerDef["tiles"][3] = lowerDefTiles[1]
|
||||||
|
lowerDef["tiles"][4] = lowerDefTiles[1]
|
||||||
|
lowerDef["tiles"][5] = lowerDefTiles[1] .. "^[transformR180"
|
||||||
|
lowerDef["tiles"][6] = lowerDefTiles[1]
|
||||||
|
end
|
||||||
local lowerGroups = shallow_copy(definition["groups"])
|
local lowerGroups = shallow_copy(definition["groups"])
|
||||||
lowerDef.node_placement_prediction = "air"
|
lowerDef.node_placement_prediction = "air"
|
||||||
lowerGroups.orion_slabtype = SLAB_LOWER
|
lowerGroups.orion_slabtype = SLAB_LOWER
|
||||||
|
@ -194,18 +230,18 @@ orion.register_slab_node = function(name, definition)
|
||||||
secondLower["tiles"] = {
|
secondLower["tiles"] = {
|
||||||
firstTiles[1],
|
firstTiles[1],
|
||||||
secondTiles[2],
|
secondTiles[2],
|
||||||
firstTiles[3] .. "^[lowpart:50:" .. secondTiles[3],
|
firstTiles[3] .. "^[resize:128x128^[lowpart:50:" .. secondTiles[3] .. "\\^[resize\\:128x128",
|
||||||
firstTiles[4] .. "^[lowpart:50:" .. secondTiles[4],
|
firstTiles[4] .. "^[resize:128x128^[lowpart:50:" .. secondTiles[4] .. "\\^[resize\\:128x128",
|
||||||
firstTiles[5] .. "^[lowpart:50:" .. secondTiles[5],
|
firstTiles[5] .. "^[resize:128x128^[lowpart:50:" .. secondTiles[5] .. "\\^[resize\\:128x128",
|
||||||
firstTiles[6] .. "^[lowpart:50:" .. secondTiles[6],
|
firstTiles[6] .. "^[resize:128x128^[lowpart:50:" .. secondTiles[6] .. "\\^[resize\\:128x128",
|
||||||
}
|
}
|
||||||
secondUpper["tiles"] = {
|
secondUpper["tiles"] = {
|
||||||
secondTiles[1],
|
secondTiles[1],
|
||||||
firstTiles[2],
|
firstTiles[2],
|
||||||
secondTiles[3] .. "^[lowpart:50:" .. firstTiles[3],
|
secondTiles[3] .. "^[resize:128x128^[lowpart:50:" .. firstTiles[3] .. "\\^[resize\\:128x128",
|
||||||
secondTiles[4] .. "^[lowpart:50:" .. firstTiles[4],
|
secondTiles[4] .. "^[resize:128x128^[lowpart:50:" .. firstTiles[4] .. "\\^[resize\\:128x128",
|
||||||
secondTiles[5] .. "^[lowpart:50:" .. firstTiles[5],
|
secondTiles[5] .. "^[resize:128x128^[lowpart:50:" .. firstTiles[5] .. "\\^[resize\\:128x128",
|
||||||
secondTiles[6] .. "^[lowpart:50:" .. firstTiles[6],
|
secondTiles[6] .. "^[resize:128x128^[lowpart:50:" .. firstTiles[6] .. "\\^[resize\\:128x128",
|
||||||
}
|
}
|
||||||
local groups = shallow_copy(definition["groups"])
|
local groups = shallow_copy(definition["groups"])
|
||||||
local secondGroup = shallow_copy(definition["groups"])
|
local secondGroup = shallow_copy(definition["groups"])
|
||||||
|
|
|
@ -46,24 +46,25 @@ local treedef = { -- Yes, i will use L-trees, when i can send meshes over the ne
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
orion.make_tree = function(x, y, z)
|
orion.make_tree = function(x, y, z, variant)
|
||||||
for i = 1, #treedef do
|
for i = 1, #treedef do
|
||||||
local node
|
local node
|
||||||
if treedef[i]["leaf"] == 1 then
|
if treedef[i]["leaf"] == 1 then
|
||||||
node = NAME .. ":leaf"
|
node = NAME .. ":leaf"
|
||||||
else
|
else
|
||||||
node = NAME .. ":trunk"
|
node = NAME .. ":trunk_" .. variant
|
||||||
end
|
end
|
||||||
minetest.set_node({ x=x + treedef[i]["x"], y =y + treedef[i]["y"], z = z + treedef[i]["z"]}, { name = node})
|
minetest.set_node({ x=x + treedef[i]["x"], y =y + treedef[i]["y"], z = z + treedef[i]["z"]}, { name = node})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local make_trees = function(min_pos, max_pos, _)
|
local make_trees = function(min_pos, max_pos, _)
|
||||||
|
local random = PcgRandom(min_pos.x + min_pos.y * 2^16 + min_pos.z * 2^17 )
|
||||||
local notification = minetest.get_mapgen_object("gennotify")
|
local notification = minetest.get_mapgen_object("gennotify")
|
||||||
local saplings = notification["decoration#" .. sap_id]
|
local saplings = notification["decoration#" .. sap_id]
|
||||||
if saplings == nil then return end
|
if saplings == nil then return end
|
||||||
for i = 1, #saplings do
|
for i = 1, #saplings do
|
||||||
orion.make_tree(saplings[i]["x"], saplings[i]["y"], saplings[i]["z"])
|
orion.make_tree(saplings[i]["x"], saplings[i]["y"], saplings[i]["z"], "c0" .. random:next(1,6))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,35 @@
|
||||||
NAME = minetest.get_current_modname()
|
NAME = minetest.get_current_modname()
|
||||||
|
local variants = 6
|
||||||
|
|
||||||
orion.register_slab_node(NAME .. ":trunk", {
|
for variant = 1, variants do
|
||||||
description = "Tree trunk",
|
orion.register_slab_node(NAME .. ":trunk_c0" .. variant, {
|
||||||
groups = { flora = 3 },
|
description = "Tree trunk",
|
||||||
node_dig_prediction = "air",
|
groups = { flora = 3, colorVariant = variant},
|
||||||
tiles = {
|
node_dig_prediction = "air",
|
||||||
NAME .. "_trunk_core.png",
|
tiles = {
|
||||||
NAME .. "_trunk_core.png",
|
NAME .. "_trunk_core.png",
|
||||||
NAME .. "_trunk_bark.png",
|
NAME .. "_trunk_core.png",
|
||||||
NAME .. "_trunk_bark.png",
|
"tree_c0" .. variant .. "_bark.png",
|
||||||
NAME .. "_trunk_bark.png",
|
"tree_c0" .. variant .. "_bark.png",
|
||||||
NAME .. "_trunk_bark.png"
|
"tree_c0" .. variant .. "_bark.png",
|
||||||
},
|
"tree_c0" .. variant .. "_bark.png"
|
||||||
walkable = true,
|
},
|
||||||
})
|
walkable = true,
|
||||||
|
})
|
||||||
|
orion.register_slab_node(NAME .. ":plank_c0" .. variant, {
|
||||||
|
description = "Tree trunk",
|
||||||
|
groups = { flora = 3, colorVariant = variant},
|
||||||
|
node_dig_prediction = "air",
|
||||||
|
tiles = {
|
||||||
|
"wood_c0" .. variant .. "_plank.png",
|
||||||
|
"wood_c0" .. variant .. "_plank.png",
|
||||||
|
"wood_c0" .. variant .. "_plank.png",
|
||||||
|
"wood_c0" .. variant .. "_plank.png",
|
||||||
|
"wood_c0" .. variant .. "_plank.png",
|
||||||
|
"wood_c0" .. variant .. "_plank.png",
|
||||||
|
},
|
||||||
|
walkable = true,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
orion.craft.register_fuel(NAME .. ":trunk", 60, 10)
|
orion.craft.register_fuel(NAME .. ":trunk", 60, 10)
|
||||||
|
|
After Width: | Height: | Size: 8.0 KiB |
After Width: | Height: | Size: 7.8 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
|
@ -6,3 +6,4 @@ spark_log (Enable console log) bool true
|
||||||
spark_quick_put_enabled (Left click items into inventories) bool true
|
spark_quick_put_enabled (Left click items into inventories) bool true
|
||||||
spark_debug_enable ([WARNING: ARBITRARY LUA CODE [very bad!]] enable sparkdebug) bool false
|
spark_debug_enable ([WARNING: ARBITRARY LUA CODE [very bad!]] enable sparkdebug) bool false
|
||||||
orion_world_gen_decoslabs (Enabled decoration slabs worldgen) bool false
|
orion_world_gen_decoslabs (Enabled decoration slabs worldgen) bool false
|
||||||
|
orion_api_enable_half_slabs (Enable half slabs [experimental]) bool false
|
||||||
|
|