From aa2693795d6ba8610f8807526e4d003d0c2dcb04 Mon Sep 17 00:00:00 2001 From: epCode <64379263+epCode@users.noreply.github.com> Date: Mon, 10 Oct 2022 13:42:01 -0700 Subject: [PATCH] Add Spider Jockey --- mods/ENTITIES/mcl_mobs/api.lua | 13 ++++++++++++ .../mobs_mc/models/mobs_mc_skeleton.b3d | Bin 184408 -> 184760 bytes .../mobs_mc/models/mobs_mc_spider.b3d | Bin 52909 -> 52909 bytes mods/ENTITIES/mobs_mc/skeleton+stray.lua | 20 +++++++++++++++++- mods/ENTITIES/mobs_mc/spider.lua | 13 ++++++++++-- 5 files changed, 43 insertions(+), 3 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index d0972d050..d09a9adfe 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -467,6 +467,10 @@ local set_animation = function(self, anim, fixed_frame) return end + if self.jockey then + anim = "jockey" + end + if flight_check(self) and self.fly and anim == "walk" then anim = "fly" end self._current_animation = self._current_animation or "" @@ -3459,6 +3463,11 @@ end local mob_detach_child = function(self, child) + if self.detach_child then + if self.detach_child(self, child) then + return + end + end if self.driver == child then self.driver = nil end @@ -3807,6 +3816,9 @@ local mob_step = function(self, dtime) _locked_object_eye_height = self._locked_object:get_properties().eye_height end local self_rot = self.object:get_rotation() + if self.object:get_attach() then + self_rot = self.object:get_attach():get_rotation() + end local player_pos = self._locked_object:get_pos() 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 @@ -4094,6 +4106,7 @@ minetest.register_entity(name, { on_die = def.on_die, spawn_small_alternative = def.spawn_small_alternative, do_custom = def.do_custom, + detach_child = def.detach_child, jump_height = def.jump_height or 4, -- was 6 rotate = math.rad(def.rotate or 0), -- 0=front, 90=side, 180=back, 270=side2 lifetimer = def.lifetimer or 57.73, diff --git a/mods/ENTITIES/mobs_mc/models/mobs_mc_skeleton.b3d b/mods/ENTITIES/mobs_mc/models/mobs_mc_skeleton.b3d index f4ff18e25d0c956410b2c5831f383d2616a6f7dc..b390fb310adba6fb892b959bcab17afd1a12bdfa 100644 GIT binary patch delta 3765 zcma)83sh5A7Jc_ZA|UcnAz&);-?1P<5{f3kd;X^M=Vy(|_^BWtJ1#%99ko)?7X{a7 zYg-lcs>@cM*#aw=ai-?1B->yNq>5Xx1uADe`?rXT}EGVuwMQCW!q5z z|E1sBrdRXw1?77mKScam;ViyVc|v#XYPh~NrJubVuou!;Q&rGZA=z@;`oP5tI56=w zV<+)%XJ66PWhwMa%0}A%3|Pm2Pnv|((ZV}#|7djq4hLcbHf#CzAbXdt`oS$-YJPHY z#?>*TqIkx+SOxa!n0d?93D73i8bLAw2X3n|)cYmze#{j?)aFWhpa?438ddbcp<|`o2Qz>T5N_I1|sw zV^CX>!37+XP8JzDAj~0_sUqsYk+OLfYfB`W2tIiNh_GUIoCJt7a4KnX$|H>wskgQF1sZV@!l0T3Rw6cI45~Iup+Z$t9Tn<^FSZlkY-0EH^GA~1&&5AY_wzHXek`GqsQc|KFErc*vtzYiaww~+g#O;j2{yKY zX|}55Q$pGKN^&~z+rIaWmz^R%gITIzB`ju_s$jpSR0TH}S6>G`kSjcHyVI!Y7Wp;K zK@Ck&Cm=DmIaK+TF&fP8rjKs;tIb&(%C=QOWaaisV`rDht4fj^{>hrENrqzTvkpUl zw^vH8AuA#j{ZS`oIthK)2F1?%#bghk5G**VFV*z8*o~7UOmx2k9OYfQ>i7D4P{G0S zB14zUuH7Ne?GJO|ui1;mowdvd+wF2`i)C!s6JSevc*VyO@9Y6T7Q0KvVzKb||0c}b z*l8YR9tYm-20sCoz0^XQA1P`nh}!MCsQvIEsv*DT=x)Ftdm4b){SRT~=0T&}4UnvWyb9_Yb7D{x#77>N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c|#!K9zTBn_7E}wFv?tFmkTbp?2REN#)^i9zyBzw(t{PZ8-iGIdppwF4pPRh z0ZSK=ihs1b!P~rewa2a)>NA$shon7V!FzSSVS(rf*^FOXU<>^r23o_?9@H78u%E33 z7Km?lH{=4T4|xC^HWeU<4NH4a=wdLSsSCs*XsFr0X;{R^e!xI$SlTOQk_rh%#V!|I zZrK~dA`G`PL&Go(2egL?q_7(r7tD4fwk=F!L)U;V7rMHncj>^@UgIG6&nsVFN96%K z)hg?J1AVVt|KL<>o!{|yZJ;OC|A>LuFoku7jncyqGg@H2ce+dFfbGP7@Oy$7Xpu<< zP+?&K7O|*UPmK*9!%a5nO?=oS2U^2$J12vFrq1^y*3>q3|q8rn}u$>v2;db^g zzye|S18pEeXKoIyA!yqVIguEqHp9@y`AxFj2Fxn2Zl1Q|hK3&hc+6ka4u0l8*~Nor zR>=SR=^x!jd-{{BY3{5W-rSkJPzRp0wk&yVX7*Lx6VK2+dEab#^4e7PqL|`L-(md| zPuL@-QPk0%$!k;D%9!Fza2^w09MdQ|VejO%scfH^;>?_yT4mN%GoMwqHzf zCOtg)gacw4MJK#8d2K2?Fs3-O_dF&X6w@d=;bqBdQ`x~W#Tj*Vat~86jiM6{NnV@E zULI4N8C9En!Yg7LMJF7Zyf&4+GNw3l_&g>Y7Skv?VNLSdRCahwai(oV|M5wG6V%2u L${roD{jL81m3aa; diff --git a/mods/ENTITIES/mobs_mc/skeleton+stray.lua b/mods/ENTITIES/mobs_mc/skeleton+stray.lua index ce80a680b..3954edf68 100644 --- a/mods/ENTITIES/mobs_mc/skeleton+stray.lua +++ b/mods/ENTITIES/mobs_mc/skeleton+stray.lua @@ -34,7 +34,6 @@ local skeleton = { "mcl_bows_bow_0.png", -- bow "mobs_mc_skeleton.png", -- skeleton } }, - visual_size = {x=1, y=1}, makes_footstep_sound = true, textures = { { @@ -81,11 +80,27 @@ local skeleton = { run_speed = 30, shoot_start = 70, shoot_end = 90, + jockey_start = 172, + jockey_end = 172, die_start = 160, die_end = 170, die_speed = 15, die_loop = false, }, + jock = "mobs_mc:spider", + on_spawn = function(self) + self.jockey = false + if math.random(100) == 1 then -- 1% like from MCwiki + self.jockey = true + local jock = minetest.add_entity(self.object:get_pos(), "mobs_mc:spider") + jock:get_luaentity().docile_by_day = false + self.object:set_attach(jock, "", vector.new(0,0,0), vector.new(0,0,0)) + end + return true + end, + on_detach=function(self, parent) + self.jockey = false + end, ignited_by_sunlight = true, view_range = 16, fear_height = 4, @@ -93,6 +108,9 @@ local skeleton = { arrow = "mcl_bows:arrow_entity", shoot_arrow = function(self, pos, dir) if mod_bows then + if self.attack then + self.object:set_yaw(minetest.dir_to_yaw(vector.direction(self.object:get_pos(), self.attack:get_pos()))) + end -- 2-4 damage per arrow local dmg = math.max(4, math.random(2, 8)) mcl_bows.shoot_arrow("mcl_bows:arrow", pos, dir, self.object:get_yaw(), self.object, nil, dmg) diff --git a/mods/ENTITIES/mobs_mc/spider.lua b/mods/ENTITIES/mobs_mc/spider.lua index 9a0f49395..e94f804d6 100644 --- a/mods/ENTITIES/mobs_mc/spider.lua +++ b/mods/ENTITIES/mobs_mc/spider.lua @@ -14,7 +14,7 @@ local S = minetest.get_translator("mobs_mc") minetest.register_entity("mobs_mc:spider_eyes", { visual = "mesh", mesh = "mobs_mc_spider.b3d", - visual_size = {x=1.01, y=1.01}, + visual_size = {x=1.01/3, y=1.01/3}, textures = { "mobs_mc_spider_eyes.png", }, @@ -44,6 +44,7 @@ local spider = { xp_max = 5, armor = {fleshy = 100, arthropod = 100}, on_spawn = function(self) + self.object:set_properties({visual_size={x=1,y=1}}) local spider_eyes=false for n = 1, #self.object:get_children() do local obj = self.object:get_children()[n] @@ -55,6 +56,14 @@ local spider = { minetest.add_entity(self.object:get_pos(), "mobs_mc:spider_eyes"):set_attach(self.object, "body.head", vector.new(0,-0.98,2), vector.new(90,180,180)) end end, + on_die=function(self) + if self.object:get_children() and self.object:get_children()[1] then + self.object:get_children()[1]:set_detach() + end + end, + detach_child=function(self, child) + child:get_luaentity().jockey = false + end, head_swivel = "Head_Control", bone_eye_height = 1, curiosity = 10, @@ -65,7 +74,7 @@ local spider = { textures = { {"mobs_mc_spider.png"}, }, - visual_size = {x=3, y=3}, + visual_size = {x=1, y=1}, makes_footstep_sound = false, sounds = { random = "mobs_mc_spider_random",