From eb97641e72c25cb2adf5336205df9f0a7a039756 Mon Sep 17 00:00:00 2001 From: Juraj Vajda Date: Sun, 18 Nov 2018 12:13:47 -0500 Subject: [PATCH] custom attack function for balrog --- spawners_mobs/depends.txt | 1 + spawners_mobs/mob_balrog.lua | 44 ++++++++++++++++-- .../sounds/spawners_mobs_teleport.ogg | Bin 0 -> 8356 bytes 3 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 spawners_mobs/sounds/spawners_mobs_teleport.ogg diff --git a/spawners_mobs/depends.txt b/spawners_mobs/depends.txt index f101d19..48063c9 100644 --- a/spawners_mobs/depends.txt +++ b/spawners_mobs/depends.txt @@ -1,4 +1,5 @@ default +x_default xpanes? fire? mobs? diff --git a/spawners_mobs/mob_balrog.lua b/spawners_mobs/mob_balrog.lua index 4c7abe3..2952dbb 100644 --- a/spawners_mobs/mob_balrog.lua +++ b/spawners_mobs/mob_balrog.lua @@ -121,6 +121,47 @@ local balrog_def = { speed_normal = 15, speed_run = 15, }, + _timer = 0, + _random_trigger = 15, + do_custom = function(self, dtime) + if not self._timer then + self._timer = 0 + end + + if not self._random_trigger then + self._random_trigger = math.random(15, 30) + end + + self._timer = self._timer + dtime + + if self._timer > self._random_trigger then + self._timer = 0 + self._random_trigger = math.random(15, 30) + + local mob_pos = self.object:get_pos() + local activation_area = minetest.get_objects_inside_radius(mob_pos, 20) + for k, object in ipairs(activation_area) do + if object:is_player() then + local player_pos = object:get_pos() + local player_hp = object:get_hp() + + -- is in MMO Arena & health check + if x_default:isInMMOArena(player_pos) and player_hp > 0 then + -- play sound + minetest.sound_play("spawners_mobs_teleport", { + object = object, + gain = 1.0, + max_hear_distance = 20 + }) + + -- teleport player + object:set_pos(mob_pos) + end + + end + end + end + end } mobs:register_mob("spawners_mobs:balrog", balrog_def) @@ -143,9 +184,6 @@ mobs:register_arrow("spawners_mobs:balrog_firebolt", { visual_size = {x = 1, y = 1}, textures = {"spawners_mobs_firebolt.png"}, velocity = 15, - -- tail = 1, - -- tail_texture = "spawners_mobs_black_skull.png", - -- tail_size = 10, -- direct hit, no fire... just plenty of pain hit_player = function(self, player) diff --git a/spawners_mobs/sounds/spawners_mobs_teleport.ogg b/spawners_mobs/sounds/spawners_mobs_teleport.ogg new file mode 100644 index 0000000000000000000000000000000000000000..8fa188457114d6f4b74bb16d83e2f020a3a1ddc7 GIT binary patch literal 8356 zcmb_=c|4Te`~Pjp7P1VDeXJP~V=G%R_CYjMqNEwS>_yqDQDTx9vPX=vOeKv%MAq!< zRD>j3L?ufpeb0>Nc|OnQ_s8$`{o{MT&dglrT+2Dv`?}6`&fK=1p7szk^w%T1QGSX} zHp4VgOp;8Y0l_%$5c&X<%rW{81lcuh|CTV>(l!5i=$cHRm%WgH+U5J_-_LuNZ9B?< z?dToowa+%#6LHoXcZ^{jVTn*zLusj@)U*(aAF>JmG$eghaPYAY@HiKCCfMD;KH$8+ z8^SCg*wY=Mxle5u;F%aXm>QsTbPlMf9Z*p}z_ep~Dmk?AF($|m=%e|Rc2Mw1y6r;J zM3KAs=niC?1iDYUP|i4Bw^geRjyJD%OF+N6)R%k|qAL`MAGZs(RGG~QDTE*I3YtRz zY8v6$6~rkIs3e`)l;9-PHkUUTNte3>GfxP*2M1JTHl;9p6K+PboVS^uN z(YbI>-r${dE3I^U3v|mwt*1lVatvX{7m;qBLHVO*g+m_Dt$?oh_83CbO$bVcp!@>G zgb#|me4>xJpmqr2GYo>6--20HhvR@yNX$N zmC7D_cRW_^e7sPzkD+b>qIv|@5(r~w=(#}j;en)&jw$35dF+I%<;+kl1hE1+ zZu1J5%~!eJZ~DC}|8Lu#76C!fWkokQ%ikg3kQNm&&czCxf0cGq3~km)hhwqzO3K9+RMA1fZtn96K(~$#INb;X^;m ziRi2b8Vo3aj|~U{9~#JjFJuu3Yk@4zz$GBt#6!AJZHOz}>T~(2hjm{Sr5x7nkSk2W z`XZ??d+Um6VLXLO%L#dCgv1k3t?>VR$ueL74)d{zxFv%H5?~CY!N8vQwp)Nn&rWeu zteknU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