Merge pull request 'Use uncarved pumpkin in survival' (#2119) from uncarved_pumpkins into master

Reviewed-on: MineClone2/MineClone2#2119
Reviewed-by: kabou <kabou@noreply.git.minetest.land>
This commit is contained in:
cora 2022-04-22 20:01:23 +00:00
commit dd12417529
7 changed files with 23 additions and 24 deletions

View File

@ -124,6 +124,10 @@ mobs:register_mob("mobs_mc:snowman", {
local pos = self.object:get_pos() local pos = self.object:get_pos()
minetest.sound_play("mcl_tools_shears_cut", {pos = pos}, true) 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 -- Wear out
if not minetest.is_creative_enabled(clicker:get_player_name()) then if not minetest.is_creative_enabled(clicker:get_player_name()) then
item:add_wear(mobs_mc.misc.shears_wear) 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} }, { E1, { "mcl_farming:pumpkin_pie", 2, 3} },
}, },

View File

@ -108,7 +108,6 @@ local pumpkin_base_def = {
_mcl_blast_resistance = 1, _mcl_blast_resistance = 1,
_mcl_hardness = 1, _mcl_hardness = 1,
} }
minetest.register_node("mcl_farming:pumpkin", pumpkin_base_def)
local pumpkin_face_base_def = table.copy(pumpkin_base_def) local pumpkin_face_base_def = table.copy(pumpkin_base_def)
pumpkin_face_base_def.description = S("Pumpkin") pumpkin_face_base_def.description = S("Pumpkin")
@ -121,10 +120,17 @@ pumpkin_face_base_def.groups.armor_head=1
pumpkin_face_base_def.groups.non_combat_armor_head=1 pumpkin_face_base_def.groups.non_combat_armor_head=1
pumpkin_face_base_def._mcl_armor_mob_range_factor = 0 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._mcl_armor_mob_range_mob = "mobs_mc:enderman"
pumpkin_face_base_def._mcl_armor_element = "head" pumpkin_face_base_def._mcl_armor_element = "head"
pumpkin_face_base_def._mcl_armor_texture = "mcl_farming_pumpkin_face.png" pumpkin_face_base_def._mcl_armor_texture = "mcl_farming_pumpkin_face.png"
pumpkin_face_base_def._mcl_armor_preview = "mcl_farming_pumpkin_face_preview.png" pumpkin_face_base_def._mcl_armor_preview = "mcl_farming_pumpkin_face_preview.png"
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 if minetest.get_modpath("mcl_armor") then
local pumpkin_hud = {} local pumpkin_hud = {}
local function add_pumpkin_hud(player) local function add_pumpkin_hud(player)
@ -178,12 +184,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) 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 -- 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", 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")
function(pos)
-- Attempt to spawn iron golem or snow golem -- Steal function to properly disconnect a carved pumpkin
mobs_mc.tools.check_iron_golem_summon(pos) pumpkin_face_base_def.after_destruct = minetest.registered_nodes["mcl_farming:pumpkin"].after_destruct
mobs_mc.tools.check_snow_golem_summon(pos) minetest.register_node("mcl_farming:pumpkin_face", pumpkin_face_base_def)
end)
-- Jack o'Lantern -- Jack o'Lantern
minetest.register_node("mcl_farming:pumpkin_face_light", { minetest.register_node("mcl_farming:pumpkin_face_light", {
@ -220,11 +225,6 @@ minetest.register_craft({
recipe = {{"mcl_farming:pumpkin"}} 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", { minetest.register_craftitem("mcl_farming:pumpkin_pie", {
description = S("Pumpkin Pie"), description = S("Pumpkin Pie"),
_doc_items_longdesc = S("A pumpkin pie is a tasty food item which can be eaten."), _doc_items_longdesc = S("A pumpkin pie is a tasty food item which can be eaten."),
@ -242,11 +242,6 @@ minetest.register_craft({
output = "mcl_farming:pumpkin_pie", output = "mcl_farming:pumpkin_pie",
recipe = {"mcl_farming:pumpkin", "mcl_core:sugar", "mcl_throwing:egg"}, 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 if minetest.get_modpath("doc") then

View File

@ -185,7 +185,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_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 - stem_drop: Drop probability table for all stem
- gourd_itemstring: Desired itemstring of the full gourd node - 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_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 - 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 - connected_stem_texture: Texture of the connected stem
@ -235,8 +235,8 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
end end
-- Register gourd -- Register gourd
if not gourd_def.after_dig_node then if not gourd_def.after_destruct then
function gourd_def.after_dig_node(blockpos, oldnode, oldmetadata, user) gourd_def.after_destruct = function(blockpos, oldnode)
-- Disconnect any connected stems, turning them back to normal stems -- Disconnect any connected stems, turning them back to normal stems
for n=1, #neighbors do for n=1, #neighbors do
local offset = neighbors[n] local offset = neighbors[n]

View File

@ -238,7 +238,7 @@ if minetest.get_modpath("mcl_farming") then
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = pointed_thing.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 dir = vector.subtract(pointed_thing.under, pointed_thing.above)
local param2 = minetest.dir_to_facedir(dir) 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") minetest.add_item(pointed_thing.above, "mcl_farming:pumpkin_seeds 4")
end end
return itemstack return itemstack

View File

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

View File

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