}
}
-void ok_DropItem(entity this, entity targ)
+void ok_DropItem(entity this, entity attacker, entity e)
{
- entity e = spawn();
e.ok_item = true;
- Item_InitializeLoot(e, "item_armor_small", this.origin + '0 0 32',
- '0 0 200' + normalize(targ.origin - this.origin) * 500, 5);
+ e.itemdef = ITEM_ArmorSmall;
+ e.origin = this.origin + '0 0 32';
+ e.velocity = '0 0 200' + normalize(attacker.origin - this.origin) * 500;
+ e.lifetime = 5;
}
MUTATOR_HOOKFUNCTION(ok, PlayerDies)
entity frag_attacker = M_ARGV(1, entity);
entity frag_target = M_ARGV(2, entity);
- entity targ = ((IS_PLAYER(frag_attacker)) ? frag_attacker : frag_target);
-
- ok_DropItem(frag_target, targ);
+ entity attacker = ((IS_PLAYER(frag_attacker)) ? frag_attacker : frag_target);
+ entity item = spawn();
+ ok_DropItem(frag_target, attacker, item);
+ Item_Initialise(item);
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
MUTATOR_HOOKFUNCTION(ok, MonsterDropItem)
{
entity mon = M_ARGV(0, entity);
- entity olditem = M_ARGV(1, entity);
+ entity item = M_ARGV(1, entity);
entity frag_attacker = M_ARGV(2, entity);
- delete(olditem);
-
- M_ARGV(1, entity) = NULL;
-
- ok_DropItem(mon, frag_attacker);
+ ok_DropItem(mon, frag_attacker, item);
}
MUTATOR_HOOKFUNCTION(ok, ForbidThrowCurrentWeapon)