1
0
Fork 0

Fix Stalker texture generation (#4343)

This fixes stalker texture generation when the stalker is standing on a node that uses a texture using a texture modifier.

Reviewed-on: VoxeLibre/VoxeLibre#4343
Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land>
Co-authored-by: teknomunk <teknomunk@protonmail.com>
Co-committed-by: teknomunk <teknomunk@protonmail.com>
This commit is contained in:
teknomunk 2024-06-01 20:23:38 +00:00 committed by the-real-herowl
parent ecf12b85cc
commit beccbacc73
1 changed files with 7 additions and 2 deletions

View File

@ -35,7 +35,8 @@ local function get_texture(self)
if not texture or texture == "" then
texture = "vl_stalker_default.png"
end
texture = "([combine:16x24:0,0=" .. texture .. ":0,16=" .. texture .. texture_suff
texture = texture:gsub("([\\^:\\[])","\\%1") -- escape texture modifiers
texture = "([combine:16x24:0,0=(" .. texture .. "):0,16=(" .. texture ..")".. texture_suff
if self.attack then
texture = texture .. ")^vl_mobs_stalker_overlay_angry.png"
else
@ -131,7 +132,11 @@ mcl_mobs.register_mob("mobs_mc:stalker", {
self:boom(mcl_util.get_object_center(self.object), self.explosion_strength)
end
end
self.object:set_properties({textures={get_texture(self)}})
local new_texture = get_texture(self)
if self._stalker_texture ~= new_texture then
self.object:set_properties({textures={new_texture, "mobs_mc_empty.png"}})
self._stalker_texture = new_texture
end
end,
on_die = function(self, pos, cmi_cause)
-- Drop a random music disc when killed by skeleton or stray