1 string W_Apply_Weaponreplace(string in)
3 float n = tokenize_console(in);
9 string r = cvar_string(strcat("g_weaponreplace_", s));
11 out = strcat(out, " ", s);
13 out = strcat(out, " ", r);
15 return substring(out, 1, -1);
18 void weapon_defaultspawnfunc(float wpn)
28 if(self.classname != "droppedweapon" && self.classname != "replacedweapon")
30 e = get_weaponinfo(wpn);
32 if(e.spawnflags & WEP_FLAG_MUTATORBLOCKED)
34 objerror("Attempted to spawn a mutator-blocked weapon rejected");
35 startitem_failed = TRUE;
39 s = W_Apply_Weaponreplace(e.netname);
42 MUTATOR_CALLHOOK(SetWeaponreplace);
47 startitem_failed = TRUE;
50 t = tokenize_console(s);
53 self.team = --internalteam;
55 for(i = 1; i < t; ++i)
58 for(j = WEP_FIRST; j <= WEP_LAST; ++j)
60 e = get_weaponinfo(j);
64 copyentity(oldself, self);
65 self.classname = "replacedweapon";
66 weapon_defaultspawnfunc(j);
72 print("The weapon replace list for ", oldself.classname, " contains an unknown weapon ", s, ". Skipped.\n");
77 if(t >= 1) // always the case!
81 for(j = WEP_FIRST; j <= WEP_LAST; ++j)
83 e = get_weaponinfo(j);
92 print("The weapon replace list for ", self.classname, " contains an unknown weapon ", s, ". Skipped.\n");
98 startitem_failed = TRUE;
103 e = get_weaponinfo(wpn);
105 if(!self.respawntime)
107 if(WEPSET_CONTAINS_ANY_EA(e, WEPBIT_SUPERWEAPONS))
109 self.respawntime = g_pickup_respawntime_superweapon;
110 self.respawntimejitter = g_pickup_respawntimejitter_superweapon;
114 self.respawntime = g_pickup_respawntime_weapon;
115 self.respawntimejitter = g_pickup_respawntimejitter_weapon;
119 if(WEPSET_CONTAINS_ANY_EA(e, WEPBIT_SUPERWEAPONS))
120 if(!self.superweapons_finished)
121 self.superweapons_finished = autocvar_g_balance_superweapons_time;
125 for(i = 0, j = 1; i < 24; ++i, j *= 2)
129 ammofield = Item_CounterField(j);
131 self.ammofield = cvar(strcat("g_pickup_", Item_CounterFieldName(j), "_weapon"));
137 if(g_pickup_weapons_anyway)
138 self.pickup_anyway = TRUE;
142 // no weapon-stay on superweapons
143 if(WEPSET_CONTAINS_ANY_EA(e, WEPBIT_SUPERWEAPONS))
144 f |= FL_NO_WEAPON_STAY;
146 // weapon stay isn't supported for teamed weapons
148 f |= FL_NO_WEAPON_STAY;
150 StartItem(e.model, "weapons/weaponpickup.wav", self.respawntime, self.respawntimejitter, e.message, 0, e.weapon, f, weapon_pickupevalfunc, e.bot_pickupbasevalue);
151 if (self.modelindex) // don't precache if self was removed
152 WEP_ACTION(e.weapon, WR_INIT);