]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
when "a CSQC entity changed its type", make sure ALL entity fields are cleared
authorRudolf Polzer <divverent@xonotic.org>
Thu, 5 Apr 2012 13:15:28 +0000 (15:15 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Thu, 5 Apr 2012 13:15:28 +0000 (15:15 +0200)
qcsrc/client/Main.qc

index 12343e6a24bac333753628e7ca63fe473f126318..d4a8a38deb66917117976e65d44a2e9d12995024 100644 (file)
@@ -2,6 +2,19 @@
 // BEGIN REQUIRED CSQC FUNCTIONS
 //include "main.qh"
 
+.entity clearentity_ent;
+void clearentity(entity e)
+{
+       if(!clearentity_ent)
+       {
+               clearentity_ent = spawn();
+               clearentity_ent.classname = "clearentity";
+       }
+       float n = e.entnum;
+       copyentity(clearentity_ent, e);
+       e.entnum = n;
+}
+
 #define DP_CSQC_ENTITY_REMOVE_IS_B0RKED
 void menu_show_error()
 {
@@ -706,6 +719,7 @@ void CSQC_Ent_Update(float bIsNewEntity)
                        //print(_("A CSQC entity changed its type!\n"));
                        print(sprintf(_("A CSQC entity changed its type! (edict: %d, server: %d, type: %d -> %d)\n"), num_for_edict(self), self.entnum, self.enttype, t));
                        Ent_Remove();
+                       clearentity(self);
                        bIsNewEntity = 1;
                }
        }