]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add some more hooks and fix a particle effect call
authorMario <zacjardine@y7mail.com>
Fri, 28 Aug 2015 11:04:10 +0000 (21:04 +1000)
committerMario <zacjardine@y7mail.com>
Fri, 28 Aug 2015 11:04:10 +0000 (21:04 +1000)
qcsrc/common/triggers/func/breakable.qc
qcsrc/common/turrets/sv_turrets.qc
qcsrc/common/turrets/unit/fusionreactor.qc
qcsrc/server/mutators/events.qh

index 12a225ad9ef8966888aad0a94b1593affbe3636b..444b99b35a0ce4dd1e6b3513cb41b068cec20714 100644 (file)
@@ -211,8 +211,8 @@ void func_breakable_destroy() {
        if(self.dmg)
                RadiusDamage(self, activator, self.dmg, self.dmg_edge, self.dmg_radius, self, world, self.dmg_force, DEATH_HURTTRIGGER, world);
 
-       if(self.cnt)
-               Send_Effect((effects_ent[self.cnt - 1]).eent_eff_name, self.absmin * 0.5 + self.absmax * 0.5, '0 0 0', self.count);
+       if(self.cnt) // TODO
+               pointparticles(self.cnt, self.absmin * 0.5 + self.absmax * 0.5, '0 0 0', self.count);
 
        if(self.respawntime)
        {
index fa5318dc2d602917a982aa14bdbfbd348da84aca..4595d678937d13f83ecde7e04d694168eb3c06ee 100644 (file)
@@ -974,11 +974,23 @@ float turret_firecheck()
        return 1;
 }
 
+bool turret_checkfire()
+{
+       bool ret = false; // dummy
+       if(MUTATOR_CALLHOOK(Turret_CheckFire, ret))
+               return ret_bool;
+
+       return self.turret_firecheckfunc();
+}
+
 void turret_fire()
 {
        if (autocvar_g_turrets_nofire != 0)
                return;
 
+       if(MUTATOR_CALLHOOK(TurretFire, self))
+               return;
+
        TUR_ACTION(self.turretid, TR_ATTACK);
 
        self.attack_finished_single = time + self.shot_refire;
@@ -1060,7 +1072,7 @@ void turret_think()
 
                                        turret_do_updates(self);
 
-                                       if (self.turret_firecheckfunc())
+                                       if (turret_checkfire())
                                                turret_fire();
                                }
                        }
@@ -1084,7 +1096,7 @@ void turret_think()
                turret_do_updates(self);
 
                // Fire?
-               if (self.turret_firecheckfunc())
+               if (turret_checkfire())
                        turret_fire();
        }
        else
@@ -1104,7 +1116,7 @@ void turret_think()
                                turret_do_updates(self);
 
                                // Fire!
-                               if (self.turret_firecheckfunc() != 0)
+                               if (turret_checkfire())
                                        turret_fire();
 
                                TUR_ACTION(self.turretid, TR_THINK);
@@ -1164,7 +1176,7 @@ void turret_think()
                turret_do_updates(self);
 
                // Fire?
-               if (self.turret_firecheckfunc())
+               if (turret_checkfire())
                        turret_fire();
        }
 
index 459c1263a75467629ee7d4f4aadbdec5437cd14d..ca4c3e2de0c92d6f0c9bd304fdd29868358a1865 100644 (file)
@@ -11,33 +11,33 @@ REGISTER_TURRET(
 );
 #else
 #ifdef SVQC
-float turret_fusionreactor_firecheck()
+bool turret_fusionreactor_firecheck()
 {
     if (self.attack_finished_single > time)
-        return 0;
+        return false;
 
     if (self.enemy.deadflag != DEAD_NO)
-        return 0;
+        return false;
 
     if (self.enemy == world)
-        return 0;
+        return false;
 
     if (self.ammo < self.shot_dmg)
-        return 0;
+        return false;
 
     if (self.enemy.ammo >= self.enemy.ammo_max)
-        return 0;
+        return false;
 
     if (vlen(self.enemy.origin - self.origin) > self.target_range)
-        return 0;
+        return false;
 
     if(self.team != self.enemy.team)
-        return 0;
+        return false;
 
     if(!(self.enemy.ammo_flags & TFL_AMMO_ENERGY))
-        return 0;
+        return false;
 
-    return 1;
+    return true;
 }
 
 void spawnfunc_turret_fusionreactor() { if(!turret_initialize(TUR_FUSIONREACTOR)) remove(self); }
index 2d10ee01cc956e2c78ed47612526fd92dda46777..ad493f4f68fd180e4eb63fe29c1574ef5d447ae8 100644 (file)
@@ -182,6 +182,20 @@ MUTATOR_HOOKABLE(FilterItem, EV_NO_ARGS);
     /**/
 MUTATOR_HOOKABLE(TurretSpawn, EV_TurretSpawn);
 
+/** return error to not attack */
+#define EV_TurretFire(i, o) \
+    /** turret */ i(entity, self) \
+    /**/
+MUTATOR_HOOKABLE(TurretFire, EV_TurretFire);
+
+/** return error to not attack */
+#define EV_Turret_CheckFire(i, o) \
+    /**/ i(bool, ret_bool) \
+    /**/ o(bool, ret_bool) \
+    /**/
+bool ret_bool;
+MUTATOR_HOOKABLE(Turret_CheckFire, EV_Turret_CheckFire);
+
 /** return error to prevent entity spawn, or modify the entity */
 MUTATOR_HOOKABLE(OnEntityPreSpawn, EV_NO_ARGS);