Fix get_pos crash since 92a55c3

This commit is contained in:
SmallJoker 2018-07-04 18:53:11 +02:00
parent 92a55c3985
commit d19f4fc518

View File

@ -186,13 +186,13 @@ local entitydef_default = {
self:_add_attached(id) self:_add_attached(id)
end end
end, end,
getid = function(self) get_id = function(self)
return self._id return self._id
end, end,
getpos = function(self) get_pos = function(self)
return vector.new(self._pos) return vector.new(self._pos)
end, end,
setpos = function(self, pos) set_pos = function(self, pos)
self._pos = vector.new(pos) self._pos = vector.new(pos)
--for _, entity in pairs(self._attached_entities) do --for _, entity in pairs(self._attached_entities) do
-- if entity.entity then -- if entity.entity then
@ -205,20 +205,20 @@ local entitydef_default = {
master_def.entity:set_pos(vector.add(self._pos, master_def.offset)) master_def.entity:set_pos(vector.add(self._pos, master_def.offset))
end end
end, end,
getvelocity = function(self) get_velocity = function(self)
return vector.new(self._velocity) return vector.new(self._velocity)
end, end,
setvelocity = function(self, velocity) set_velocity = function(self, velocity)
self._velocity = vector.new(velocity) self._velocity = vector.new(velocity)
local master = self._attached_entities_master local master = self._attached_entities_master
if master then if master then
self._attached_entities[master].entity:set_velocity(self._velocity) self._attached_entities[master].entity:set_velocity(self._velocity)
end end
end, end,
getacceleration = function(self) get_acceleration = function(self)
return vector.new(self._acceleration) return vector.new(self._acceleration)
end, end,
setacceleration = function(self, acceleration) set_acceleration = function(self, acceleration)
self._acceleration = vector.new(acceleration) self._acceleration = vector.new(acceleration)
local master = self._attached_entities_master local master = self._attached_entities_master
if master then if master then