From 8b77b919cc78f3a71992be1cae4de1cc8a52a03e Mon Sep 17 00:00:00 2001
From: Mario <mario@smbclan.net>
Date: Fri, 23 Aug 2019 17:13:09 +1000
Subject: [PATCH] Properly check against the world when trying for
 worldstartsolid, fixes some issues with elevators

---
 qcsrc/common/physics/movetypes/movetypes.qc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/qcsrc/common/physics/movetypes/movetypes.qc b/qcsrc/common/physics/movetypes/movetypes.qc
index b3f460ce7..4539466a2 100644
--- a/qcsrc/common/physics/movetypes/movetypes.qc
+++ b/qcsrc/common/physics/movetypes/movetypes.qc
@@ -509,10 +509,11 @@ bool _Movetype_PushEntity(entity this, vector push, bool failonstartsolid, bool
 {
 	_Movetype_PushEntityTrace(this, push);
 
+	// NOTE: this is a workaround for the QC's lack of a worldstartsolid trace parameter
 	if(trace_startsolid && failonstartsolid)
 	{
 		int oldtype = this.move_nomonsters;
-		this.move_nomonsters = MOVE_NOMONSTERS;
+		this.move_nomonsters = MOVE_WORLDONLY;
 		_Movetype_PushEntityTrace(this, push);
 		this.move_nomonsters = oldtype;
 		if(trace_startsolid)
@@ -527,7 +528,7 @@ bool _Movetype_PushEntity(entity this, vector push, bool failonstartsolid, bool
 		_Movetype_LinkEdict(this, true);
 
 	if(trace_fraction < 1)
-		if(this.solid >= SOLID_TRIGGER && (!IS_ONGROUND(this) || (this.groundentity != trace_ent)))
+		if(this.solid >= SOLID_TRIGGER && trace_ent && (!IS_ONGROUND(this) || (this.groundentity != trace_ent)))
 			_Movetype_Impact(this, trace_ent);
 
 	return (this.origin == last_origin); // false if teleported by touch
-- 
2.39.5