mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-25 03:51:05 +01:00
make snowballs activate target
This commit is contained in:
parent
4bd91750bc
commit
9e7a525a0a
3 changed files with 6 additions and 2 deletions
|
@ -3,7 +3,6 @@ local S = minetest.get_translator("mcl_target")
|
||||||
mcl_target = {}
|
mcl_target = {}
|
||||||
|
|
||||||
function mcl_target.hit(pos, time)
|
function mcl_target.hit(pos, time)
|
||||||
minetest.log("error", "Hello")
|
|
||||||
minetest.set_node(pos, {name="mcl_target:target_on"})
|
minetest.set_node(pos, {name="mcl_target:target_on"})
|
||||||
mesecon.receptor_on(pos, mesecon.rules.alldirs)
|
mesecon.receptor_on(pos, mesecon.rules.alldirs)
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
name = mcl_throwing
|
name = mcl_throwing
|
||||||
depends = mcl_colors
|
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 math = math
|
||||||
local vector = vector
|
local vector = vector
|
||||||
|
|
||||||
|
local mod_target = minetest.get_modpath("mcl_target")
|
||||||
|
|
||||||
-- The snowball entity
|
-- The snowball entity
|
||||||
local snowball_ENTITY={
|
local snowball_ENTITY={
|
||||||
physical = false,
|
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)
|
minetest.sound_play("mcl_throwing_snowball_impact_hard", { pos = pos, max_hear_distance=16, gain=0.7 }, true)
|
||||||
snowball_particles(self._lastpos, vel)
|
snowball_particles(self._lastpos, vel)
|
||||||
self.object:remove()
|
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
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue