diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index fbc34173390a1be01be3058772629779558f5c4a..30b342c66e0d308170de6cc6ae89ad644a8f90c2 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -104,6 +104,7 @@ add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32
 	lua_hudlib_drawlist.c
 	lua_colorlib.c
 	lua_inputlib.c
+	lua_interceptlib.c
 )
 
 # This updates the modification time for comptime.c at the
diff --git a/src/Sourcefile b/src/Sourcefile
index 60ee5db5baf16fe20657c93e5143afe60615bc89..3e926e31850a2055d335326096de6034a87b0a69 100644
--- a/src/Sourcefile
+++ b/src/Sourcefile
@@ -98,3 +98,4 @@ lua_hudlib.c
 lua_hudlib_drawlist.c
 lua_inputlib.c
 lua_colorlib.c
+lua_interceptlib.c
diff --git a/src/deh_tables.c b/src/deh_tables.c
index a96adf8ae6fb432bf04fd472d525eec1b6dcbd2a..57a243f5b737f8ab91c60414af09f0d5eb176ae3 100644
--- a/src/deh_tables.c
+++ b/src/deh_tables.c
@@ -25,6 +25,7 @@
 #include "g_game.h" // Joystick axes (for lua)
 #include "i_joy.h"
 #include "g_input.h" // Game controls (for lua)
+#include "p_maputl.h" // P_PathTraverse constants (for lua)
 
 #include "deh_tables.h"
 
@@ -5829,6 +5830,11 @@ struct int_const_s const INT_CONST[] = {
 	{"MB_BUTTON8",MB_BUTTON8},
 	{"MB_SCROLLUP",MB_SCROLLUP},
 	{"MB_SCROLLDOWN",MB_SCROLLDOWN},
+	
+	// P_PathTraverse constants
+	{"PT_ADDLINES",PT_ADDLINES},
+	{"PT_ADDTHINGS",PT_ADDTHINGS},
+	{"PT_EARLYOUT",PT_EARLYOUT},
 
 	// screen.h constants
 	{"BASEVIDWIDTH",BASEVIDWIDTH},
diff --git a/src/lua_baselib.c b/src/lua_baselib.c
index c253fa3b19a97f0513b90cdbddd56489515945db..9eaf784defedcf9f6321e91d2f45223cbbd90310 100644
--- a/src/lua_baselib.c
+++ b/src/lua_baselib.c
@@ -240,6 +240,8 @@ static const struct {
 	{META_KEYEVENT,     "keyevent_t"},
 	{META_TEXTEVENT,    "textevent_t"},
 	{META_MOUSE,        "mouse_t"},
+	
+	{META_INTERCEPT,	"intercept_t"},
 	{NULL,              NULL}
 };
 
diff --git a/src/lua_interceptlib.c b/src/lua_interceptlib.c
new file mode 100644
index 0000000000000000000000000000000000000000..5907b2bf5ac909bced02fab2107f013370831e15
--- /dev/null
+++ b/src/lua_interceptlib.c
@@ -0,0 +1,115 @@
+// SONIC ROBO BLAST 2
+//-----------------------------------------------------------------------------
+// Copyright (C) 2024-2024 by Sonic Team Junior.
+//
+// This program is free software distributed under the
+// terms of the GNU General Public License, version 2.
+// See the 'LICENSE' file for more details.
+//-----------------------------------------------------------------------------
+/// \file  lua_interceptlib.c
+/// \brief intercept library for Lua scripting
+
+#include "doomdef.h"
+#include "fastcmp.h"
+#include "p_local.h"
+#include "lua_script.h"
+#include "lua_libs.h"
+
+#include "lua_hud.h" // hud_running errors
+
+#define NOHUD if (hud_running)\
+return luaL_error(L, "HUD rendering code should not call this function!");
+
+enum intercept_e {
+	intercept_valid = 0,
+	intercept_frac,
+	intercept_thing,
+	intercept_line
+};
+
+static const char *const intercept_opt[] = {
+	"valid",
+	"frac",
+	"thing",
+	"line",
+	NULL};
+
+static int intercept_fields_ref = LUA_NOREF;
+
+static boolean Lua_PathTraverser(intercept_t *in)
+{
+	boolean traverse = false;
+	I_Assert(in != NULL);
+	
+	lua_settop(gL, 6);
+	lua_pushcfunction(gL, LUA_GetErrorMessage);
+	
+	I_Assert(lua_isfunction(gL, -2));
+	
+	lua_pushvalue(gL, -2);
+	LUA_PushUserdata(gL, in, META_INTERCEPT);
+	LUA_Call(gL, 1, 1, -3);
+	
+	traverse = lua_toboolean(gL, -1);
+	lua_pop(gL, 1);
+	
+	return !traverse; // Stay consistent with the MobjMoveCollide hook
+}
+
+static int intercept_get(lua_State *L)
+{
+	intercept_t *in = *((intercept_t **)luaL_checkudata(L, 1, META_INTERCEPT));
+	enum intercept_e field = Lua_optoption(L, 2, intercept_valid, intercept_fields_ref);
+	
+	if (!in)
+	{
+		if (field == intercept_valid) {
+			lua_pushboolean(L, 0);
+			return 1;
+		}
+		return luaL_error(L, "accessed intercept_t doesn't exist anymore.");
+	}
+	
+	switch(field)
+	{
+	case intercept_valid: // valid
+		lua_pushboolean(L, 1);
+		return 1;
+	case intercept_frac:
+		lua_pushfixed(L, in->frac);
+		return 1;
+	case intercept_thing:
+		if (in->isaline)
+			return 0;
+		LUA_PushUserdata(L, in->d.thing, META_MOBJ);
+		return 1;
+	case intercept_line:
+		if (!in->isaline)
+			return 0;
+		LUA_PushUserdata(L, in->d.line, META_LINE);
+		return 1;
+	}
+	return 0;
+}
+
+static int lib_pPathTraverse(lua_State *L)
+{
+	fixed_t px1 = luaL_checkfixed(L, 1);
+	fixed_t py1 = luaL_checkfixed(L, 2);
+	fixed_t px2 = luaL_checkfixed(L, 3);
+	fixed_t py2 = luaL_checkfixed(L, 4);
+	INT32 flags = (INT32)luaL_checkinteger(L, 5);
+	luaL_checktype(L, 6, LUA_TFUNCTION);
+	NOHUD
+	INLEVEL
+	lua_pushboolean(L, P_PathTraverse(px1, py1, px2, py2, flags, Lua_PathTraverser));
+	return 1;
+}
+
+int LUA_InterceptLib(lua_State *L)
+{
+	LUA_RegisterUserdataMetatable(L, META_INTERCEPT, intercept_get, NULL, NULL);
+	intercept_fields_ref = Lua_CreateFieldTable(L, intercept_opt);
+	lua_register(L, "P_PathTraverse", lib_pPathTraverse);
+	return 0;
+}
diff --git a/src/lua_libs.h b/src/lua_libs.h
index 99a395c95eb3806644243d9e07af7e30fe919610..381c3462955312d97b09b6b8529ff91d6e4ee27b 100644
--- a/src/lua_libs.h
+++ b/src/lua_libs.h
@@ -98,6 +98,8 @@ extern boolean ignoregameinputs;
 #define META_KEYEVENT "KEYEVENT_T*"
 #define META_MOUSE "MOUSE_T*"
 
+#define META_INTERCEPT "INTERCEPT_T*"
+
 boolean luaL_checkboolean(lua_State *L, int narg);
 
 int LUA_EnumLib(lua_State *L);
@@ -118,3 +120,4 @@ int LUA_BlockmapLib(lua_State *L);
 int LUA_HudLib(lua_State *L);
 int LUA_ColorLib(lua_State *L);
 int LUA_InputLib(lua_State *L);
+int LUA_InterceptLib(lua_State *L);
diff --git a/src/lua_script.c b/src/lua_script.c
index 686555a16d6b09b98d839cefec0ac0fc876181ae..bb3101d1eb48867b96d8f54e85f5e811e1da3b4f 100644
--- a/src/lua_script.c
+++ b/src/lua_script.c
@@ -62,6 +62,7 @@ static lua_CFunction liblist[] = {
 	LUA_HudLib, // HUD stuff
 	LUA_ColorLib, // general color functions
 	LUA_InputLib, // inputs
+	LUA_InterceptLib, // intercept_t
 	NULL
 };
 
diff --git a/src/p_maputl.c b/src/p_maputl.c
index 4c7b959270993a7117c58d83f71c86348206937e..de239056a51524813b4466519035c631f3975a02 100644
--- a/src/p_maputl.c
+++ b/src/p_maputl.c
@@ -1056,7 +1056,7 @@ boolean P_BlockThingsIterator(INT32 x, INT32 y, boolean (*func)(mobj_t *), mobj_
 
 	boolean checkthing = false;
 	if (thing)
-			checkthing = true;
+		checkthing = true;
 
 	if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight)
 		return true;
@@ -1434,7 +1434,7 @@ static boolean P_TraverseIntercepts(traverser_t func, fixed_t maxfrac)
 
 		if (dist > maxfrac)
 			return true; // Checked everything in range.
-
+		
 		if (!func(in))
 			return false; // Don't bother going farther.
 
@@ -1462,7 +1462,7 @@ boolean P_PathTraverse(fixed_t px1, fixed_t py1, fixed_t px2, fixed_t py2,
 
 	validcount++;
 	intercept_p = intercepts;
-
+	
 	if (((px1 - bmaporgx) & (MAPBLOCKSIZE-1)) == 0)
 		px1 += FRACUNIT; // Don't side exactly on a line.
 
@@ -1475,7 +1475,7 @@ boolean P_PathTraverse(fixed_t px1, fixed_t py1, fixed_t px2, fixed_t py2,
 	trace.dy = py2 - py1;
 
 	xt1 = px1>>MAPBLOCKSHIFT;
-	yt1 = py2>>MAPBLOCKSHIFT;
+	yt1 = py1>>MAPBLOCKSHIFT;
 	px1 = (unsigned)(px1 - bmaporgx);
 	py1 = (unsigned)(py1 - bmaporgy);
 
@@ -1624,6 +1624,7 @@ boolean P_PathTraverse(fixed_t px1, fixed_t py1, fixed_t px2, fixed_t py2,
 				break;
 		}
 	}
+	
 	// Go through the sorted list
 	return P_TraverseIntercepts(trav, FRACUNIT);
 }
diff --git a/src/sdl/Srb2SDL-vc10.vcxproj b/src/sdl/Srb2SDL-vc10.vcxproj
index 8026cd3acbdd4adb6652269dbf308c8ec6fa4e12..2a25f33031adee58358a423e0251937995e5471c 100644
--- a/src/sdl/Srb2SDL-vc10.vcxproj
+++ b/src/sdl/Srb2SDL-vc10.vcxproj
@@ -513,6 +513,7 @@
     <ClCompile Include="..\lua_hudlib_drawlist.c" />
     <ClCompile Include="..\lua_infolib.c" />
     <ClCompile Include="..\lua_inputlib.c" />
+	<ClCompile Include="..\lua_interceptlib.c" />
     <ClCompile Include="..\lua_maplib.c" />
     <ClCompile Include="..\lua_mathlib.c" />
     <ClCompile Include="..\lua_mobjlib.c" />
diff --git a/src/sdl/Srb2SDL-vc10.vcxproj.filters b/src/sdl/Srb2SDL-vc10.vcxproj.filters
index bbfca04d4c1132bc5241e02e612aa6fc2e48c7e5..8daaa7773f091d5dfbf6bac965b58160380bb50c 100644
--- a/src/sdl/Srb2SDL-vc10.vcxproj.filters
+++ b/src/sdl/Srb2SDL-vc10.vcxproj.filters
@@ -783,6 +783,9 @@
     </ClCompile>
     <ClCompile Include="..\lua_inputlib.c">
       <Filter>LUA</Filter>
+    </ClCompile>
+	<ClCompile Include="..\lua_interceptlib.c">
+      <Filter>LUA</Filter>
     </ClCompile>
     <ClCompile Include="..\lua_maplib.c">
       <Filter>LUA</Filter>