]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/t_items.qc
Bots: define the API boundaries
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / t_items.qc
index ee9babfb3009fbe835526e0cf89c5f7ad2980030..d180e1c1b91c0af5809269198153ff57e7bd1a92 100644 (file)
@@ -4,8 +4,7 @@
 
 #if defined(SVQC)
 
-    #include "../server/bot/bot.qh"
-    #include "../server/bot/waypoints.qh"
+    #include "../server/bot/api.qh"
 
     #include <server/mutators/all.qh>
 
@@ -194,7 +193,8 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew)
     if(sf & ISF_MODEL)
     {
         this.drawmask  = MASK_NORMAL;
-               this.move_movetype = MOVETYPE_TOSS;
+               set_movetype(this, MOVETYPE_TOSS);
+               if (isnew) IL_PUSH(g_drawables, this);
         this.draw       = ItemDraw;
         this.solid = SOLID_TRIGGER;
         //this.flags |= FL_ITEM;
@@ -214,7 +214,6 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew)
 
         if(autocvar_cl_simple_items && (this.ItemStatus & ITS_ALLOWSI))
         {
-            if (isnew) IL_PUSH(g_drawables, this);
             string _fn2 = substring(_fn, 0 , strlen(_fn) -4);
             this.draw = ItemDrawSimple;
 
@@ -254,7 +253,7 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew)
         this.gravity = 1;
         this.pushable = true;
         //this.angles = '0 0 0';
-        this.move_movetype = MOVETYPE_TOSS;
+        set_movetype(this, MOVETYPE_TOSS);
         this.velocity_x = ReadCoord();
         this.velocity_y = ReadCoord();
         this.velocity_z = ReadCoord();
@@ -768,7 +767,7 @@ void Item_Touch(entity this, entity toucher)
        {
                if (ITEM_TOUCH_NEEDKILL())
                {
-                       remove(this);
+                       delete(this);
                        return;
                }
        }
@@ -817,7 +816,7 @@ LABEL(pickup)
        _sound (toucher, (this.itemdef.instanceOfPowerup ? CH_TRIGGER_SINGLE : CH_TRIGGER), (this.item_pickupsound ? this.item_pickupsound : Sound_fixpath(this.item_pickupsound_ent)), VOL_BASE, ATTEN_NORM);
 
        if (this.classname == "droppedweapon")
-               remove (this);
+               delete (this);
        else if (this.spawnshieldtime)
        {
                entity e;
@@ -904,7 +903,7 @@ void RemoveItem(entity this)
 {
        if(wasfreed(this) || !this) { return; }
        Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(this), '0 0 0', 1);
-       remove(this);
+       delete(this);
 }
 
 // pickup evaluation functions
@@ -1069,7 +1068,7 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
        if(MUTATOR_CALLHOOK(FilterItem, this)) // error means we do not want the item
        {
                startitem_failed = true;
-               remove(this);
+               delete(this);
                return;
        }
 
@@ -1098,7 +1097,7 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
                if (trace_dpstartcontents & DPCONTENTS_NODROP)
                {
                        startitem_failed = true;
-                       remove(this);
+                       delete(this);
                        return;
                }
        }
@@ -1107,7 +1106,7 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
                if(!have_pickup_item(this))
                {
                        startitem_failed = true;
-                       remove (this);
+                       delete (this);
                        return;
                }
 
@@ -1226,7 +1225,7 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
        if (MUTATOR_CALLHOOK(Item_Spawn, this))
        {
                startitem_failed = true;
-               remove(this);
+               delete(this);
                return;
        }
 }
@@ -1423,7 +1422,7 @@ void target_items_use(entity this, entity actor, entity trigger)
        if(actor.classname == "droppedweapon")
        {
                EXACTTRIGGER_TOUCH(this, trigger);
-               remove(actor);
+               delete(actor);
                return;
        }
 
@@ -1439,7 +1438,7 @@ void target_items_use(entity this, entity actor, entity trigger)
        FOREACH_ENTITY_ENT(enemy, actor,
        {
                if(it.classname == "droppedweapon")
-                       remove(it);
+                       delete(it);
        });
 
        if(GiveItems(actor, 0, tokenize_console(this.netname)))