3 important bugfixes

This commit is contained in:
Joachim Stolberg
2019-02-10 10:17:29 +01:00
parent c87f336c0e
commit 7bd6ff3236
2 changed files with 5 additions and 5 deletions

View File

@ -175,11 +175,11 @@ function Tube:decode_param2(pos, param2)
end
function Tube:repair_tube(pos, dir)
local param2 = self:get_primary_node_param2(pos, dir)
local param2, npos = self:get_primary_node_param2(pos, dir)
if param2 then
local dir1, dir2 = self:decode_param2(pos, param2)
local dir1, dir2 = self:decode_param2(npos, param2)
local param2, tube_type = self:encode_param2(dir1, dir2, 2)
self.clbk_after_place_tube(pos, param2, tube_type, 2)
self.clbk_after_place_tube(npos, param2, tube_type, 2)
end
end
@ -213,7 +213,7 @@ function Tube:determine_tube_dirs(pos, preferred_pos, fdir)
-- If the node at players "prefered position" is a tube,
-- then the other side of the new tube shall point to the player.
if preferred_pos and self:friendly_primary_node(preferred_pos) then
if preferred_pos and self:friendly_primary_node(preferred_pos)[1] then
local v = vector.direction(pos, preferred_pos)
local dir1
if v.y > 0 then

View File

@ -68,7 +68,7 @@ local function update2(self, pos1, dir1, pos2, dir2)
local fpos2,fdir2 = self:walk_tube_line(pos2, dir2)
if not fdir1 or not fdir2 then -- line to long?
-- reset next tube(s) to head tube(s) again
local param2 = tubelib2.encode_param2(dir1, dir2, 2)
local param2 = self:encode_param2(dir1, dir2, 2)
self:update_after_dig_tube(pos1, param2)
M(get_pos(pos1, dir1)):set_string("infotext", I("Maximum length reached!"))
M(get_pos(pos1, dir2)):set_string("infotext", I("Maximum length reached!"))