]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix a very rare and major issue that took place if someone killtarget'ed a func_bobbi...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 3 Oct 2010 18:39:14 +0000 (21:39 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 3 Oct 2010 18:39:14 +0000 (21:39 +0300)
Make a map and place a func_bobbing on it, a trigger_multiple that killtarget's the func_bobbing, and the hook gun pickup somewhere. Get the hook gun in that map and shoot at the walls with it (make sure the map is large enough so the hook flies for at least one second before hitting a wall). The hook will behave normally. Now trigger the trigger_multiple and watch it make the func_bobbing disappear like it should. However, from this point on, shooting the hook gun will cause the hook to change direction in the air and go toward origin '0 0 0' half of the time you shoot it.

This seems to be because the func_bobbing's controller (that moves it up and down) attaches to the hook projectile if the func_bobbing is killed, for an unknown reason (likely happens with other projectiles too). So I added a check that makes it only change the velocity of func_bobbing as long as its classname corresponds. That way, if someone makes a map where they want to killtarget a func_bobbing for whatever reason, that won't brake projectiles.

qcsrc/server/t_plats.qc

index 583fc735966d68c1de4b22cce08c6fc084f4c295..0d8233da53da88a942b32879c11f4c91d0be604a 100644 (file)
@@ -418,8 +418,9 @@ void func_bobbing_controller_think()
        // calculate sinewave using makevectors
        makevectors((self.nextthink * self.owner.cnt + self.owner.phase * 360) * '0 1 0');
        v = self.owner.destvec + self.owner.movedir * v_forward_y;
-       // * 10 so it will arrive in 0.1 sec
-       self.owner.velocity = (v - self.owner.origin) * 10;
+       if(self.owner.classname == "func_bobbing") // don't brake stuff if the func_bobbing was killtarget'ed
+               // * 10 so it will arrive in 0.1 sec
+               self.owner.velocity = (v - self.owner.origin) * 10;
 };
 
 void bobbing_blocked()