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

@ -18,6 +18,11 @@ minetest.register_node("dfcaverns:dirt_with_cave_moss", {
sounds = default.node_sound_dirt_defaults({
footstep = {name = "default_grass_footstep", gain = 0.25},
}),
soil = {
base = "dfcaverns:dirt_with_cave_moss",
dry = "farming:soil",
wet = "farming:soil_wet"
},
_dfcaverns_dead_node = "default:dirt",
})
@ -48,7 +53,9 @@ minetest.register_node("dfcaverns:cobble_with_floor_fungus", {
is_ground_content = false,
groups = {cracky = 3, stone = 2, light_sensitive_fungus = 11},
_dfcaverns_dead_node = "default:cobble",
sounds = default.node_sound_stone_defaults(),
sounds = default.node_sound_stone_defaults({
footstep = {name = "dfcaverns_squish", gain = 0.25},
}),
})
minetest.register_abm{

View File

@ -14,7 +14,7 @@ minetest.register_node("dfcaverns:dead_fungus", {
paramtype = "light",
walkable = false,
buildable_to = true,
groups = {flammable=4, oddly_breakable_by_hand=1, plant = 1},
groups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
@ -37,7 +37,7 @@ minetest.register_node("dfcaverns:cavern_fungi", {
paramtype = "light",
walkable = false,
buildable_to = true,
groups = {flammable=4, oddly_breakable_by_hand=1},
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(),
selection_box = {
type = "fixed",
@ -53,14 +53,63 @@ minetest.register_craft({
-----------------------------------------------------------------------------------------
local place_seed = 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 = 1})
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end
dfcaverns.register_seed = function(name, description, image, stage_one)
local def = {
description = description,
tiles = {image},
inventory_image = image,
wield_image = image,
drawtype = "signlike",
paramtype2 = "wallmounted",
groups = {flammable=4, oddly_breakable_by_hand=1},
groups = {seed = 1, snappy = 3, attached_node = 1, flammable = 2},
_dfcaverns_next_stage = stage_one,
paramtype = "light",
walkable = false,
@ -69,6 +118,9 @@ dfcaverns.register_seed = function(name, description, image, stage_one)
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5},
},
on_place = function(itemstack, placer, pointed_thing)
return place_seed(itemstack, placer, pointed_thing, "dfcaverns:"..name)
end,
}
minetest.register_node("dfcaverns:"..name, def)

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 = {

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,3 +1,3 @@
https://freesound.org/people/DrMinky/sounds/167073/
https://freesound.org/people/HonorHunter/sounds/271666/
https://freesound.org/people/DrMinky/sounds/167074/
dfcaverns_squish.1.ogg - from https://freesound.org/people/DrMinky/sounds/167074/ by DrMinky under Creative Commons BY 3.0
dfcaverns_squish.2.ogg - from https://freesound.org/people/DrMinky/sounds/167075/ by DrMinky under Creative Commons BY 3.0
dfcaverns_squish.3.ogg - from https://freesound.org/people/DrMinky/sounds/167073/ by DrMinky under Creative Commons BY 3.0