]> icculus.org git repositories - divverent/nexuiz.git/blob - qcsrc/gamec/w_hagar.c
Added more push when shot with bullets
[divverent/nexuiz.git] / qcsrc / gamec / w_hagar.c
1 void() hagar_ready_01;
2 void() hagar_fire1_01;
3 void() hagar_fire2_01;
4 void() hagar_deselect_01;
5 void() hagar_select_01;
6
7 float() hagar_check = 
8 {
9         if (self.ammo_rockets > 0) 
10                 return TRUE; 
11         return FALSE;
12 };
13
14 void(float req) w_hagar =
15 {
16         if (req == WR_IDLE)
17                 hagar_ready_01();
18         else if (req == WR_FIRE1)
19                 weapon_prepareattack(hagar_check, hagar_check, hagar_fire1_01, 0.2);
20         else if (req == WR_FIRE2)
21                 weapon_prepareattack(hagar_check, hagar_check, hagar_fire2_01, 0.2);
22         else if (req == WR_RAISE)
23                 hagar_select_01();
24         else if (req == WR_UPDATECOUNTS)
25                 self.currentammo = self.ammo_rockets;
26         else if (req == WR_DROP)
27                 hagar_deselect_01();
28         else if (req == WR_SETUP)
29                 weapon_setup(WEP_HAGAR, "w_hagar.zym", IT_ROCKETS);
30         else if (req == WR_CHECKAMMO)
31                 weapon_hasammo = hagar_check();
32 };               
33
34 void W_Hagar_Explode (void)
35 {
36         ImpactEffect (self, IT_HAGAR);
37
38         self.event_damage = nullfunction;
39         RadiusDamage (self, self.owner, 40, 15, 70, world, 100, IT_HAGAR);
40
41         remove (self);
42 }
43
44 void W_Hagar_Touch (void)
45 {
46         if (other == self.owner)
47                 return;
48         else if (pointcontents (self.origin) == CONTENT_SKY)
49         {
50                 remove (self);
51                 return;
52         }
53
54         W_Hagar_Explode ();
55 }
56
57 void W_Hagar_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
58 {
59         self.health = self.health - damage;
60         if (self.health <= 0)
61                 W_Hagar_Explode();
62 }
63
64 void W_Hagar_Attack (void)
65 {
66         entity  missile;
67
68         makevectors(self.v_angle);
69         sound (self, CHAN_WEAPON, "weapons/hagar_fire.wav", 1, ATTN_NORM);
70
71         missile = spawn ();
72         missile.owner = self;
73         missile.classname = "missile";
74
75         missile.takedamage = DAMAGE_YES;
76         missile.damageforcescale = 4;
77         missile.health = 10;
78         missile.event_damage = W_Hagar_Damage;
79
80         missile.movetype = MOVETYPE_FLY;
81         missile.solid = SOLID_BBOX;
82         setmodel (missile, "models/hagarmissile.mdl");
83         setsize (missile, '0 0 0', '0 0 0');
84
85         setorigin (missile, self.origin + self.view_ofs + v_forward * 25 + v_right * 5 + v_up * -12);
86
87         missile.velocity = v_forward * 2000;
88         missile.velocity = missile.velocity + v_right * ( crandom() * 70 );
89         missile.velocity = missile.velocity + v_up * ( crandom() * 30 );
90         missile.angles = vectoangles (missile.velocity);
91
92         missile.touch = W_Hagar_Touch;
93         missile.think = W_Hagar_Explode;
94         missile.nextthink = time + 10;
95
96         self.attack_finished = time + 0.2;
97         self.ammo_rockets = self.ammo_rockets - 0.25;
98 }
99
100 void W_Hagar_Attack2 (void)
101 {
102         entity  missile;
103
104         sound (self, CHAN_WEAPON, "weapons/hagar_fire.wav", 1, ATTN_NORM);
105
106         makevectors(self.v_angle);
107
108         missile = spawn ();
109         missile.owner = self;
110         missile.classname = "missile";
111
112         missile.movetype = MOVETYPE_TOSS;
113         missile.solid = SOLID_BBOX;
114
115         missile.takedamage = DAMAGE_YES;
116         missile.damageforcescale = 4;
117         missile.health = 5;
118         missile.event_damage = W_Hagar_Damage;
119
120         setmodel (missile, "models/hagarmissile.mdl");
121         setsize (missile, '-6 -6 -3', '6 6 3');
122
123         setorigin (missile, self.origin + self.view_ofs + v_forward * 15 + v_right * 5 + v_up * -12);
124
125         missile.velocity = v_forward * 1400 + v_up * 100;
126         missile.angles = vectoangles (missile.velocity);
127         missile.avelocity = '100 10 10';
128
129         missile.touch = W_Hagar_Touch;
130         missile.think = W_Hagar_Explode;
131         missile.nextthink = time + 10;
132
133         self.attack_finished = time + 0.2;
134         self.ammo_rockets = self.ammo_rockets - 0.25;
135 }
136
137 // weapon frames 
138 void()  hagar_ready_01 =        {weapon_thinkf(WFRAME_IDLE, 0.1, hagar_ready_01); self.weaponentity.state = WS_READY;};
139 void()  hagar_select_01 =       {weapon_thinkf(-1, PLAYER_WEAPONSELECTION_DELAY, w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');};
140 void()  hagar_deselect_01 =     {weapon_thinkf(-1, PLAYER_WEAPONSELECTION_DELAY, w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);};
141 void()  hagar_fire1_01 =        
142 {
143         weapon_doattack(hagar_check, hagar_check, W_Hagar_Attack);
144         weapon_thinkf(WFRAME_FIRE1, 0.15, hagar_ready_01);
145 };
146 void()  hagar_fire2_01 =        
147 {
148         weapon_doattack(hagar_check, hagar_check, W_Hagar_Attack2);
149         weapon_thinkf(WFRAME_FIRE2, 0.15, hagar_ready_01);
150 };
151