Fix rope bugs I introduced

This commit is contained in:
Pyrex 2022-12-18 18:31:06 -08:00
parent 64ef489c2a
commit 8d37dbef80

View File

@ -1398,19 +1398,18 @@ function rope:_tug(hypothetically)
for i=#ancs-1,2,-1 do for i=#ancs-1,2,-1 do
local ops_before_trash,hit_end1=self:_calc_push(ancs[i+1],ancs[i],ancs[i-1],ancs[i-2]) local ops_before_trash,hit_end1=self:_calc_push(ancs[i+1],ancs[i],ancs[i-1],ancs[i-2])
local ops_after_trash,hit_end2=self:_calc_push(ancs[i-2],ancs[i-1],ancs[i],ancs[i+1])
local ops_to_do,corners={},{} local ops_to_do,corners={},{}
if #ops_before_trash>0 then if #ops_before_trash>0 then
ops_to_do=ops_before_trash ops_to_do=ops_before_trash
corners[i-1]=true corners[i-1]=true
corners[i]=hit_end1
else else
local ops_after_trash,hit_end2=self:_calc_push(ancs[i-2],ancs[i-1],ancs[i],ancs[i+1])
ops_to_do=ops_after_trash ops_to_do=ops_after_trash
corners[i]=true corners[i-1]=true
corners[i]=hit_end1
end end
local corners={}
if (hit_end1 and hit_end2) corners[i-1],corners[i]=true,true
local ops=ops_to_do local ops=ops_to_do
if #ops>0 then if #ops>0 then
@ -1594,7 +1593,7 @@ function rope:_calc_push(
break break
else else
if not level:can_move(false,o.mx,o.my,o.dmx,o.dmy,0,0) then if not level:can_move(false,o.mx,o.my,o.dmx,o.dmy,0,0) then
hit_end=false hit_end=false
break break
end end
end end