1
0
Fork 0

Fix can place flower podzol and coarse dirt

Also fix help entries
This commit is contained in:
Wuzzy 2017-11-15 05:02:37 +01:00
parent 192a440745
commit 06d109e86b
3 changed files with 21 additions and 12 deletions

View File

@ -109,6 +109,7 @@ These groups are used mostly for informational purposes
* `flower_pot=2`: Flower pot with a plant or flower * `flower_pot=2`: Flower pot with a plant or flower
* `flower=1`: Flower * `flower=1`: Flower
* `place_flowerlike=1`: Node has placement rules like that of a flower * `place_flowerlike=1`: Node has placement rules like that of a flower
* `place_flowerlike=2`: Node has placement rules like tall grass
* `cake`: Cake (rating = slices left) * `cake`: Cake (rating = slices left)
* `book=1`: Book * `book=1`: Book
* `pane=1`: Node is a “pane”-like node glass pane or iron bars * `pane=1`: Node is a “pane”-like node glass pane or iron bars

View File

@ -62,7 +62,9 @@ end)
doc.sub.items.register_factoid("nodes", "groups", function(itemstring, def) doc.sub.items.register_factoid("nodes", "groups", function(itemstring, def)
local datastring = "" local datastring = ""
if def.groups.place_flowerlike == 1 then if def.groups.place_flowerlike == 1 then
return "This plant can only grow on dirt, grass blocks and podzol. To survive, it needs to have an unobstructed view to the sky above or be exposed to a light level of 8 or higher." return "This plant can only grow on grass blocks and dirt. To survive, it needs to have an unobstructed view to the sky above or be exposed to a light level of 8 or higher."
elseif def.groups.place_flowerlike == 2 then
return "This plant can grow on grass blocks, podzol, dirt and coarse dirt. To survive, it needs to have an unobstructed view to the sky above or be exposed to a light level of 8 or higher."
end end
return "" return ""
end) end)

View File

@ -4,7 +4,7 @@ local init = os.clock()
-- Simple flower template -- Simple flower template
local smallflowerlongdesc = "This is a small flower. Small flowers are mainly used for dye production and can also be potted." local smallflowerlongdesc = "This is a small flower. Small flowers are mainly used for dye production and can also be potted."
local flowerusagehelp = "It can only be placed on a block on which it would also survive." local plant_usage_help = "It can only be placed on a block on which it would also survive."
-- on_place function for flowers -- on_place function for flowers
local on_place_flower = mcl_util.generate_on_place_plant_function(function(pos, node, itemstack) local on_place_flower = mcl_util.generate_on_place_plant_function(function(pos, node, itemstack)
@ -20,6 +20,7 @@ local on_place_flower = mcl_util.generate_on_place_plant_function(function(pos,
--[[ Placement requirements: --[[ Placement requirements:
* Dirt or grass block * Dirt or grass block
* If not flower, also allowed on podzol and coarse dirt
* Light level >= 8 at any time or exposed to sunlight at day * Light level >= 8 at any time or exposed to sunlight at day
]] ]]
local light_night = minetest.get_node_light(pos, 0.0) local light_night = minetest.get_node_light(pos, 0.0)
@ -28,7 +29,8 @@ local on_place_flower = mcl_util.generate_on_place_plant_function(function(pos,
if (light_night and light_night >= 8) or (light_day and light_day >= minetest.LIGHT_MAX) then if (light_night and light_night >= 8) or (light_day and light_day >= minetest.LIGHT_MAX) then
light_ok = true light_ok = true
end end
local ok = (soil_node.name == "mcl_core:dirt" or minetest.get_item_group(soil_node.name, "grass_block") == 1 or soil_node.name == "mcl_core:coarse_dirt" or soil_node.name == "mcl_core:podzol" or soil_node.name == "mcl_core:podzol_snow") and light_ok local is_flower = minetest.get_item_group(itemstack:get_name(), "flower") == 1
local ok = (soil_node.name == "mcl_core:dirt" or minetest.get_item_group(soil_node.name, "grass_block") == 1 or (not is_flower and (soil_node.name == "mcl_core:coarse_dirt" or soil_node.name == "mcl_core:podzol" or soil_node.name == "mcl_core:podzol_snow"))) and light_ok
if ok and replace then if ok and replace then
return replace return replace
end end
@ -39,7 +41,7 @@ local function add_simple_flower(name, desc, image, simple_selection_box)
minetest.register_node("mcl_flowers:"..name, { minetest.register_node("mcl_flowers:"..name, {
description = desc, description = desc,
_doc_items_longdesc = smallflowerlongdesc, _doc_items_longdesc = smallflowerlongdesc,
_doc_items_usagehelp = flowerusagehelp, _doc_items_usagehelp = plant_usage_help,
drawtype = "plantlike", drawtype = "plantlike",
waving = 1, waving = 1,
tiles = { image..".png" }, tiles = { image..".png" },
@ -85,7 +87,7 @@ local wheat_seed_drop = {
-- Tall Grass and Fern -- Tall Grass and Fern
for i=1,2 do for i=1,2 do
-- CHECKME: How does tall grass behave when pushed by a piston? -- CHECKME: How does tall grass behave when pushed by a piston?
local tgf_groups = {dig_immediate=3, flammable=3,attached_node=1,plant=1,place_flowerlike=1,non_mycelium_plant=1,dig_by_water=1,destroy_by_lava_flow=1,deco_block=1} local tgf_groups = {dig_immediate=3, flammable=3,attached_node=1,plant=1,place_flowerlike=2,non_mycelium_plant=1,dig_by_water=1,destroy_by_lava_flow=1,deco_block=1}
local id, idf, longdesc, longdesc_fern, create_entry, shears_drop, shears_drop_fern local id, idf, longdesc, longdesc_fern, create_entry, shears_drop, shears_drop_fern
if i==1 then if i==1 then
@ -110,6 +112,7 @@ for i=1,2 do
description = "Tall Grass", description = "Tall Grass",
drawtype = "plantlike", drawtype = "plantlike",
_doc_items_longdesc = longdesc, _doc_items_longdesc = longdesc,
_doc_items_usagehelp = plant_usage_help,
_doc_items_hidden = hidden, _doc_items_hidden = hidden,
_doc_items_create_entry = create_entry, _doc_items_create_entry = create_entry,
waving = 1, waving = 1,
@ -140,6 +143,7 @@ for i=1,2 do
minetest.register_node("mcl_flowers:"..idf, { minetest.register_node("mcl_flowers:"..idf, {
description = "Fern", description = "Fern",
_doc_items_longdesc = longdesc_fern, _doc_items_longdesc = longdesc_fern,
_doc_items_usagehelp = plant_usage_help,
_doc_items_create_entry = create_entry, _doc_items_create_entry = create_entry,
_doc_items_hidden = hidden, _doc_items_hidden = hidden,
drawtype = "plantlike", drawtype = "plantlike",
@ -173,18 +177,19 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im
if not inv_img then if not inv_img then
inv_img = top_img inv_img = top_img
end end
local flowergroup, usagehelp, noncreative, create_entry local flowergroup, place_flowerlike, usagehelp, noncreative, create_entry
if is_flower == nil then if is_flower == nil then
is_flower = true is_flower = true
end end
if is_flower then if is_flower then
flowergroup = 1 flowergroup = 1
usagehelp = flowerusagehelp place_flowerlike = 1
else
place_flowerlike = 2
end end
if longdesc == nil then if longdesc == nil then
noncreative = 1 noncreative = 1
create_entry = false create_entry = false
usagehelp = nil
end end
-- Drop itself by default -- Drop itself by default
local drop_bottom, drop_top local drop_bottom, drop_top
@ -198,7 +203,7 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im
description = desc, description = desc,
_doc_items_create_entry = create_entry, _doc_items_create_entry = create_entry,
_doc_items_longdesc = longdesc, _doc_items_longdesc = longdesc,
_doc_items_usagehelp = usagehelp, _doc_items_usagehelp = plant_usage_help,
drawtype = "plantlike", drawtype = "plantlike",
tiles = { bottom_img }, tiles = { bottom_img },
inventory_image = inv_img, inventory_image = inv_img,
@ -262,9 +267,10 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im
-- Placement rules: -- Placement rules:
-- * Allowed on dirt or grass block -- * Allowed on dirt or grass block
-- * If not a flower, also allowed on podzol and coarse dirt
-- * Only with light level >= 8 -- * Only with light level >= 8
-- * Only if two enough space -- * Only if two enough space
if (floorname == "mcl_core:dirt" or minetest.get_item_group(floorname, "grass_block") == 1 or floorname == "mcl_core:coarse_dirt" or floorname == "mcl_core:podzol" or floorname == "mcl_core:podzol_snow") and bottom_buildable and top_buildable and light_ok then if (floorname == "mcl_core:dirt" or minetest.get_item_group(floorname, "grass_block") == 1 or (not is_flower and (floorname == "mcl_core:coarse_dirt" or floorname == "mcl_core:podzol" or floorname == "mcl_core:podzol_snow"))) and bottom_buildable and top_buildable and light_ok then
local dry_override = minetest.registered_nodes[itemstring]._mcl_dry_override local dry_override = minetest.registered_nodes[itemstring]._mcl_dry_override
if dry_override and (floorname == "mcl_core:dirt_with_dry_grass" or floorname == "mcl_core:dirt_with_dry_grass_snow") then if dry_override and (floorname == "mcl_core:dirt_with_dry_grass" or floorname == "mcl_core:dirt_with_dry_grass_snow") then
itemstring = dry_override itemstring = dry_override
@ -287,7 +293,7 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im
minetest.remove_node(top) minetest.remove_node(top)
end end
end, end,
groups = {dig_immediate=3,flammable=2,flower=flowergroup,place_flowerlike=1,non_mycelium_plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1, plant=1,double_plant=1,deco_block=1,not_in_creative_inventory=noncreative}, groups = {dig_immediate=3,flammable=2,flower=flowergroup,place_flowerlike=place_flowerlike,non_mycelium_plant=1,attached_node=1, dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1, plant=1,double_plant=1,deco_block=1,not_in_creative_inventory=noncreative},
sounds = mcl_sounds.node_sound_leaves_defaults(), sounds = mcl_sounds.node_sound_leaves_defaults(),
}) })
@ -315,7 +321,7 @@ local function add_large_plant(name, desc, longdesc, bottom_img, top_img, inv_im
minetest.remove_node(bottom) minetest.remove_node(bottom)
end end
end, end,
groups = {dig_immediate=3,flammable=2,flower=flowergroup,place_flowerlike=1,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1, not_in_creative_inventory = 1, plant=1,double_plant=2}, groups = {dig_immediate=3,flammable=2,flower=flowergroup,place_flowerlike=place_flowerlike,dig_by_water=1,destroy_by_lava_flow=1,dig_by_piston=1, not_in_creative_inventory = 1, plant=1,double_plant=2},
sounds = mcl_sounds.node_sound_leaves_defaults(), sounds = mcl_sounds.node_sound_leaves_defaults(),
}) })