mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-17 00:21:07 +01:00
make lingering potions activate target (+ indentation fix)
This commit is contained in:
parent
1a1c592452
commit
fb35af4dba
1 changed files with 66 additions and 61 deletions
|
@ -1,5 +1,7 @@
|
||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
|
|
||||||
|
local mod_target = minetest.get_modpath("mcl_target")
|
||||||
|
|
||||||
local function lingering_image(colorstring, opacity)
|
local function lingering_image(colorstring, opacity)
|
||||||
if not opacity then
|
if not opacity then
|
||||||
opacity = 127
|
opacity = 127
|
||||||
|
@ -125,11 +127,11 @@ function mcl_potions.register_lingering(name, descr, color, def)
|
||||||
obj:set_velocity({x=dropdir.x*velocity,y=dropdir.y*velocity,z=dropdir.z*velocity})
|
obj:set_velocity({x=dropdir.x*velocity,y=dropdir.y*velocity,z=dropdir.z*velocity})
|
||||||
obj:set_acceleration({x=dropdir.x*-3, y=-9.8, z=dropdir.z*-3})
|
obj:set_acceleration({x=dropdir.x*-3, y=-9.8, z=dropdir.z*-3})
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
local w = 0.7
|
local w = 0.7
|
||||||
|
|
||||||
minetest.register_entity(id.."_flying",{
|
minetest.register_entity(id.."_flying",{
|
||||||
textures = {lingering_image(color)},
|
textures = {lingering_image(color)},
|
||||||
hp_max = 1,
|
hp_max = 1,
|
||||||
visual_size = {x=w/2,y=w/2},
|
visual_size = {x=w/2,y=w/2},
|
||||||
|
@ -141,6 +143,9 @@ minetest.register_entity(id.."_flying",{
|
||||||
local n = node.name
|
local n = node.name
|
||||||
local g = minetest.get_item_group(n, "liquid")
|
local g = minetest.get_item_group(n, "liquid")
|
||||||
local d = 4
|
local d = 4
|
||||||
|
if mod_target and n == "mcl_target:target_off" then
|
||||||
|
mcl_target.hit(vector.round(pos), 0.4) --4 redstone ticks
|
||||||
|
end
|
||||||
if n ~= "air" and n ~= "mcl_portals:portal" and n ~= "mcl_portals:portal_end" and g == 0 or mcl_potions.is_obj_hit(self, pos) then
|
if n ~= "air" and n ~= "mcl_portals:portal" and n ~= "mcl_portals:portal_end" and g == 0 or mcl_potions.is_obj_hit(self, pos) then
|
||||||
minetest.sound_play("mcl_potions_breaking_glass", {pos = pos, max_hear_distance = 16, gain = 1})
|
minetest.sound_play("mcl_potions_breaking_glass", {pos = pos, max_hear_distance = 16, gain = 1})
|
||||||
add_lingering_effect(pos, color, def, name == "water")
|
add_lingering_effect(pos, color, def, name == "water")
|
||||||
|
@ -161,5 +166,5 @@ minetest.register_entity(id.."_flying",{
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue