Add setorigin_safe(), which is just like setorigin but pushes

entities upwards out of the ground.
This commit is contained in:
Marco Cawthorne 2021-09-12 00:12:55 +02:00
parent b8de87d45c
commit 10b2ff1fca
Signed by: eukara
GPG Key ID: C196CD8BA993248A
1 changed files with 17 additions and 0 deletions

View File

@ -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)