10 void W_Hook_ExplodeThink (void)
12 float dt, dmg_remaining_next, f;
14 dt = time - self.teleport_time;
15 dmg_remaining_next = pow(bound(0, 1 - dt / self.dmg_duration, 1), self.dmg_power);
17 f = self.dmg_last - dmg_remaining_next;
18 self.dmg_last = dmg_remaining_next;
20 RadiusDamage (self, self.owner, self.dmg * f, self.dmg_edge * f, self.dmg_radius, self.owner, self.dmg_force * f, self.projectiledeathtype, world);
21 //RadiusDamage (self, world, self.dmg * f, self.dmg_edge * f, self.dmg_radius, world, self.dmg_force * f, self.projectiledeathtype, world);
23 if(dt < self.dmg_duration)
24 self.nextthink = time + 0.05; // soon
29 void W_Hook_Explode2 (void)
33 org2 = findbetterlocation (self.origin, 12);
34 pointparticles(particleeffectnum("hookbomb_explode"), org2, '0 0 0', 1);
35 sound (self, CHAN_PROJECTILE, "weapons/hookbomb_impact.wav", VOL_BASE, ATTN_NORM);
37 self.event_damage = SUB_Null;
38 self.touch = SUB_Null;
40 self.think = W_Hook_ExplodeThink;
41 self.nextthink = time;
42 self.dmg = cvar("g_balance_hook_secondary_damage");
43 self.dmg_edge = cvar("g_balance_hook_secondary_edgedamage");
44 self.dmg_radius = cvar("g_balance_hook_secondary_radius");
45 self.dmg_force = cvar("g_balance_hook_secondary_force");
46 self.dmg_power = cvar("g_balance_hook_secondary_power");
47 self.dmg_duration = cvar("g_balance_hook_secondary_duration");
48 self.teleport_time = time;
50 self.movetype = MOVETYPE_NONE;
53 void W_Hook_Touch2 (void)
63 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
64 self.ammo_cells = self.ammo_cells - cvar("g_balance_hook_secondary_ammo");
65 W_SetupShot (self, '25 6 -8', FALSE, 4, "weapons/hookbomb_fire.wav");
69 gren.classname = "hookbomb";
70 gren.bot_dodge = TRUE;
71 gren.bot_dodgerating = cvar("g_balance_hook_secondary_damage");
72 gren.movetype = MOVETYPE_TOSS;
73 gren.solid = SOLID_BBOX;
74 gren.effects = EF_LOWPRECISION;
75 gren.modelflags = MF_TRACER2;
76 gren.projectiledeathtype = WEP_HOOK | HITTYPE_SECONDARY;
77 setmodel(gren, "models/grenademodel.md3"); // precision set above // FIXME replace
78 setsize(gren, '0 0 0', '0 0 0');
79 setorigin(gren, w_shotorg);
81 gren.nextthink = time + cvar("g_balance_hook_secondary_lifetime");
82 gren.think = adaptor_think2use;
83 gren.use = W_Hook_Explode2;
84 gren.touch = W_Hook_Touch2;
86 gren.velocity = '0 0 1' * cvar("g_balance_hook_secondary_speed");
87 if(cvar("g_projectiles_newton_style"))
88 gren.velocity = gren.velocity + self.velocity;
90 gren.gravity = cvar("g_balance_hook_secondary_gravity");
91 //W_SetupProjectileVelocity(gren); // just falling down!
93 gren.angles = '0 0 0';
94 gren.flags = FL_PROJECTILE;
97 void spawnfunc_weapon_hook (void)
99 if(g_grappling_hook) // offhand hook
101 startitem_failed = TRUE;
105 weapon_defaultspawnfunc(WEP_HOOK);
108 float w_hook(float req)
114 else if (req == WR_THINK)
116 if (self.BUTTON_ATCK || self.BUTTON_HOOK)
119 if not(self.hook_state & HOOK_WAITING_FOR_RELEASE)
120 if (time > self.hook_refire)
121 if (weapon_prepareattack(0, -1))
123 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
124 self.ammo_cells = self.ammo_cells - cvar("g_balance_hook_primary_ammo");
125 self.hook_state |= HOOK_FIRING;
126 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hook_primary_animtime"), w_ready);
130 if (self.BUTTON_ATCK2)
132 if (weapon_prepareattack(1, cvar("g_balance_hook_secondary_refire")))
135 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hook_secondary_animtime"), w_ready);
141 // if hooked, no bombs, and increase the timer
142 self.hook_refire = max(self.hook_refire, time + cvar("g_balance_hook_primary_refire"));
145 if (self.BUTTON_CROUCH)
147 self.hook_state &~= HOOK_PULLING;
148 if (self.BUTTON_ATCK || self.BUTTON_HOOK)
149 self.hook_state &~= HOOK_RELEASING;
151 self.hook_state |= HOOK_RELEASING;
155 self.hook_state |= HOOK_PULLING;
156 self.hook_state &~= HOOK_RELEASING;
158 if (self.BUTTON_ATCK || self.BUTTON_HOOK)
162 self.hook_state |= HOOK_WAITING_FOR_RELEASE;
166 self.hook_state |= HOOK_REMOVING;
167 self.hook_state &~= HOOK_WAITING_FOR_RELEASE;
171 else if (req == WR_PRECACHE)
173 precache_model ("models/weapons/g_hookgun.md3");
174 precache_model ("models/weapons/v_hookgun.md3");
175 precache_model ("models/weapons/w_hookgun.zym");
176 precache_sound ("weapons/hook_fire.wav");
177 precache_sound ("weapons/hook_impact.wav");
178 precache_sound ("weapons/hookbomb_fire.wav");
179 precache_sound ("weapons/hookbomb_impact.wav");
181 else if (req == WR_SETUP)
183 weapon_setup(WEP_HOOK);
185 else if (req == WR_CHECKAMMO1)
187 return self.ammo_cells >= cvar("g_balance_hook_primary_ammo");
189 else if (req == WR_CHECKAMMO2)
191 return self.ammo_cells >= cvar("g_balance_hook_secondary_ammo");
193 else if (req == WR_SUICIDEMESSAGE)
194 w_deathtypestring = "did the impossible";
195 else if (req == WR_KILLMESSAGE)
196 w_deathtypestring = "has run into #'s gravity bomb";