diff options
author | TenPlus1 <kinsellaja@yahoo.com> | 2017-07-03 19:07:57 +0100 |
---|---|---|
committer | TenPlus1 <kinsellaja@yahoo.com> | 2017-07-03 19:07:57 +0100 |
commit | 949497248375b643431d2ece0b2588344b574042 (patch) | |
tree | a7d0f7d2ffa55e208ca3e0b8521a6a2cafe47ace | |
parent | cf3a9fd679a8369f24438179889b7fc3518cdd1c (diff) |
add visual/sound when protecting mob, also when using net/lasso
-rw-r--r-- | api.lua | 28 | ||||
-rw-r--r-- | sounds/license.txt | 4 | ||||
-rw-r--r-- | sounds/spell.ogg | bin | 0 -> 15205 bytes | |||
-rw-r--r-- | sounds/swing.ogg | bin | 0 -> 6895 bytes | |||
-rw-r--r-- | textures/mobs_protect_particle.png | bin | 0 -> 117 bytes |
5 files changed, 26 insertions, 6 deletions
@@ -1,9 +1,9 @@ --- Mobs Api (2nd July 2017) +-- Mobs Api (3rd July 2017) mobs = {} mobs.mod = "redo" -mobs.version = "20170630" +mobs.version = "20170703" -- Intllib @@ -275,12 +275,13 @@ end -- 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 min_size = min_size or 0.5 max_size = max_size or 1 gravity = gravity or -10 + glow = glow or 0 minetest.add_particlespawner({ amount = amount, @@ -296,6 +297,7 @@ local effect = function(pos, amount, texture, min_size, max_size, radius, gravit minsize = min_size, maxsize = max_size, texture = texture, + glow = glow, }) end @@ -3292,8 +3294,13 @@ function mobs:capture_mob(self, clicker, chance_hand, chance_net, chance_lasso, self.object:remove() + mob_sound(self, "default_place_node_hard") + + else minetest.chat_send_player(name, S("Missed!")) + + mob_sound(self, "swing") end end @@ -3321,11 +3328,20 @@ function mobs:protect(self, clicker) return true -- false end - tool:take_item() -- take 1 protection rune - clicker:set_wielded_item(tool) + if not creative then + tool:take_item() -- take 1 protection rune + clicker:set_wielded_item(tool) + end 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 end diff --git a/sounds/license.txt b/sounds/license.txt new file mode 100644 index 0000000..9dda317 --- /dev/null +++ b/sounds/license.txt @@ -0,0 +1,4 @@ +Creative Commons License sounds from Freesound.org + +swing.ogg by qubodup +spell.ogg by littletobotsoundfactory diff --git a/sounds/spell.ogg b/sounds/spell.ogg Binary files differnew file mode 100644 index 0000000..455b54f --- /dev/null +++ b/sounds/spell.ogg diff --git a/sounds/swing.ogg b/sounds/swing.ogg Binary files differnew file mode 100644 index 0000000..ffe6a9c --- /dev/null +++ b/sounds/swing.ogg diff --git a/textures/mobs_protect_particle.png b/textures/mobs_protect_particle.png Binary files differnew file mode 100644 index 0000000..debe20c --- /dev/null +++ b/textures/mobs_protect_particle.png |