forked from mtcontrib/mobs_redo
add visual/sound when protecting mob, also when using net/lasso
This commit is contained in:
parent
cf3a9fd679
commit
9494972483
24
api.lua
24
api.lua
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
-- Mobs Api (2nd July 2017)
|
-- Mobs Api (3rd July 2017)
|
||||||
|
|
||||||
mobs = {}
|
mobs = {}
|
||||||
mobs.mod = "redo"
|
mobs.mod = "redo"
|
||||||
mobs.version = "20170630"
|
mobs.version = "20170703"
|
||||||
|
|
||||||
|
|
||||||
-- Intllib
|
-- Intllib
|
||||||
|
@ -275,12 +275,13 @@ end
|
||||||
|
|
||||||
|
|
||||||
-- particle effects
|
-- particle effects
|
||||||
local effect = function(pos, amount, texture, min_size, max_size, radius, gravity)
|
local effect = function(pos, amount, texture, min_size, max_size, radius, gravity, glow)
|
||||||
|
|
||||||
radius = radius or 2
|
radius = radius or 2
|
||||||
min_size = min_size or 0.5
|
min_size = min_size or 0.5
|
||||||
max_size = max_size or 1
|
max_size = max_size or 1
|
||||||
gravity = gravity or -10
|
gravity = gravity or -10
|
||||||
|
glow = glow or 0
|
||||||
|
|
||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
amount = amount,
|
amount = amount,
|
||||||
|
@ -296,6 +297,7 @@ local effect = function(pos, amount, texture, min_size, max_size, radius, gravit
|
||||||
minsize = min_size,
|
minsize = min_size,
|
||||||
maxsize = max_size,
|
maxsize = max_size,
|
||||||
texture = texture,
|
texture = texture,
|
||||||
|
glow = glow,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -3292,8 +3294,13 @@ function mobs:capture_mob(self, clicker, chance_hand, chance_net, chance_lasso,
|
||||||
|
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
|
|
||||||
|
mob_sound(self, "default_place_node_hard")
|
||||||
|
|
||||||
|
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(name, S("Missed!"))
|
minetest.chat_send_player(name, S("Missed!"))
|
||||||
|
|
||||||
|
mob_sound(self, "swing")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -3321,11 +3328,20 @@ function mobs:protect(self, clicker)
|
||||||
return true -- false
|
return true -- false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not creative then
|
||||||
tool:take_item() -- take 1 protection rune
|
tool:take_item() -- take 1 protection rune
|
||||||
clicker:set_wielded_item(tool)
|
clicker:set_wielded_item(tool)
|
||||||
|
end
|
||||||
|
|
||||||
self.protected = true
|
self.protected = true
|
||||||
minetest.chat_send_player(name, S("Protected!"))
|
-- minetest.chat_send_player(name, S("Protected!"))
|
||||||
|
|
||||||
|
local pos = self.object:getpos()
|
||||||
|
pos.y = pos.y + self.collisionbox[2] + 0.5
|
||||||
|
|
||||||
|
effect(self.object:getpos(), 25, "mobs_protect_particle.png", 0.5, 4, 2, 15)
|
||||||
|
|
||||||
|
mob_sound(self, "spell")
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
4
sounds/license.txt
Normal file
4
sounds/license.txt
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
Creative Commons License sounds from Freesound.org
|
||||||
|
|
||||||
|
swing.ogg by qubodup
|
||||||
|
spell.ogg by littletobotsoundfactory
|
BIN
sounds/spell.ogg
Normal file
BIN
sounds/spell.ogg
Normal file
Binary file not shown.
BIN
sounds/swing.ogg
Normal file
BIN
sounds/swing.ogg
Normal file
Binary file not shown.
BIN
textures/mobs_protect_particle.png
Normal file
BIN
textures/mobs_protect_particle.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 117 B |
Loading…
Reference in New Issue
Block a user