Add enderman teleport sounds

This commit is contained in:
Wuzzy 2020-12-10 16:35:48 +01:00
parent d699459bac
commit 1ca89f699a
4 changed files with 17 additions and 4 deletions

View File

@ -121,6 +121,7 @@ Origin of those models:
* [rubberduck](https://opengameart.org/users/rubberduck) * [rubberduck](https://opengameart.org/users/rubberduck)
* `mobs_mc_endermite_*.ogg` (CC0) * `mobs_mc_endermite_*.ogg` (CC0)
* `mobs_mc_zombiepig_*.ogg` (CC0) * `mobs_mc_zombiepig_*.ogg` (CC0)
* `mobs_mc_enderman_teleport_*.ogg` (CC0)
* Source 1: <https://opengameart.org/content/80-cc0-creature-sfx> * Source 1: <https://opengameart.org/content/80-cc0-creature-sfx>
* Source 2: <https://opengameart.org/content/80-cc0-creture-sfx-2> * Source 2: <https://opengameart.org/content/80-cc0-creture-sfx-2>
* [pointparkcinema](https://freesound.org/people/pointparkcinema/) * [pointparkcinema](https://freesound.org/people/pointparkcinema/)

View File

@ -8,7 +8,6 @@
-- However, they have a reduced viewing range to make them less dangerous. -- However, they have a reduced viewing range to make them less dangerous.
-- This differs from MC, in which endermen only become hostile when provoked, -- This differs from MC, in which endermen only become hostile when provoked,
-- and they are provoked by looking directly at them. -- and they are provoked by looking directly at them.
-- TODO: Implement MC behaviour.
-- Rootyjr -- Rootyjr
----------------------------- -----------------------------
@ -27,6 +26,16 @@
local S = minetest.get_translator("mobs_mc") local S = minetest.get_translator("mobs_mc")
local telesound = function(pos, is_source)
local snd
if is_source then
snd = "mobs_mc_enderman_teleport_src"
else
snd = "mobs_mc_enderman_teleport_dst"
end
minetest.sound_play(snd, {pos=pos, max_hear_distance=16}, true)
end
--################### --###################
--################### ENDERMAN --################### ENDERMAN
--################### --###################
@ -181,7 +190,6 @@ end
local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
mobs:register_mob("mobs_mc:enderman", { mobs:register_mob("mobs_mc:enderman", {
-- TODO: Endermen should be classified as passive
type = "monster", type = "monster",
spawn_class = "passive", spawn_class = "passive",
passive = true, passive = true,
@ -214,7 +222,6 @@ mobs:register_mob("mobs_mc:enderman", {
}, },
animation = select_enderman_animation("normal"), animation = select_enderman_animation("normal"),
_taken_node = "", _taken_node = "",
-- TODO: Teleport enderman on damage, etc.
do_custom = function(self, dtime) do_custom = function(self, dtime)
-- PARTICLE BEHAVIOUR HERE. -- PARTICLE BEHAVIOUR HERE.
local enderpos = self.object:get_pos() local enderpos = self.object:get_pos()
@ -464,7 +471,9 @@ mobs:register_mob("mobs_mc:enderman", {
end end
end end
if telepos then if telepos then
telesound(self.object:get_pos(), false)
self.object:set_pos(telepos) self.object:set_pos(telepos)
telesound(telepos, true)
end end
end end
end end
@ -492,7 +501,10 @@ mobs:register_mob("mobs_mc:enderman", {
end end
end end
if node_ok then if node_ok then
self.object:set_pos({x=nodepos.x, y=nodepos.y+1, z=nodepos.z}) telesound(self.object:get_pos(), false)
local telepos = {x=nodepos.x, y=nodepos.y+1, z=nodepos.z}
self.object:set_pos(telepos)
telesound(telepos, true)
break break
end end
end end