]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/porto.qc
Add weaponentity parameter to ammo checking
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / porto.qc
index b5bc00353e025e75f765023654ab13266ff55e5b..f55d31f6d76207b65a14c7772948528bd976d68f 100644 (file)
@@ -1,3 +1,4 @@
+#include "porto.qh"
 #ifndef IMPLEMENTATION
 CLASS(PortoLaunch, Weapon)
 /* ammotype  */ ATTRIB(PortoLaunch, ammo_field, .int, ammo_none);
@@ -6,7 +7,7 @@ CLASS(PortoLaunch, Weapon)
 /* rating    */ ATTRIB(PortoLaunch, bot_pickupbasevalue, float, 0);
 /* color     */ ATTRIB(PortoLaunch, wpcolor, vector, '0.5 0.5 0.5');
 /* modelname */ ATTRIB(PortoLaunch, mdl, string, "porto");
-#ifndef MENUQC
+#ifdef GAMEQC
 /* model     */ ATTRIB(PortoLaunch, m_model, Model, MDL_PORTO_ITEM);
 #endif
 /* crosshair */ ATTRIB(PortoLaunch, w_crosshair, string, "gfx/crosshairporto");
@@ -65,7 +66,7 @@ void W_Porto_Success(entity this)
        delete(this);
 }
 
-string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo);
+string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo, .entity weaponentity);
 void W_Porto_Fail(entity this, float failhard)
 {
        if(this.realowner == NULL)
@@ -89,11 +90,13 @@ void W_Porto_Fail(entity this, float failhard)
                if(move_out_of_solid(this))
                {
                        this.flags = FL_ITEM;
+                       IL_PUSH(g_items, this);
                        this.velocity = trigger_push_calculatevelocity(this.origin, this.realowner, 128);
                        tracetoss(this, this);
                        if(vdist(trace_endpos - this.realowner.origin, <, 128))
                        {
-                               W_ThrowNewWeapon(this.realowner, WEP_PORTO.m_id, 0, this.origin, this.velocity);
+                               .entity weaponentity = weaponentities[0]; // TODO: unhardcode
+                               W_ThrowNewWeapon(this.realowner, WEP_PORTO.m_id, 0, this.origin, this.velocity, weaponentity);
                                Send_Notification(NOTIF_ONE, this.realowner, MSG_CENTER, CENTER_PORTO_FAILED);
                        }
                }
@@ -276,6 +279,7 @@ void W_Porto_Attack(entity actor, .entity weaponentity, float type)
        gren.angles = vectoangles(gren.velocity);
        gren.flags = FL_PROJECTILE;
        IL_PUSH(g_projectiles, gren);
+       IL_PUSH(g_bot_dodge, gren);
 
        gren.portal_id = time;
        actor.porto_current = gren;
@@ -357,12 +361,12 @@ METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, .entity weapone
         }
     }
 }
-METHOD(PortoLaunch, wr_checkammo1, bool(entity thiswep, entity this))
+METHOD(PortoLaunch, wr_checkammo1, bool(entity thiswep, entity this, .entity weaponentity))
 {
     // always allow infinite ammo
     return true;
 }
-METHOD(PortoLaunch, wr_checkammo2, bool(entity thiswep, entity this))
+METHOD(PortoLaunch, wr_checkammo2, bool(entity thiswep, entity this, .entity weaponentity))
 {
     // always allow infinite ammo
     return true;