Particle spawner on dead plants: flies.
These buzz around dead plants, right after they die.
This commit is contained in:
parent
f5908b08af
commit
5329ff5b36
3
corn.lua
3
corn.lua
@ -290,8 +290,7 @@ minetest.register_node("crops:corn_top_3", {
|
||||
for i = 1,math.random(2 - (damage / 100), 4 - (3 * (damage / 100))) do
|
||||
table.insert(drops, ('crops:corn_cob'))
|
||||
end
|
||||
minetest.set_node(pos, { name = "crops:corn_top_4" })
|
||||
minetest.set_node(below, { name = "crops:corn_base_3" })
|
||||
crops.die(below)
|
||||
core.handle_node_drops(pos, drops, digger)
|
||||
end
|
||||
})
|
||||
|
95
init.lua
95
init.lua
@ -142,7 +142,7 @@ crops.particles = function(pos, flag)
|
||||
local p = {}
|
||||
if flag == 0 then
|
||||
-- wither (0)
|
||||
p = {
|
||||
minetest.add_particlespawner({
|
||||
amount = 1 * crops.settings.interval,
|
||||
time = crops.settings.interval,
|
||||
minpos = { x = pos.x - 0.4, y = pos.y - 0.4, z = pos.z - 0.4 },
|
||||
@ -158,10 +158,10 @@ crops.particles = function(pos, flag)
|
||||
collisiondetection = false,
|
||||
texture = "crops_wither.png",
|
||||
vertical = true,
|
||||
}
|
||||
})
|
||||
elseif flag == 1 then
|
||||
-- soak (1)
|
||||
p = {
|
||||
minetest.add_particlespawner({
|
||||
amount = 8 * crops.settings.interval,
|
||||
time = crops.settings.interval,
|
||||
minpos = { x = pos.x - 0.4, y = pos.y - 0.4, z = pos.z - 0.4 },
|
||||
@ -177,9 +177,10 @@ crops.particles = function(pos, flag)
|
||||
collisiondetection = false,
|
||||
texture = "crops_soak.png",
|
||||
vertical = false,
|
||||
}
|
||||
else -- watering (2)
|
||||
p = {
|
||||
})
|
||||
elseif flag == 2 then
|
||||
-- watering (2)
|
||||
minetest.add_particlespawner({
|
||||
amount = 30,
|
||||
time = 3,
|
||||
minpos = { x = pos.x - 0.4, y = pos.y - 0.4, z = pos.z - 0.4 },
|
||||
@ -195,9 +196,85 @@ crops.particles = function(pos, flag)
|
||||
collisiondetection = false,
|
||||
texture = "crops_watering.png",
|
||||
vertical = true,
|
||||
}
|
||||
})
|
||||
else
|
||||
-- withered/rotting (3)
|
||||
minetest.add_particlespawner({
|
||||
amount = 20,
|
||||
time = 30,
|
||||
minpos = { x = pos.x + 0.3, y = pos.y - 0.5, z = pos.z - 0.5 },
|
||||
maxpos = { x = pos.x + 0.5, y = pos.y + 0.5, z = pos.z + 0.5 },
|
||||
minvel = { x = -0.6, y = -0.1, z = -0.2 },
|
||||
maxvel = { x = -0.4, y = 0.1, z = 0.2 },
|
||||
minacc = { x = 0.4, y = 0, z = -0.1 },
|
||||
maxacc = { x = 0.5, y = 0, z = 0.1 },
|
||||
minexptime = 2,
|
||||
maxexptime = 4,
|
||||
minsize = 1,
|
||||
maxsize = 1,
|
||||
collisiondetection = false,
|
||||
texture = "crops_flies.png",
|
||||
vertical = true,
|
||||
})
|
||||
minetest.add_particlespawner({
|
||||
amount = 20,
|
||||
time = 30,
|
||||
minpos = { x = pos.x - 0.3, y = pos.y - 0.5, z = pos.z - 0.5 },
|
||||
maxpos = { x = pos.x - 0.5, y = pos.y + 0.5, z = pos.z + 0.5 },
|
||||
minvel = { x = 0.6, y = -0.1, z = -0.2 },
|
||||
maxvel = { x = 0.4, y = 0.1, z = 0.2 },
|
||||
minacc = { x = -0.4, y = 0, z = -0.1 },
|
||||
maxacc = { x = -0.5, y = 0, z = 0.1 },
|
||||
minexptime = 2,
|
||||
maxexptime = 4,
|
||||
minsize = 1,
|
||||
maxsize = 1,
|
||||
collisiondetection = false,
|
||||
texture = "crops_flies.png",
|
||||
vertical = true,
|
||||
})
|
||||
minetest.add_particlespawner({
|
||||
amount = 20,
|
||||
time = 30,
|
||||
minpos = { x = pos.x - 0.5, y = pos.y - 0.5, z = pos.z + 0.3 },
|
||||
maxpos = { x = pos.x + 0.5, y = pos.y + 0.5, z = pos.z + 0.5 },
|
||||
minvel = { z = -0.6, y = -0.1, x = -0.2 },
|
||||
maxvel = { z = -0.4, y = 0.1, x = 0.2 },
|
||||
minacc = { z = 0.4, y = 0, x = -0.1 },
|
||||
maxacc = { z = 0.5, y = 0, x = 0.1 },
|
||||
minexptime = 2,
|
||||
maxexptime = 4,
|
||||
minsize = 1,
|
||||
maxsize = 1,
|
||||
collisiondetection = false,
|
||||
texture = "crops_flies.png",
|
||||
vertical = true,
|
||||
})
|
||||
minetest.add_particlespawner({
|
||||
amount = 20,
|
||||
time = 30,
|
||||
minpos = { x = pos.x - 0.5, y = pos.y - 0.5, z = pos.z - 0.3 },
|
||||
maxpos = { x = pos.x + 0.5, y = pos.y + 0.5, z = pos.z - 0.5 },
|
||||
minvel = { z = 0.6, y = -0.1, x = -0.2 },
|
||||
maxvel = { z = 0.4, y = 0.1, x = 0.2 },
|
||||
minacc = { z = -0.4, y = 0, x = -0.1 },
|
||||
maxacc = { z = -0.5, y = 0, x = 0.1 },
|
||||
minexptime = 2,
|
||||
maxexptime = 4,
|
||||
minsize = 1,
|
||||
maxsize = 1,
|
||||
collisiondetection = false,
|
||||
texture = "crops_flies.png",
|
||||
vertical = true,
|
||||
})
|
||||
end
|
||||
minetest.add_particlespawner(p)
|
||||
end
|
||||
|
||||
crops.die = function(pos)
|
||||
crops.particles(pos, 3)
|
||||
local node = minetest.get_node(pos)
|
||||
local plant = find_plant(node)
|
||||
plant.properties.die(pos)
|
||||
end
|
||||
|
||||
minetest.register_tool("crops:watering_can", {
|
||||
@ -383,7 +460,7 @@ minetest.register_abm({
|
||||
|
||||
-- is it dead?
|
||||
if damage >= 100 then
|
||||
plant.properties.die(pos)
|
||||
crops.die(pos)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
@ -97,8 +97,7 @@ local function crops_beanpole_on_dig(pos, node, digger)
|
||||
for i = 1,math.random(3 - (2 * (damage / 100)),7 - (6 * (damage / 100))) do
|
||||
table.insert(drops, "crops:green_bean")
|
||||
end
|
||||
minetest.set_node(bottom, { name = "crops:beanpole_plant_base_6"})
|
||||
minetest.set_node(top, { name = "crops:beanpole_plant_top_4"})
|
||||
crops.die(bottom)
|
||||
elseif bottom_n.name == "crops:beanpole_plant_base_6" and top_n.name == "crops:beanpole_plant_top_4" then
|
||||
-- harvested beans
|
||||
for i = 1,math.random(3,4) do
|
||||
|
@ -125,7 +125,7 @@ minetest.register_abm({
|
||||
local meta = minetest.get_meta(pos)
|
||||
local damage = meta:get_int("crops_damage")
|
||||
if damage == 100 then
|
||||
minetest.set_node(pos, { name = "crops:potato_plant_5" })
|
||||
crops.die(pos)
|
||||
return
|
||||
end
|
||||
local n = string.gsub(node.name, "3", "4")
|
||||
|
@ -197,8 +197,7 @@ minetest.register_abm({
|
||||
minetest.swap_node(pos, {name = "crops:pumpkin_plant_5_attached", param2 = faces[r].r})
|
||||
meta:set_int("crops_pumpkin_ttl", ttl - 1)
|
||||
else
|
||||
-- no luck, plant dead!
|
||||
minetest.set_node(pos, { name = "crops:pumpkin_plant_6" })
|
||||
crops.die(pos)
|
||||
end
|
||||
local water = meta:get_int("crops_water")
|
||||
-- growing a pumpkin costs 25 water!
|
||||
@ -228,8 +227,7 @@ minetest.register_abm({
|
||||
minetest.swap_node(pos, { name = "crops:pumpkin_plant_4" })
|
||||
meta:set_int("crops_pumpkin_ttl", ttl)
|
||||
else
|
||||
minetest.swap_node(pos, { name = "crops:pumpkin_plant_6"})
|
||||
meta:set_int("crops_pumpkin_ttl", 0)
|
||||
crops.die(pos)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
BIN
textures/crops_flies.png
Normal file
BIN
textures/crops_flies.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 89 B |
@ -85,8 +85,7 @@ minetest.register_node("crops:tomato_plant_5" , {
|
||||
minetest.swap_node(pos, { name = "crops:tomato_plant_4"})
|
||||
meta:set_int("crops_tomato_ttl", ttl - 1)
|
||||
else
|
||||
minetest.swap_node(pos, { name = "crops:tomato_plant_6"})
|
||||
meta:set_int("crops_tomato_ttl", 0)
|
||||
crops.die(pos)
|
||||
end
|
||||
end
|
||||
})
|
||||
@ -162,8 +161,7 @@ minetest.register_abm({
|
||||
minetest.swap_node(pos, { name = "crops:tomato_plant_5" })
|
||||
meta:set_int("crops_tomato_ttl", ttl)
|
||||
else
|
||||
-- no luck, plant dead!
|
||||
minetest.set_node(pos, { name = "crops:tomato_plant_6" })
|
||||
crops.die(pos)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user