1
0
Fork 0

make snowballs activate target

new_mapgen_api
AFCMS 2022-02-26 18:45:11 +01:00
parent 4bd91750bc
commit 9e7a525a0a
No known key found for this signature in database
GPG Key ID: 8720389A25B652E3
3 changed files with 6 additions and 2 deletions

View File

@ -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)

View File

@ -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

View File

@ -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