]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/monsters/sv_monsters.qc
Merge branch 'terencehill/playerlist_layout' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / sv_monsters.qc
index 1635b5cb0d235c6eeb84dac673c18d98e9421e96..7f00250fbf781a13a32572c71dc193b6bb483ba6 100644 (file)
@@ -36,33 +36,23 @@ void monsters_setstatus(entity this)
        STAT(MONSTERS_KILLED, this) = monsters_killed;
 }
 
+bool autocvar_g_monsters_drop = true;
 void monster_dropitem(entity this, entity attacker)
 {
-       if(!this.candrop || !this.monster_loot)
+       if(!this.candrop || !this.monster_loot || !autocvar_g_monsters_drop)
                return;
 
-       vector org = CENTER_OR_VIEWOFS(this);
        entity e = spawn();
-       Item_SetLoot(e, true);
-       e.spawnfunc_checked = true;
-
-       e.monster_loot = this.monster_loot;
+       e.itemdef = this.monster_loot;
+       e.origin = CENTER_OR_VIEWOFS(this);
+       e.velocity = randomvec() * 175 + '0 0 325';
+       e.lifetime = max(0, autocvar_g_monsters_drop_time);
 
        MUTATOR_CALLHOOK(MonsterDropItem, this, e, attacker);
        e = M_ARGV(1, entity);
 
-       if(e && e.monster_loot)
-       {
-               e.noalign = true;
-               StartItem(e, e.monster_loot);
-               if(startitem_failed || wasfreed(e))
-                       return;
-               e.gravity = 1;
-               setorigin(e, org);
-               e.velocity = randomvec() * 175 + '0 0 325';
-               e.item_spawnshieldtime = time + 0.7;
-               SUB_SetFade(e, time + autocvar_g_monsters_drop_time, 1);
-       }
+       if(e && e.itemdef)
+               Item_Initialise(e);
 }
 
 bool monster_facing(entity this, entity targ)
@@ -976,7 +966,7 @@ void Monster_Dead(entity this, entity attacker, float gibbed)
        Monster mon = this.monsterdef;
        mon.mr_death(mon, this);
 
-       if(this.candrop && this.weapon)
+       if(this.candrop && this.weapon && autocvar_g_monsters_drop)
        {
                .entity weaponentity = weaponentities[0]; // TODO: unhardcode
                W_ThrowNewWeapon(this, this.weapon, 0, this.origin, randomvec() * 150 + '0 0 325', weaponentity);