]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/mutators/mutator_touchexplode.qc
Update Luma simple items. Minor color changes
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / mutator_touchexplode.qc
1 .float touchexplode_time;
2
3 void PlayerTouchExplode(entity p1, entity p2)
4 {
5         vector org;
6         org = (p1.origin + p2.origin) * 0.5;
7         org_z += (p1.mins_z + p2.mins_z) * 0.5;
8
9         sound(self, CH_TRIGGER, "weapons/grenade_impact.wav", VOL_BASE, ATTEN_NORM);
10         pointparticles(particleeffectnum("explosion_small"), org, '0 0 0', 1);
11
12         entity e;
13         e = spawn();
14         setorigin(e, org);
15         RadiusDamage(e, world, autocvar_g_touchexplode_damage, autocvar_g_touchexplode_edgedamage, autocvar_g_touchexplode_radius, world, autocvar_g_touchexplode_force, DEATH_TOUCHEXPLODE, world);
16         remove(e);
17 }
18
19 MUTATOR_HOOKFUNCTION(touchexplode_PlayerThink)
20 {
21         if(time > self.touchexplode_time)
22         if (!gameover)
23         if(IS_PLAYER(self))
24         if(self.deadflag == DEAD_NO)
25         if (!IS_INDEPENDENT_PLAYER(self))
26         FOR_EACH_PLAYER(other) if(self != other)
27         {
28                 if(time > other.touchexplode_time)
29                 if(other.deadflag == DEAD_NO)
30                 if (!IS_INDEPENDENT_PLAYER(other))
31                 if(boxesoverlap(self.absmin, self.absmax, other.absmin, other.absmax))
32                 {
33                         PlayerTouchExplode(self, other);
34                         self.touchexplode_time = other.touchexplode_time = time + 0.2;
35                 }
36         }
37
38         return FALSE;
39 }
40
41 MUTATOR_DEFINITION(mutator_touchexplode)
42 {
43         MUTATOR_HOOK(PlayerPreThink, touchexplode_PlayerThink, CBC_ORDER_ANY);
44
45         return FALSE;
46 }