From da6563a5b39b30502635e331c3c7bbfb9b22de4b Mon Sep 17 00:00:00 2001 From: cora Date: Thu, 26 May 2022 02:24:56 +0200 Subject: [PATCH 1/4] Spawn witch and black cat on witchhut generation --- .../mobs_mc/textures/mobs_mc_cat_black.png | Bin 606 -> 7117 bytes mods/MAPGEN/mcl_structures/init.lua | 19 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/mods/ENTITIES/mobs_mc/textures/mobs_mc_cat_black.png b/mods/ENTITIES/mobs_mc/textures/mobs_mc_cat_black.png index d6e54c7a15637a4925a492b852e27071896479d3..a839a6ef37d345362f80c340f500ad42f999b393 100644 GIT binary patch literal 7117 zcmeHMcT^Kg-wsWriJ*vzN{oOMlWZzUq)Je@0&*1*#KLB?fdDCx08ykXf+&dC1rY=+ zND~W4vvEZM6~qQy3rdr!g3^R{0rl$n-tV06p6|WyU*?=mc4vOSXXbh4nVp%F7)OUy zDvI+JQ7Dv(tqpT6@@s)yXjvKL+pz$;ib72<-0tKeUJC}Ig?<7K*9S(6w+Uf1Ea7rc zC`m)cQSX4ag(|zoMH;RVgD6Yf?gyfak;}}r^$#`TiajzD&tFMDU^DY}X<=AH_V{Q} zap-%6BAp}5)j9O7JJ#A$$hdp{p$+t5qvSV3>1}G|DiFmA?E;#`>KL~FeI0h_noV%N5PSsxdc4Wl+S zE;SGS*qAF?6!MCtSS8nj*{RlC1Iyl((#9 zzP{TYC+SAPtj(i%-DvstN{iP!+D<(knu}&G!_wX?nI3jLzPX^BEIV-0Vh+lya1l#! zp=^oGQQEw{YrT2Aj2wWs*Zb)OxOlX?)j-NBweF`^qtG%Gb=9J9Ni;Kib=h9cj+lSPkp`%{65&eRK0$7Zr^>oEEp}OLCEazM!ENi$aImv$vuga+l${x#fDZROgH0^{q=a`)&nJ5?jLd9kx(#G zZo|76Da)qosZ~c7OM6v}tj}Bqcq*=*<|72To9HW*Akgs|{zA~;_LJc?ta&MML)Oad z%Q*!rXE$}vYjBuT&$k?qD{t6)cR@0KR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czTL44LU|H^02_JiiEXTkdx_^Sr1`SxpEV9>gof9wx2D4mDfHYKp3c8z>bw%Pm>rsNb)va)Ajf11V z3?M25d~z08dZ(Zw+5l)~&G!?6`4pE4>LpnA>%lr=`C$ZEg2_X{_heotsQyflWeJtU z9ODClSeMA^_Nl<11Y-^wO3agoukz8>ee?NC(cnH4uz#(h0)0W?ecR?QQK%jXAR?i1 zEs#9RW!BBJhCm|J<`fW;#I-JWWvaojC=xKp3qf#S!Dg4TO)ZwP)4Zns}MxBq0hK2qUo f-um`?gWLcBf)6=#*sJXE00000NkvXXu0mjfW9J&t diff --git a/mods/MAPGEN/mcl_structures/init.lua b/mods/MAPGEN/mcl_structures/init.lua index 9a1a73281d..2b791aa91a 100644 --- a/mods/MAPGEN/mcl_structures/init.lua +++ b/mods/MAPGEN/mcl_structures/init.lua @@ -280,6 +280,24 @@ function mcl_structures.generate_boulder(pos, rotation, pr) return minetest.place_schematic(newpos, path, rotation) -- don't serialize schematics for registered biome decorations, for MT 5.4.0, https://github.com/minetest/minetest/issues/10995 end +local function spawn_witch(p1,p2) + local c = minetest.find_node_near(p1,15,{"mcl_cauldrons:cauldron"}) + local nn = minetest.find_nodes_in_area(p1,p2,{"mcl_core:sprucewood"}) + if c then + for _,v in pairs(nn) do + local ap = vector.offset(v,0,1,0) + local an = minetest.get_node(ap) + if ap.y == c.y and an.name == "air" then + minetest.add_entity(ap,"mobs_mc:witch"):get_luaentity()._home = c + local cat = minetest.add_entity(ap,"mobs_mc:cat") + cat:set_properties({textures = {"mobs_mc_cat_black.png"}}) + cat:get_luaentity().owner = "witch" --so it's not claimable by players (unless they're named witch hehe) + return + end + end + end +end + local function hut_placement_callback(p1, p2, size, orientation, pr) if not p1 or not p2 then return end local legs = minetest.find_nodes_in_area(p1, p2, "mcl_core:tree") @@ -289,6 +307,7 @@ local function hut_placement_callback(p1, p2, size, orientation, pr) minetest.swap_node(legs[i], {name = "mcl_core:tree", param2 = 2}) end end + spawn_witch(p1,p2) end function mcl_structures.generate_witch_hut(pos, rotation, pr) From 2337e72a235157048976d0335d4634461594a2c0 Mon Sep 17 00:00:00 2001 From: cora Date: Thu, 26 May 2022 14:46:06 +0200 Subject: [PATCH 2/4] simplify spawn logic --- mods/MAPGEN/mcl_structures/init.lua | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/mods/MAPGEN/mcl_structures/init.lua b/mods/MAPGEN/mcl_structures/init.lua index 2b791aa91a..322874d4c0 100644 --- a/mods/MAPGEN/mcl_structures/init.lua +++ b/mods/MAPGEN/mcl_structures/init.lua @@ -282,19 +282,16 @@ end local function spawn_witch(p1,p2) local c = minetest.find_node_near(p1,15,{"mcl_cauldrons:cauldron"}) - local nn = minetest.find_nodes_in_area(p1,p2,{"mcl_core:sprucewood"}) if c then - for _,v in pairs(nn) do - local ap = vector.offset(v,0,1,0) - local an = minetest.get_node(ap) - if ap.y == c.y and an.name == "air" then - minetest.add_entity(ap,"mobs_mc:witch"):get_luaentity()._home = c - local cat = minetest.add_entity(ap,"mobs_mc:cat") - cat:set_properties({textures = {"mobs_mc_cat_black.png"}}) - cat:get_luaentity().owner = "witch" --so it's not claimable by players (unless they're named witch hehe) - return - end - end + local nn = minetest.find_nodes_in_area_under_air(vector.new(p1.x,c.y-1,p1.z),vector.new(p2.x,c.y-1,p2.z),{"mcl_core:sprucewood"}) + local witch = minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:witch"):get_luaentity() + local cat = minetest.add_entity(vector.offset(nn[math.random(#nn)],0,1,0),"mobs_mc:cat"):get_luaentity() + witch._home = c + witch.can_despawn = false + cat.object:set_properties({textures = {"mobs_mc_cat_black.png"}}) + cat.owner = "!witch!" --so it's not claimable by player + cat.can_despawn = false + return end end From 6b9cb0062d98a49432a8b3e86909f9769a69de90 Mon Sep 17 00:00:00 2001 From: cora Date: Thu, 26 May 2022 15:16:06 +0200 Subject: [PATCH 3/4] save home coords in cat entity as well --- mods/MAPGEN/mcl_structures/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/MAPGEN/mcl_structures/init.lua b/mods/MAPGEN/mcl_structures/init.lua index 322874d4c0..5d3ecac6c2 100644 --- a/mods/MAPGEN/mcl_structures/init.lua +++ b/mods/MAPGEN/mcl_structures/init.lua @@ -290,6 +290,7 @@ local function spawn_witch(p1,p2) witch.can_despawn = false cat.object:set_properties({textures = {"mobs_mc_cat_black.png"}}) cat.owner = "!witch!" --so it's not claimable by player + cat._home = c cat.can_despawn = false return end From e4a4648b25a790d64c73a3c06d1aa0ace9b2f9a5 Mon Sep 17 00:00:00 2001 From: cora Date: Thu, 26 May 2022 15:20:18 +0200 Subject: [PATCH 4/4] fix size of black cat texture --- .../mobs_mc/textures/mobs_mc_cat_black.png | Bin 7117 -> 385 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/textures/mobs_mc_cat_black.png b/mods/ENTITIES/mobs_mc/textures/mobs_mc_cat_black.png index a839a6ef37d345362f80c340f500ad42f999b393..8d1322565a7745bab53b111a7a35657f898cb923 100644 GIT binary patch delta 15 WcmX?W-pD*bd9sz1_U2hq#*6?gq6Fyx literal 7117 zcmeHMcT^Kg-wsWriJ*vzN{oOMlWZzUq)Je@0&*1*#KLB?fdDCx08ykXf+&dC1rY=+ zND~W4vvEZM6~qQy3rdr!g3^R{0rl$n-tV06p6|WyU*?=mc4vOSXXbh4nVp%F7)OUy zDvI+JQ7Dv(tqpT6@@s)yXjvKL+pz$;ib72<-0tKeUJC}Ig?<7K*9S(6w+Uf1Ea7rc zC`m)cQSX4ag(|zoMH;RVgD6Yf?gyfak;}}r^$#`TiajzD&tFMDU^DY}X<=AH_V{Q} zap-%6BAp}5)j9O7JJ#A$$hdp{p$+t5qvSV3>1}G|DiFmA?E;#`>KL~FeI0h_noV%N5PSsxdc4Wl+S zE;SGS*qAF?6!MCtSS8nj*{RlC1Iyl((#9 zzP{TYC+SAPtj(i%-DvstN{iP!+D<(knu}&G!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