NULL, // #564
NULL, // #565
VM_CL_findbox, // #566 entity(vector mins, vector maxs) findbox = #566; (DP_QC_FINDBOX)
-NULL, // #567
+VM_nudgeoutofsolid, // #567 float(entity ent) nudgeoutofsolid = #567; (DP_QC_NUDGEOUTOFSOLID)
NULL, // #568
NULL, // #569
NULL, // #570
//description:
//Returns a chain of entities that are touching a box (a simpler findradius); supports DP_QC_FINDCHAIN_TOFIELD
+//DP_QC_NUDGEOUTOFSOLID
+//idea: LadyHavoc, bones_was_here
+//darkplaces implementation: LadyHavoc, bones_was_here
+//builtin definitions:
+float(entity ent) nudgeoutofsolid = #567;
+//cvar definitions:
+//sv_gameplayfix_nudgeoutofsolid_separation
+//description:
+//Attempts to move a stuck entity out of solid brushes, returning 1 if successful, 0 if it remains stuck, -1 if it wasn't stuck.
+//Note: makes only one tracebox call if the entity isn't stuck, so don't call tracebox just to see if you should call nudgeoutofsolid.
+
+
float(float dividend, float divisor) mod = #245;
}
}
+// DP_QC_NUDGEOUTOFSOLID
+// float(entity ent) nudgeoutofsolid = #567;
+void VM_nudgeoutofsolid(prvm_prog_t *prog)
+{
+ prvm_edict_t *ent;
+
+ VM_SAFEPARMCOUNTRANGE(1, 1, VM_nudgeoutofsolid);
+
+ ent = PRVM_G_EDICT(OFS_PARM0);
+ if (ent == prog->edicts)
+ {
+ VM_Warning(prog, "nudgeoutofsolid: can not modify world entity\n");
+ PRVM_G_FLOAT(OFS_RETURN) = 0;
+ return;
+ }
+ if (ent->free)
+ {
+ VM_Warning(prog, "nudgeoutofsolid: can not modify free entity\n");
+ PRVM_G_FLOAT(OFS_RETURN) = 0;
+ return;
+ }
+
+ PRVM_G_FLOAT(OFS_RETURN) = PHYS_NudgeOutOfSolid(prog, ent);
+
+ if (PRVM_G_FLOAT(OFS_RETURN) > 0)
+ {
+ if (prog == SVVM_prog)
+ SV_LinkEdict(ent);
+ else if (prog == CLVM_prog)
+ CL_LinkEdict(ent);
+ else
+ Sys_Error("PHYS_NudgeOutOfSolid: cannot be called from %s VM\n", prog->name);
+ }
+}
+
/*
=========
Common functions between menu.dat and clsprogs
void VM_physics_enable(prvm_prog_t *prog);
void VM_physics_addforce(prvm_prog_t *prog);
void VM_physics_addtorque(prvm_prog_t *prog);
+void VM_nudgeoutofsolid(prvm_prog_t *prog);
void VM_coverage(prvm_prog_t *prog);
"DP_QC_LOG",
"DP_QC_MINMAXBOUND",
"DP_QC_MULTIPLETEMPSTRINGS",
+"DP_QC_NUDGEOUTOFSOLID",
"DP_QC_NUM_FOR_EDICT",
"DP_QC_RANDOMVEC",
"DP_QC_SINCOSSQRTPOW",
NULL, // #564
NULL, // #565
VM_SV_findbox, // #566 entity(vector mins, vector maxs) findbox = #566; (DP_QC_FINDBOX)
-NULL, // #567
+VM_nudgeoutofsolid, // #567 float(entity ent) nudgeoutofsolid = #567; (DP_QC_NUDGEOUTOFSOLID)
NULL, // #568
NULL, // #569
NULL, // #570