]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix possible crash with monster_loot set to an invalid function
authorMario <mario.mario@y7mail.com>
Sun, 4 Aug 2013 12:03:35 +0000 (22:03 +1000)
committerMario <mario.mario@y7mail.com>
Sun, 4 Aug 2013 12:03:35 +0000 (22:03 +1000)
qcsrc/server/monsters/lib/monsters.qc
qcsrc/server/monsters/lib/monsters_early.qh

index 91a4587dd7ffa36363ab10fa9c34eda81f5d8a57..7e013515aeb6bdebc2de47c1aac1e597c0abee5d 100644 (file)
@@ -14,7 +14,8 @@ void M_Item_Touch ()
 
 void monster_item_spawn()
 {
-       self.monster_loot();
+       if(self.monster_loot)
+               self.monster_loot();
        
        self.gravity = 1;
        self.velocity = randomvec() * 175 + '0 0 325';
@@ -124,7 +125,7 @@ float monster_isvalidtarget (entity targ, entity ent)
        
        if not(targ.vehicle_flags & VHF_ISVEHICLE)
        if(targ.flags & FL_NOTARGET)
-               return FALSE; // enemy can't be targetted
+               return FALSE; // enemy can't be targeted
        
        if not(autocvar_g_monsters_typefrag)
        if(targ.BUTTON_CHAT)
@@ -662,8 +663,7 @@ void monster_move(float runspeed, float walkspeed, float stopspeed, float manim_
                        monsters_setframe(manim_idle);
        }
        
-       if(self.enemy)
-               monster_checkattack(self, self.enemy);
+       monster_checkattack(self, self.enemy);
                
        self.SendFlags |= MSF_ANG;
        self.SendFlags |= MSF_MOVE;
@@ -882,7 +882,7 @@ void monsters_damage (entity inflictor, entity attacker, float damage, float dea
        self.SendFlags |= MSF_STATUS;
 }
 
-// used to hook into monster post death functions without a mutator
+// post-death functions
 void monster_hook_death()
 {
        WaypointSprite_Kill(self.sprite);
@@ -920,7 +920,7 @@ void monster_hook_death()
        totalspawned -= 1;
 }
 
-// used to hook into monster post spawn functions without a mutator
+// post-spawn functions
 void monster_hook_spawn()
 {
        if not(self.monster_respawned)
index 445b3d08dc7c91cee56f74bc3f878c17a0ec5c2d..9c7fc1e758b1de2169ba0cbf7a22965f472a59ba 100644 (file)
@@ -32,9 +32,9 @@ float MONSTER_CERBERUS                = 8;
 float MONSTER_SLIME            = 9;
 float MONSTER_KNIGHT           = 10;
 float MONSTER_STINGRAY                 = 11;
-float MONSTER_MAGE                     = 12;
+float MONSTER_MAGE             = 12;
 float MONSTER_SPIDER           = 13;
-float MONSTER_LAST                     = 14;
+float MONSTER_LAST             = 14;
 
 // id-string converters (TODO: remove these!)
 string monster_id2string(float mnster)
@@ -87,4 +87,4 @@ float MSF_ANIM         = 64;
 
 float MSF_FULL_UPDATE  = 16777215;
 
-#endif // CSQC/SVQC
\ No newline at end of file
+#endif // CSQC/SVQC