mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-26 12:31:05 +01:00
Merge pull request 'Add Target' (#2033) from AFCMS/MineClone2:target into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2033 Reviewed-by: cora <cora@noreply.git.minetest.land>
This commit is contained in:
commit
a3e01e6dbe
16 changed files with 206 additions and 90 deletions
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
local S = minetest.get_translator("mobs_mc")
|
local S = minetest.get_translator("mobs_mc")
|
||||||
|
|
||||||
|
local mod_target = minetest.get_modpath("mcl_target")
|
||||||
|
|
||||||
--###################
|
--###################
|
||||||
--################### BLAZE
|
--################### BLAZE
|
||||||
--###################
|
--###################
|
||||||
|
@ -178,17 +180,19 @@ mobs:register_arrow("mobs_mc:blaze_fireball", {
|
||||||
|
|
||||||
-- Node hit, make fire
|
-- Node hit, make fire
|
||||||
hit_node = function(self, pos, node)
|
hit_node = function(self, pos, node)
|
||||||
if node.name == "air" then
|
if node == "air" then
|
||||||
minetest.set_node(pos_above, {name=mobs_mc.items.fire})
|
minetest.set_node(pos, {name = mobs_mc.items.fire})
|
||||||
else
|
else
|
||||||
local v = self.object:get_velocity()
|
if self._shot_from_dispenser and mod_target and node == "mcl_target:target_off" then
|
||||||
v = vector.normalize(v)
|
mcl_target.hit(vector.round(pos), 0.4) --4 redstone ticks
|
||||||
|
end
|
||||||
|
local v = vector.normalize(self.object:get_velocity())
|
||||||
local crashpos = vector.subtract(pos, v)
|
local crashpos = vector.subtract(pos, v)
|
||||||
local crashnode = minetest.get_node(crashpos)
|
local crashnode = minetest.get_node(crashpos)
|
||||||
-- Set fire if node is air, or a replacable flammable node (e.g. a plant)
|
-- Set fire if node is air, or a replacable flammable node (e.g. a plant)
|
||||||
if crashnode.name == "air" or
|
if crashnode.name == "air" or
|
||||||
(minetest.registered_nodes[crashnode.name].buildable_to and minetest.get_item_group(crashnode.name, "flammable") >= 1) then
|
(minetest.registered_nodes[crashnode.name].buildable_to and minetest.get_item_group(crashnode.name, "flammable") >= 1) then
|
||||||
minetest.set_node(crashpos, {name=mobs_mc.items.fire})
|
minetest.set_node(crashpos, {name = mobs_mc.items.fire})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -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")
|
||||||
|
|
||||||
minetest.register_entity("mcl_experience:bottle",{
|
minetest.register_entity("mcl_experience:bottle",{
|
||||||
textures = {"mcl_experience_bottle.png"},
|
textures = {"mcl_experience_bottle.png"},
|
||||||
hp_max = 1,
|
hp_max = 1,
|
||||||
|
@ -30,6 +32,9 @@ minetest.register_entity("mcl_experience:bottle",{
|
||||||
vertical = false,
|
vertical = false,
|
||||||
texture = "mcl_particles_effect.png^[colorize:blue:127",
|
texture = "mcl_particles_effect.png^[colorize:blue:127",
|
||||||
})
|
})
|
||||||
|
if mod_target and n == "mcl_target:target_off" then
|
||||||
|
mcl_target.hit(vector.round(pos), 0.4) --4 redstone ticks
|
||||||
|
end
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
70
mods/ITEMS/REDSTONE/mcl_target/init.lua
Normal file
70
mods/ITEMS/REDSTONE/mcl_target/init.lua
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
local S = minetest.get_translator("mcl_target")
|
||||||
|
|
||||||
|
local mod_farming = minetest.get_modpath("mcl_farming")
|
||||||
|
|
||||||
|
mcl_target = {}
|
||||||
|
|
||||||
|
function mcl_target.hit(pos, time)
|
||||||
|
minetest.set_node(pos, {name="mcl_target:target_on"})
|
||||||
|
mesecon.receptor_on(pos, mesecon.rules.alldirs)
|
||||||
|
|
||||||
|
local timer = minetest.get_node_timer(pos)
|
||||||
|
timer:start(time)
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node("mcl_target:target_off", {
|
||||||
|
description = S("Target"),
|
||||||
|
_doc_items_longdesc = S("A target is a block that provides a temporary redstone charge when hit by a projectile."),
|
||||||
|
_doc_items_usagehelp = S("Throw a projectile on the target to activate it."),
|
||||||
|
tiles = {"mcl_target_target_top.png", "mcl_target_target_top.png", "mcl_target_target_side.png"},
|
||||||
|
groups = {hoey = 1},
|
||||||
|
sounds = mcl_sounds.node_sound_dirt_defaults({
|
||||||
|
footstep = {name="default_grass_footstep", gain=0.1},
|
||||||
|
}),
|
||||||
|
mesecons = {
|
||||||
|
receptor = {
|
||||||
|
state = mesecon.state.off,
|
||||||
|
rules = mesecon.rules.alldirs,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
_mcl_blast_resistance = 0.5,
|
||||||
|
_mcl_hardness = 0.5,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("mcl_target:target_on", {
|
||||||
|
description = S("Target"),
|
||||||
|
_doc_items_create_entry = false,
|
||||||
|
tiles = {"mcl_target_target_top.png", "mcl_target_target_top.png", "mcl_target_target_side.png"},
|
||||||
|
groups = {hoey = 1, not_in_creative_inventory = 1},
|
||||||
|
drop = "mcl_target:target_off",
|
||||||
|
sounds = mcl_sounds.node_sound_dirt_defaults({
|
||||||
|
footstep = {name="default_grass_footstep", gain=0.1},
|
||||||
|
}),
|
||||||
|
on_timer = function(pos, elapsed)
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
if node.name == "mcl_target:target_on" then --has not been dug
|
||||||
|
minetest.set_node(pos, {name="mcl_target:target_off"})
|
||||||
|
mesecon.receptor_off(pos, mesecon.rules.alldirs)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
mesecons = {
|
||||||
|
receptor = {
|
||||||
|
state = mesecon.state.on,
|
||||||
|
rules = mesecon.rules.alldirs,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
_mcl_blast_resistance = 0.5,
|
||||||
|
_mcl_hardness = 0.5,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
if mod_farming then
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "mcl_target:target_off",
|
||||||
|
recipe = {
|
||||||
|
{"", "mesecons:redstone", ""},
|
||||||
|
{"mesecons:redstone", "mcl_farming:hay_block", "mesecons:redstone"},
|
||||||
|
{"", "mesecons:redstone", ""},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
4
mods/ITEMS/REDSTONE/mcl_target/locale/mcl_target.fr.tr
Normal file
4
mods/ITEMS/REDSTONE/mcl_target/locale/mcl_target.fr.tr
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# textdomain: mcl_target
|
||||||
|
Target=Cible
|
||||||
|
A target is a block that provides a temporary redstone charge when hit by a projectile.=La cible est un bloc qui se comporte comme une source d'énergie temporaire quand elle est frappée par un projectile.
|
||||||
|
Throw a projectile on the target to activate it.=Lancer un projectile sur la cible pour l'activer.
|
4
mods/ITEMS/REDSTONE/mcl_target/locale/template.txt
Normal file
4
mods/ITEMS/REDSTONE/mcl_target/locale/template.txt
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# textdomain: mcl_target
|
||||||
|
Target=
|
||||||
|
A target is a block that provides a temporary redstone charge when hit by a projectile.=
|
||||||
|
Throw a projectile on the target to activate it.=
|
3
mods/ITEMS/REDSTONE/mcl_target/mod.conf
Normal file
3
mods/ITEMS/REDSTONE/mcl_target/mod.conf
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
name = mcl_target
|
||||||
|
author = AFCMS
|
||||||
|
depends = mesecons, mcl_sounds
|
BIN
mods/ITEMS/REDSTONE/mcl_target/textures/mcl_target_target_side.png
Executable file
BIN
mods/ITEMS/REDSTONE/mcl_target/textures/mcl_target_target_side.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 752 B |
BIN
mods/ITEMS/REDSTONE/mcl_target/textures/mcl_target_target_top.png
Executable file
BIN
mods/ITEMS/REDSTONE/mcl_target/textures/mcl_target_target_top.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 752 B |
|
@ -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 math = math
|
local math = math
|
||||||
local vector = vector
|
local vector = vector
|
||||||
|
|
||||||
|
@ -117,8 +119,7 @@ function ARROW_ENTITY.on_step(self, dtime)
|
||||||
self._time_in_air = self._time_in_air + .001
|
self._time_in_air = self._time_in_air + .001
|
||||||
|
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
local dpos = table.copy(pos) -- digital pos
|
local dpos = vector.round(vector.new(pos)) -- digital pos
|
||||||
dpos = vector.round(dpos)
|
|
||||||
local node = minetest.get_node(dpos)
|
local node = minetest.get_node(dpos)
|
||||||
|
|
||||||
if self._stuck then
|
if self._stuck then
|
||||||
|
@ -383,6 +384,11 @@ function ARROW_ENTITY.on_step(self, dtime)
|
||||||
tnt.ignite(self._stuckin)
|
tnt.ignite(self._stuckin)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Activate target
|
||||||
|
if mod_target and snode.name == "mcl_target:target_off" then
|
||||||
|
mcl_target.hit(self._stuckin, 1) --10 redstone ticks
|
||||||
|
end
|
||||||
|
|
||||||
-- Push the button! Push, push, push the button!
|
-- Push the button! Push, push, push the button!
|
||||||
if mod_button and minetest.get_item_group(node.name, "button") > 0 and minetest.get_item_group(node.name, "button_push_by_arrow") == 1 then
|
if mod_button and minetest.get_item_group(node.name, "button") > 0 and minetest.get_item_group(node.name, "button_push_by_arrow") == 1 then
|
||||||
local bdir = minetest.wallmounted_to_dir(node.param2)
|
local bdir = minetest.wallmounted_to_dir(node.param2)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name = mcl_bows
|
name = mcl_bows
|
||||||
author = Arcelmi
|
author = Arcelmi
|
||||||
description = This mod adds bows and arrows for MineClone 2.
|
description = This mod adds bows and arrows for MineClone 2.
|
||||||
depends = controls, mcl_particles, mcl_enchanting, mcl_init
|
depends = controls, mcl_particles, mcl_enchanting, mcl_init, mcl_util
|
||||||
optional_depends = awards, mcl_achievements, mcl_core, mcl_mobitems, playerphysics, doc, doc_identifier, mesecons_button
|
optional_depends = awards, mcl_achievements, mcl_core, mcl_mobitems, playerphysics, doc, doc_identifier, mesecons_button
|
||||||
|
|
||||||
|
|
|
@ -18,20 +18,6 @@ local function dir_to_pitch(dir)
|
||||||
return -math.atan2(-dir.y, xz)
|
return -math.atan2(-dir.y, xz)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function random_arrow_positions(positions, placement)
|
|
||||||
if positions == "x" then
|
|
||||||
return math.random(-4, 4)
|
|
||||||
elseif positions == "y" then
|
|
||||||
return math.random(0, 10)
|
|
||||||
end
|
|
||||||
if placement == "front" and positions == "z" then
|
|
||||||
return 3
|
|
||||||
elseif placement == "back" and positions == "z" then
|
|
||||||
return -3
|
|
||||||
end
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
|
|
||||||
local function damage_explosion(self, damagemulitplier)
|
local function damage_explosion(self, damagemulitplier)
|
||||||
mcl_explosions.explode(self.object:get_pos(), 3, {})
|
mcl_explosions.explode(self.object:get_pos(), 3, {})
|
||||||
local objects = minetest.get_objects_inside_radius(self.object:get_pos(), 8)
|
local objects = minetest.get_objects_inside_radius(self.object:get_pos(), 8)
|
||||||
|
@ -49,10 +35,10 @@ end
|
||||||
|
|
||||||
local function particle_explosion(self)
|
local function particle_explosion(self)
|
||||||
local particle_pattern = math.random(1, 3)
|
local particle_pattern = math.random(1, 3)
|
||||||
local fpitch = 0
|
local fpitch
|
||||||
local true_type = ""
|
--local true_type
|
||||||
local type = math.random(1,2)
|
local type = math.random(1, 2)
|
||||||
local size = math.random(1,3)
|
local size = math.random(1, 3)
|
||||||
local colors = {"red", "yellow", "blue", "green", "white"}
|
local colors = {"red", "yellow", "blue", "green", "white"}
|
||||||
local this_colors = {colors[math.random(#colors)], colors[math.random(#colors)], colors[math.random(#colors)]}
|
local this_colors = {colors[math.random(#colors)], colors[math.random(#colors)], colors[math.random(#colors)]}
|
||||||
|
|
||||||
|
@ -64,11 +50,11 @@ local function particle_explosion(self)
|
||||||
fpitch = math.random(60, 70)
|
fpitch = math.random(60, 70)
|
||||||
end
|
end
|
||||||
|
|
||||||
if type == 1 then
|
--[[if type == 1 then
|
||||||
true_type = "Popper"
|
true_type = "Popper"
|
||||||
else
|
else
|
||||||
true_type = "Floof"
|
true_type = "Floof"
|
||||||
end
|
end]]
|
||||||
|
|
||||||
if type == 1 then
|
if type == 1 then
|
||||||
minetest.sound_play("mcl_bows_firework", {
|
minetest.sound_play("mcl_bows_firework", {
|
||||||
|
@ -243,6 +229,7 @@ end
|
||||||
|
|
||||||
local mod_awards = minetest.get_modpath("awards") and minetest.get_modpath("mcl_achievements")
|
local mod_awards = minetest.get_modpath("awards") and minetest.get_modpath("mcl_achievements")
|
||||||
local mod_button = minetest.get_modpath("mesecons_button")
|
local mod_button = minetest.get_modpath("mesecons_button")
|
||||||
|
local mod_target = minetest.get_modpath("mcl_target")
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_bows:rocket", {
|
minetest.register_craftitem("mcl_bows:rocket", {
|
||||||
description = S("Arrow"),
|
description = S("Arrow"),
|
||||||
|
@ -578,6 +565,11 @@ function ARROW_ENTITY.on_step(self, dtime)
|
||||||
tnt.ignite(self._stuckin)
|
tnt.ignite(self._stuckin)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Activate target
|
||||||
|
if mod_target and snode.name == "mcl_target:target_off" then
|
||||||
|
mcl_target.hit(self._stuckin, 1) --10 redstone ticks
|
||||||
|
end
|
||||||
|
|
||||||
-- Push the button! Push, push, push the button!
|
-- Push the button! Push, push, push the button!
|
||||||
if mod_button and minetest.get_item_group(node.name, "button") > 0 and minetest.get_item_group(node.name, "button_push_by_arrow") == 1 then
|
if mod_button and minetest.get_item_group(node.name, "button") > 0 and minetest.get_item_group(node.name, "button_push_by_arrow") == 1 then
|
||||||
local bdir = minetest.wallmounted_to_dir(node.param2)
|
local bdir = minetest.wallmounted_to_dir(node.param2)
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
local GRAVITY = tonumber(minetest.settings:get("movement_gravity"))
|
local GRAVITY = tonumber(minetest.settings:get("movement_gravity"))
|
||||||
|
|
||||||
|
local mod_target = minetest.get_modpath("mcl_target")
|
||||||
|
|
||||||
local function splash_image(colorstring, opacity)
|
local function splash_image(colorstring, opacity)
|
||||||
if not opacity then
|
if not opacity then
|
||||||
opacity = 127
|
opacity = 127
|
||||||
|
@ -66,6 +68,9 @@ function mcl_potions.register_splash(name, descr, color, def)
|
||||||
local g = minetest.get_item_group(n, "liquid")
|
local g = minetest.get_item_group(n, "liquid")
|
||||||
local d = 0.1
|
local d = 0.1
|
||||||
local redux_map = {7/8,0.5,0.25}
|
local redux_map = {7/8,0.5,0.25}
|
||||||
|
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})
|
||||||
local texture, acc
|
local texture, acc
|
||||||
|
|
|
@ -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 math = math
|
local math = math
|
||||||
|
|
||||||
-- Time in seconds after which a stuck arrow is deleted
|
-- Time in seconds after which a stuck arrow is deleted
|
||||||
|
@ -342,6 +344,11 @@ function mcl_potions.register_arrow(name, desc, color, def)
|
||||||
self.object:set_velocity({x=0, y=0, z=0})
|
self.object:set_velocity({x=0, y=0, z=0})
|
||||||
self.object:set_acceleration({x=0, y=0, z=0})
|
self.object:set_acceleration({x=0, y=0, z=0})
|
||||||
|
|
||||||
|
-- Activate target
|
||||||
|
if mod_target and snode.name == "mcl_target:target_off" then
|
||||||
|
mcl_target.hit(self._stuckin, 1) --10 redstone ticks
|
||||||
|
end
|
||||||
|
|
||||||
-- Push the button! Push, push, push the button!
|
-- Push the button! Push, push, push the button!
|
||||||
if mod_button and minetest.get_item_group(node.name, "button") > 0 and minetest.get_item_group(node.name, "button_push_by_arrow") == 1 then
|
if mod_button and minetest.get_item_group(node.name, "button") > 0 and minetest.get_item_group(node.name, "button_push_by_arrow") == 1 then
|
||||||
local bdir = minetest.wallmounted_to_dir(node.param2)
|
local bdir = minetest.wallmounted_to_dir(node.param2)
|
||||||
|
|
|
@ -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
|
||||||
|
@ -172,6 +177,9 @@ local function egg_on_step(self, dtime)
|
||||||
end
|
end
|
||||||
minetest.sound_play("mcl_throwing_egg_impact", { pos = self.object:get_pos(), max_hear_distance=10, gain=0.5 }, true)
|
minetest.sound_play("mcl_throwing_egg_impact", { pos = self.object:get_pos(), max_hear_distance=10, gain=0.5 }, true)
|
||||||
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
|
||||||
|
@ -276,6 +284,9 @@ local function pearl_on_step(self, dtime)
|
||||||
|
|
||||||
end
|
end
|
||||||
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