Add setorigin_safe(), which is just like setorigin but pushes
entities upwards out of the ground.
This commit is contained in:
parent
b8de87d45c
commit
10b2ff1fca
1 changed files with 17 additions and 0 deletions
|
@ -134,6 +134,23 @@ setmodel(entity ent, string mname)
|
|||
return prior(ent, mname);
|
||||
}
|
||||
|
||||
void
|
||||
setorigin_safe(entity target, vector testorg)
|
||||
{
|
||||
|
||||
for (int i = 0; i < 16; i++) {
|
||||
tracebox(testorg, target.mins, target.maxs, testorg, MOVE_NORMAL, target);
|
||||
|
||||
if (!trace_startsolid) {
|
||||
break;
|
||||
}
|
||||
|
||||
testorg[2] += 1.0;
|
||||
}
|
||||
|
||||
setorigin(target, testorg);
|
||||
}
|
||||
|
||||
/* info print */
|
||||
void
|
||||
iprint(string m)
|
||||
|
|
Loading…
Reference in a new issue