mirror of
https://github.com/ElCeejo/creatura.git
synced 2025-04-30 13:51:41 -04:00
Cache entity properties to self.properties
This commit is contained in:
parent
a7af111180
commit
7b82f23abf
1 changed files with 889 additions and 887 deletions
12
mob_meta.lua
12
mob_meta.lua
|
@ -597,8 +597,8 @@ end
|
|||
-- Return current collisionbox
|
||||
|
||||
function mob:get_hitbox()
|
||||
if not self.object:get_properties() then return self.collisionbox end
|
||||
return self.object:get_properties().collisionbox
|
||||
if not self.properties then return self.collisionbox end
|
||||
return self.properties.collisionbox
|
||||
end
|
||||
|
||||
-- Return height of current collisionbox
|
||||
|
@ -611,8 +611,8 @@ end
|
|||
-- Return current visual size
|
||||
|
||||
function mob:get_visual_size()
|
||||
if not self.object:get_properties() then return end
|
||||
return self.object:get_properties().visual_size
|
||||
if not self.properties then return end
|
||||
return self.properties.visual_size
|
||||
end
|
||||
|
||||
local function is_group_in_table(tbl, name)
|
||||
|
@ -713,6 +713,7 @@ end
|
|||
-- Functions
|
||||
|
||||
function mob:activate(staticdata, dtime)
|
||||
self.properties = self.object:get_properties()
|
||||
self.width = self:get_hitbox()[4] or 0.5
|
||||
self.height = self:get_height() or 1
|
||||
self._tyaw = self.object:get_yaw()
|
||||
|
@ -755,7 +756,7 @@ function mob:activate(staticdata, dtime)
|
|||
|
||||
-- Initialize Stats and Visuals
|
||||
if not self.textures then
|
||||
local textures = self.object:get_properties().textures
|
||||
local textures = self.properties.textures
|
||||
if textures then self.textures = textures end
|
||||
end
|
||||
|
||||
|
@ -836,6 +837,7 @@ function mob:on_step(dtime, moveresult)
|
|||
self:_vitals()
|
||||
end
|
||||
-- Cached Geometry
|
||||
self.properties = self.object:get_properties()
|
||||
self.width = self:get_hitbox()[4] or 0.5
|
||||
self.height = self:get_height() or 1
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue