Merge pull request 'Update old mobs_mc_ horse armor textures' (#2262) from legacy_horse_armor_texture into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2262
This commit is contained in:
cora 2022-05-30 10:54:12 +00:00
commit ad1b7510aa
1 changed files with 15 additions and 1 deletions

View File

@ -81,6 +81,20 @@ for b=1, #horse_base do
end
end
-- in e7898352d890c2414af653eba624939df9c0b8b4 (0.76-dev) all items from mobs_mc were moved to mcl_mobitems
-- this results in existing horses wearing armor would still have the old texture filename in their
-- properties this function updates them. It should be removed some time in the future when we can be
-- reasonably sure all horses that want it get the new nexture.
local function update_textures(self)
local old = "mobs_mc_horse_armor_"
local txt = self.object:get_properties().textures
if txt[2]:find(old) then
txt[2] = txt[2]:gsub(old,"mcl_mobitems_horse_armor_")
self.object:set_properties({textures=txt})
return
end
end
-- Horse
local horse = {
description = S("Horse"),
@ -138,7 +152,7 @@ local horse = {
max = 2,
looting = "common",},
},
on_spawn = update_textures,
do_custom = function(self, dtime)
-- set needed values if not already present