plant enhancements, floor fungus footsteps

This commit is contained in:
FaceDeer
2017-03-17 00:06:21 -06:00
parent c05373d273
commit 03d1ce841a
12 changed files with 141 additions and 34 deletions

View File

@ -14,7 +14,8 @@ local register_cave_wheat = function(number)
inventory_image = "dfcaverns_cave_wheat_"..tostring(number)..".png",
paramtype = "light",
walkable = false,
groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11},
buildable_to = true,
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11},
sounds = default.node_sound_leaves_defaults(),
drop = {
max_items = 1,

View File

@ -12,7 +12,8 @@ local register_dimple_cup = function(number)
inventory_image = "dfcaverns_dimple_cup_"..tostring(number)..".png",
paramtype = "light",
walkable = false,
groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11},
buildable_to = true,
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11},
sounds = default.node_sound_leaves_defaults(),
drop = {
max_items = 1,

View File

@ -14,7 +14,8 @@ local register_pig_tail = function(number)
inventory_image = "dfcaverns_pig_tail_"..tostring(number)..".png",
paramtype = "light",
walkable = false,
groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11},
buildable_to = true,
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11},
sounds = default.node_sound_leaves_defaults(),
drop = {
max_items = 1,

View File

@ -5,12 +5,61 @@ local S, NS = dofile(MP.."/intllib.lua")
local displace_x = 0.125
local displace_z = 0.125
local plump_helmet_on_place = function(itemstack, placer, pointed_thing, plantname)
local pt = pointed_thing
-- check if pointing at a node
if not pt then
return itemstack
end
if pt.type ~= "node" then
return itemstack
end
local under = minetest.get_node(pt.under)
local above = minetest.get_node(pt.above)
if minetest.is_protected(pt.under, placer:get_player_name()) then
minetest.record_protection_violation(pt.under, placer:get_player_name())
return
end
if minetest.is_protected(pt.above, placer:get_player_name()) then
minetest.record_protection_violation(pt.above, placer:get_player_name())
return
end
-- return if any of the nodes is not registered
if not minetest.registered_nodes[under.name] then
return itemstack
end
if not minetest.registered_nodes[above.name] then
return itemstack
end
-- check if pointing at the top of the node
if pt.above.y ~= pt.under.y+1 then
return itemstack
end
-- check if you can replace the node above the pointed node
if not minetest.registered_nodes[above.name].buildable_to then
return itemstack
end
-- add the node and remove 1 item from the itemstack
minetest.add_node(pt.above, {name = plantname, param2 = math.random(0,3)})
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end
minetest.register_node("dfcaverns:plump_helmet_spawn", {
description = S("Plump Helmet Spawn"),
tiles = {
"dfcaverns_plump_helmet_cap.png",
},
groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11, plant = 1},
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11},
_dfcaverns_next_stage = "dfcaverns:plump_helmet_1",
drawtype = "nodebox",
paramtype = "light",
@ -22,8 +71,8 @@ minetest.register_node("dfcaverns:plump_helmet_spawn", {
{-0.0625 + displace_x, -0.5, -0.125 + displace_z, 0.125 + displace_x, -0.375, 0.0625 + displace_z},
}
},
on_construct = function(pos)
minetest.swap_node(pos, {name="dfcaverns:plump_helmet_spawn", param2 = math.random(0,3)})
on_place = function(itemstack, placer, pointed_thing)
return plump_helmet_on_place(itemstack, placer, pointed_thing, "dfcaverns:plump_helmet_spawn")
end,
})
@ -34,7 +83,7 @@ minetest.register_node("dfcaverns:plump_helmet_1", {
"dfcaverns_plump_helmet_cap.png",
"dfcaverns_plump_helmet_cap.png^[lowpart:5:dfcaverns_plump_helmet_stem.png",
},
groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11, plant = 1},
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11},
_dfcaverns_next_stage = "dfcaverns:plump_helmet_2",
drawtype = "nodebox",
paramtype = "light",
@ -47,9 +96,8 @@ minetest.register_node("dfcaverns:plump_helmet_1", {
{-0.125 + displace_x, -0.4375, -0.1875 + displace_z, 0.1875 + displace_x, -0.3125, 0.125 + displace_z}, -- cap
}
},
on_construct = function(pos)
minetest.swap_node(pos, {name="dfcaverns:plump_helmet_1", param2 = math.random(0,3)})
on_place = function(itemstack, placer, pointed_thing)
return plump_helmet_on_place(itemstack, placer, pointed_thing, "dfcaverns:plump_helmet_1")
end,
})
@ -61,7 +109,7 @@ minetest.register_node("dfcaverns:plump_helmet_2", {
"dfcaverns_plump_helmet_cap.png",
"dfcaverns_plump_helmet_cap.png^[lowpart:15:dfcaverns_plump_helmet_stem.png",
},
groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11, plant = 1},
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11},
_dfcaverns_next_stage = "dfcaverns:plump_helmet_3",
drawtype = "nodebox",
paramtype = "light",
@ -88,9 +136,8 @@ minetest.register_node("dfcaverns:plump_helmet_2", {
},
},
},
on_construct = function(pos)
minetest.swap_node(pos, {name="dfcaverns:plump_helmet_2", param2 = math.random(0,3)})
on_place = function(itemstack, placer, pointed_thing)
return plump_helmet_on_place(itemstack, placer, pointed_thing, "dfcaverns:plump_helmet_2")
end,
})
@ -101,7 +148,7 @@ minetest.register_node("dfcaverns:plump_helmet_3", {
"dfcaverns_plump_helmet_cap.png",
"dfcaverns_plump_helmet_cap.png^[lowpart:35:dfcaverns_plump_helmet_stem.png",
},
groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11, plant = 1},
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11},
_dfcaverns_next_stage = "dfcaverns:plump_helmet_4",
drawtype = "nodebox",
paramtype = "light",
@ -114,7 +161,6 @@ minetest.register_node("dfcaverns:plump_helmet_3", {
{-0.1875 + displace_x, -0.125, -0.25 + displace_z, 0.25 + displace_x, 0.1875, 0.1875 + displace_z}, -- cap
}
},
drop = {
max_items = 2,
items = {
@ -128,9 +174,8 @@ minetest.register_node("dfcaverns:plump_helmet_3", {
},
},
},
on_construct = function(pos)
minetest.swap_node(pos, {name="dfcaverns:plump_helmet_3", param2 = math.random(0,3)})
on_place = function(itemstack, placer, pointed_thing)
return plump_helmet_on_place(itemstack, placer, pointed_thing, "dfcaverns:plump_helmet_3")
end,
})
@ -141,7 +186,7 @@ minetest.register_node("dfcaverns:plump_helmet_4", {
"dfcaverns_plump_helmet_cap.png",
"dfcaverns_plump_helmet_cap.png^[lowpart:40:dfcaverns_plump_helmet_stem.png",
},
groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11, plant = 1},
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
@ -154,8 +199,7 @@ minetest.register_node("dfcaverns:plump_helmet_4", {
{-0.1875 + displace_x, 0.25, -0.25 + displace_z, 0.25 + displace_x, 0.3125, 0.1875 + displace_z}, -- cap rounding
}
},
drop = {
drop = {
max_items = 4,
items = {
{
@ -176,9 +220,8 @@ minetest.register_node("dfcaverns:plump_helmet_4", {
},
},
},
on_construct = function(pos)
minetest.swap_node(pos, {name="dfcaverns:plump_helmet_4", param2 = math.random(0,3)})
on_place = function(itemstack, placer, pointed_thing)
return plump_helmet_on_place(itemstack, placer, pointed_thing, "dfcaverns:plump_helmet_4")
end,
})

View File

@ -14,7 +14,8 @@ local register_quarry_bush = function(number)
inventory_image = "dfcaverns_quarry_bush_"..tostring(number)..".png",
paramtype = "light",
walkable = false,
groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11},
buildable_to = true,
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11},
sounds = default.node_sound_leaves_defaults(),
drop = {

View File

@ -12,7 +12,8 @@ local register_sweet_pod = function(number)
inventory_image = "dfcaverns_sweet_pod_"..tostring(number)..".png",
paramtype = "light",
walkable = false,
groups = {flammable=4, oddly_breakable_by_hand=1, light_sensitive_fungus = 11},
buildable_to = true,
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, light_sensitive_fungus = 11},
sounds = default.node_sound_leaves_defaults(),
drop = {