Lots of little things

- Add shapes for most/all of the nodes that need them
- Fix a couple of issues with the creative inv (due to it using a 0 index for lists)
- Make more things digabble, especially in creative
- Redo the tree nodes registration system to remove loads of essentially duplicated code
- And a new overlay!
I think that's everything, although I quite possibly have missed a couple of bits.
master
Amaz 2019-08-10 21:15:15 +01:00
parent bcd9a23bf9
commit c2d81b896e
14 changed files with 213 additions and 496 deletions

BIN
menu/overlay.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 778 KiB

View File

@ -34,7 +34,7 @@ minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing)
if not node or not node.name then
return
end
if minetest.registered_items[node.name].groups.not_in_creative_inventory ~= 1 then
puncher:set_wielded_item(node)
end
@ -53,9 +53,14 @@ if minetest.settings:get_bool("creative_mode") then
full_punch_interval = 0.5,
max_drop_level = 3,
groupcaps = {
hand = {times={[1]=digtime, [2]=digtime, [3]=digtime, [4]=digtime}, uses=0, maxlevel=0},
hand = {times = {[1] = digtime, [2] = digtime, [3] = digtime, [4] = digtime},
uses = 0, maxlevel = 0},
axe = {times = {[1] = digtime, [2] = digtime, [3] = digtime, [4] = digtime},
uses = 0, maxlevel = 0},
pickaxe = {times = {[1] = digtime, [2] = digtime, [3] = digtime, [4] = digtime},
uses = 0, maxlevel = 0},
},
damage_groups = {fleshy = 10},
}
})
end
end

View File

@ -14,7 +14,7 @@ trash:set_size("main", 1)
-- Create detached creative inventory after loading all mods
local function creative_inv(player)
local name = player:get_player_name()
creative.players[name] = {filter = "", old_filter = "not_done", page = "all", size = 0, start_i = 1}
creative.players[name] = {filter = "", old_filter = "not_done", page = "all", size = 0, start_i = 0}
local inv = minetest.create_detached_inventory("creative_" .. name, {
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
if creative.is_enabled_for(name) then
@ -43,14 +43,14 @@ creative.update_list = function(player, pageitems, searchcheck)
local name = player:get_player_name()
local player_inv = creative.players[name]
local filter = player_inv.filter
if searchcheck == true then
-- dont update if filter remains the same
if creative.players[name].filter == creative.players[name].old_filter then
return
end
end
-- regenerate creative list
for name, def in pairs(pageitems) do
if (not def.groups.not_in_creative_inventory
@ -85,7 +85,7 @@ creative.update_formspec = function(player, pagename)
local pagenum = math.floor(start_i / (4*5) + 1)
local pagemax = math.floor((player_inv.size-1) / (4*5) + 1)
local filter = player_inv.filter
if pagename == "block" then
creative.nav_icons =
"image_button[-0.45,-1.1;0.8,0.8;icon_all.png;creative_tab_all;;true;false;icon_all.png^\\[brighten]"..
@ -93,7 +93,7 @@ creative.update_formspec = function(player, pagename)
"image_button[0.95,-1.1;0.8,0.8;icon_craftitem.png;creative_tab_craftitem;;true;false;icon_craftitem.png^\\[brighten]"..
"image_button[1.65,-1.1;0.8,0.8;icon_tool.png;creative_tab_tool;;true;false;icon_tool.png^\\[brighten]"
--"image_button[2.35,-1.1;0.8,0.8;icon_craft.png;creative_crafting;;true;false;icon_craft.png^\\[brighten]"
elseif pagename == "craftitem" then
creative.nav_icons =
"image_button[-0.45,-1.1;0.8,0.8;icon_all.png;creative_tab_all;;true;false;icon_all.png^\\[brighten]"..
@ -101,7 +101,7 @@ creative.update_formspec = function(player, pagename)
"image_button[0.95,-1.1;0.8,0.8;icon_craftitem.png^\\[brighten;creative_tab_craftitem;;true;false;]"..
"image_button[1.65,-1.1;0.8,0.8;icon_tool.png;creative_tab_tool;;true;false;icon_tool.png^\\[brighten]"
--"image_button[2.35,-1.1;0.8,0.8;icon_craft.png;creative_crafting;;true;false;icon_craft.png^\\[brighten]"
elseif pagename == "tool" then
creative.nav_icons =
"image_button[-0.45,-1.1;0.8,0.8;icon_all.png;creative_tab_all;;true;false;icon_all.png^\\[brighten]"..
@ -109,12 +109,12 @@ creative.update_formspec = function(player, pagename)
"image_button[0.95,-1.1;0.8,0.8;icon_craftitem.png;creative_tab_craftitem;;true;false;icon_craftitem.png^\\[brighten]"..
"image_button[1.65,-1.1;0.8,0.8;icon_tool.png^\\[brighten;creative_tab_tool;;true;false;]"
--"image_button[2.35,-1.1;0.8,0.8;icon_craft.png;creative_crafting;;true;false;icon_craft.png^\\[brighten]"
else
if player_inv.page ~= "all" then
player_inv.page = "all"
end
creative.nav_icons =
"image_button[-0.45,-1.1;0.8,0.8;icon_all.png^\\[brighten;creative_tab_all;;true;false;]"..
"image_button[0.25,-1.1;0.8,0.8;icon_block.png;creative_tab_block;;true;false;icon_block.png^\\[brighten]"..
@ -122,42 +122,43 @@ creative.update_formspec = function(player, pagename)
"image_button[1.65,-1.1;0.8,0.8;icon_tool.png;creative_tab_tool;;true;false;icon_tool.png^\\[brighten]"
--"image_button[2.35,-1.1;0.8,0.8;icon_craft.png;creative_crafting;;true;false;icon_craft.png^\\[brighten]"
end
player:set_inventory_formspec(
lottplayer.inv_size("4x6")..
lottplayer.inv(player)..
"list[detached:creative_trash;main;2.8,4.85;1,1;]" ..
"image[2.86,4.95;0.8,0.8;icon_trash.png]" ..
"list[detached:creative_" .. name .. ";main;-0.2,-0.15;4,5;" ..
tostring(start_i) .. "]" ..
"listring[]" ..
"image_button[-1.15,1.8;1,1;icon_arrow_mini_l.png;creative_prev;;true;false;icon_arrow_mini_l.png^\\[brighten]"..
"image_button[3.7,1.8;1,1;icon_arrow_mini_r.png;creative_next;;true;false;icon_arrow_mini_r.png^\\[brighten]"..
"image_button[2.25,4.85;0.6,0.6;;creative_search;?;false;true;]"..
"image_button[2.25,5.3;0.6,0.6;;creative_reset;X;false;true;]"..
"field[0.06,5.4;2.55,0.45;creative_filter;;" ..
minetest.formspec_escape(filter) .. "]" ..
"field_close_on_enter[creative_filter;false]" ..
creative.nav_icons..
"image_button[10.35,-0.35;0.6,0.6;;creative_palette_up;^;true;true;]"..
"image_button[10.35,0.20;0.6,0.6;;creative_clear_row;1;true;true;]"..
"image_button[10.35,0.75;0.6,0.6;;creative_clear;X;true;true;]"..
"image_button[10.35,1.30;0.6,0.6;;creative_palette_down;v;true;true;]"..
"tooltip[creative_prev;Previous Page]" ..
"tooltip[creative_next;Next Page]" ..
"tooltip[creative_search;Search]" ..
"tooltip[creative_palette_up;Move Row Up]" ..
"tooltip[creative_clear_row;Clear First Row]" ..
"tooltip[creative_clear;Clear Inventory]" ..
"tooltip[creative_palette_down;Move Row Down]" ..
"tooltip[creative_palette_up;Move Row Up]" ..
"tooltip[creative_clear_row;Clear First Row]" ..
"tooltip[creative_clear;Clear Inventory]" ..
"tooltip[creative_palette_down;Move Row Down]" ..
"image_button[-0.7,5.7.5;2,1;;-;Page "..tostring(pagenum).."/"..tostring(pagemax)..";true;false;]")
end
@ -171,28 +172,28 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
if not minetest.settings:get_bool("creative_mode") then
return
end
if fields.creative_tab_all then
creative.players[name].page = "all"
creative.players[name].start_i = 1
creative.players[name].start_i = 0
creative.update_list(player, minetest.registered_items, false)
end
if fields.creative_tab_block then
creative.players[name].page = "block"
creative.players[name].start_i = 1
creative.players[name].start_i = 0
creative.update_list(player, minetest.registered_nodes, false)
end
if fields.creative_tab_craftitem then
creative.players[name].page = "craftitem"
creative.players[name].start_i = 1
creative.players[name].start_i = 0
creative.update_list(player, minetest.registered_craftitems, false)
end
if fields.creative_tab_tool then
creative.players[name].page = "tool"
creative.players[name].start_i = 1
creative.players[name].start_i = 0
creative.update_list(player, minetest.registered_tools, false)
end
local current_page = 0
local formspec = player:get_inventory_formspec()
local start_i = creative.players[name].start_i
@ -220,7 +221,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
end
end
if fields.creative_palette_up then
local inv = minetest.get_inventory({type='player',name=name})
local items = {}
@ -258,25 +259,13 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
end
end
if start_i < 0 then
start_i = start_i + 4*5
end
if start_i >= creative.players[name].size then
start_i = start_i - 4*5
end
if start_i < 0 or start_i >= creative.players[name].size then
start_i = 0
end
creative.players[name].start_i = start_i
if fields.creative_reset then
creative.players[name].filter = ""
if creative.players[name].page == nil then
creative.players[name].page = "all"
end
if creative.players[name].page == "all" then
creative.update_list(player, minetest.registered_items, false)
elseif creative.players[name].page == "block" then
@ -287,10 +276,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
creative.update_list(player, minetest.registered_tools, false)
end
end
if fields.creative_search or fields.key_enter_field == "creative_filter" then
creative.players[name].filter = fields.creative_filter
start_i = 0
if creative.players[name].page == "all" then
creative.update_list(player, minetest.registered_items, true)
elseif creative.players[name].page == "block" then
@ -301,7 +290,18 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
creative.update_list(player, minetest.registered_tools, true)
end
end
if start_i < 0 then
start_i = start_i + 4*5
end
if start_i >= creative.players[name].size then
start_i = start_i - 4*5
end
if start_i < 0 or start_i >= creative.players[name].size then
start_i = 0
end
creative.players[name].start_i = start_i
if not fields.quit and not fields.bags and not fields.main then
minetest.after(0, function()
creative.update_formspec(player, creative.players[name].page)
@ -313,4 +313,4 @@ minetest.register_on_joinplayer(function(player)
if minetest.settings:get_bool("creative_mode") then
creative_inv(player)
end
end)
end)

View File

@ -0,0 +1,13 @@
lottshapes:register_shapes("lottitems:stone")
lottshapes:register_shapes("lottitems:cobble")
lottshapes:register_shapes("lottitems:red_stone")
lottshapes:register_shapes("lottitems:red_cobble")
lottshapes:register_shapes("lottitems:blue_stone")
lottshapes:register_shapes("lottitems:blue_cobble")
lottshapes:register_shapes("lottitems:mordor_stone")
lottshapes:register_shapes("lottitems:sandstone")
lottshapes:register_shapes("lottitems:desert_sandstone")
lottshapes:register_shapes("lottitems:silver_sandstone")
lottshapes:register_shapes("lottitems:obsidian")
--lottshapes:register_shapes("lottitems:snow")
--lottshapes:register_shapes("lottitems:ice")

View File

@ -1,6 +1,7 @@
local modpath = minetest.get_modpath("lottitems") .. "/base_nodes"
dofile(modpath .. "/base.lua")
dofile(modpath .. "/base_shapes.lua")
dofile(modpath .. "/liquids.lua")
minetest.register_alias("mapgen_stone", "lottitems:stone")
minetest.register_alias("mapgen_stone", "lottitems:stone")

View File

@ -13,6 +13,9 @@ minetest.register_node("lottitems:stone_block", {
groups = {stone = 2, pickaxe = 1},
})
lottshapes:register_shapes("lottitems:stone_brick")
lottshapes:register_shapes("lottitems:stone_block")
-- Red
minetest.register_node("lottitems:red_stone_brick", {
description = "Red Stone Brick",
@ -26,6 +29,9 @@ minetest.register_node("lottitems:red_stone_block", {
groups = {stone = 2, pickaxe = 1},
})
lottshapes:register_shapes("lottitems:red_stone_brick")
lottshapes:register_shapes("lottitems:red_stone_block")
-- Blue
minetest.register_node("lottitems:blue_stone_brick", {
description = "Blue Stone Brick",
@ -39,6 +45,9 @@ minetest.register_node("lottitems:blue_stone_block", {
groups = {stone = 2, pickaxe = 1},
})
lottshapes:register_shapes("lottitems:blue_stone_brick")
lottshapes:register_shapes("lottitems:blue_stone_block")
-- Sandstone
minetest.register_node("lottitems:sandstone_brick", {
description = "Sandstone Brick",
@ -52,6 +61,9 @@ minetest.register_node("lottitems:sandstone_block", {
groups = {stone = 2, sandstone = 2, pickaxe = 1},
})
lottshapes:register_shapes("lottitems:sandstone_brick")
lottshapes:register_shapes("lottitems:sandstone_block")
-- Desert Sandstone
minetest.register_node("lottitems:desert_sandstone_brick", {
description = "Desert Sandstone Brick",
@ -65,6 +77,9 @@ minetest.register_node("lottitems:desert_sandstone_block", {
groups = {stone = 2, sandstone = 2, pickaxe = 1},
})
lottshapes:register_shapes("lottitems:desert_sandstone_brick")
lottshapes:register_shapes("lottitems:desert_sandstone_block")
-- Silver Sandstone
minetest.register_node("lottitems:silver_sandstone_brick", {
description = "Silver Sandstone Brick",
@ -76,4 +91,7 @@ minetest.register_node("lottitems:silver_sandstone_block", {
description = "Silver Sandstone Block",
tiles = {"lottitems_silver_sandstone_block.png"},
groups = {stone = 2, sandstone = 2, pickaxe = 1},
})
})
lottshapes:register_shapes("lottitems:silver_sandstone_brick")
lottshapes:register_shapes("lottitems:silver_sandstone_block")

View File

@ -1 +1,2 @@
lott
lottshapes

View File

@ -7,6 +7,6 @@ dofile(modpath .. "/ores.lua")
minetest.register_node("lottitems:ignore", {
description = "You Hacker You (LOTT Ignore)",
tiles = {"ignore.png"},
groups = {hidden = 1},
groups = {not_in_creative_inventory = 1},
drop = "",
})

View File

@ -1 +1,2 @@
lott
lottshapes

View File

@ -72,7 +72,7 @@ register_flower("lissuin_tall_bottom", {
type = "fixed",
fixed = {-0.1, -0.1, -0.1, 0.1, 0.1, 0.1},
},
groups = {orange = 1, flower = 1, hand = 2, plant = 1, lorien = 1, hidden = 1},
groups = {orange = 1, flower = 1, hand = 2, plant = 1, lorien = 1, not_in_creative_inventory = 1},
})
register_flower("lissuin_tall_top", {

View File

@ -17,7 +17,7 @@ local function register_grass(name, heights, def)
})
if def.groups then
def.groups["hidden"] = 1
def.groups["not_in_creative_inventory"] = 1
end
for i = 1, heights - 1 do
minetest.register_node("lottplants:" .. name .. "_" .. i, {
@ -35,7 +35,7 @@ local function register_grass(name, heights, def)
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -0.3125, 0.5},
},
groups = def.groups or {green = 1, grass = 1, plant = 1, hand = 2, hidden = 1}
groups = def.groups or {green = 1, grass = 1, plant = 1, hand = 2, not_in_creative_inventory = 1}
})
end
end

View File

@ -1,4 +1,3 @@
-- trunks, and related things
--[[
Young trunk nbs:
@ -17,6 +16,72 @@ local leaves_litter_box = {
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5}
}
local function register_tree_nodes(tree_name, has_young_tree, axe_group, needles)
minetest.register_node("lottplants:" .. tree_name .. "_trunk", {
description = lott.str_to_desc(tree_name) .. " Trunk",
tiles = {
"lottplants_" .. tree_name .. "_trunk_top.png",
"lottplants_" .. tree_name .. "_trunk_top.png",
"lottplants_" .. tree_name .. "_trunk.png"
},
paramtype2 = "facedir",
groups = {tree = 1, wood = 1, plant = 1, axe = axe_group},
})
minetest.register_node("lottplants:" .. tree_name .. "_planks", {
description = lott.str_to_desc(tree_name) .. " Planks",
tiles = {"lottplants_" .. tree_name .. "_planks.png"},
paramtype2 = "facedir",
groups = {wood = 1, axe = axe_group},
})
if needles then
minetest.register_node("lottplants:" .. tree_name .. "_needles", {
description = lott.str_to_desc(tree_name) .. " Needles",
drawtype = "allfaces_optional",
tiles = {"lottplants_" .. tree_name .. "_needles.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {leaves = 1, plant = 1, hand = 3},
})
else
minetest.register_node("lottplants:" .. tree_name .. "_leaves", {
description = lott.str_to_desc(tree_name) .. " Leaves",
drawtype = "allfaces_optional",
tiles = {"lottplants_" .. tree_name .. "_leaves.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {leaves = 1, plant = 1, hand = 3},
})
end
if has_young_tree then
minetest.register_node("lottplants:young_" .. tree_name .. "_trunk", {
description = "Young " .. lott.str_to_desc(tree_name) .. " Trunk",
drawtype = "nodebox",
tiles = {
"lottplants_" .. tree_name .. "_trunk_top.png",
"lottplants_" .. tree_name .. "_trunk_top.png",
"lottplants_" .. tree_name .. "_trunk.png"
},
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.125, -0.5, -0.125, 0.125, 0.5, 0.125}, -- NodeBox1
{-0.0625, -0.5, -0.1875, 0.0625, 0.5, -0.125}, -- NodeBox2
{0.125, -0.5, -0.0625, 0.1875, 0.5, 0.0625}, -- NodeBox3
{-0.0625, -0.5, 0.125, 0.0625, 0.5, 0.1875}, -- NodeBox4
{-0.1875, -0.5, -0.0625, -0.125, 0.5, 0.0625}, -- NodeBox5
},
},
paramtype2 = "facedir",
groups = {tree = 1, wood = 1, plant = 1, axe = axe_group}
})
end
lottshapes:register_shapes("lottplants:" .. tree_name .. "_planks")
-- TODO: Add shapes for trees? Would need 1 new texture (at least).
end
minetest.register_node("lottplants:oak_leaves_litter", {
description = "Oak Leaves Litter",
drawtype = "nodebox",
@ -30,400 +95,50 @@ minetest.register_node("lottplants:oak_leaves_litter", {
groups = {leaves = 1, plant = 1},
})
-- Oak
minetest.register_node("lottplants:oak_trunk", {
description = "Oak Trunk",
tiles = {"lottplants_oak_trunk_top.png", "lottplants_oak_trunk_top.png", "lottplants_oak_trunk.png"},
paramtype2 = "facedir",
groups = {tree = 1, wood = 1, plant = 1, axe = 1},
})
minetest.register_node("lottplants:oak_planks", {
description = "Oak Planks",
tiles = {"lottplants_oak_planks.png"},
paramtype2 = "facedir",
groups = {wood = 1, axe = 1},
})
minetest.register_node("lottplants:oak_leaves", {
description = "Oak Leaves",
drawtype = "allfaces_optional",
tiles = {"lottplants_oak_leaves.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {leaves = 1, plant = 1},
})
-- Alder
minetest.register_node("lottplants:alder_trunk", {
description = "Alder Trunk",
tiles = {"lottplants_alder_trunk_top.png", "lottplants_alder_trunk_top.png", "lottplants_alder_trunk.png"},
paramtype2 = "facedir",
groups = {tree = 1, wood = 1, plant = 1, axe = 1},
})
minetest.register_node("lottplants:alder_planks", {
description = "Alder Planks",
tiles = {"lottplants_alder_planks.png"},
paramtype2 = "facedir",
groups = {wood = 1, axe = 1},
})
minetest.register_node("lottplants:alder_leaves", {
description = "Alder Leaves",
drawtype = "allfaces_optional",
tiles = {"lottplants_alder_leaves.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {leaves = 1, plant = 1},
})
register_tree_nodes("alder", false, 3)
-- Apple
minetest.register_node("lottplants:apple_trunk", {
description = "Apple Trunk",
tiles = {"lottplants_apple_trunk_top.png", "lottplants_apple_trunk_top.png", "lottplants_apple_trunk.png"},
paramtype2 = "facedir",
groups = {tree = 1, wood = 1, plant = 1, axe = 1},
})
minetest.register_node("lottplants:apple_planks", {
description = "Apple Planks",
tiles = {"lottplants_apple_planks.png"},
paramtype2 = "facedir",
groups = {wood = 1, axe = 1},
})
minetest.register_node("lottplants:apple_leaves", {
description = "Apple Leaves",
drawtype = "allfaces_optional",
tiles = {"lottplants_apple_leaves.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {leaves = 1, plant = 1},
})
register_tree_nodes("apple", false, 2)
-- Ash
minetest.register_node("lottplants:ash_trunk", {
description = "Ash Trunk",
tiles = {"lottplants_ash_trunk_top.png", "lottplants_ash_trunk_top.png", "lottplants_ash_trunk.png"},
paramtype2 = "facedir",
groups = {tree = 1, wood = 1, plant = 1, axe = 1},
})
minetest.register_node("lottplants:ash_planks", {
description = "Ash Planks",
tiles = {"lottplants_ash_planks.png"},
paramtype2 = "facedir",
groups = {wood = 1, axe = 1},
})
minetest.register_node("lottplants:ash_leaves", {
description = "Ash Leaves",
drawtype = "allfaces_optional",
tiles = {"lottplants_ash_leaves.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {leaves = 1, plant = 1},
})
register_tree_nodes("ash", false, 1)
-- Beech
minetest.register_node("lottplants:beech_trunk", {
description = "Beech Trunk",
tiles = {"lottplants_beech_trunk_top.png", "lottplants_beech_trunk_top.png", "lottplants_beech_trunk.png"},
paramtype2 = "facedir",
groups = {tree = 1, wood = 1, plant = 1, axe = 1},
})
minetest.register_node("lottplants:beech_planks", {
description = "Beech Planks",
tiles = {"lottplants_beech_planks.png"},
paramtype2 = "facedir",
groups = {wood = 1, axe = 1},
})
minetest.register_node("lottplants:beech_leaves", {
description = "Beech Leaves",
drawtype = "allfaces_optional",
tiles = {"lottplants_beech_leaves.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {leaves = 1, plant = 1},
})
register_tree_nodes("beech", false, 3)
-- Birch
minetest.register_node("lottplants:birch_trunk", {
description = "Birch Trunk",
tiles = {"lottplants_birch_trunk_top.png", "lottplants_birch_trunk_top.png", "lottplants_birch_trunk.png"},
paramtype2 = "facedir",
groups = {tree = 1, wood = 1, plant = 1, axe = 1},
})
minetest.register_node("lottplants:birch_planks", {
description = "Birch Planks",
tiles = {"lottplants_birch_planks.png"},
paramtype2 = "facedir",
groups = {wood = 1, axe = 1},
})
minetest.register_node("lottplants:birch_leaves", {
description = "Birch Leaves",
drawtype = "allfaces_optional",
tiles = {"lottplants_birch_leaves.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {leaves = 1, plant = 1},
})
register_tree_nodes("birch", false, 3)
-- Cedar
minetest.register_node("lottplants:cedar_trunk", {
description = "Cedar Trunk",
tiles = {"lottplants_cedar_trunk_top.png", "lottplants_cedar_trunk_top.png", "lottplants_cedar_trunk.png"},
paramtype2 = "facedir",
groups = {tree = 1, wood = 1, plant = 1, axe = 1},
})
minetest.register_node("lottplants:cedar_planks", {
description = "Cedar Planks",
tiles = {"lottplants_cedar_planks.png"},
paramtype2 = "facedir",
groups = {wood = 1, axe = 1},
})
minetest.register_node("lottplants:cedar_leaves", {
description = "Cedar Leaves",
drawtype = "allfaces_optional",
tiles = {"lottplants_cedar_leaves.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {leaves = 1, plant = 1},
})
register_tree_nodes("cedar", false, 2)
-- Dark Oak
minetest.register_node("lottplants:dark_oak_trunk", {
description = "Dark Oak Trunk",
tiles = {"lottplants_dark_oak_trunk_top.png", "lottplants_dark_oak_trunk_top.png", "lottplants_dark_oak_trunk.png"},
paramtype2 = "facedir",
groups = {tree = 1, wood = 1, plant = 1, axe = 1},
})
minetest.register_node("lottplants:dark_oak_planks", {
description = "Dark Oak Planks",
tiles = {"lottplants_dark_oak_planks.png"},
paramtype2 = "facedir",
groups = {wood = 1, axe = 1},
})
minetest.register_node("lottplants:dark_oak_leaves", {
description = "Dark Oak Leaves",
drawtype = "allfaces_optional",
tiles = {"lottplants_dark_oak_leaves.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {leaves = 1, plant = 1},
})
register_tree_nodes("dark_oak", false, 4)
-- Elm
minetest.register_node("lottplants:elm_trunk", {
description = "Elm Trunk",
tiles = {"lottplants_elm_trunk_top.png", "lottplants_elm_trunk_top.png", "lottplants_elm_trunk.png"},
paramtype2 = "facedir",
groups = {tree = 1, wood = 1, plant = 1, axe = 1},
})
minetest.register_node("lottplants:elm_planks", {
description = "Elm Planks",
tiles = {"lottplants_elm_planks.png"},
paramtype2 = "facedir",
groups = {wood = 1, axe = 1},
})
minetest.register_node("lottplants:elm_leaves", {
description = "Elm Leaves",
drawtype = "allfaces_optional",
tiles = {"lottplants_elm_leaves.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {leaves = 1, plant = 1},
})
register_tree_nodes("elm", false, 2)
-- Holly
minetest.register_node("lottplants:holly_trunk", {
description = "Holly Trunk",
tiles = {"lottplants_holly_trunk_top.png", "lottplants_holly_trunk_top.png", "lottplants_holly_trunk.png"},
paramtype2 = "facedir",
groups = {tree = 1, wood = 1, plant = 1, axe = 1},
})
minetest.register_node("lottplants:holly_planks", {
description = "Holly Planks",
tiles = {"lottplants_holly_planks.png"},
paramtype2 = "facedir",
groups = {wood = 1, axe = 1},
})
minetest.register_node("lottplants:holly_leaves", {
description = "Holly Leaves",
drawtype = "allfaces_optional",
tiles = {"lottplants_holly_leaves.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {leaves = 1, plant = 1},
})
register_tree_nodes("holly", false, 1)
-- Maple
minetest.register_node("lottplants:maple_trunk", {
description = "Maple Trunk",
tiles = {"lottplants_maple_trunk_top.png", "lottplants_maple_trunk_top.png", "lottplants_maple_trunk.png"},
paramtype2 = "facedir",
groups = {tree = 1, wood = 1, plant = 1, axe = 1},
})
minetest.register_node("lottplants:maple_planks", {
description = "Maple Planks",
tiles = {"lottplants_maple_planks.png"},
paramtype2 = "facedir",
groups = {wood = 1, axe = 1},
})
minetest.register_node("lottplants:maple_leaves", {
description = "Maple Leaves",
drawtype = "allfaces_optional",
tiles = {"lottplants_maple_leaves.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {leaves = 1, plant = 1},
})
register_tree_nodes("maple", false, 3)
-- Mallorn
register_tree_nodes("mallorn", true, 4)
minetest.register_node("lottplants:mallorn_trunk", {
description = "Mallorn Trunk",
tiles = {"lottplants_mallorn_trunk_top.png", "lottplants_mallorn_trunk_top.png", "lottplants_mallorn_trunk.png"},
paramtype2 = "facedir",
groups = {tree = 1, wood = 1, plant = 1, axe = 4}
})
minetest.register_node("lottplants:young_mallorn_trunk", {
description = "Young Mallorn Trunk",
drawtype = "nodebox",
tiles = {"lottplants_mallorn_trunk_top.png", "lottplants_mallorn_trunk_top.png", "lottplants_mallorn_trunk.png"},
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.125, -0.5, -0.125, 0.125, 0.5, 0.125}, -- NodeBox1
{-0.0625, -0.5, -0.1875, 0.0625, 0.5, -0.125}, -- NodeBox2
{0.125, -0.5, -0.0625, 0.1875, 0.5, 0.0625}, -- NodeBox3
{-0.0625, -0.5, 0.125, 0.0625, 0.5, 0.1875}, -- NodeBox4
{-0.1875, -0.5, -0.0625, -0.125, 0.5, 0.0625}, -- NodeBox5
},
},
paramtype2 = "facedir",
groups = {tree = 1, wood = 1, plant = 1, axe = 4}
})
minetest.register_node("lottplants:mallorn_planks", {
description = "Mallorn Planks",
tiles = {"lottplants_mallorn_planks.png"},
paramtype2 = "facedir",
groups = {wood = 1, axe = 1},
})
minetest.register_node("lottplants:mallorn_leaves", {
description = "Mallorn Leaves",
drawtype = "allfaces_optional",
tiles = {"lottplants_mallorn_leaves.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {leaves = 1, plant = 1},
})
-- Oak
register_tree_nodes("oak", false, 1)
-- Pine
minetest.register_node("lottplants:pine_trunk", {
description = "Pine Trunk",
tiles = {"lottplants_pine_trunk_top.png", "lottplants_pine_trunk_top.png", "lottplants_pine_trunk.png"},
paramtype2 = "facedir",
groups = {tree = 1, wood = 1, plant = 1, axe = 1},
})
minetest.register_node("lottplants:pine_planks", {
description = "Pine Planks",
tiles = {"lottplants_pine_planks.png"},
paramtype2 = "facedir",
groups = {wood = 1, axe = 1},
})
minetest.register_node("lottplants:pine_needles", {
description = "Pine Needles",
drawtype = "allfaces_optional",
tiles = {"lottplants_pine_needles.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {leaves = 1, plant = 1},
})
register_tree_nodes("pine", false, 1, true)
-- Poplar
minetest.register_node("lottplants:poplar_trunk", {
description = "Poplar Trunk",
tiles = {"lottplants_poplar_trunk_top.png", "lottplants_poplar_trunk_top.png", "lottplants_poplar_trunk.png"},
paramtype2 = "facedir",
groups = {tree = 1, wood = 1, plant = 1, axe = 1},
})
minetest.register_node("lottplants:poplar_planks", {
description = "Poplar Planks",
tiles = {"lottplants_poplar_planks.png"},
paramtype2 = "facedir",
groups = {wood = 1, axe = 1},
})
minetest.register_node("lottplants:poplar_leaves", {
description = "Poplar Leaves",
drawtype = "allfaces_optional",
tiles = {"lottplants_poplar_leaves.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {leaves = 1, plant = 1},
})
register_tree_nodes("poplar", false, 1)
-- Rowan
minetest.register_node("lottplants:rowan_trunk", {
description = "Rowan Trunk",
tiles = {"lottplants_rowan_trunk_top.png", "lottplants_rowan_trunk_top.png", "lottplants_rowan_trunk.png"},
paramtype2 = "facedir",
groups = {tree = 1, wood = 1, plant = 1, axe = 1},
})
minetest.register_node("lottplants:rowan_planks", {
description = "Rowan Planks",
tiles = {"lottplants_rowan_planks.png"},
paramtype2 = "facedir",
groups = {wood = 1, axe = 1},
})
minetest.register_node("lottplants:rowan_leaves", {
description = "Rowan Leaves",
drawtype = "allfaces_optional",
tiles = {"lottplants_rowan_leaves.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {leaves = 1, plant = 1},
})
register_tree_nodes("rowan", false, 2)
-- TODO: Drop berries
minetest.register_node("lottplants:rowan_berries", {
@ -436,52 +151,4 @@ minetest.register_node("lottplants:rowan_berries", {
})
-- White Tree
minetest.register_node("lottplants:white_tree_trunk", {
description = "White Tree Trunk",
tiles = {
"lottplants_white_tree_trunk_top.png",
"lottplants_white_tree_trunk_top.png",
"lottplants_white_tree_trunk.png"
},
paramtype2 = "facedir",
groups = {tree = 1, wood = 1, plant = 1, axe = 4}
})
minetest.register_node("lottplants:young_white_tree_trunk", {
description = "Young White Tree Trunk",
drawtype = "nodebox",
tiles = {
"lottplants_white_tree_trunk_top.png",
"lottplants_white_tree_trunk_top.png",
"lottplants_white_tree_trunk.png"
},
paramtype = "light",
node_box = {
type = "fixed",
fixed = {
{-0.125, -0.5, -0.125, 0.125, 0.5, 0.125}, -- NodeBox1
{-0.0625, -0.5, -0.1875, 0.0625, 0.5, -0.125}, -- NodeBox2
{0.125, -0.5, -0.0625, 0.1875, 0.5, 0.0625}, -- NodeBox3
{-0.0625, -0.5, 0.125, 0.0625, 0.5, 0.1875}, -- NodeBox4
{-0.1875, -0.5, -0.0625, -0.125, 0.5, 0.0625}, -- NodeBox5
},
},
paramtype2 = "facedir",
groups = {tree = 1, wood = 1, plant = 1, axe = 4}
})
minetest.register_node("lottplants:white_tree_planks", {
description = "White Tree Planks",
tiles = {"lottplants_white_tree_planks.png"},
paramtype2 = "facedir",
groups = {wood = 1, axe = 1},
})
minetest.register_node("lottplants:white_tree_leaves", {
description = "White Tree Leaves",
drawtype = "allfaces_optional",
tiles = {"lottplants_white_tree_leaves.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {leaves = 1, plant = 1},
})
register_tree_nodes("white_tree", true, 4)

View File

@ -156,7 +156,8 @@ minetest.register_item(":", {
full_punch_interval = 0.9,
max_drop_level = 0,
groupcaps = {
hand = {times={[1]=0, [2]=0.25, [3]=0.5}, uses=0, maxlevel=0},
hand = {times = {[1] = 0, [2] = 0.25, [3] = 0.5}, uses = 0, maxlevel = 0},
axe = {times = {[1] = 3}, uses = 0, maxlevel = 0},
},
damage_groups = {fleshy=1},
}
@ -272,4 +273,4 @@ dofile(modpath .. "/race_texts.lua")
dofile(modpath .. "/races.lua")
dofile(modpath .. "/systems/hp.lua")
dofile(modpath .. "/systems/hunger.lua")
dofile(modpath .. "/systems/stamina.lua")
dofile(modpath .. "/systems/stamina.lua")

View File

@ -39,25 +39,35 @@ end
local function connects_dir(pos, name, dir)
local aside = vector.add(pos, minetest.facedir_to_dir(dir))
if is_pane(aside) then return true end
if is_pane(aside) then
return true
end
local connects_to = minetest.registered_nodes[name].connects_to
if not connects_to then return false end
if not connects_to then
return false
end
local list = minetest.find_nodes_in_area(aside, aside, connects_to)
if #list > 0 then return true end
if #list > 0 then
return true
end
return false
end
local function swap(pos, node, name, param2)
if node.name == name and node.param2 == param2 then return end
if node.name == name and node.param2 == param2 then
return
end
minetest.set_node(pos, {name = name, param2 = param2})
end
local function update_pane(pos)
if not is_pane(pos) then return end
if not is_pane(pos) then
return
end
local node = minetest.get_node(pos)
local name = node.name
if name:sub(-5) == "_flat" then
@ -116,7 +126,7 @@ function lottshapes:register_shapes(name, def)
local r_group = table.copy(itemmeta.groups)
r_group.not_in_creative_inventory = 2
local stexture = def.texture or string.match(minetest.serialize(itemmeta.tiles), '{"(.*)"}')
-- Registering nodebox shapes
for i in ipairs(nodebox_list) do
local tdesc = nodebox_list[i][1]
@ -124,11 +134,11 @@ function lottshapes:register_shapes(name, def)
local tnobo = nodebox_list[i][3]
local tcraf = nodebox_list[i][4]
local tsunl = nodebox_list[i][5]
if itemmeta.sunlight_propagates == true then
tsunl = true
end
if is_disabled(disabled, tname) then
minetest.register_node(":lottshapes:"..sname.."_"..tname, {
description = itemmeta.description.." "..tdesc,
@ -147,21 +157,21 @@ function lottshapes:register_shapes(name, def)
},
on_place = minetest.rotate_node
})
minetest.register_craft({
output = 'lottshapes:'..sname..'_cube '..tcraf,
recipe = {{'lottshapes:'..sname..'_'..tname}}
})
end
end
-- Registering model-based shapes
for i in ipairs(model_list) do
local tdesc = model_list[i][1]
local tname = model_list[i][2]
local tmodl = model_list[i][3]
local tcraf = model_list[i][4]
if is_disabled(disabled, tname) then
minetest.register_node(":lottshapes:"..sname.."_"..tname, {
description = itemmeta.description.." "..tdesc,
@ -177,21 +187,21 @@ function lottshapes:register_shapes(name, def)
sounds = itemmeta.sounds,
on_place = minetest.rotate_node
})
minetest.register_craft({
output = 'lottshapes:'..sname..'_cube '..tcraf,
recipe = {{'lottshapes:'..sname..'_'..tname}}
})
end
end
-- Registering fences
if is_disabled(disabled, "fence") then
local f_group = table.copy(itemmeta.groups)
f_group.not_in_creative_inventory = 1
f_group.fence = 1
local fence_texture = "lottshapes_fence_overlay.png^" .. stexture .. "^lottshapes_fence_overlay.png^[makealpha:255,126,126"
minetest.register_node(":lottshapes:"..sname.."_fence", {
description = itemmeta.description.." Fence",
drawtype = "nodebox",
@ -220,20 +230,20 @@ function lottshapes:register_shapes(name, def)
},
connects_to = {"group:fence", "group:wood", "group:tree"},
})
minetest.register_craft({
output = 'lottshapes:'..sname..'_cube',
recipe = {{'lottshapes:'..sname..'_fence'}}
})
end
-- Registering walls
if is_disabled(disabled, "wall") then
local w_group = table.copy(itemmeta.groups)
w_group.not_in_creative_inventory = 1
w_group.wall = 1
local wall_texture = "lottshapes_wall_overlay.png^" .. stexture .. "^lottshapes_wall_overlay.png^[makealpha:255,126,126"
minetest.register_node(":lottshapes:"..sname.."_wall", {
description = itemmeta.description.." Wall",
drawtype = "nodebox",
@ -257,19 +267,19 @@ function lottshapes:register_shapes(name, def)
},
connects_to = {"group:wall", "group:stone"},
})
minetest.register_craft({
output = 'lottshapes:'..sname..'_cube 2',
recipe = {{'lottshapes:'..sname..'_wall'}}
})
end
-- Registering panes
if is_disabled(disabled, "pane") then
local p_group = table.copy(itemmeta.groups)
p_group.not_in_creative_inventory = 1
p_group.pane = 1
minetest.register_node(":lottshapes:"..sname.."_pane_flat", {
description = itemmeta.description.." Pane" or "Pane",
drawtype = "nodebox",
@ -289,7 +299,7 @@ function lottshapes:register_shapes(name, def)
},
connect_sides = { "left", "right" },
})
minetest.register_node(":lottshapes:"..sname.."_pane", {
description = itemmeta.description.. " Pane" or "Pane",
drawtype = "nodebox",
@ -310,7 +320,7 @@ function lottshapes:register_shapes(name, def)
},
connects_to = {"group:pane", "group:stone", "group:glass", "group:wood", "group:tree"},
})
minetest.register_craft({
output = 'lottshapes:'..sname..'_cube',
recipe = {{'lottshapes:'..sname..'_pane_flat'}}