allow a spider/skeleton jockey to be spawnable with spawn_mob command

This commit is contained in:
epCode 2022-10-11 16:36:05 -07:00 committed by cora
parent 22a5856b46
commit 93e2f1997a
1 changed files with 12 additions and 8 deletions

View File

@ -89,14 +89,18 @@ local skeleton = {
}, },
jock = "mobs_mc:spider", jock = "mobs_mc:spider",
on_spawn = function(self) on_spawn = function(self)
self.jockey = false minetest.after(1,function()
if math.random(100) == 1 then -- 1% like from MCwiki if self and self.object then
self.jockey = true if math.random(100) == 1 or self.jockey == true then -- 1% like from MCwiki
local jock = minetest.add_entity(self.object:get_pos(), "mobs_mc:spider") self.jockey = true
jock:get_luaentity().docile_by_day = false local jock = minetest.add_entity(self.object:get_pos(), "mobs_mc:spider")
self.object:set_attach(jock, "", vector.new(0,0,0), vector.new(0,0,0)) jock:get_luaentity().docile_by_day = false
end self.object:set_attach(jock, "", vector.new(0,0,0), vector.new(0,0,0))
return true end
self.jockey = false
return true
end
end)
end, end,
on_detach=function(self, parent) on_detach=function(self, parent)
self.jockey = false self.jockey = false