Spawn witch and black cat on witchhut generation

This commit is contained in:
cora 2022-05-26 02:24:56 +02:00
parent 41ebaf12a5
commit da6563a5b3
2 changed files with 19 additions and 0 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 606 B

After

Width:  |  Height:  |  Size: 7.0 KiB

@ -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)