Compare commits

..

No commits in common. "78f0a96529c8a8f361849253a6dd26fc1944945c" and "b1cc74fe3be94837c5eff77aecf105a2c5e6785f" have entirely different histories.

View File

@ -633,12 +633,10 @@ end
ropecheck=split"-0.6,0.4,0.4" ropecheck=split"-0.6,0.4,0.4"
-- argument "o" is a rope operation:
-- array of [mx0,my0,dmx,dmy]
function level:can_move( function level:can_move(
is_player,o,exclude_src,exclude_dst is_player,
mx0,my0,dmx,dmy,exclude_src,exclude_dst
) )
local mx0,my0,dmx,dmy=unpack(o)
local mx1,my1=mx0+dmx,my0+dmy local mx1,my1=mx0+dmx,my0+dmy
if (is_player and self:win_at(mx1,my1)) return true if (is_player and self:win_at(mx1,my1)) return true
if (is_player and self:get_open_pit(mx1,my1)) return wrongbleep:adequately_warned() if (is_player and self:get_open_pit(mx1,my1)) return wrongbleep:adequately_warned()
@ -654,8 +652,7 @@ function level:can_move(
return true return true
end end
-- argument is a rope operation: -- argument is array-like: mx0,my0,dmx,dmy
-- array of [mx0,my0,dmx,dmy]
function level:tug_crate(t) function level:tug_crate(t)
local mx0,my0,dmx,dmy=unpack(t) local mx0,my0,dmx,dmy=unpack(t)
local mxy0=_mix{mx0,my0} local mxy0=_mix{mx0,my0}
@ -739,7 +736,7 @@ function player:update()
else else
local x,y=self.x,self.y local x,y=self.x,self.y
local function try_move(dx,dy,f) local function try_move(dx,dy,f)
if level:can_move(true,{x,y,dx,dy},0,2) then if level:can_move(true,x,y,dx,dy,0,2) then
self.todo=f self.todo=f
self.cooldown=3 self.cooldown=3
local t=f[#f] local t=f[#f]
@ -1607,7 +1604,7 @@ function rope:_tug(hypothetically)
if not invalid_move then if not invalid_move then
local mv = {mx0,my0,dmx,dmy} local mv = {mx0,my0,dmx,dmy}
if level:can_move(false,mv,1,0) then if level:can_move(false,mx0,my0,dmx,dmy,1,0) then
if (hypothetically) return ancs,0,{mv},blocks if (hypothetically) return ancs,0,{mv},blocks
level:tug_crate(mv) level:tug_crate(mv)
@ -1690,11 +1687,17 @@ function rope:_calc_push(
local ops2,blocked={},{} local ops2,blocked={},{}
for o in all(ops) do for o in all(ops) do
local mx,my=unpack(o) local mx,my,dmx,dmy=unpack(o)
if level:mcoll(mx,my) if not level:mcoll(mx,my) then
if not (level:get_crate(mx, my)) break -- great!
if not level:can_move(false,o,0,0) then else
add(blocked,o) local crate=level:get_crate(mx,my)
if crate then
if not level:can_move(false,mx,my,dmx,dmy,0,0) then
add(blocked,o)
break
end
else
break break
end end
add(ops2,o) add(ops2,o)