From e2fd8b804c2030c2cfed13d8e9fa0e304d320989 Mon Sep 17 00:00:00 2001 From: Faerraven Date: Sun, 9 Oct 2022 17:30:42 +0200 Subject: [PATCH 01/16] Add glow squids from mcl5 --- mods/ENTITIES/mobs_mc/glow_squid.lua | 253 ++++++++++++++++++ mods/ENTITIES/mobs_mc/init.lua | 2 + .../mobs_mc/models/extra_mobs_glow_squid.b3d | Bin 0 -> 40908 bytes .../textures/extra_mobs_glow_squid.png | Bin 0 -> 9028 bytes .../textures/extra_mobs_glow_squid_glint1.png | Bin 0 -> 170 bytes .../textures/extra_mobs_glow_squid_glint2.png | Bin 0 -> 175 bytes .../textures/extra_mobs_glow_squid_glint3.png | Bin 0 -> 175 bytes .../textures/extra_mobs_glow_squid_glint4.png | Bin 0 -> 175 bytes 8 files changed, 255 insertions(+) create mode 100644 mods/ENTITIES/mobs_mc/glow_squid.lua create mode 100644 mods/ENTITIES/mobs_mc/models/extra_mobs_glow_squid.b3d create mode 100644 mods/ENTITIES/mobs_mc/textures/extra_mobs_glow_squid.png create mode 100644 mods/ENTITIES/mobs_mc/textures/extra_mobs_glow_squid_glint1.png create mode 100644 mods/ENTITIES/mobs_mc/textures/extra_mobs_glow_squid_glint2.png create mode 100644 mods/ENTITIES/mobs_mc/textures/extra_mobs_glow_squid_glint3.png create mode 100644 mods/ENTITIES/mobs_mc/textures/extra_mobs_glow_squid_glint4.png diff --git a/mods/ENTITIES/mobs_mc/glow_squid.lua b/mods/ENTITIES/mobs_mc/glow_squid.lua new file mode 100644 index 000000000..37bf72eab --- /dev/null +++ b/mods/ENTITIES/mobs_mc/glow_squid.lua @@ -0,0 +1,253 @@ +--MCmobs v0.4 +--maikerumine +--made for MC like Survival game +--License for code WTFPL and otherwise stated in readmes + +local S = minetest.get_translator("extra_mobs") + +mcl_mobs:register_mob("mobs_mc:glow_squid", { + type = "animal", + spawn_class = "water", + can_despawn = true, + passive = true, + hp_min = 10, + hp_max = 10, + xp_min = 1, + xp_max = 3, + armor = 100, + rotate = 270, + -- tilt_swim breaks the animations. + --tilt_swim = true, + -- FIXME: If the qlow squid is near the floor, it turns black + collisionbox = { -0.4, 0.0, -0.4, 0.4, 0.9, 0.4 }, + visual = "mesh", + mesh = "extra_mobs_glow_squid.b3d", + textures = { + { "extra_mobs_glow_squid.png" } + }, + sounds = { + damage = { name = "mobs_mc_squid_hurt", gain = 0.3 }, + death = { name = "mobs_mc_squid_death", gain = 0.4 }, + flop = "mobs_mc_squid_flop", + distance = 16, + }, + animation = { + stand_start = 1, + stand_end = 60, + walk_start = 1, + walk_end = 60, + run_start = 1, + run_end = 60, + }, + drops = { + { name = "mobs_mc:glow_ink_sac", + chance = 1, + min = 1, + max = 3, + looting = "common", }, + }, + visual_size = { x = 3, y = 3 }, + makes_footstep_sound = false, + swim = true, + breathes_in_water = true, + jump = false, + view_range = 16, + runaway = true, + fear_height = 4, + fly = true, + fly_in = { "mcl_core:water_source", "mclx_core:river_water_source" }, + -- don't add "mcl_core:water_flowing", or it won't move vertically. + + glow = minetest.LIGHT_MAX, + + do_custom = function(self, dtime) + local glowSquidPos = 0 + if self.object:get_pos() ~= nil then + glowSquidPos = self.object:get_pos() + + local chanceOfParticle = math.random(0, 2) + if chanceOfParticle >= 1 then + minetest.add_particle({ + pos = { x = glowSquidPos.x + math.random(-2, 2) * math.random() / 2, y = glowSquidPos.y + math.random(-1, 2), z = glowSquidPos.z + math.random(-2, 2) * math.random() / 2 }, + velocity = { x = math.random(-0.25, 0.25), y = math.random(-0.25, 0.25), z = math.random(-0.25, 0.25) }, + acceleration = { x = math.random(-0.5, 0.5), y = math.random(-0.5, 0.5), z = math.random(-0.5, 0.5) }, + expirationtime = math.random(), + size = 1.5 + math.random(), + collisiondetection = true, + vertical = false, + texture = "extra_mobs_glow_squid_glint" .. math.random(1, 4) .. ".png", + glow = minetest.LIGHT_MAX, + }) + end + end + end +}) + +-- spawning +local water = mobs_mc.water_level - 1 +-- local water = mobs_mc.spawn_height.water + 1 +mcl_mobs:spawn_specific( + "mobs_mc:glow_squid", + "overworld", + "water", + { + "Mesa", + "FlowerForest", + "Swampland", + "Taiga", + "ExtremeHills", + "Jungle", + "Savanna", + "BirchForest", + "MegaSpruceTaiga", + "MegaTaiga", + "ExtremeHills+", + "Forest", + "Plains", + "Desert", + "ColdTaiga", + "MushroomIsland", + "IcePlainsSpikes", + "SunflowerPlains", + "IcePlains", + "RoofedForest", + "ExtremeHills+_snowtop", + "MesaPlateauFM_grasstop", + "JungleEdgeM", + "ExtremeHillsM", + "JungleM", + "BirchForestM", + "MesaPlateauF", + "MesaPlateauFM", + "MesaPlateauF_grasstop", + "MesaBryce", + "JungleEdge", + "SavannaM", + "FlowerForest_beach", + "Forest_beach", + "StoneBeach", + "ColdTaiga_beach_water", + "Taiga_beach", + "Savanna_beach", + "Plains_beach", + "ExtremeHills_beach", + "ColdTaiga_beach", + "Swampland_shore", + "MushroomIslandShore", + "JungleM_shore", + "Jungle_shore", + "MesaPlateauFM_sandlevel", + "MesaPlateauF_sandlevel", + "MesaBryce_sandlevel", + "Mesa_sandlevel", + "RoofedForest_ocean", + "JungleEdgeM_ocean", + "BirchForestM_ocean", + "BirchForest_ocean", + "IcePlains_deep_ocean", + "Jungle_deep_ocean", + "Savanna_ocean", + "MesaPlateauF_ocean", + "ExtremeHillsM_deep_ocean", + "Savanna_deep_ocean", + "SunflowerPlains_ocean", + "Swampland_deep_ocean", + "Swampland_ocean", + "MegaSpruceTaiga_deep_ocean", + "ExtremeHillsM_ocean", + "JungleEdgeM_deep_ocean", + "SunflowerPlains_deep_ocean", + "BirchForest_deep_ocean", + "IcePlainsSpikes_ocean", + "Mesa_ocean", + "StoneBeach_ocean", + "Plains_deep_ocean", + "JungleEdge_deep_ocean", + "SavannaM_deep_ocean", + "Desert_deep_ocean", + "Mesa_deep_ocean", + "ColdTaiga_deep_ocean", + "Plains_ocean", + "MesaPlateauFM_ocean", + "Forest_deep_ocean", + "JungleM_deep_ocean", + "FlowerForest_deep_ocean", + "MushroomIsland_ocean", + "MegaTaiga_ocean", + "StoneBeach_deep_ocean", + "IcePlainsSpikes_deep_ocean", + "ColdTaiga_ocean", + "SavannaM_ocean", + "MesaPlateauF_deep_ocean", + "MesaBryce_deep_ocean", + "ExtremeHills+_deep_ocean", + "ExtremeHills_ocean", + "MushroomIsland_deep_ocean", + "Forest_ocean", + "MegaTaiga_deep_ocean", + "JungleEdge_ocean", + "MesaBryce_ocean", + "MegaSpruceTaiga_ocean", + "ExtremeHills+_ocean", + "Jungle_ocean", + "RoofedForest_deep_ocean", + "IcePlains_ocean", + "FlowerForest_ocean", + "ExtremeHills_deep_ocean", + "MesaPlateauFM_deep_ocean", + "Desert_ocean", + "Taiga_ocean", + "BirchForestM_deep_ocean", + "Taiga_deep_ocean", + "JungleM_ocean", + "FlowerForest_underground", + "JungleEdge_underground", + "StoneBeach_underground", + "MesaBryce_underground", + "Mesa_underground", + "RoofedForest_underground", + "Jungle_underground", + "Swampland_underground", + "MushroomIsland_underground", + "BirchForest_underground", + "Plains_underground", + "MesaPlateauF_underground", + "ExtremeHills_underground", + "MegaSpruceTaiga_underground", + "BirchForestM_underground", + "SavannaM_underground", + "MesaPlateauFM_underground", + "Desert_underground", + "Savanna_underground", + "Forest_underground", + "SunflowerPlains_underground", + "ColdTaiga_underground", + "IcePlains_underground", + "IcePlainsSpikes_underground", + "MegaTaiga_underground", + "Taiga_underground", + "ExtremeHills+_underground", + "JungleM_underground", + "ExtremeHillsM_underground", + "JungleEdgeM_underground", + }, + 0, + minetest.LIGHT_MAX + 1, + 30, + 10000, + 3, + water - 16, + water) + +-- spawn egg +mcl_mobs:register_egg("mobs_mc:glow_squid", S("Glow Squid"), "#0000FF", "#ffffff", 1) + +-- dropped item (used to craft glowing itemframe) + +minetest.register_craftitem("mobs_mc:glow_ink_sac", { + description = S("Glow Ink Sac"), + _doc_items_longdesc = S("Use it to craft the Glow Item Frame."), + _doc_items_usagehelp = S("Use the Glow Ink Sac and the normal Item Frame to craft the Glow Item Frame."), + inventory_image = "extra_mobs_glow_ink_sac.png", + groups = { craftitem = 1 }, +}) diff --git a/mods/ENTITIES/mobs_mc/init.lua b/mods/ENTITIES/mobs_mc/init.lua index f32255d39..9c845c93e 100644 --- a/mods/ENTITIES/mobs_mc/init.lua +++ b/mods/ENTITIES/mobs_mc/init.lua @@ -148,3 +148,5 @@ dofile(path .. "/cod.lua") dofile(path .. "/salmon.lua") dofile(path .. "/tropical_fish.lua") dofile(path .. "/dolphin.lua") + +dofile(path .. "/glow_squid.lua") diff --git a/mods/ENTITIES/mobs_mc/models/extra_mobs_glow_squid.b3d b/mods/ENTITIES/mobs_mc/models/extra_mobs_glow_squid.b3d new file mode 100644 index 0000000000000000000000000000000000000000..887576b28a8948bdd4aa0f19099db2303936f196 GIT binary patch literal 40908 zcmeHw33OCN*8i2oL}c6m7X(F6K|~BR8-v1`ry>HJ;TW|pbZtB;!;n`d$s!@lC-g)bfZaDCmm~^0^q|Mun zydD2oEk5qp$|LG2h*}8bhXRj@=6^5pkpIKL=3Qg?GK~CFj|QvcXWdax5OqakRDR>5 z!7Am)^11xP`NJx|KXLiUSLHiKzCiuB{EW(cqkMt(#q!nn*O*^Z`9}Y!@8|xxvGV(k z{#D-}%TKO4stU*hkt>|e|HAz#feOaG#OI6ra!R_0sAAM=yvuhIXB z=4Z9-&;GWb`}d2wb+KXE?V&-sbV z=lONPGuJpqzA^vNKT_oz3zeU^d>()NKl)Gi&oT4g&)5BX%>1|K z^YicLA6q^@|Mv0W`uX|CjxVVM?t{OtvS|3^ObYb;-e zuUwn!UAsPC>Hos|ebn=JZI_8rU;kgRHrGpEpRdYCKFW{fw-EMx9)ElJJpQO(hi?a| z@AvEXbwM{lx_^=1?%P3C+84`jq1sndes$%4v+*OhXRQ5d{&V}df4|!Jk=rBIel>q$ z`7K0E`8Aba)A%62y79I5KjtTqz5jTAR$qTv&G+;CNBN2Sm&>=0KhOV~+Fw)u4I1&K z)3Vjv1oM;i9v^%E#>!7Tzj*%F)c%^rr^Uv%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IaQ&=_0;dDN zs~v|nZ2WT!7mE$69ftxz=Pzr=VInNXW6VkwSSrTPC=Jiljzb$3fe<)>`TLCgFoGfA zI821a*gdQDpvUyVkedsH`IZpHf(`Dv2@nriXxiJfu-?SzaAqi154SynSrJH#8UM}i~FbC=M8)G z$LLob=WOx+7uWTb2bLx}m*zj+eOP-gP3`**S!&;R$Wr^hLzaKf`wpex_Z>>X?>m%& z`Joj2zC$VaeTP!;`wpex_Z>>X?>m%&152gg_Z>>X?>m%&-G@@}`wpex_Z>>X?>m%& z-*+elzwb~A-gqblzwb~Ae&3-K{Juje_*@z(_|7cf_8%8b z^A9ZT^7_eqE{zR)-SrRq2bP9z`mjJ9SZc#w-Q{urz|znKlM2*yp@T|5gl>5-cn(Ll66!8x%4ZqfIxpE(xSaZ$L=fjorOJJ1!#4i(i_QALQs>=g7AyCmi8bqR*Y1C9)(4h4y`EdB z+=n*ox{}n0KCskT_Q-tYKD1%Cw>mAN4=i)fz75YY#9I>F|TDEFZayLL;bh(55?p$lgz_o0b3+xBSo^gsk7zDnaX`=!_GZE z8qo)qI#-_^Q0_w;cGIiHs$94c)9wu@_o0b3+xBDKVpZSJ=bqC+29^8JhW%_?QDr|o z9PXsthbGo++oDgmMf8EC&RZ)lSMEa_HZAJ~HEsh&KI^Po(^ZP;D+MAUqEByG9# zQwK-64^6B;W~j?6pFCGN&(@!Nm2w}NShK!2mabFtH>+rx^H!f8%6(|Vp4@qjdM<*in1#kLUwSy9}N%LY+%v!>+G9u$1lF{{xaF<@Nvo literal 0 HcmV?d00001 diff --git a/mods/ENTITIES/mobs_mc/textures/extra_mobs_glow_squid.png b/mods/ENTITIES/mobs_mc/textures/extra_mobs_glow_squid.png new file mode 100644 index 0000000000000000000000000000000000000000..ccbdb9707a87ab43dfb41969e2c6e8cbe7672814 GIT binary patch literal 9028 zcmeHrc{r5q-~KJTl${X9WD8@)jAbzPJ^Q{!voe^)%wS5=LXuEa_9YT3J5h+FMMVkO zBSjG+gi^f+_4M@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!7U&Wco3QH?^_pPs@Ui*z5BR3@M>e5~UrPmf@`vT3G%42dX>rSe_lLDBfP#(8+u0 z@WSivQ;wl^@JCORm!-JbGj2R|XJZ{?e4|mNQ~6YdPlx$M>ockT=D!XUyY%e&^srsGO5kvT(st{7Dk}GA*zdxY)==y=+ z3+&uY?v0nWt(kAmKve%0B$F+V*llvTzu0}`^9C!c_tA3~i&S+&BNbxHr46&x2QS&D zKjqJvwz#uo;F03BTatHA;>NeH5^||2AzGIa7vjz0a@hgYpdkRPt#s|icofUp$X-UQ zU%fZ^xic@AtXKV}eIGpG-815S8K6C-$133CS$ReHJ#bCxGkFuC{&zX1+AI;#jhsM3 zWJ_VbQjo>n^1D`(^Iw;GoMB!a1eXfLJ+NGsU9*F~P|W_gDrPifuM*E$HusdlD3_zJ zy5IUa_XBaG<$?=?aTM3%j|idb&F`rLbMIho_CAmFhU}?IBjb{^m>h&i+xpX_bi*XZFO kP^LT%a3Wj3OGdLM>d-z|+3U`4{!M9ZZf{m@a^U!X0ZRPE`~Uy| literal 0 HcmV?d00001 diff --git a/mods/ENTITIES/mobs_mc/textures/extra_mobs_glow_squid_glint1.png b/mods/ENTITIES/mobs_mc/textures/extra_mobs_glow_squid_glint1.png new file mode 100644 index 0000000000000000000000000000000000000000..2ed9a013c75a6f6a4dbb3965eb66a8b8aedf1d62 GIT binary patch literal 170 zcmeAS@N?(olHy`uVBq!ia0y~yVBiE{4mJh`h6fYb1Q-|?*pj^6T^Rm@;DWu&CxfI5 zJR*x381$4un6YB1eHjA-1AB?5uPggg7FI4X>C2h@eGCi?=AJH&ArhC96BO9r>@Ry} zze_^cP%2R5tlfr(_C~zSJv-JkFuLmsyRnr_{uXcjS^lodE6X_=3=CFjQUSNaL=+hq P7#KWV{an^LB{Ts5kXJ61 literal 0 HcmV?d00001 diff --git a/mods/ENTITIES/mobs_mc/textures/extra_mobs_glow_squid_glint2.png b/mods/ENTITIES/mobs_mc/textures/extra_mobs_glow_squid_glint2.png new file mode 100644 index 0000000000000000000000000000000000000000..deed540994c12422878d1d98f5f7115603fb22d1 GIT binary patch literal 175 zcmeAS@N?(olHy`uVBq!ia0y~yVBiE{4mJh`h6fYb1Q-|?*pj^6T^Rm@;DWu&CxfI5 zJR*x381$4un6YB1eHjA-1AB?5uPggg7FI3^j*}se?=dhi*m$})hDcmaPEcT9W3}b6 z{VoY%L#aR!Q@y$0)uA3I?<6QB+hPqc)Ps4q?}B|VUOB&VO9qJ>q6|j U6PI^0FfcH9y85}Sb4q9e07c9%qW}N^ literal 0 HcmV?d00001 From a599f6636056e090bae2abcf06389b8003817359 Mon Sep 17 00:00:00 2001 From: cora Date: Sun, 9 Oct 2022 17:37:01 +0200 Subject: [PATCH 02/16] move ink sac to mcl_mobitems --- mods/ENTITIES/mobs_mc/glow_squid.lua | 12 +----------- mods/ITEMS/mcl_mobitems/init.lua | 9 +++++++++ .../textures/extra_mobs_glow_ink_sac.png | Bin 0 -> 407 bytes 3 files changed, 10 insertions(+), 11 deletions(-) create mode 100644 mods/ITEMS/mcl_mobitems/textures/extra_mobs_glow_ink_sac.png diff --git a/mods/ENTITIES/mobs_mc/glow_squid.lua b/mods/ENTITIES/mobs_mc/glow_squid.lua index 37bf72eab..22faaec16 100644 --- a/mods/ENTITIES/mobs_mc/glow_squid.lua +++ b/mods/ENTITIES/mobs_mc/glow_squid.lua @@ -240,14 +240,4 @@ mcl_mobs:spawn_specific( water) -- spawn egg -mcl_mobs:register_egg("mobs_mc:glow_squid", S("Glow Squid"), "#0000FF", "#ffffff", 1) - --- dropped item (used to craft glowing itemframe) - -minetest.register_craftitem("mobs_mc:glow_ink_sac", { - description = S("Glow Ink Sac"), - _doc_items_longdesc = S("Use it to craft the Glow Item Frame."), - _doc_items_usagehelp = S("Use the Glow Ink Sac and the normal Item Frame to craft the Glow Item Frame."), - inventory_image = "extra_mobs_glow_ink_sac.png", - groups = { craftitem = 1 }, -}) +mcl_mobs:register_egg("mobs_mc:glow_squid", S("Glow Squid"), "#0000FF", "#ffffff", 0) diff --git a/mods/ITEMS/mcl_mobitems/init.lua b/mods/ITEMS/mcl_mobitems/init.lua index d5b43058e..a5c2a4214 100644 --- a/mods/ITEMS/mcl_mobitems/init.lua +++ b/mods/ITEMS/mcl_mobitems/init.lua @@ -390,6 +390,15 @@ minetest.register_alias("mobs_mc:iron_horse_armor", "mcl_mobitems:iron_horse_arm minetest.register_alias("mobs_mc:gold_horse_armor", "mcl_mobitems:gold_horse_armor") minetest.register_alias("mobs_mc:diamond_horse_armor", "mcl_mobitems:diamond_horse_armor") +minetest.register_craftitem("mcl_mobitems:glow_ink_sac", { + description = S("Glow Ink Sac"), + _doc_items_longdesc = S("Use it to craft the Glow Item Frame."), + _doc_items_usagehelp = S("Use the Glow Ink Sac and the normal Item Frame to craft the Glow Item Frame."), + inventory_image = "extra_mobs_glow_ink_sac.png", + groups = { craftitem = 1 }, +}) + + ----------- -- Crafting ----------- diff --git a/mods/ITEMS/mcl_mobitems/textures/extra_mobs_glow_ink_sac.png b/mods/ITEMS/mcl_mobitems/textures/extra_mobs_glow_ink_sac.png new file mode 100644 index 0000000000000000000000000000000000000000..6628e6abb1b239b3ca6c325b131baadbec05f1b6 GIT binary patch literal 407 zcmV;I0cie-P)Px$QAtEWR5*?8kvmHRK@>*MiZ2qgV6lRdI00>puQC!FQ6fI7XiBw>SXx-w+50D~ z)hb{kY9R<}p@G Date: Sun, 9 Oct 2022 17:59:31 +0200 Subject: [PATCH 03/16] Fix glow squid rotation / swimming direction --- mods/ENTITIES/mobs_mc/glow_squid.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/glow_squid.lua b/mods/ENTITIES/mobs_mc/glow_squid.lua index 22faaec16..6aac27a75 100644 --- a/mods/ENTITIES/mobs_mc/glow_squid.lua +++ b/mods/ENTITIES/mobs_mc/glow_squid.lua @@ -15,7 +15,7 @@ mcl_mobs:register_mob("mobs_mc:glow_squid", { xp_min = 1, xp_max = 3, armor = 100, - rotate = 270, + rotate = 0, -- tilt_swim breaks the animations. --tilt_swim = true, -- FIXME: If the qlow squid is near the floor, it turns black From af8b1baba5e88941e0b7167d1f9162dc09b8ffea Mon Sep 17 00:00:00 2001 From: cora Date: Sun, 9 Oct 2022 17:59:51 +0200 Subject: [PATCH 04/16] Do not spam the network with individual particles --- mods/ENTITIES/mobs_mc/glow_squid.lua | 58 +++++++++++++++++++--------- 1 file changed, 40 insertions(+), 18 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/glow_squid.lua b/mods/ENTITIES/mobs_mc/glow_squid.lua index 6aac27a75..5b3e5f8b0 100644 --- a/mods/ENTITIES/mobs_mc/glow_squid.lua +++ b/mods/ENTITIES/mobs_mc/glow_squid.lua @@ -5,6 +5,30 @@ local S = minetest.get_translator("extra_mobs") +local base_psdef = { + amount = 8, + time=0, + minpos = vector.new(-1,-1,-1), + maxpos = vector.new(1,1,1), + minvel = vector.new(-0.25,-0.25,-0.25), + maxvel = vector.new(0.25,0.25,0.25), + minacc = vector.new(-0.5,-0.5,-0.5), + maxacc = vector.new(0.5,0.5,0.5), + minexptime = 1, + maxexptime = 2, + minsize = 0.8, + maxsize= 1.5, + glow = 5, + collisiondetection = true, + collision_removal = true, +} +local psdefs = {} +for i=1,4 do + local p = table.copy(base_psdef) + p.texture = "extra_mobs_glow_squid_glint"..i..".png" + table.insert(psdefs,p) +end + mcl_mobs:register_mob("mobs_mc:glow_squid", { type = "animal", spawn_class = "water", @@ -61,24 +85,22 @@ mcl_mobs:register_mob("mobs_mc:glow_squid", { glow = minetest.LIGHT_MAX, do_custom = function(self, dtime) - local glowSquidPos = 0 - if self.object:get_pos() ~= nil then - glowSquidPos = self.object:get_pos() - - local chanceOfParticle = math.random(0, 2) - if chanceOfParticle >= 1 then - minetest.add_particle({ - pos = { x = glowSquidPos.x + math.random(-2, 2) * math.random() / 2, y = glowSquidPos.y + math.random(-1, 2), z = glowSquidPos.z + math.random(-2, 2) * math.random() / 2 }, - velocity = { x = math.random(-0.25, 0.25), y = math.random(-0.25, 0.25), z = math.random(-0.25, 0.25) }, - acceleration = { x = math.random(-0.5, 0.5), y = math.random(-0.5, 0.5), z = math.random(-0.5, 0.5) }, - expirationtime = math.random(), - size = 1.5 + math.random(), - collisiondetection = true, - vertical = false, - texture = "extra_mobs_glow_squid_glint" .. math.random(1, 4) .. ".png", - glow = minetest.LIGHT_MAX, - }) - end + if not self.particlespawners then self.particlespawners = {} end + local pos = self.object:get_pos() + for _,p in pairs(minetest.get_connected_players()) do + if vector.distance(pos,p:get_pos()) < 150 and not self.particlespawners[p] then + self.particlespawners[p] = {} + for _,psdef in pairs(psdefs) do + psdef.attached = self.object + psdef.playername = p:get_player_name() + table.insert(self.particlespawners[p],minetest.add_particlespawner(psdef)) + end + elseif vector.distance(pos,p:get_pos()) > 150 then + for _,ps in pairs(self.particlespawners[p]) do + minetest.delete_particlespawner(ps) + end + self.particlespawners[p] = nil + end end end }) From ddd39b553df0b5fe6be17c9cc24ddad430c99723 Mon Sep 17 00:00:00 2001 From: cora Date: Sun, 9 Oct 2022 18:01:30 +0200 Subject: [PATCH 05/16] Fix indentation --- mods/ENTITIES/mobs_mc/glow_squid.lua | 418 +++++++++++++-------------- 1 file changed, 209 insertions(+), 209 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/glow_squid.lua b/mods/ENTITIES/mobs_mc/glow_squid.lua index 5b3e5f8b0..958688941 100644 --- a/mods/ENTITIES/mobs_mc/glow_squid.lua +++ b/mods/ENTITIES/mobs_mc/glow_squid.lua @@ -30,64 +30,64 @@ for i=1,4 do end mcl_mobs:register_mob("mobs_mc:glow_squid", { - type = "animal", - spawn_class = "water", - can_despawn = true, - passive = true, - hp_min = 10, - hp_max = 10, - xp_min = 1, - xp_max = 3, - armor = 100, - rotate = 0, - -- tilt_swim breaks the animations. - --tilt_swim = true, - -- FIXME: If the qlow squid is near the floor, it turns black - collisionbox = { -0.4, 0.0, -0.4, 0.4, 0.9, 0.4 }, - visual = "mesh", - mesh = "extra_mobs_glow_squid.b3d", - textures = { - { "extra_mobs_glow_squid.png" } - }, - sounds = { - damage = { name = "mobs_mc_squid_hurt", gain = 0.3 }, - death = { name = "mobs_mc_squid_death", gain = 0.4 }, - flop = "mobs_mc_squid_flop", - distance = 16, - }, - animation = { - stand_start = 1, - stand_end = 60, - walk_start = 1, - walk_end = 60, - run_start = 1, - run_end = 60, - }, - drops = { - { name = "mobs_mc:glow_ink_sac", - chance = 1, - min = 1, - max = 3, - looting = "common", }, - }, - visual_size = { x = 3, y = 3 }, - makes_footstep_sound = false, - swim = true, - breathes_in_water = true, - jump = false, - view_range = 16, - runaway = true, - fear_height = 4, - fly = true, - fly_in = { "mcl_core:water_source", "mclx_core:river_water_source" }, - -- don't add "mcl_core:water_flowing", or it won't move vertically. + type = "animal", + spawn_class = "water", + can_despawn = true, + passive = true, + hp_min = 10, + hp_max = 10, + xp_min = 1, + xp_max = 3, + armor = 100, + rotate = 0, + -- tilt_swim breaks the animations. + --tilt_swim = true, + -- FIXME: If the qlow squid is near the floor, it turns black + collisionbox = { -0.4, 0.0, -0.4, 0.4, 0.9, 0.4 }, + visual = "mesh", + mesh = "extra_mobs_glow_squid.b3d", + textures = { + { "extra_mobs_glow_squid.png" } + }, + sounds = { + damage = { name = "mobs_mc_squid_hurt", gain = 0.3 }, + death = { name = "mobs_mc_squid_death", gain = 0.4 }, + flop = "mobs_mc_squid_flop", + distance = 16, + }, + animation = { + stand_start = 1, + stand_end = 60, + walk_start = 1, + walk_end = 60, + run_start = 1, + run_end = 60, + }, + drops = { + { name = "mobs_mc:glow_ink_sac", + chance = 1, + min = 1, + max = 3, + looting = "common", }, + }, + visual_size = { x = 3, y = 3 }, + makes_footstep_sound = false, + swim = true, + breathes_in_water = true, + jump = false, + view_range = 16, + runaway = true, + fear_height = 4, + fly = true, + fly_in = { "mcl_core:water_source", "mclx_core:river_water_source" }, + -- don't add "mcl_core:water_flowing", or it won't move vertically. - glow = minetest.LIGHT_MAX, + glow = minetest.LIGHT_MAX, - do_custom = function(self, dtime) - if not self.particlespawners then self.particlespawners = {} end - local pos = self.object:get_pos() - for _,p in pairs(minetest.get_connected_players()) do + do_custom = function(self, dtime) + if not self.particlespawners then self.particlespawners = {} end + local pos = self.object:get_pos() + for _,p in pairs(minetest.get_connected_players()) do if vector.distance(pos,p:get_pos()) < 150 and not self.particlespawners[p] then self.particlespawners[p] = {} for _,psdef in pairs(psdefs) do @@ -101,165 +101,165 @@ mcl_mobs:register_mob("mobs_mc:glow_squid", { end self.particlespawners[p] = nil end - end - end + end + end }) -- spawning local water = mobs_mc.water_level - 1 -- local water = mobs_mc.spawn_height.water + 1 mcl_mobs:spawn_specific( - "mobs_mc:glow_squid", - "overworld", - "water", - { - "Mesa", - "FlowerForest", - "Swampland", - "Taiga", - "ExtremeHills", - "Jungle", - "Savanna", - "BirchForest", - "MegaSpruceTaiga", - "MegaTaiga", - "ExtremeHills+", - "Forest", - "Plains", - "Desert", - "ColdTaiga", - "MushroomIsland", - "IcePlainsSpikes", - "SunflowerPlains", - "IcePlains", - "RoofedForest", - "ExtremeHills+_snowtop", - "MesaPlateauFM_grasstop", - "JungleEdgeM", - "ExtremeHillsM", - "JungleM", - "BirchForestM", - "MesaPlateauF", - "MesaPlateauFM", - "MesaPlateauF_grasstop", - "MesaBryce", - "JungleEdge", - "SavannaM", - "FlowerForest_beach", - "Forest_beach", - "StoneBeach", - "ColdTaiga_beach_water", - "Taiga_beach", - "Savanna_beach", - "Plains_beach", - "ExtremeHills_beach", - "ColdTaiga_beach", - "Swampland_shore", - "MushroomIslandShore", - "JungleM_shore", - "Jungle_shore", - "MesaPlateauFM_sandlevel", - "MesaPlateauF_sandlevel", - "MesaBryce_sandlevel", - "Mesa_sandlevel", - "RoofedForest_ocean", - "JungleEdgeM_ocean", - "BirchForestM_ocean", - "BirchForest_ocean", - "IcePlains_deep_ocean", - "Jungle_deep_ocean", - "Savanna_ocean", - "MesaPlateauF_ocean", - "ExtremeHillsM_deep_ocean", - "Savanna_deep_ocean", - "SunflowerPlains_ocean", - "Swampland_deep_ocean", - "Swampland_ocean", - "MegaSpruceTaiga_deep_ocean", - "ExtremeHillsM_ocean", - "JungleEdgeM_deep_ocean", - "SunflowerPlains_deep_ocean", - "BirchForest_deep_ocean", - "IcePlainsSpikes_ocean", - "Mesa_ocean", - "StoneBeach_ocean", - "Plains_deep_ocean", - "JungleEdge_deep_ocean", - "SavannaM_deep_ocean", - "Desert_deep_ocean", - "Mesa_deep_ocean", - "ColdTaiga_deep_ocean", - "Plains_ocean", - "MesaPlateauFM_ocean", - "Forest_deep_ocean", - "JungleM_deep_ocean", - "FlowerForest_deep_ocean", - "MushroomIsland_ocean", - "MegaTaiga_ocean", - "StoneBeach_deep_ocean", - "IcePlainsSpikes_deep_ocean", - "ColdTaiga_ocean", - "SavannaM_ocean", - "MesaPlateauF_deep_ocean", - "MesaBryce_deep_ocean", - "ExtremeHills+_deep_ocean", - "ExtremeHills_ocean", - "MushroomIsland_deep_ocean", - "Forest_ocean", - "MegaTaiga_deep_ocean", - "JungleEdge_ocean", - "MesaBryce_ocean", - "MegaSpruceTaiga_ocean", - "ExtremeHills+_ocean", - "Jungle_ocean", - "RoofedForest_deep_ocean", - "IcePlains_ocean", - "FlowerForest_ocean", - "ExtremeHills_deep_ocean", - "MesaPlateauFM_deep_ocean", - "Desert_ocean", - "Taiga_ocean", - "BirchForestM_deep_ocean", - "Taiga_deep_ocean", - "JungleM_ocean", - "FlowerForest_underground", - "JungleEdge_underground", - "StoneBeach_underground", - "MesaBryce_underground", - "Mesa_underground", - "RoofedForest_underground", - "Jungle_underground", - "Swampland_underground", - "MushroomIsland_underground", - "BirchForest_underground", - "Plains_underground", - "MesaPlateauF_underground", - "ExtremeHills_underground", - "MegaSpruceTaiga_underground", - "BirchForestM_underground", - "SavannaM_underground", - "MesaPlateauFM_underground", - "Desert_underground", - "Savanna_underground", - "Forest_underground", - "SunflowerPlains_underground", - "ColdTaiga_underground", - "IcePlains_underground", - "IcePlainsSpikes_underground", - "MegaTaiga_underground", - "Taiga_underground", - "ExtremeHills+_underground", - "JungleM_underground", - "ExtremeHillsM_underground", - "JungleEdgeM_underground", - }, - 0, - minetest.LIGHT_MAX + 1, - 30, - 10000, - 3, - water - 16, - water) + "mobs_mc:glow_squid", + "overworld", + "water", + { + "Mesa", + "FlowerForest", + "Swampland", + "Taiga", + "ExtremeHills", + "Jungle", + "Savanna", + "BirchForest", + "MegaSpruceTaiga", + "MegaTaiga", + "ExtremeHills+", + "Forest", + "Plains", + "Desert", + "ColdTaiga", + "MushroomIsland", + "IcePlainsSpikes", + "SunflowerPlains", + "IcePlains", + "RoofedForest", + "ExtremeHills+_snowtop", + "MesaPlateauFM_grasstop", + "JungleEdgeM", + "ExtremeHillsM", + "JungleM", + "BirchForestM", + "MesaPlateauF", + "MesaPlateauFM", + "MesaPlateauF_grasstop", + "MesaBryce", + "JungleEdge", + "SavannaM", + "FlowerForest_beach", + "Forest_beach", + "StoneBeach", + "ColdTaiga_beach_water", + "Taiga_beach", + "Savanna_beach", + "Plains_beach", + "ExtremeHills_beach", + "ColdTaiga_beach", + "Swampland_shore", + "MushroomIslandShore", + "JungleM_shore", + "Jungle_shore", + "MesaPlateauFM_sandlevel", + "MesaPlateauF_sandlevel", + "MesaBryce_sandlevel", + "Mesa_sandlevel", + "RoofedForest_ocean", + "JungleEdgeM_ocean", + "BirchForestM_ocean", + "BirchForest_ocean", + "IcePlains_deep_ocean", + "Jungle_deep_ocean", + "Savanna_ocean", + "MesaPlateauF_ocean", + "ExtremeHillsM_deep_ocean", + "Savanna_deep_ocean", + "SunflowerPlains_ocean", + "Swampland_deep_ocean", + "Swampland_ocean", + "MegaSpruceTaiga_deep_ocean", + "ExtremeHillsM_ocean", + "JungleEdgeM_deep_ocean", + "SunflowerPlains_deep_ocean", + "BirchForest_deep_ocean", + "IcePlainsSpikes_ocean", + "Mesa_ocean", + "StoneBeach_ocean", + "Plains_deep_ocean", + "JungleEdge_deep_ocean", + "SavannaM_deep_ocean", + "Desert_deep_ocean", + "Mesa_deep_ocean", + "ColdTaiga_deep_ocean", + "Plains_ocean", + "MesaPlateauFM_ocean", + "Forest_deep_ocean", + "JungleM_deep_ocean", + "FlowerForest_deep_ocean", + "MushroomIsland_ocean", + "MegaTaiga_ocean", + "StoneBeach_deep_ocean", + "IcePlainsSpikes_deep_ocean", + "ColdTaiga_ocean", + "SavannaM_ocean", + "MesaPlateauF_deep_ocean", + "MesaBryce_deep_ocean", + "ExtremeHills+_deep_ocean", + "ExtremeHills_ocean", + "MushroomIsland_deep_ocean", + "Forest_ocean", + "MegaTaiga_deep_ocean", + "JungleEdge_ocean", + "MesaBryce_ocean", + "MegaSpruceTaiga_ocean", + "ExtremeHills+_ocean", + "Jungle_ocean", + "RoofedForest_deep_ocean", + "IcePlains_ocean", + "FlowerForest_ocean", + "ExtremeHills_deep_ocean", + "MesaPlateauFM_deep_ocean", + "Desert_ocean", + "Taiga_ocean", + "BirchForestM_deep_ocean", + "Taiga_deep_ocean", + "JungleM_ocean", + "FlowerForest_underground", + "JungleEdge_underground", + "StoneBeach_underground", + "MesaBryce_underground", + "Mesa_underground", + "RoofedForest_underground", + "Jungle_underground", + "Swampland_underground", + "MushroomIsland_underground", + "BirchForest_underground", + "Plains_underground", + "MesaPlateauF_underground", + "ExtremeHills_underground", + "MegaSpruceTaiga_underground", + "BirchForestM_underground", + "SavannaM_underground", + "MesaPlateauFM_underground", + "Desert_underground", + "Savanna_underground", + "Forest_underground", + "SunflowerPlains_underground", + "ColdTaiga_underground", + "IcePlains_underground", + "IcePlainsSpikes_underground", + "MegaTaiga_underground", + "Taiga_underground", + "ExtremeHills+_underground", + "JungleM_underground", + "ExtremeHillsM_underground", + "JungleEdgeM_underground", + }, + 0, + minetest.LIGHT_MAX + 1, + 30, + 10000, + 3, + water - 16, + water) -- spawn egg mcl_mobs:register_egg("mobs_mc:glow_squid", S("Glow Squid"), "#0000FF", "#ffffff", 0) From 26ba771a0219b46a79c8fd96cd6a4296080bbfed Mon Sep 17 00:00:00 2001 From: cora Date: Sun, 9 Oct 2022 21:24:27 +0200 Subject: [PATCH 06/16] Fix translator to use mobs_mc instead of extra_mobs --- mods/ENTITIES/mobs_mc/glow_squid.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/glow_squid.lua b/mods/ENTITIES/mobs_mc/glow_squid.lua index 958688941..b1280ce2a 100644 --- a/mods/ENTITIES/mobs_mc/glow_squid.lua +++ b/mods/ENTITIES/mobs_mc/glow_squid.lua @@ -3,7 +3,7 @@ --made for MC like Survival game --License for code WTFPL and otherwise stated in readmes -local S = minetest.get_translator("extra_mobs") +local S = minetest.get_translator("mobs_mc") local base_psdef = { amount = 8, From 438d22e52eec57831c332d85f5b238725018443c Mon Sep 17 00:00:00 2001 From: cora Date: Sun, 9 Oct 2022 21:54:40 +0200 Subject: [PATCH 07/16] Fix glow inksac itemstring --- mods/ENTITIES/mobs_mc/glow_squid.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/glow_squid.lua b/mods/ENTITIES/mobs_mc/glow_squid.lua index b1280ce2a..92e7fe108 100644 --- a/mods/ENTITIES/mobs_mc/glow_squid.lua +++ b/mods/ENTITIES/mobs_mc/glow_squid.lua @@ -64,7 +64,7 @@ mcl_mobs:register_mob("mobs_mc:glow_squid", { run_end = 60, }, drops = { - { name = "mobs_mc:glow_ink_sac", + { name = "mcl_mobitems:glow_ink_sac", chance = 1, min = 1, max = 3, From dc873f4de22bf7e2a1fdc1459e46687ea454eb49 Mon Sep 17 00:00:00 2001 From: cora Date: Sun, 9 Oct 2022 23:21:01 +0200 Subject: [PATCH 08/16] Fix crash when deleting particlespawners --- mods/ENTITIES/mobs_mc/glow_squid.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/glow_squid.lua b/mods/ENTITIES/mobs_mc/glow_squid.lua index 92e7fe108..703d5eb7c 100644 --- a/mods/ENTITIES/mobs_mc/glow_squid.lua +++ b/mods/ENTITIES/mobs_mc/glow_squid.lua @@ -95,7 +95,7 @@ mcl_mobs:register_mob("mobs_mc:glow_squid", { psdef.playername = p:get_player_name() table.insert(self.particlespawners[p],minetest.add_particlespawner(psdef)) end - elseif vector.distance(pos,p:get_pos()) > 150 then + elseif vector.distance(pos,p:get_pos()) > 150 and self.particlespawners[p] then for _,ps in pairs(self.particlespawners[p]) do minetest.delete_particlespawner(ps) end From ef4b243a30075a925f1bc976a2e141a17a07a7ce Mon Sep 17 00:00:00 2001 From: cora Date: Mon, 10 Oct 2022 03:42:51 +0200 Subject: [PATCH 09/16] Add coord safe infinite particlespawners api for mobs --- mods/ENTITIES/mcl_mobs/api.lua | 63 +++++++++++++++++++++++++++++++++- mods/ENTITIES/mcl_mobs/api.txt | 2 ++ 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index e85cfc160..5cb7fcf85 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -68,6 +68,7 @@ local disable_blood = minetest.settings:get_bool("mobs_disable_blood") local mobs_drop_items = minetest.settings:get_bool("mobs_drop_items") ~= false local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false local spawn_protected = minetest.settings:get_bool("mobs_spawn_protected") ~= false +local player_transfer_distance = minetest.settings:get("player_transfer_distance") or 128 local remove_far = true local difficulty = tonumber(minetest.settings:get("mob_difficulty")) or 1.0 local show_health = false @@ -84,6 +85,8 @@ if minetest.settings:get_bool("only_peaceful_mobs", false) then end) end +local active_particlespawners = {} + local function dir_to_pitch(dir) --local dir2 = vector.normalize(dir) @@ -121,6 +124,60 @@ minetest.register_chatcommand("clearmobs",{ end end}) +local function remove_particlespawners(pn,self) + if not active_particlespawners[pn] then return end + if not active_particlespawners[pn][self.object] then return end + for k,v in pairs(active_particlespawners[pn][self.object]) do + minetest.delete_particlespawner(v) + end +end + +local function add_particlespawners(pn,self) + if not active_particlespawners[pn] then active_particlespawners[pn] = {} end + if not active_particlespawners[pn][object] then active_particlespawners[pn][self.object] = {} end + for _,ps in pairs(self.particlespawners) do + ps.attached = self.object + ps.playername = pn + table.insert(active_particlespawners[pn][self.object],minetest.add_particlespawner(ps)) + end +end + +local function particlespawner_check(self,dtime) + if not self.particlespawners then return end + --minetest.log(dump(active_particlespawners)) + if self._particle_timer and self._particle_timer >= 1 then + self._particle_timer = 0 + local players = {} + for _,player in pairs(minetest.get_connected_players()) do + local pn = player:get_player_name() + table.insert(players,pn) + if not active_particlespawners[pn] then + active_particlespawners[pn] = {} end + + local dst = vector.distance(player:get_pos(),self.object:get_pos()) + if dst < player_transfer_distance and not active_particlespawners[pn][self.object] then + add_particlespawners(pn,self) + elseif dst >= player_transfer_distance and active_particlespawners[pn][self.object] then + remove_particlespawners(pn,self) + end + end + elseif not self._particle_timer then + self._particle_timer = 0 + end + self._particle_timer = self._particle_timer + dtime +end + +minetest.register_on_leaveplayer(function(player) + local pn = player:get_player_name() + if not active_particlespawners[pn] then return end + for _,m in pairs(active_particlespawners[pn]) do + for k,v in pairs(m) do + minetest.delete_particlespawner(v) + end + end + active_particlespawners[pn] = nil +end) + ----For Water Flowing: local enable_physics = function(object, luaentity, ignore_check) if luaentity.physical_state == false or ignore_check == true then @@ -3477,7 +3534,9 @@ end -- get entity staticdata local mob_staticdata = function(self) - + for _,p in pairs(minetest.get_connected_players()) do + remove_particlespawners(p:get_player_name(),self) + end -- remove mob when out of range unless tamed if remove_far and self.can_despawn @@ -3711,6 +3770,7 @@ local mob_step = function(self, dtime) self.lifetimer = self.lifetimer - dtime check_item_pickup(self) check_aggro(self,dtime) + particlespawner_check(self,dtime) if not self.fire_resistant then mcl_burning.tick(self.object, dtime, self) -- mcl_burning.tick may remove object immediately @@ -4226,6 +4286,7 @@ minetest.register_entity(name, { spawn_in_group = def.spawn_in_group, spawn_in_group_min = def.spawn_in_group_min, noyaw = def.noyaw or false, + particlespawners = def.particlespawners, -- End of MCL2 extensions on_spawn = def.on_spawn, diff --git a/mods/ENTITIES/mcl_mobs/api.txt b/mods/ENTITIES/mcl_mobs/api.txt index a73cc2e3e..038c34a77 100644 --- a/mods/ENTITIES/mcl_mobs/api.txt +++ b/mods/ENTITIES/mcl_mobs/api.txt @@ -260,6 +260,8 @@ functions needed for the mob to work properly which contains the following: 'pick_up' table of itemstrings the mob will pick up (e.g. for breeding) 'on_pick_up' function that will be called on item pickup - return true to not pickup the item 'custom_visual_size' will not reset visual_size from the base class on reload + 'noyaw' If true this mob will not automatically change yaw + 'particlespawners' Table of particlespawners attached to the mob. This is implemented in a coord safe manner i.e. spawners are only sent to players within the player_transfer_distance (and automatically removed). This enables infinitely lived particlespawners. mobs:gopath(self,target,callback_arrived) pathfind a way to target and run callback on arrival From 063102cc1e8b3d14d784824edbc9d2be7394b910 Mon Sep 17 00:00:00 2001 From: cora Date: Mon, 10 Oct 2022 03:48:20 +0200 Subject: [PATCH 10/16] Make glow squids use the particlespawner api --- mods/ENTITIES/mobs_mc/glow_squid.lua | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/glow_squid.lua b/mods/ENTITIES/mobs_mc/glow_squid.lua index 703d5eb7c..e459bd5a7 100644 --- a/mods/ENTITIES/mobs_mc/glow_squid.lua +++ b/mods/ENTITIES/mobs_mc/glow_squid.lua @@ -83,26 +83,7 @@ mcl_mobs:register_mob("mobs_mc:glow_squid", { -- don't add "mcl_core:water_flowing", or it won't move vertically. glow = minetest.LIGHT_MAX, - - do_custom = function(self, dtime) - if not self.particlespawners then self.particlespawners = {} end - local pos = self.object:get_pos() - for _,p in pairs(minetest.get_connected_players()) do - if vector.distance(pos,p:get_pos()) < 150 and not self.particlespawners[p] then - self.particlespawners[p] = {} - for _,psdef in pairs(psdefs) do - psdef.attached = self.object - psdef.playername = p:get_player_name() - table.insert(self.particlespawners[p],minetest.add_particlespawner(psdef)) - end - elseif vector.distance(pos,p:get_pos()) > 150 and self.particlespawners[p] then - for _,ps in pairs(self.particlespawners[p]) do - minetest.delete_particlespawner(ps) - end - self.particlespawners[p] = nil - end - end - end + particlespawners = psdefs, }) -- spawning From 11742b61b2ac0e45a9b07dd201f70a4d53b754fb Mon Sep 17 00:00:00 2001 From: cora Date: Mon, 10 Oct 2022 03:48:37 +0200 Subject: [PATCH 11/16] Make Endermen also use the api instead of the old method --- mods/ENTITIES/mobs_mc/enderman.lua | 64 +++++++++--------------------- 1 file changed, 18 insertions(+), 46 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/enderman.lua b/mods/ENTITIES/mobs_mc/enderman.lua index e00906cd4..4e08ae731 100644 --- a/mods/ENTITIES/mobs_mc/enderman.lua +++ b/mods/ENTITIES/mobs_mc/enderman.lua @@ -237,7 +237,23 @@ local select_enderman_animation = function(animation_type) end local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false -local spawners = {} +local psdefs = {{ + amount = 5, + minpos = vector.new(-0.6,0,-0.6), + maxpos = vector.new(0.6,3,0.6), + minvel = vector.new(-0.25,-0.25,-0.25), + maxvel = vector.new(0.25,0.25,0.25), + minacc = vector.new(-0.5,-0.5,-0.5), + maxacc = vector.new(0.5,0.5,0.5), + minexptime = 0.2, + maxexptime = 3, + minsize = 0.2, + maxsize = 1.2, + collisiondetection = true, + vertical = false, + time = 0, + texture = "mcl_portals_particle"..math.random(1, 5)..".png", +}} mcl_mobs:register_mob("mobs_mc:enderman", { description = S("Enderman"), @@ -280,6 +296,7 @@ mcl_mobs:register_mob("mobs_mc:enderman", { run_velocity = 3.4, damage = 7, reach = 2, + particlespawners = psdefs, drops = { {name = "mcl_throwing:ender_pearl", chance = 1, @@ -293,42 +310,6 @@ mcl_mobs:register_mob("mobs_mc:enderman", { return #minetest.find_nodes_in_area(vector.offset(pos,0,1,0),vector.offset(pos,0,3,0),{"air"}) > 2 end, do_custom = function(self, dtime) - -- PARTICLE BEHAVIOUR HERE. - local enderpos = self.object:get_pos() - if self._particle_timer and self._particle_timer >= 1 then - for _,player in pairs(minetest.get_connected_players()) do - if not spawners[player] then spawners[player] = {} end - local dst = vector.distance(player:get_pos(),enderpos) - if dst < 128 and not spawners[player][self.object] then - self._particle_timer = 0 - spawners[player][self.object] = minetest.add_particlespawner({ - amount = 5, - minpos = vector.new(-0.6,0,-0.6), - maxpos = vector.new(0.6,3,0.6), - minvel = vector.new(-0.25,-0.25,-0.25), - maxvel = vector.new(0.25,0.25,0.25), - minacc = vector.new(-0.5,-0.5,-0.5), - maxacc = vector.new(0.5,0.5,0.5), - minexptime = 0.2, - maxexptime = 3, - minsize = 0.2, - maxsize = 1.2, - collisiondetection = true, - vertical = false, - time = 0, - texture = "mcl_portals_particle"..math.random(1, 5)..".png", - attached = self.object, - playername = player:get_player_name(), - }) - elseif dst > 128 and spawners[player][self.object] then - minetest.delete_particlespawner(spawners[player][self.object]) - spawners[player][self.object] = nil - end - end - elseif not self._particle_timer then - self._particle_timer = 0 - end - self._particle_timer = self._particle_timer + dtime -- RAIN DAMAGE / EVASIVE WARP BEHAVIOUR HERE. enderpos = self.object:get_pos() local dim = mcl_worlds.pos_to_dimension(enderpos) @@ -648,15 +629,6 @@ mcl_mobs:register_mob("mobs_mc:enderman", { attack_type = "dogfight", }) -minetest.register_on_leaveplayer(function(player) - if not spawners[player] then return end - for _,s in pairs(spawners[player]) do - minetest.delete_particlespawner(s) - end - spawners[player] = nil -end) - - -- End spawn mcl_mobs:spawn_specific( "mobs_mc:enderman", From 01791cf5503abad345b9766acad7afdf5ad7a7ce Mon Sep 17 00:00:00 2001 From: cora Date: Tue, 11 Oct 2022 05:42:45 +0200 Subject: [PATCH 12/16] fix crash when player_transfer_distance is not set --- mods/ENTITIES/mcl_mobs/api.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 5cb7fcf85..af58de3b6 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -68,7 +68,7 @@ local disable_blood = minetest.settings:get_bool("mobs_disable_blood") local mobs_drop_items = minetest.settings:get_bool("mobs_drop_items") ~= false local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false local spawn_protected = minetest.settings:get_bool("mobs_spawn_protected") ~= false -local player_transfer_distance = minetest.settings:get("player_transfer_distance") or 128 +local player_transfer_distance = tonumber(minetest.settings:get("player_transfer_distance")) or 128 local remove_far = true local difficulty = tonumber(minetest.settings:get("mob_difficulty")) or 1.0 local show_health = false From fb07fee7f0de22a7912744602c3fe6e65d9eb86d Mon Sep 17 00:00:00 2001 From: cora Date: Tue, 11 Oct 2022 11:22:09 +0200 Subject: [PATCH 13/16] Glow squid spawn egg colors --- mods/ENTITIES/mobs_mc/glow_squid.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/glow_squid.lua b/mods/ENTITIES/mobs_mc/glow_squid.lua index e459bd5a7..092206998 100644 --- a/mods/ENTITIES/mobs_mc/glow_squid.lua +++ b/mods/ENTITIES/mobs_mc/glow_squid.lua @@ -243,4 +243,4 @@ mcl_mobs:spawn_specific( water) -- spawn egg -mcl_mobs:register_egg("mobs_mc:glow_squid", S("Glow Squid"), "#0000FF", "#ffffff", 0) +mcl_mobs:register_egg("mobs_mc:glow_squid", S("Glow Squid"), "#095757", "#87f6c0", 0) From b770ce42e30cf2f9b1d6c435425dc5e2e0533407 Mon Sep 17 00:00:00 2001 From: cora Date: Tue, 11 Oct 2022 11:58:27 +0200 Subject: [PATCH 14/16] Fix particlespawners not showing on player_transfer_distance == 0 --- mods/ENTITIES/mcl_mobs/api.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index af58de3b6..ac8d57bcd 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -69,6 +69,7 @@ local mobs_drop_items = minetest.settings:get_bool("mobs_drop_items") ~= false local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false local spawn_protected = minetest.settings:get_bool("mobs_spawn_protected") ~= false local player_transfer_distance = tonumber(minetest.settings:get("player_transfer_distance")) or 128 +if player_transfer_distance == 0 then player_transfer_distance = math.huge end local remove_far = true local difficulty = tonumber(minetest.settings:get("mob_difficulty")) or 1.0 local show_health = false From 3e312af3b9fe7607858a537710d8ffe0275e3841 Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 14 Oct 2022 00:07:26 +0200 Subject: [PATCH 15/16] fix warning / wrong var --- mods/ENTITIES/mcl_mobs/api.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index ac8d57bcd..a4b74a237 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -135,7 +135,7 @@ end local function add_particlespawners(pn,self) if not active_particlespawners[pn] then active_particlespawners[pn] = {} end - if not active_particlespawners[pn][object] then active_particlespawners[pn][self.object] = {} end + if not active_particlespawners[pn][self.object] then active_particlespawners[pn][self.object] = {} end for _,ps in pairs(self.particlespawners) do ps.attached = self.object ps.playername = pn From 80ff5f12072364a3c11ab9342dd3d121c0180b1d Mon Sep 17 00:00:00 2001 From: cora Date: Fri, 14 Oct 2022 00:24:44 +0200 Subject: [PATCH 16/16] Fix enderpos global warning --- mods/ENTITIES/mobs_mc/enderman.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs_mc/enderman.lua b/mods/ENTITIES/mobs_mc/enderman.lua index 4e08ae731..2849b62b6 100644 --- a/mods/ENTITIES/mobs_mc/enderman.lua +++ b/mods/ENTITIES/mobs_mc/enderman.lua @@ -311,7 +311,7 @@ mcl_mobs:register_mob("mobs_mc:enderman", { end, do_custom = function(self, dtime) -- RAIN DAMAGE / EVASIVE WARP BEHAVIOUR HERE. - enderpos = self.object:get_pos() + local enderpos = self.object:get_pos() local dim = mcl_worlds.pos_to_dimension(enderpos) if dim == "overworld" then if mcl_weather.state == "rain" or mcl_weather.state == "lightning" then