1
0
Fork 0

Compare commits

...

2 Commits

4 changed files with 17 additions and 4 deletions

View File

@ -84,7 +84,9 @@ minetest.register_entity(":mcl_raids:ominous_banner",oban_def)
function mcl_raids.drop_obanner(pos)
local it = ItemStack("mcl_banners:banner_item_white")
it:get_meta():set_string("layers",minetest.serialize(oban_layers))
it:get_meta():set_string("name",S("Ominous Banner"))
local banner_description = string.gsub(it:get_definition().description, "White Banner", "Ominous Banner")
local description = mcl_banners.make_advanced_banner_description(banner_description, oban_layers)
it:get_meta():set_string("description", description)
minetest.add_item(pos,it)
end
@ -94,7 +96,7 @@ function mcl_raids.promote_to_raidcaptain(c) -- object
local l = c:get_luaentity()
l._banner = minetest.add_entity(pos,"mcl_raids:ominous_banner")
l._banner:set_properties({textures = {mcl_banners.make_banner_texture("unicolor_white", oban_layers)}})
l._banner:set_attach(c,"",vector.new(-1,5.5,0),vector.new(0,0,0),true)
l._banner:set_attach(c,"",vector.new(0,5.5,0),vector.new(0,0,0),true)
l._raidcaptain = true
local old_ondie = l.on_die
l.on_die = function(self, pos, cmi_cause)
@ -129,7 +131,7 @@ function mcl_raids.register_possible_raidcaptain(mob)
table.insert(minetest.registered_entities[mob].pick_up,"mcl_banners:banner_item_white")
minetest.registered_entities[mob].on_pick_up = function(self,e)
local stack = ItemStack(e.itemstring)
if not self._raidcaptain and stack:get_meta():get_string("name"):find("Ominous Banner") then
if not self._raidcaptain and stack:get_meta():get_string("description"):find("Ominous Banner") then
stack:take_item(1)
mcl_raids.promote_to_raidcaptain(self.object)
return stack

View File

@ -1,3 +1,3 @@
name = mcl_raids
author = PrairieWind
depends = mcl_events, mobs_mc, mcl_potions, mcl_bells, mcl_achievements
depends = mcl_events, mobs_mc, mcl_potions, mcl_bells, mcl_achievements, mcl_banners

View File

@ -493,6 +493,16 @@ for colorid, colortab in pairs(mcl_banners.colors) do
end
end
-- Update old pre 0.84.0 Ominous Banners with correct description.
local stackmeta = itemstack:get_meta()
if stackmeta:get_string("name"):find("Ominous Banner") then
local oban_layers = minetest.deserialize(stackmeta:get_string("layers"))
local banner_description = string.gsub(itemstack:get_definition().description, "White Banner", "Ominous Banner")
local description = mcl_banners.make_advanced_banner_description(banner_description, oban_layers)
stackmeta:set_string("description", description)
stackmeta:set_string("name", nil)
end
-- Place the node!
local hanging = false

View File

@ -76,3 +76,4 @@ You can copy the pattern of a banner by placing two banners of the same color in
And one additional layer=
And @1 additional layers=
Paintable decoration=
Ominous Banner=