Merge pull request 'ITEMS/mcl_farming: Use uncarved pumpkin in survival' (#285) from uncarved-pumpkin-4 into master

Reviewed-on: https://git.minetest.land/Mineclonia/Mineclonia/pulls/285
Reviewed-by: Li0n_2 <li0n_2@noreply.git.minetest.land>
master
erlehmann 2022-04-15 22:51:58 +00:00
commit d2c335d8fb
7 changed files with 22 additions and 25 deletions

View File

@ -123,6 +123,10 @@ mobs:register_mob("mobs_mc:snowman", {
local pos = self.object:get_pos()
minetest.sound_play("mcl_tools_shears_cut", {pos = pos}, true)
if minetest.registered_items["mcl_farming:pumpkin_face"] then
minetest.add_item({x=pos.x, y=pos.y+1.4, z=pos.z}, "mcl_farming:pumpkin_face")
end
-- Wear out
if not minetest.is_creative_enabled(clicker:get_player_name()) then
item:add_wear(mobs_mc.misc.shears_wear)

View File

@ -74,7 +74,7 @@ local professions = {
},
{
{ { "mcl_farming:pumpkin_face", 8, 13 }, E1 },
{ { "mcl_farming:pumpkin", 8, 13 }, E1 },
{ E1, { "mcl_farming:pumpkin_pie", 2, 3} },
},

View File

@ -104,7 +104,6 @@ local pumpkin_base_def = {
_mcl_blast_resistance = 1,
_mcl_hardness = 1,
}
minetest.register_node("mcl_farming:pumpkin", pumpkin_base_def)
local pumpkin_face_base_def = table.copy(pumpkin_base_def)
pumpkin_face_base_def.description = S("Pumpkin")
@ -115,6 +114,11 @@ pumpkin_face_base_def.groups.armor_head=1
pumpkin_face_base_def._mcl_armor_mob_range_factor = 0
pumpkin_face_base_def._mcl_armor_mob_range_mob = "mobs_mc:enderman"
pumpkin_face_base_def.groups.non_combat_armor=1
pumpkin_face_base_def.on_construct = function(pos)
-- Attempt to spawn iron golem or snow golem
mobs_mc.tools.check_iron_golem_summon(pos)
mobs_mc.tools.check_snow_golem_summon(pos)
end
if minetest.get_modpath("mcl_armor") then
pumpkin_face_base_def.on_secondary_use = armor.on_armor_use
end
@ -123,12 +127,11 @@ end
mcl_farming:add_plant("plant_pumpkin_stem", "mcl_farming:pumpkintige_unconnect", {"mcl_farming:pumpkin_1", "mcl_farming:pumpkin_2", "mcl_farming:pumpkin_3", "mcl_farming:pumpkin_4", "mcl_farming:pumpkin_5", "mcl_farming:pumpkin_6", "mcl_farming:pumpkin_7"}, 30, 5)
-- Register actual pumpkin, connected stems and stem-to-pumpkin growth
mcl_farming:add_gourd("mcl_farming:pumpkintige_unconnect", "mcl_farming:pumpkintige_linked", "mcl_farming:pumpkintige_unconnect", stem_def, stem_drop, "mcl_farming:pumpkin_face", pumpkin_face_base_def, 30, 15, "mcl_farming_pumpkin_stem_connected.png^[colorize:#FFA800:127",
function(pos)
-- Attempt to spawn iron golem or snow golem
mobs_mc.tools.check_iron_golem_summon(pos)
mobs_mc.tools.check_snow_golem_summon(pos)
end)
mcl_farming:add_gourd("mcl_farming:pumpkintige_unconnect", "mcl_farming:pumpkintige_linked", "mcl_farming:pumpkintige_unconnect", stem_def, stem_drop, "mcl_farming:pumpkin", pumpkin_base_def, 30, 15, "mcl_farming_pumpkin_stem_connected.png^[colorize:#FFA800:127")
-- Steal function to properly disconnect a carved pumpkin
pumpkin_face_base_def.after_destruct = minetest.registered_nodes["mcl_farming:pumpkin"].after_destruct
minetest.register_node("mcl_farming:pumpkin_face", pumpkin_face_base_def)
-- Jack o'Lantern
minetest.register_node("mcl_farming:pumpkin_face_light", {
@ -165,11 +168,6 @@ minetest.register_craft({
recipe = {{"mcl_farming:pumpkin"}}
})
minetest.register_craft({
output = "mcl_farming:pumpkin_seeds 4",
recipe = {{"mcl_farming:pumpkin_face"}}
})
minetest.register_craftitem("mcl_farming:pumpkin_pie", {
description = S("Pumpkin Pie"),
_doc_items_longdesc = S("A pumpkin pie is a tasty food item which can be eaten."),
@ -187,11 +185,6 @@ minetest.register_craft({
output = "mcl_farming:pumpkin_pie",
recipe = {"mcl_farming:pumpkin", "mcl_core:sugar", "mcl_throwing:egg"},
})
minetest.register_craft({
type = "shapeless",
output = "mcl_farming:pumpkin_pie",
recipe = {"mcl_farming:pumpkin_face", "mcl_core:sugar", "mcl_throwing:egg"},
})
if minetest.get_modpath("doc") then

View File

@ -178,7 +178,7 @@ end
- stem_def: Partial node definition of the fully-grown unconnected stem node. Many fields are already defined. You need to add `tiles` and `description` at minimum. Don't define on_construct without good reason
- stem_drop: Drop probability table for all stem
- gourd_itemstring: Desired itemstring of the full gourd node
- gourd_def: (almost) full definition of the gourd node. This function will add on_construct and after_dig_node to the definition for unconnecting any connected stems
- gourd_def: (almost) full definition of the gourd node. This function will add on_construct and after_destruct to the definition for unconnecting any connected stems
- grow_interval: Will attempt to grow a gourd periodically at this interval in seconds
- grow_chance: Chance of 1/grow_chance to grow a gourd next to the full unconnected stem after grow_interval has passed. Must be a natural number
- connected_stem_texture: Texture of the connected stem
@ -228,8 +228,8 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
end
-- Register gourd
if not gourd_def.after_dig_node then
gourd_def.after_dig_node = function(blockpos, oldnode, oldmetadata, user)
if not gourd_def.after_destruct then
gourd_def.after_destruct = function(blockpos, oldnode)
-- Disconnect any connected stems, turning them back to normal stems
for n=1, #neighbors do
local offset = neighbors[n]

View File

@ -232,10 +232,10 @@ if minetest.get_modpath("mcl_farming") then
local wear = mcl_autogroup.get_wear(toolname, "shearsy")
itemstack:add_wear(wear)
end
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = above}, true)
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = pointed_thing.above}, true)
local dir = vector.subtract(pointed_thing.under, pointed_thing.above)
local param2 = minetest.dir_to_facedir(dir)
minetest.swap_node(pointed_thing.under, {name="mcl_farming:pumpkin_face", param2 = param2})
minetest.set_node(pointed_thing.under, {name="mcl_farming:pumpkin_face", param2 = param2})
minetest.add_item(pointed_thing.above, "mcl_farming:pumpkin_seeds 4")
end
return itemstack

View File

@ -3532,7 +3532,7 @@ local function register_decorations()
-- Pumpkin
minetest.register_decoration({
deco_type = "simple",
decoration = "mcl_farming:pumpkin_face",
decoration = "mcl_farming:pumpkin",
param2 = 0,
param2_max = 3,
place_on = {"group:grass_block_no_snow"},

View File

@ -868,7 +868,7 @@ local function register_mgv6_decorations()
-- Pumpkin
minetest.register_decoration({
deco_type = "simple",
decoration = "mcl_farming:pumpkin_face",
decoration = "mcl_farming:pumpkin",
param2 = 0,
param2_max = 3,
place_on = {"group:grass_block_no_snow"},