Assorted token golf in rope logic #25

Merged
pyrex merged 7 commits from kistaro/chameleonic:rope_golf into main 2023-01-03 01:06:57 +00:00
Showing only changes of commit 49284d44a8 - Show all commits

View File

@ -659,12 +659,13 @@ end
-- must be a free function
-- to use as a foreach target
function level_tug_crate(t)
local self=level
local mx0,my0,dmx,dmy=unpack(t)
local mxy0=_mix{mx0,my0}
local existing=self._crates[mxy0]
if (not existing) return
level._crates[mxy0]=nil
self._crates[mxy0]=nil
local mx1,my1=mx0+dmx,my0+dmy
local px1,py1=mx1*8,my1*8
existing.todo={
@ -675,7 +676,7 @@ function level_tug_crate(t)
{px=px1,py=py1}
}
level._crates[_mix{mx1,my1}]=existing
self._crates[_mix{mx1,my1}]=existing
end
-->8
@ -1669,7 +1670,7 @@ function rope:_calc_push(
local dmy=1 -- maybe push down?
if anch.ady==-1 and a0.y>an.y+6 then
-- push up
ay0,dmy=ay0-1,dmy=-1
ay0,dmy=ay0-1,-1
elseif anch.ady!=1 or a0.y>=an.y-6 then
return {}
end