Merge branch 'use_animal_mods' into 'master'
Use animal mods if available for sheep See merge request freelikegnu/witches!1master
commit
94d42cbdd9
20
init.lua
20
init.lua
|
@ -68,7 +68,25 @@ dofile(path .. "/utilities.lua")
|
|||
dofile(path .. "/ui.lua")
|
||||
dofile(path .. "/items.lua")
|
||||
dofile(path .. "/nodes.lua")
|
||||
dofile(path .. "/sheep.lua")
|
||||
|
||||
-- This gets the list of possible sheep that an enemy can be turned into
|
||||
if minetest.get_modpath("animalia") then
|
||||
witches.sheep = {"animalia:sheep"}
|
||||
elseif minetest.get_modpath("mobs_animal") then
|
||||
witches.sheep = {}
|
||||
for key, value in pairs(minetest.registered_entities) do
|
||||
if string.sub(key, 1, #("mobs_animal:sheep_")) == "mobs_animal:sheep_" then
|
||||
witches.sheep[#witches.sheep + 1] = key
|
||||
end
|
||||
end
|
||||
else
|
||||
dofile(path .. "/sheep.lua")
|
||||
witches.sheep = {}
|
||||
for _, col in ipairs(witches.sheep_colors) do
|
||||
witches.sheep[#witches.sheep + 1] = "witches:sheep_" .. col[1]
|
||||
end
|
||||
end
|
||||
|
||||
dofile(path .. "/magic.lua")
|
||||
|
||||
dofile(path .. "/cottages.lua")
|
||||
|
|
13
magic.lua
13
magic.lua
|
@ -1,5 +1,4 @@
|
|||
witches.magic = {}
|
||||
local wsc = witches.sheep_colors
|
||||
|
||||
local magic_texture = "bubble.png"
|
||||
local magic_animation = nil
|
||||
|
@ -136,7 +135,6 @@ end
|
|||
|
||||
function witches.magic.polymorph(self, target, mob, duration)
|
||||
duration = duration or 0
|
||||
local colors = {}
|
||||
local caster_pos = self.object:get_pos()
|
||||
minetest.sound_play(self.sounds.polymorph or "witches_magic02", {
|
||||
pos = caster_pos,
|
||||
|
@ -144,12 +142,6 @@ function witches.magic.polymorph(self, target, mob, duration)
|
|||
max_hear_distance = self.sounds and self.sounds.distance or 32
|
||||
}, true)
|
||||
|
||||
for _, col in ipairs(wsc) do
|
||||
table.insert(colors,col[1])
|
||||
end
|
||||
local r_sheep = "witches:sheep_"..colors[math.random(#colors)]
|
||||
mob = mob or r_sheep
|
||||
|
||||
local ent = target:get_luaentity()
|
||||
local ent_pos = ent.object:get_pos()
|
||||
|
||||
|
@ -167,9 +159,10 @@ function witches.magic.polymorph(self, target, mob, duration)
|
|||
|
||||
witches.magic.effect_area01(vol_ent[1],vol_ent[2],200)
|
||||
|
||||
mob = mob or witches.sheep[math.random(1, #witches.sheep)]
|
||||
if mob then
|
||||
local new_obj = minetest.add_entity(ent_pos, mob)
|
||||
--local new_ent = new_obj:get_luaentity()
|
||||
--new_ent.old_mob_name = ent.name
|
||||
end
|
||||
|
||||
end
|
||||
--volume is a vector!
|
||||
|
|
Loading…
Reference in New Issue