forked from VoxeLibre/VoxeLibre
Fix pumpkin placement not connecting pumpkin stems
This commit is contained in:
parent
fa7cb8397a
commit
d45ca46f99
|
@ -82,11 +82,6 @@ local pumpkin_base_def = {
|
|||
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_face.png"},
|
||||
groups = {handy=1,axey=1, plant=1,building_block=1, armor_head=1,non_combat_armor=1, dig_by_piston=1, enderman_takable=1},
|
||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||
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,
|
||||
_mcl_blast_resistance = 5,
|
||||
_mcl_hardness = 1,
|
||||
}
|
||||
|
@ -95,7 +90,12 @@ local pumpkin_base_def = {
|
|||
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_base_def, 30, 15, "mcl_farming_pumpkin_stem_connected.png")
|
||||
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_base_def, 30, 15, "mcl_farming_pumpkin_stem_connected.png",
|
||||
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)
|
||||
|
||||
-- Jack o'Lantern
|
||||
minetest.register_node("mcl_farming:pumpkin_face_light", {
|
||||
|
|
|
@ -104,13 +104,14 @@ 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 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_dig_node 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
|
||||
- gourd_on_construct_extra: Custom on_construct extra function for the gourd. Will be called after the stem check code
|
||||
]]
|
||||
|
||||
function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, stem_itemstring, stem_def, stem_drop, gourd_itemstring, gourd_def, grow_interval, grow_chance, connected_stem_texture)
|
||||
function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, stem_itemstring, stem_def, stem_drop, gourd_itemstring, gourd_def, grow_interval, grow_chance, connected_stem_texture, gourd_on_construct_extra)
|
||||
|
||||
local connected_stem_names = {
|
||||
connected_stem_basename .. "_r",
|
||||
|
@ -175,6 +176,10 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
|
|||
local stempos = vector.add(blockpos, neighbors[n])
|
||||
try_connect_stem(stempos)
|
||||
end
|
||||
-- Call custom on_construct
|
||||
if gourd_on_construct_extra then
|
||||
gourd_on_construct_extra(blockpos)
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.register_node(gourd_itemstring, gourd_def)
|
||||
|
|
Loading…
Reference in New Issue