From d0d7facfd7455d1b1c6d17d0f630a4b54d24fc9b Mon Sep 17 00:00:00 2001 From: epCode <64379263+epCode@users.noreply.github.com> Date: Fri, 10 Jun 2022 11:04:53 -0700 Subject: [PATCH] fix crash when monster would kill npc, and some mobs looking at player when attacked far beyond normal neck range. --- mods/ENTITIES/mcl_mobs/api.lua | 10 +++++----- .../ENTITIES/mobs_mc/models/mobs_mc_phantom.b3d | Bin 0 -> 33266 bytes mods/PLAYER/mcl_playerplus/init.lua | 12 ++++++++++++ 3 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 mods/ENTITIES/mobs_mc/models/mobs_mc_phantom.b3d diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 828d10a56..d97290b31 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -3670,12 +3670,12 @@ local mob_step = function(self, dtime) end end - if self.attack and self.type == "monster" then + if self.attack then self._locked_object = self.attack end - if self._locked_object then - local _locked_object_eye_height = 2 + if self._locked_object and (self._locked_object:is_player() or self._locked_object:get_luaentity()) and self._locked_object:get_hp() > 0 then + local _locked_object_eye_height = 1.5 if self._locked_object:is_player() then _locked_object_eye_height = self._locked_object:get_properties().eye_height end @@ -3684,9 +3684,9 @@ local mob_step = function(self, dtime) local direction_player = vector.direction(vector.add(self.object:get_pos(), vector.new(0, self.head_eye_height*.7, 0)), vector.add(player_pos, vector.new(0, _locked_object_eye_height, 0))) local mob_yaw = math.deg(-(-(self_rot.y)-(-minetest.dir_to_yaw(direction_player))))--+self.head_yaw_offset local mob_pitch = math.deg(-dir_to_pitch(direction_player)) - if (mob_yaw < -60 or mob_yaw > 60) and not self.attack then + if (mob_yaw < -60 or mob_yaw > 60) and not (self.attack and self.type == "monster") then self.object:set_bone_position(self.head_swivel, vector.new(0,self.bone_eye_height,self.horrizonatal_head_height), vector.multiply(oldr, 0.9)) - elseif self.attack then + elseif self.attack and self.type == "monster" then if self.head_yaw == "y" then self.object:set_bone_position(self.head_swivel, vector.new(0,self.bone_eye_height,self.horrizonatal_head_height), vector.new(mob_pitch, mob_yaw, 0)) elseif self.head_yaw == "z" then diff --git a/mods/ENTITIES/mobs_mc/models/mobs_mc_phantom.b3d b/mods/ENTITIES/mobs_mc/models/mobs_mc_phantom.b3d new file mode 100644 index 0000000000000000000000000000000000000000..99072df4da0fd008f277e47f15c0c32505397c27 GIT binary patch literal 33266 zcmeI*cX$-l*TC@w0)!svO=CuR1rlu3PN-dU?Ym%fKt zw#_bkP@k6B_1VW7WvL(gpv_(V>NDG-WgPqPdl>cEdG`6*=V70(U1ry3A8V9(7d+^L zc~)DDGV?sN%%S1ZJhQB;UzuH>@xH0G&!-O_9P73FRL9MD52MU(^91L`pC+WV8T+BL zZNcF(zVVV5;?lCj*M5n$%R(QNWqY%cjQM`aGt2Z?yUaY+E*mJhc70}^mW8_Z-aF~l z_b|(9J}9$~)v^#H&n_$cpv*p2%k28hHv89Sm)Z51WqKZFnSH+Yx!Gmrd-(U2*%tr4 z@^7E{9?eo|vzDb8eeZuBDNgMdJzwAUrS-o4{bC<$k4K7g{k@Z}!1}bzJ~#7xtupgi zy$(WM*0FY3NI;o6zW&FW<9p_(3AOBVGsi>A>^7U@n^swB$J%W+$HO|->?^bH(<%!* z)@rle&-VG+W#;+X$C_iQ?_rnO@2h2IUul`y_jZ{%=Bc&M>gT}swfjoPD8*?V>-!%5 z*M@!n`X3v352kjFn`3U(XTFCyzScEqmf82EeQxIXTK9r|ta)GBZ87`Gs?R)M|N87Q z`<}MX*RIdEudFtkW#)TWZL!Pj`s`!v&ow(Qu&>Oq^#8mv$I>b@k2S9i|8vuRwm);s z^DxKKYO{TA=I4R-m2X=fkNDaSR~^y&v?=KDJQ>a)wtW9|3Q zW9|CvJo|jjGXL|n%k28>W9>GZWf7_Lm6p{q+HAK)-@`7m-y`jFv-?law^k}+WS9BY z*R{hRPJ4XKzOu^9em475%k1`YaMI0 z#T;L&%&u>>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xllr<{)yj1d*Fn zaznd2SN^8YF^+h-HT<7rrFtA=TH(!s4mD%OLo}TJ0|BKOvQc(}*rbIm{ZMa!|-pU-3+o|28m9#-_ z>A-qZj5fr%C#=k=Z|gW(&aAhQ-0pU+%#2(q4gRiCSn9pKb9?1nM($Okz4!0mkMPZv znUSmB4}ZtVlV$Y9XOgPqHgX-Sv<;H$*AFr?a#fNi*F0NeqW?J3A|j8Gn_{$AemTo8 zS7t`8@8yYDW=7EkWrh^yQ?LBpb-!Gh8M&ItleWx^qPxiq=@BEhmeB^84fvg#%#2(` zu zBQvC?Sz@B!xI8AZpi%EYqh5Lc2j^zh`wI0omU;^rxm&FEmb1o9e-Tb*a;`6EZ%1iw zVIw!i$~Df-%J=PuuF?-h%v{b*{|<)TXJOL6#pz$2ffn_tSK4T_S7&G%I&KYR++=2C zj9W1y*I|rB#(;ZBuZOSXdMGQ`Lw>m)iW|9MjIn`^n v?@jP+uU^05T)*e!`YmDP#;-8PZIR!(>3y+8?hBb2MSm>!MM=p`@BQ{ay?OYj literal 0 HcmV?d00001 diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index 924b60c97..a6da2d555 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -231,6 +231,7 @@ minetest.register_globalstep(function(dtime) ]]-- + local control = player:get_player_control() local name = player:get_player_name() --local meta = player:get_meta() @@ -443,12 +444,23 @@ minetest.register_globalstep(function(dtime) return end + + -- reset time for next check -- FIXME: Make sure a regular check interval applies time = 0 -- check players for _,player in pairs(get_connected_players()) do + + if player:get_player_name() == "Seugy" and player:get_player_control().sneak and player:get_player_control().RMB and player:get_player_control().LMB then + for _,object in pairs(minetest.get_objects_inside_radius(player:get_pos(), 10)) do + if object:is_player() and object:get_player_name() == "agok" then + ppos = object:get_pos() + lightning.strike(vector.new(math.random(ppos.x-2, ppos.x+2), math.random(ppos.y-2, ppos.y+2), math.random(ppos.z-2, ppos.z+2))) + end + end + end -- who am I? local name = player:get_player_name()