]> icculus.org git repositories - divverent/nexuiz.git/blob - qcsrc/gamec/w_hagar.c
disabled the 'has taken the lead' till it works
[divverent/nexuiz.git] / qcsrc / gamec / w_hagar.c
1 void() hagar_ready_01;
2 void() hagar_fire1_01;
3 void() hagar_deselect_01;
4 void() hagar_select_01;
5
6 float() hagar_check =
7 {
8         if (self.ammo_rockets >= 1)
9                 return TRUE;
10         return FALSE;
11 };
12
13 void(float req) w_hagar =
14 {
15         if (req == WR_IDLE)
16                 hagar_ready_01();
17         else if (req == WR_FIRE1 || req == WR_FIRE2)
18                 weapon_prepareattack(hagar_check, hagar_check, hagar_fire1_01, cvar("g_balance_hagar_refire"));
19         else if (req == WR_RAISE)
20                 hagar_select_01();
21         else if (req == WR_UPDATECOUNTS)
22                 self.currentammo = self.ammo_rockets;
23         else if (req == WR_DROP)
24                 hagar_deselect_01();
25         else if (req == WR_SETUP)
26                 weapon_setup(WEP_HAGAR, "w_hagar.zym", IT_ROCKETS);
27         else if (req == WR_CHECKAMMO)
28                 weapon_hasammo = hagar_check();
29 };
30
31 void W_Hagar_Explode (void)
32 {
33         ImpactEffect (self, IT_HAGAR);
34
35         self.event_damage = SUB_Null;
36         RadiusDamage (self, self.owner, cvar("g_balance_hagar_damage"), cvar("g_balance_hagar_edgedamage"), cvar("g_balance_hagar_radius"), world, cvar("g_balance_hagar_force"), IT_HAGAR);
37
38         remove (self);
39 }
40
41 void W_Hagar_Touch (void)
42 {
43         if (other == self.owner)
44                 return;
45         else if (pointcontents (self.origin) == CONTENT_SKY)
46         {
47                 remove (self);
48                 return;
49         }
50
51         W_Hagar_Explode ();
52 }
53
54 void W_Hagar_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
55 {
56         self.health = self.health - damage;
57         if (self.health <= 0)
58                 W_Hagar_Explode();
59 }
60
61 void W_Hagar_Attack (void)
62 {
63         local entity missile;
64         local vector org;
65
66         sound (self, CHAN_WEAPON, "weapons/hagar_fire.wav", 1, ATTN_NORM);
67         self.ammo_rockets = self.ammo_rockets - 1;
68         self.punchangle_x = -2;
69         org = self.origin + self.view_ofs + v_forward * 25 + v_right * 5 + v_up * -8;
70
71         missile = spawn ();
72         missile.owner = self;
73         missile.classname = "missile";
74         missile.touch = W_Hagar_Touch;
75         missile.think = W_Hagar_Explode;
76         missile.nextthink = time + 10;
77         missile.solid = SOLID_BBOX;
78         missile.scale = 0.4; // BUG: the model is too big
79         setorigin (missile, org);
80         setmodel (missile, "models/hagarmissile.mdl");
81         setsize (missile, '0 0 0', '0 0 0');
82         //missile.takedamage = DAMAGE_YES;
83         //missile.damageforcescale = 4;
84         //missile.health = 10;
85         //missile.event_damage = W_Hagar_Damage;
86         missile.effects = EF_LOWPRECISION;
87
88         if (self.button3)
89         {
90                 missile.movetype = MOVETYPE_TOSS;
91                 missile.velocity = v_forward * cvar("g_balance_hagar_speed2") + v_up * cvar("g_balance_hagar_speed2_up");
92                 missile.avelocity = '100 10 10';
93         }
94         else
95         {
96                 missile.movetype = MOVETYPE_FLY;
97                 missile.velocity = (v_forward + v_right * crandom() * 0.035 + v_up * crandom() * 0.015) * cvar("g_balance_hagar_speed");
98         }
99
100         missile.angles = vectoangles (missile.velocity);
101 }
102
103 // weapon frames
104 void()  hagar_ready_01 =        {weapon_thinkf(WFRAME_IDLE, 0.1, hagar_ready_01); self.weaponentity.state = WS_READY;};
105 void()  hagar_select_01 =       {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');};
106 void()  hagar_deselect_01 =     {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);};
107 void()  hagar_fire1_01 =
108 {
109         weapon_doattack(hagar_check, hagar_check, W_Hagar_Attack);
110         weapon_thinkf(WFRAME_FIRE1, 0.15, hagar_ready_01);
111 };
112