[ moving Player | Boxes ] -> [ moving Player | moving Boxes ]
+ [ moving Boxes | Boxes ] -> [ moving Boxes | moving Boxes ]
+ rigid [ moving RigidBox | RigidBox ] -> [ moving RigidBox | moving RigidBox ]
[ left Player | RigidBox ] -> [ left Player | RigidRobot markLeft ]
[ right Player | RigidBox ] -> [ right Player | RigidBox markRight ]
[ up Player | RigidBox ] -> [ up Player | RigidBox markUp ]
[ down Player | RigidBox ] -> [ down Player | RigidBox markDown ]
[ RigidBox | RigidBox markLeft ] -> [ RigidBox markLeft | RigidBox markLeft ]
[ RigidBox | RigidBox markRight ] -> [ RigidBox markRight | RigidBox markRight ]
[ RigidBox | RigidBox markUp ] -> [ RigidBox markUp | RigidBox markUp ]
[ RigidBox | RigidBox markDown ] -> [ RigidBox markDown | RigidBox markDown ]
[ RigidBox markLeft | NONRigidBox ] -> [ RigidBox markLeft | left NONRigidBox ]
[ RigidBox markRight | NONRigidBox ] -> [ RigidBox markRight | right NONRigidBox ]
[ RigidBox markUp | NONRigidBox ] -> [ RigidBox markUp | up NONRigidBox ]
[ RigidBox markDown | NONRigidBox ] -> [ RigidBox markDown | down NONRigidBox ]
[moving Player | NONRigidBox ] -> [moving Player | moving NONRigidBox ]
[moving NONRigidBox | NONRigidBox ] -> [moving NONRigidBox | moving NONRigidBox ]
late [ RigidBox markLeft ] -> [ RigidBox ]
late [ RigidBox markRight ] -> [ RigidBox ]
late [ RigidBox markUp ] -> [ RigidBox ]
late [ RigidBox markDown ] -> [ RigidBox ]
So, the code at the top does the basic rigid body stuff that does not happen if
the rigid stuff is activated.
Then we have temporary entities that get placed in a rigid body entity next to the player, and rigid body entities next to a rigid body entity with this mark get the mark as well. That way the movement info spreads and you can just check whether you are next to a rigid body entity with a mark or not.
the late rule is to remove the marks from the rigid bodies.
Hope this helps someone!
Hey anyone that is reading, I discovered that if any rigid box of the same type can't move, other rigid blocks that _should_ be able to move can't, because rules marked as rigid disable themselves and re-simulate the turn, and since [ moving Player | Boxes ] -> [ moving Player | moving Boxes ] is in the same rule group it gets disabled as well(if I understand correctly)!
Here is a gif to demonstrate what I am talking about: https://s3.amazonaws.com/f.cl.ly/items/1d2v1x2H391B2L173f32/test.gif
So my fix is to dump the rigid keyword all together and create a new mark object called hitWall and mark stuff that gets hit by a wall(and mark connected rigid objects) so you can tell those objects not to move!
So if you just wanted to fix the situation that occurs in the GIF, the code would look like this:
[ moving Player | Crate ] -> [ moving Player | moving Crate ]
[ moving Crate | Crate ] -> [ moving Crate | moving Crate ]
[ > Crate | Wall ] -> [ Crate wallHit | Wall ]
[ Crate wallHit | Crate ] -> [ Crate wallHit | Crate wallHit ]
[ moving Crate wallHit ] -> [ Crate wallHit ]
late [ Crate wallHit ] -> [ Crate ]
late [ wallHit ] -> []
And now that box can move freely!:https://s3.amazonaws.com/f.cl.ly/items/220f41422r0R1M1j0741/test2.gif
And here is a fix for the code I posted previously:
[ moving Player | Boxes ] -> [ moving Player | moving Boxes ]
[ moving Boxes | Boxes ] -> [ moving Boxes | moving Boxes ]
[ > Boxes | Wall ] -> [ Boxes hitWall | Wall ]
[ Boxes hitWall | RigidBox ] -> [ Boxes hitWall | RigidBox hitWall ]
[ moving RigidBox hitWall ] -> [ RigidBox hitWall ]
[ left Player | RigidBox ] -> [ left Player | RigidRobot markLeft ]
[ right Player | RigidBox ] -> [ right Player | RigidBox markRight ]
[ up Player | RigidBox ] -> [ up Player | RigidBox markUp ]
[ down Player | RigidBox ] -> [ down Player | RigidBox markDown ]
[ RigidBox | RigidBox markLeft ] -> [ RigidBox markLeft | RigidBox markLeft ]
[ RigidBox | RigidBox markRight ] -> [ RigidBox markRight | RigidBox markRight ]
[ RigidBox | RigidBox markUp ] -> [ RigidBox markUp | RigidBox markUp ]
[ RigidBox | RigidBox markDown ] -> [ RigidBox markDown | RigidBox markDown ]
[ RigidBox markLeft | NONRigidBox ] -> [ RigidBox markLeft | left NONRigidBox ]
[ RigidBox markRight | NONRigidBox ] -> [ RigidBox markRight | right NONRigidBox ]
[ RigidBox markUp | NONRigidBox ] -> [ RigidBox markUp | up NONRigidBox ]
[ RigidBox markDown | NONRigidBox ] -> [ RigidBox markDown | down NONRigidBox ]
[moving Player | NONRigidBox ] -> [moving Player | moving NONRigidBox ]
[moving NONRigidBox | NONRigidBox ] -> [moving NONRigidBox | moving NONRigidBox ]
late [ Boxes hitWall ] -> [ Boxes ]
late [ Boxes markLeft ] -> [ Boxes ]
late [ RigidBox markRight ] -> [ RigidBox ]
late [ RigidBox markUp ] -> [ RigidBox ]
late [ RigidBox markDown ] -> [ RigidBox ]
late [ MARKS ] -> []
--
You received this message because you are subscribed to the Google Groups "PuzzleScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puzzlescript...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--