diff options
author | root <root@linux-forks.de> | 2018-07-18 16:14:28 +0200 |
---|---|---|
committer | root <root@linux-forks.de> | 2018-07-18 16:14:28 +0200 |
commit | c18b9fc40837aacb1ed37b7c07eeeea315ed586b (patch) | |
tree | 1ebcea31726a6113ee90991d1e47e5aab5ce4368 /luaentity.lua | |
parent | 217869f2c1109383aaeb753c130c333840b8078f (diff) | |
parent | 8186f003beae42c9815b3c9c131e919f5b099035 (diff) |
Merge branch 'master' of https://github.com/minetest-mods/pipeworks
Diffstat (limited to 'luaentity.lua')
-rw-r--r-- | luaentity.lua | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/luaentity.lua b/luaentity.lua index 34b6665..c11c030 100644 --- a/luaentity.lua +++ b/luaentity.lua @@ -74,7 +74,7 @@ local move_entities_globalstep_part1 = function(dtime) local active_block_range = tonumber(minetest.settings:get("active_block_range")) or 2 local new_active_blocks = {} for _, player in ipairs(minetest.get_connected_players()) do - local blockpos = get_blockpos(player:getpos()) + local blockpos = get_blockpos(player:get_pos()) local minp = vector.subtract(blockpos, active_block_range) local maxp = vector.add(blockpos, active_block_range) @@ -114,9 +114,9 @@ local entitydef_default = { if not def.entity then return end - def.entity:setpos(vector.add(self._pos, def.offset)) - def.entity:setvelocity(self._velocity) - def.entity:setacceleration(self._acceleration) + def.entity:set_pos(vector.add(self._pos, def.offset)) + def.entity:set_velocity(self._velocity) + def.entity:set_acceleration(self._acceleration) end, _attach_all = function(self) local master = self._attached_entities_master @@ -186,43 +186,43 @@ local entitydef_default = { self:_add_attached(id) end end, - getid = function(self) + get_id = function(self) return self._id end, - getpos = function(self) + get_pos = function(self) return vector.new(self._pos) end, - setpos = function(self, pos) + set_pos = function(self, pos) self._pos = vector.new(pos) --for _, entity in pairs(self._attached_entities) do -- if entity.entity then - -- entity.entity:setpos(vector.add(self._pos, entity.offset)) + -- entity.entity:set_pos(vector.add(self._pos, entity.offset)) -- end --end local master = self._attached_entities_master if master then local master_def = self._attached_entities[master] - master_def.entity:setpos(vector.add(self._pos, master_def.offset)) + master_def.entity:set_pos(vector.add(self._pos, master_def.offset)) end end, - getvelocity = function(self) + get_velocity = function(self) return vector.new(self._velocity) end, - setvelocity = function(self, velocity) + set_velocity = function(self, velocity) self._velocity = vector.new(velocity) local master = self._attached_entities_master if master then - self._attached_entities[master].entity:setvelocity(self._velocity) + self._attached_entities[master].entity:set_velocity(self._velocity) end end, - getacceleration = function(self) + get_acceleration = function(self) return vector.new(self._acceleration) end, - setacceleration = function(self, acceleration) + set_acceleration = function(self, acceleration) self._acceleration = vector.new(acceleration) local master = self._attached_entities_master if master then - self._attached_entities[master].entity:setacceleration(self._acceleration) + self._attached_entities[master].entity:set_acceleration(self._acceleration) end end, remove = function(self) @@ -314,7 +314,7 @@ function luaentity.get_objects_inside_radius(pos, radius) local objects = {} local index = 1 for id, entity in pairs(luaentity.entities) do - if vector.distance(pos, entity:getpos()) <= radius then + if vector.distance(pos, entity:get_pos()) <= radius then objects[index] = entity index = index + 1 end @@ -329,11 +329,11 @@ local move_entities_globalstep_part2 = function(dtime) local master = entity._attached_entities_master local master_def = master and entity._attached_entities[master] local master_entity = master_def and master_def.entity - local master_entity_pos = master_entity and master_entity:getpos() + local master_entity_pos = master_entity and master_entity:get_pos() if master_entity_pos then entity._pos = vector.subtract(master_entity_pos, master_def.offset) - entity._velocity = master_entity:getvelocity() - entity._acceleration = master_entity:getacceleration() + entity._velocity = master_entity:get_velocity() + entity._acceleration = master_entity:get_acceleration() else entity._pos = vector.add(vector.add( entity._pos, |