This is already a function the doors use , but I redid it as another cheap way to check for a touch without needing to assign .touch field - plus I believe this code wont care if either ent is non solid. You can modify it with just a copy and paste, and there is only one call in doors.qc , which you can change to:
if (EntitiesTouching (0,self, t))
....if you want to not show a compiler warning.
basicly mode 0 is the default function, any mode > 0 will be checking absolute coordinates relative to the map, whereas mode 0 is only relative to the ent.
if (EntitiesTouching (0,self, t))
....if you want to not show a compiler warning.
Code:
[FONT="Franklin Gothic Medium"] float (float mode, entity e1, entity e2) EntitiesTouching = { [FONT="Century Gothic"][COLOR="LightBlue"]//Cobalt mode float - modifies to cover absmin/absmax, else do normal mins/maxs[/COLOR][/FONT] local vector low1, high1, low2, high2; low1 = e1.mins; high1 = e1.maxs; low2 = e2.mins; high2 = e2.maxs; if (mode) { low1 = e1.absmin; high1 = e1.absmax; low2 = e2.absmin; high2 = e2.absmax; } if (low1_x > high2_x) return FALSE; if (low1_y > high2_y) return FALSE; if (low1_z > high2_z) return FALSE; if (high1_x < e2.mins_x) return FALSE; if (high1_y < e2.mins_y) return FALSE; if (high1_z < e2.mins_z) return FALSE; return TRUE; }; [/FONT]
basicly mode 0 is the default function, any mode > 0 will be checking absolute coordinates relative to the map, whereas mode 0 is only relative to the ent.
Comment