From fb850b0233a2d1fe36d4d1d71832e9e064563a14 Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Thu, 2 Feb 2017 14:26:04 +0000 Subject: [PATCH] compatibility with older simple_mobs textures --- api.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/api.lua b/api.lua index 1a8460e..cc3ee39 100644 --- a/api.lua +++ b/api.lua @@ -1,5 +1,5 @@ --- Mobs Api (1st February 2017) +-- Mobs Api (2nd February 2017) mobs = {} mobs.mod = "redo" @@ -1970,7 +1970,7 @@ local falling = function(self, pos) if self.fall_damage == 1 and self.object:getvelocity().y == 0 then - local d = self.old_y - self.object:getpos().y + local d = (self.old_y or 0) - self.object:getpos().y -- remove or 0 if d > 5 then @@ -2217,12 +2217,12 @@ local mob_activate = function(self, staticdata, dtime_s, def) -- select random texture, set model and size if not self.base_texture then - if #def.textures == 1 then - self.base_texture = def.textures - else - self.base_texture = def.textures[random(1, #def.textures)] + -- compatiblity with old simple mobs textures + if type(def.textures[1]) == "string" then + def.textures = {def.textures} end + self.base_texture = def.textures[random(1, #def.textures)] self.base_mesh = def.mesh self.base_size = self.visual_size self.base_colbox = self.collisionbox