9 void W_Hook_ExplodeThink (void)
11 float dt, dmg_remaining, dmg_remaining_next, f;
13 dt = time - self.teleport_time;
14 dmg_remaining_next = pow(bound(0, 1 - dt / self.dmg_duration, 1), self.dmg_power);
16 f = self.dmg_last - dmg_remaining_next;
17 self.dmg_last = dmg_remaining_next;
19 RadiusDamage (self, self.owner, self.dmg * f, self.dmg_edge * f, self.dmg_radius, self.owner, self.dmg_force * f, self.projectiledeathtype, world);
20 //RadiusDamage (self, world, self.dmg * f, self.dmg_edge * f, self.dmg_radius, world, self.dmg_force * f, self.projectiledeathtype, world);
22 if(dt < self.dmg_duration)
23 self.nextthink = time + 0.05; // soon
28 void W_Hook_Explode2 (void)
32 org2 = findbetterlocation (self.origin, 12);
33 pointparticles(particleeffectnum("hookbomb_explode"), org2, '0 0 0', 1);
34 sound (self, CHAN_PROJECTILE, "weapons/hookbomb_impact.wav", VOL_BASE, ATTN_NORM);
36 self.event_damage = SUB_Null;
37 self.touch = SUB_Null;
39 self.think = W_Hook_ExplodeThink;
40 self.nextthink = time;
41 self.dmg = cvar("g_balance_hook_secondary_damage");
42 self.dmg_edge = cvar("g_balance_hook_secondary_edgedamage");
43 self.dmg_radius = cvar("g_balance_hook_secondary_radius");
44 self.dmg_force = cvar("g_balance_hook_secondary_force");
45 self.dmg_power = cvar("g_balance_hook_secondary_power");
46 self.dmg_duration = cvar("g_balance_hook_secondary_duration");
47 self.teleport_time = time;
49 self.movetype = MOVETYPE_NONE;
52 void W_Hook_Touch2 (void)
62 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
63 self.ammo_cells = self.ammo_cells - cvar("g_balance_hook_secondary_ammo");
64 W_SetupShot (self, '25 6 -8', FALSE, 4, "weapons/hookbomb_fire.wav");
68 gren.classname = "hookbomb";
69 gren.bot_dodge = TRUE;
70 gren.bot_dodgerating = cvar("g_balance_hook_secondary_damage");
71 gren.movetype = MOVETYPE_TOSS;
72 gren.solid = SOLID_BBOX;
73 gren.effects = EF_LOWPRECISION;
74 gren.modelflags = MF_TRACER2;
75 gren.projectiledeathtype = WEP_HOOK | HITTYPE_SECONDARY;
76 setmodel(gren, "models/grenademodel.md3"); // precision set above // FIXME replace
77 setsize(gren, '0 0 0', '0 0 0');
78 setorigin(gren, w_shotorg);
80 gren.nextthink = time + cvar("g_balance_hook_secondary_lifetime");
81 gren.think = adaptor_think2use;
82 gren.use = W_Hook_Explode2;
83 gren.touch = W_Hook_Touch2;
85 gren.velocity = '0 0 1' * cvar("g_balance_hook_secondary_speed");
86 if(cvar("g_projectiles_newton_style"))
87 gren.velocity = gren.velocity + self.velocity;
89 gren.gravity = cvar("g_balance_hook_secondary_gravity");
90 //W_SetupProjectileVelocity(gren); // just falling down!
92 gren.angles = '0 0 0';
93 gren.flags = FL_PROJECTILE;
96 void spawnfunc_weapon_hook (void)
98 if(g_grappling_hook) // offhand hook
100 startitem_failed = TRUE;
104 weapon_defaultspawnfunc(WEP_HOOK);
107 float w_hook(float req)
113 else if (req == WR_THINK)
115 if (self.BUTTON_ATCK || self.BUTTON_HOOK)
118 if not(self.hook_state & HOOK_WAITING_FOR_RELEASE)
119 if (weapon_prepareattack(0, cvar("g_balance_hook_primary_refire")))
121 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
122 self.ammo_cells = self.ammo_cells - cvar("g_balance_hook_primary_ammo");
123 self.hook_state |= HOOK_FIRING;
124 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hook_primary_animtime"), w_ready);
128 if (self.BUTTON_ATCK2)
130 if (weapon_prepareattack(1, cvar("g_balance_hook_secondary_refire")))
133 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hook_secondary_animtime"), w_ready);
137 if (self.BUTTON_CROUCH)
139 self.hook_state &~= HOOK_PULLING;
140 if (self.BUTTON_ATCK || self.BUTTON_HOOK)
141 self.hook_state &~= HOOK_RELEASING;
143 self.hook_state |= HOOK_RELEASING;
147 self.hook_state |= HOOK_PULLING;
148 self.hook_state &~= HOOK_RELEASING;
150 if (self.BUTTON_ATCK || self.BUTTON_HOOK)
154 self.hook_state |= HOOK_WAITING_FOR_RELEASE;
158 self.hook_state |= HOOK_REMOVING;
159 self.hook_state &~= HOOK_WAITING_FOR_RELEASE;
163 else if (req == WR_PRECACHE)
165 precache_model ("models/weapons/g_hookgun.md3");
166 precache_model ("models/weapons/v_hookgun.md3");
167 precache_model ("models/weapons/w_hookgun.zym");
168 precache_sound ("weapons/hook_fire.wav");
169 precache_sound ("weapons/hook_impact.wav");
170 precache_sound ("weapons/hookbomb_fire.wav");
171 precache_sound ("weapons/hookbomb_impact.wav");
173 else if (req == WR_SETUP)
175 weapon_setup(WEP_HOOK);
177 else if (req == WR_CHECKAMMO1)
179 return self.ammo_cells >= cvar("g_balance_hook_primary_ammo");
181 else if (req == WR_CHECKAMMO2)
183 return self.ammo_cells >= cvar("g_balance_hook_secondary_ammo");
185 else if (req == WR_SUICIDEMESSAGE)
186 w_deathtypestring = "did the impossible";
187 else if (req == WR_KILLMESSAGE)
188 w_deathtypestring = "has run into #'s gravity bomb";