Mooshroom color change with on_lightning_strike

This commit is contained in:
cora 2022-11-04 14:01:24 +01:00
parent 21f3782439
commit 220b542cbf

View file

@ -153,6 +153,16 @@ mooshroom_def.on_rightclick = function(self, clicker)
end end
mcl_mobs:capture_mob(self, clicker, 0, 5, 60, false, nil) mcl_mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
end end
mooshroom_def.on_lightning_strike = function(self, pos, pos2, objects)
if self.base_texture[1] == "mobs_mc_mooshroom_brown.png" then
self.base_texture = { "mobs_mc_mooshroom.png", "mobs_mc_mushroom_red.png" }
else
self.base_texture = { "mobs_mc_mooshroom_brown.png", "mobs_mc_mushroom_brown.png" }
end
self.object:set_properties({ textures = self.base_texture })
return true
end
mcl_mobs:register_mob("mobs_mc:mooshroom", mooshroom_def) mcl_mobs:register_mob("mobs_mc:mooshroom", mooshroom_def)