return 0;
}
+float nt_IsNewToy(float w)
+{
+ switch(w)
+ {
+ case WEP_SEEKER:
+ case WEP_MINELAYER:
+ case WEP_HLAC:
+ case WEP_RIFLE:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
string nt_GetFullReplacement(string w)
{
switch(w)
return 0;
}
+MUTATOR_HOOK(nt_FilterItem)
+{
+ if(nt_isNewToy(self.weapon))
+ self.item_pickupsound = "weapons/weaponpickup_new_toys.ogg";
+ return 0;
+}
+
+void Is_New_Toy(w)
+{
+ entity e = get_weaponinfo(i);
+ if(e.spawnflags & WEP_FLAG_MUTATORBLOCKED)
+ e.spawnflags &~= WEP_FLAG_MUTATORBLOCKED;
+}
+
MUTATOR_DEFINITION(mutator_new_toys)
{
MUTATOR_HOOK(SetModname, nt_SetModname, CBC_ORDER_ANY);
MUTATOR_HOOK(SetStartItems, nt_SetStartItems, CBC_ORDER_ANY);
MUTATOR_HOOK(SetWeaponreplace, nt_SetWeaponreplace, CBC_ORDER_LAST);
+ MUTATOR_HOOK(FilterItem, nt_FilterItem, CBC_ORDER_ANY);
MUTATOR_ONADD
{
if(time > 1) // game loads at time 1
error("This cannot be added at runtime\n");
- // mark all guns as ok to use by e.g. impulse 99
+ precache_sound("weapons/weaponpickup_new_toys.ogg");
+
+ // mark the guns as ok to use by e.g. impulse 99
float i;
for(i = WEP_FIRST; i <= WEP_LAST; ++i)
- {
- entity e = get_weaponinfo(i);
- if(e.weapon)
- e.spawnflags &~= WEP_FLAG_MUTATORBLOCKED;
- }
+ if(nt_isNewToy(i))
+ get_weaponinfo(i).spawnflags &~= WEP_FLAG_MUTATORBLOCKED;
}
MUTATOR_ONREMOVE
{
WEPSET_COPY_EW(self, weaponid);
self.flags = FL_ITEM | itemflags;
+ if(MUTATOR_CALLHOOK(FilterItem)) // error means we do not want the item
+ {
+ startitem_failed = TRUE;
+ remove(self);
+ return;
+ }
+
// is it a dropped weapon?
if (self.classname == "droppedweapon")
{
}
else
{
- if(MUTATOR_CALLHOOK(FilterItem)) // error means we do not want the item
- {
- startitem_failed = TRUE;
- remove(self);
- return;
- }
-
if(!have_pickup_item())
{
startitem_failed = TRUE;
if(self.team)
f |= FL_NO_WEAPON_STAY;
- StartItem(e.model, "weapons/weaponpickup.wav", self.respawntime, self.respawntimejitter, e.message, 0, e.weapon, f, weapon_pickupevalfunc, e.bot_pickupbasevalue);
+ self.item_pickupsound = "weapons/weaponpickup.wav";
+ StartItem(e.model, self.item_pickupsound, self.respawntime, self.respawntimejitter, e.message, 0, e.weapon, f, weapon_pickupevalfunc, e.bot_pickupbasevalue);
if (self.modelindex) // don't precache if self was removed
weapon_action(e.weapon, WR_PRECACHE);
}