More rope bugs

This commit is contained in:
Pyrex 2022-12-18 17:47:28 -08:00
parent d76699c56e
commit 546e5f2e07

View File

@ -1521,9 +1521,10 @@ function rope:_calc_push(
local ops={}
if (an==nil) return ops
local pull_ang=atan2(
a0.x\8 - an.x\8,
a0.x\8-an.x\8,
a0.y\8-an.y\8
)
local needs_good_pull=af==nil
if a0.x==a1.x then
-- no far side applying pressure?
@ -1536,15 +1537,15 @@ function rope:_calc_push(
local mx,dmx
if a0.x%8==0 and a0.x>an.x+7 then
local needs_good_pull=af==nil or af.x>=a1.x
if (needs_good_pull and _ang_diff(pull_ang,0.5)>=0.125) return {}
needs_good_pull=needs_good_pull or af.x>=a1.x
if (needs_good_pull and _ang_diff(pull_ang,0.0)>=0.125) return {}
-- push left
mx=(a0.x-1)\8
dmx=-1
elseif a0.x%8==7 and a0.x<an.x-7 then
local needs_good_pull=af==nil or af.x<=a1.x
if (needs_good_pull and _ang_diff(pull_ang,0.0)>=0.125) return {}
needs_good_pull=needs_good_pull or af.x<=a1.x
if (needs_good_pull and _ang_diff(pull_ang,0.5)>=0.125) return {}
-- push right
mx=(a0.x+1)\8
@ -1568,7 +1569,7 @@ function rope:_calc_push(
local my,dmy
if a0.y%8==0 and a0.y>an.y+6 then
local needs_good_pull=af==nil or af.x>=a1.x
needs_good_pull=needs_good_pull or af.y>=a1.y
if (needs_good_pull and _ang_diff(pull_ang,0.75)>=0.125) return {}
-- push up
@ -1576,7 +1577,7 @@ function rope:_calc_push(
dmy=-1
elseif a0.y%8==7 and a0.y<an.y-6 then
local needs_good_pull=af==nil or af.x>=a1.x
needs_good_pull=needs_good_pull or af.y<=a1.y
if (needs_good_pull and _ang_diff(pull_ang,0.25)>=0.125) return {}
-- push down