forked from VoxeLibre/VoxeLibre
Spawn raidcaptain in raids
This commit is contained in:
parent
d1788b5643
commit
3600bc8066
|
@ -86,14 +86,14 @@ function mcl_raids.drop_obanner(pos)
|
||||||
minetest.add_item(pos,it)
|
minetest.add_item(pos,it)
|
||||||
end
|
end
|
||||||
|
|
||||||
function mcl_raids.spawn_raidcaptain(pos)
|
function mcl_raids.promote_to_raidcaptain(c) -- object
|
||||||
local c = minetest.add_entity(pos,"mobs_mc:pillager")
|
if not c or not c:get_pos() then return end
|
||||||
|
local pos = c:get_pos()
|
||||||
local l = c:get_luaentity()
|
local l = c:get_luaentity()
|
||||||
local b = minetest.add_entity(pos,"mcl_raids:ominous_banner")
|
l._banner = minetest.add_entity(pos,"mcl_raids:ominous_banner")
|
||||||
b:set_properties({textures = {mcl_banners.make_banner_texture("unicolor_white", oban_layers)}})
|
l._banner:set_properties({textures = {mcl_banners.make_banner_texture("unicolor_white", oban_layers)}})
|
||||||
b:set_attach(c,"",vector.new(-1,5,-0.8),vector.new(0,0,0),true)
|
l._banner:set_attach(c,"",vector.new(-1,5.5,0),vector.new(0,0,0),true)
|
||||||
l._raidcaptain = true
|
l._raidcaptain = true
|
||||||
l._banner = b
|
|
||||||
local old_ondie = l.on_die
|
local old_ondie = l.on_die
|
||||||
l.on_die = function(self, pos, cmi_cause)
|
l.on_die = function(self, pos, cmi_cause)
|
||||||
if l._banner and l._banner:get_pos() then
|
if l._banner and l._banner:get_pos() then
|
||||||
|
@ -139,6 +139,10 @@ function mcl_raids.spawn_raid(event)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if event.stage == 1 then
|
||||||
|
table.shuffle(event.mobs)
|
||||||
|
mcl_raids.promote_to_raidcaptain(event.mobs[1])
|
||||||
|
end
|
||||||
minetest.log("action", "[mcl_raids] Raid Spawned. Illager Count: " .. #event.mobs .. ".")
|
minetest.log("action", "[mcl_raids] Raid Spawned. Illager Count: " .. #event.mobs .. ".")
|
||||||
else
|
else
|
||||||
minetest.log("action", "[mcl_raids] Raid Spawn Postion not chosen.")
|
minetest.log("action", "[mcl_raids] Raid Spawn Postion not chosen.")
|
||||||
|
@ -239,7 +243,8 @@ mcl_events.register_event("raid",{
|
||||||
minetest.register_chatcommand("raidcap",{
|
minetest.register_chatcommand("raidcap",{
|
||||||
privs = {debug = true},
|
privs = {debug = true},
|
||||||
func = function(pname,param)
|
func = function(pname,param)
|
||||||
mcl_raids.spawn_raidcaptain(minetest.get_player_by_name(pname):get_pos())
|
local c = minetest.add_entity(minetest.get_player_by_name(pname):get_pos(),"mobs_mc:pillager")
|
||||||
|
mcl_raids.promote_to_raidcaptain(c)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue