Skip to content

Allow player.lastlinehit and player.lastsidehit to be usable outside of Knuckles' climbing ability

SMS Alfredo requested to merge SMS_Alfredo/SRB2:lastlineshit into next

Instead of exclusively using player.lastlinehit and player.lastsidehit to store what line Knuckles is climbing on, this merge request also has the two variables store the last line and last side the player has collided with, as the name of the variables imply.

This proves extremely useful in Lua, and can be used to get several different aspects of a line that has blocked a player's movement, which is normally impossible with the MobjMoveBlocked and MobjLineCollide hooks. Especially in the case of the latter, because the hook is called before the player actually gets blocked by the line. That means that this partially solves #332 (closed), but not completely since there are still some problems that need to be addressed that aren't fixed here.

Anyways, included is a Lua file I used to test this merge. It makes the player always face the last line they collided with. Not a perfect Lua, but it showcases the merge well enough.

srb20008

Edited by SMS Alfredo

Merge request reports