]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Butcher another hidden gamemode specific block
authorMario <mario@smbclan.net>
Wed, 14 Oct 2015 15:23:12 +0000 (01:23 +1000)
committerMario <mario@smbclan.net>
Wed, 14 Oct 2015 15:23:12 +0000 (01:23 +1000)
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc
qcsrc/server/mutators/events.qh
qcsrc/server/mutators/gamemode_onslaught.qc

index 7f317dd9ac179c9a17e5f19d8f8dd6052ea413e5..173375d91f01e87d699be910a4f1c812b9b9b05a 100644 (file)
@@ -20,6 +20,14 @@ bool WaypointSprite_SendEntity(entity this, entity to, float sendflags)
     WriteByte(MSG_ENTITY, sendflags);
     WriteByte(MSG_ENTITY, self.wp_extra);
 
+    int f = 0;
+    if(self.currentammo)
+        f |= 1; // hideable
+    if(self.exteriormodeltoclient == to)
+        f |= 2; // my own
+
+    MUTATOR_CALLHOOK(SendWaypoint, this, to, sendflags, f);
+
     if (sendflags & 0x80)
     {
         if (self.max_health)
@@ -62,27 +70,6 @@ bool WaypointSprite_SendEntity(entity this, entity to, float sendflags)
         WriteCoord(MSG_ENTITY, self.fade_time);
         WriteCoord(MSG_ENTITY, self.teleport_time);
         WriteShort(MSG_ENTITY, self.fade_rate); // maxdist
-        float f = 0;
-        if (self.currentammo)
-            f |= 1; // hideable
-        if (self.exteriormodeltoclient == to)
-            f |= 2; // my own
-        if (g_onslaught)
-        {
-            if (self.owner.classname == "onslaught_controlpoint")
-            {
-                entity wp_owner = self.owner;
-                entity e = WaypointSprite_getviewentity(to);
-                if (SAME_TEAM(e, wp_owner) && wp_owner.goalentity.health >= wp_owner.goalentity.max_health) { f |= 2; }
-                if (!ons_ControlPoint_Attackable(wp_owner, e.team)) { f |= 2; }
-            }
-            if (self.owner.classname == "onslaught_generator")
-            {
-                entity wp_owner = self.owner;
-                if (wp_owner.isshielded && wp_owner.health >= wp_owner.max_health) { f |= 2; }
-                if (wp_owner.health <= 0) { f |= 2; }
-            }
-        }
         WriteByte(MSG_ENTITY, f);
     }
 
index b9727c7e1f08ceebc17ec69446deab82da9c791b..44801a25620f37b11498222cf4bf54a8b29bf124 100644 (file)
@@ -773,4 +773,15 @@ MUTATOR_HOOKABLE(DropSpecialItems, EV_DropSpecialItems);
 MUTATOR_HOOKABLE(AllowMobButcher, EV_NO_ARGS);
 
 MUTATOR_HOOKABLE(ReadLevelCvars, EV_NO_ARGS);
+
+#define EV_SendWaypoint(i, o) \
+    /**/ i(entity, __self) \
+    /**/ i(entity, wp_sendto) \
+    /**/ i(int, wp_sendflags) \
+    /**/ i(int, wp_flag) \
+    /**/
+entity wp_sendto;
+int wp_sendflags;
+int wp_flag;
+MUTATOR_HOOKABLE(SendWaypoint, EV_SendWaypoint);
 #endif
index cc6ad200cd05c4d01e5be035ab72e5f0f2832a54..68318f4d6b97c72149260ecee961021a63d31bc1 100644 (file)
@@ -2044,6 +2044,28 @@ MUTATOR_HOOKFUNCTION(ons, PlayHitsound)
                || (frag_victim.classname == "onslaught_controlpoint_icon" && !frag_victim.owner.isshielded);
 }
 
+MUTATOR_HOOKFUNCTION(ons, SendWaypoint)
+{
+       if(wp_sendflags & 16)
+       {
+               if(self.owner.classname == "onslaught_controlpoint")
+               {
+                       entity wp_owner = self.owner;
+                       entity e = WaypointSprite_getviewentity(wp_sendto);
+                       if(SAME_TEAM(e, wp_owner) && wp_owner.goalentity.health >= wp_owner.goalentity.max_health) { wp_flag |= 2; }
+                       if(!ons_ControlPoint_Attackable(wp_owner, e.team)) { wp_flag |= 2; }
+               }
+               if(self.owner.classname == "onslaught_generator")
+               {
+                       entity wp_owner = self.owner;
+                       if(wp_owner.isshielded && wp_owner.health >= wp_owner.max_health) { wp_flag |= 2; }
+                       if(wp_owner.health <= 0) { wp_flag |= 2; }
+               }
+       }
+
+       return false;
+}
+
 // ==========
 // Spawnfuncs
 // ==========