]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/monsters/sv_monsters.qc
Merge branch 'master' into Mario/monsters
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / sv_monsters.qc
index 6638dc3a8e9ef3157dacda2d8509c87139c97da1..f6856edeef6c505041d193b2134aef2688fa630f 100644 (file)
@@ -3,16 +3,6 @@
 // =========================
 
 
-void M_Item_Touch ()
-{
-       if(self && IS_PLAYER(other) && other.deadflag == DEAD_NO)
-       {
-               Item_Touch();
-               self.think = SUB_Remove;
-               self.nextthink = time + 0.1;
-       }
-}
-
 void monster_item_spawn()
 {
        if(self.monster_loot)
@@ -20,7 +10,7 @@ void monster_item_spawn()
 
        self.gravity = 1;
        self.velocity = randomvec() * 175 + '0 0 325';
-       self.touch = M_Item_Touch;
+       self.classname = "droppedweapon"; // hax
 
        SUB_SetFade(self, time + autocvar_g_monsters_drop_time, 1);
 }
@@ -41,8 +31,11 @@ void monster_dropitem()
        MUTATOR_CALLHOOK(MonsterDropItem);
        e = other;
 
-       e.think = monster_item_spawn;
-       e.nextthink = time + 0.3;
+       if(e)
+       {
+               e.think = monster_item_spawn;
+               e.nextthink = time + 0.3;
+       }
 }
 
 void monsters_setframe(float _frame)
@@ -108,7 +101,7 @@ float monster_isvalidtarget (entity targ, entity ent)
        if(targ.BUTTON_CHAT)
                return FALSE; // no typefragging!
 
-       if not(IsDifferentTeam(targ, ent))
+       if(SAME_TEAM(targ, ent))
                return FALSE; // enemy is on our team
 
        if(autocvar_g_monsters_target_infront || ent.spawnflags & MONSTERFLAG_INFRONT)
@@ -627,7 +620,7 @@ void monster_move(float runspeed, float walkspeed, float stopspeed, float manim_
 
        if(teamplay)
        if(autocvar_g_monsters_teams)
-       if(IsDifferentTeam(self.monster_owner, self))
+       if(DIFF_TEAM(self.monster_owner, self))
                self.monster_owner = world;
 
        if(self.enemy && self.enemy.health < 1)
@@ -901,6 +894,7 @@ void monster_die()
                W_ThrowNewWeapon(self, self.weapon, 0, self.origin, randomvec() * 150 + '0 0 325');
 
        if(IS_CLIENT(self.realowner))
+       if not(self.monster_respawned)
                self.realowner.monstercount -= 1;
 
        self.event_damage       = monsters_corpse_damage;