#include "weaponsystem.qh"
#include "../mutators/all.qh"
-#include "../t_items.qh"
+#include <common/t_items.qh>
#include "../g_damage.qh"
-#include "../../common/items/item.qh"
-#include "../../common/mapinfo.qh"
-#include "../../common/notifications.qh"
-#include "../../common/triggers/subs.qh"
-#include "../../common/util.qh"
-#include "../../common/weapons/all.qh"
+#include <common/items/item.qh>
+#include <common/mapinfo.qh>
+#include <common/notifications.qh>
+#include <common/triggers/subs.qh>
+#include <common/util.qh>
+#include <common/weapons/all.qh>
void thrown_wep_think()
{SELFPARAM();
// returns amount of ammo used as string, or -1 for failure, or 0 for no ammo count
string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo)
{SELFPARAM();
- float thisammo, i;
+ float thisammo;
string s;
Weapon info = Weapons_from(wpn);
var .int ammotype = info.ammo_field;
}
else
{
- float superweapons = 1;
- for(i = WEP_FIRST; i <= WEP_LAST; ++i)
- {
- WepSet set = WepSet_FromWeapon(Weapons_from(i));
- if ((set & WEPSET_SUPERWEAPONS) && (own.weapons & set)) ++superweapons;
- }
+ int superweapons = 1;
+ FOREACH(Weapons, it != WEP_Null, LAMBDA(
+ WepSet set = it.m_wepset;
+ if((set & WEPSET_SUPERWEAPONS) && (own.weapons & set)) ++superweapons;
+ ));
if(superweapons <= 1)
{
wep.superweapons_finished = own.superweapons_finished;
weapon_defaultspawnfunc(wep, info);
if(startitem_failed)
return string_null;
- wep.glowmod = own.weaponentity_glowmod;
+ wep.glowmod = weaponentity_glowmod(info, own.clientcolors);
wep.think = thrown_wep_think;
wep.savenextthink = wep.nextthink;
wep.nextthink = min(wep.nextthink, time + 0.5);
Send_Notification(NOTIF_ONE, self, MSG_MULTI, ITEM_WEAPON_DROP, a, w.m_id);
}
-void SpawnThrownWeapon(vector org, float w)
-{SELFPARAM();
- if(self.weapons & WepSet_FromWeapon(PS(self).m_weapon))
- if(W_IsWeaponThrowable(PS(self).m_weapon.m_id))
- W_ThrowNewWeapon(self, PS(self).m_weapon.m_id, false, org, randomvec() * 125 + '0 0 200');
+void SpawnThrownWeapon(entity this, vector org, float w)
+{
+ if(this.weapons & WepSet_FromWeapon(PS(this).m_weapon))
+ if(W_IsWeaponThrowable(PS(this).m_weapon.m_id))
+ W_ThrowNewWeapon(this, PS(this).m_weapon.m_id, false, org, randomvec() * 125 + '0 0 200');
}