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
|
-- Return current collisionbox
|
||||||
|
|
||||||
function mob:get_hitbox()
|
function mob:get_hitbox()
|
||||||
if not self.object:get_properties() then return self.collisionbox end
|
if not self.properties then return self.collisionbox end
|
||||||
return self.object:get_properties().collisionbox
|
return self.properties.collisionbox
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Return height of current collisionbox
|
-- Return height of current collisionbox
|
||||||
|
@ -611,8 +611,8 @@ end
|
||||||
-- Return current visual size
|
-- Return current visual size
|
||||||
|
|
||||||
function mob:get_visual_size()
|
function mob:get_visual_size()
|
||||||
if not self.object:get_properties() then return end
|
if not self.properties then return end
|
||||||
return self.object:get_properties().visual_size
|
return self.properties.visual_size
|
||||||
end
|
end
|
||||||
|
|
||||||
local function is_group_in_table(tbl, name)
|
local function is_group_in_table(tbl, name)
|
||||||
|
@ -713,6 +713,7 @@ end
|
||||||
-- Functions
|
-- Functions
|
||||||
|
|
||||||
function mob:activate(staticdata, dtime)
|
function mob:activate(staticdata, dtime)
|
||||||
|
self.properties = self.object:get_properties()
|
||||||
self.width = self:get_hitbox()[4] or 0.5
|
self.width = self:get_hitbox()[4] or 0.5
|
||||||
self.height = self:get_height() or 1
|
self.height = self:get_height() or 1
|
||||||
self._tyaw = self.object:get_yaw()
|
self._tyaw = self.object:get_yaw()
|
||||||
|
@ -755,7 +756,7 @@ function mob:activate(staticdata, dtime)
|
||||||
|
|
||||||
-- Initialize Stats and Visuals
|
-- Initialize Stats and Visuals
|
||||||
if not self.textures then
|
if not self.textures then
|
||||||
local textures = self.object:get_properties().textures
|
local textures = self.properties.textures
|
||||||
if textures then self.textures = textures end
|
if textures then self.textures = textures end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -836,6 +837,7 @@ function mob:on_step(dtime, moveresult)
|
||||||
self:_vitals()
|
self:_vitals()
|
||||||
end
|
end
|
||||||
-- Cached Geometry
|
-- Cached Geometry
|
||||||
|
self.properties = self.object:get_properties()
|
||||||
self.width = self:get_hitbox()[4] or 0.5
|
self.width = self:get_hitbox()[4] or 0.5
|
||||||
self.height = self:get_height() or 1
|
self.height = self:get_height() or 1
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue