make snowballs activate target
This commit is contained in:
parent
4bd91750bc
commit
9e7a525a0a
|
@ -3,7 +3,6 @@ local S = minetest.get_translator("mcl_target")
|
|||
mcl_target = {}
|
||||
|
||||
function mcl_target.hit(pos, time)
|
||||
minetest.log("error", "Hello")
|
||||
minetest.set_node(pos, {name="mcl_target:target_on"})
|
||||
mesecon.receptor_on(pos, mesecon.rules.alldirs)
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
name = mcl_throwing
|
||||
depends = mcl_colors
|
||||
optional_depends = mcl_core, mcl_mobitems, doc
|
||||
optional_depends = mcl_core, mcl_mobitems, doc, mcl_target
|
||||
|
|
|
@ -3,6 +3,8 @@ local S = minetest.get_translator(minetest.get_current_modname())
|
|||
local math = math
|
||||
local vector = vector
|
||||
|
||||
local mod_target = minetest.get_modpath("mcl_target")
|
||||
|
||||
-- The snowball entity
|
||||
local snowball_ENTITY={
|
||||
physical = false,
|
||||
|
@ -111,6 +113,9 @@ local function snowball_on_step(self, dtime)
|
|||
minetest.sound_play("mcl_throwing_snowball_impact_hard", { pos = pos, max_hear_distance=16, gain=0.7 }, true)
|
||||
snowball_particles(self._lastpos, vel)
|
||||
self.object:remove()
|
||||
if mod_target and node.name == "mcl_target:target_off" then
|
||||
mcl_target.hit(vector.round(pos), 0.4) --4 redstone ticks
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue