mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-23 08:29:34 +01:00
Disconnect gourd stems after destruct
While testing the previous commit, it became clear that gourd stems do not disconnect properly if the gourd disappears while not being dug. A simple method to create illegal curved stems was to explode the gourd. This patch changes gourds so that the stem curves back after a gourd is destroyed, regardless of reason. This hopefully makes curved stems that are not connected to matching gourds a relict of the past.
This commit is contained in:
parent
e1d67a2095
commit
56db877360
2 changed files with 4 additions and 4 deletions
|
@ -187,7 +187,7 @@ mcl_farming:add_plant("plant_pumpkin_stem", "mcl_farming:pumpkintige_unconnect",
|
|||
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_dig_node = minetest.registered_nodes["mcl_farming:pumpkin"].after_dig_node
|
||||
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
|
||||
|
|
|
@ -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_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
|
||||
|
@ -235,8 +235,8 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
|
|||
end
|
||||
|
||||
-- Register gourd
|
||||
if not gourd_def.after_dig_node then
|
||||
function gourd_def.after_dig_node(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]
|
||||
|
|
Loading…
Reference in a new issue