]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
fix origin of func_breakable too
authorRudolf Polzer <divverent@alientrap.org>
Fri, 20 Aug 2010 17:30:56 +0000 (19:30 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Fri, 20 Aug 2010 17:30:56 +0000 (19:30 +0200)
qcsrc/server/func_breakable.qc

index a5e8dfa5897ce1c74deacce9b05351bbf8498700..ca3d804d21ba8c2c1d8dfff8c885728d16a6b50b 100644 (file)
@@ -85,6 +85,9 @@ void func_breakable_look_destroyed()
 {
        local float floor_z;
 
+       if(self.solid == SOLID_BSP) // in case a misc_follow moved me, save the current origin first
+               self.dropped_origin = self.origin;
+
        if(self.mdl_dead == "")
                self.model = "";
        else {
@@ -102,6 +105,8 @@ void func_breakable_look_destroyed()
 void func_breakable_look_restore()
 {
        setmodel(self, self.mdl);
+       if(self.mdl_dead != "") // only do this if we use mdl_dead, to behave better with misc_follow
+               setorigin(self, self.dropped_origin);
        self.solid = SOLID_BSP;
 }
 
@@ -241,6 +246,7 @@ void spawnfunc_func_breakable() {
                precache_sound(self.noise);
 
        self.team_saved = self.team;
+       self.dropped_origin = self.origin;
 
        self.reset = func_breakable_reset;
        func_breakable_reset();