5 void W_Hook_ExplodeThink(
entity this)
7 float dt, dmg_remaining_next, f;
10 dmg_remaining_next = (
bound(0, 1 - dt / this.dmg_duration, 1) ** this.dmg_power);
12 f = this.dmg_last - dmg_remaining_next;
13 this.dmg_last = dmg_remaining_next;
15 RadiusDamage(
this, this.
realowner, this.
dmg * f, this.
dmg_edge * f, this.
dmg_radius, this.
realowner,
NULL, this.
dmg_force * f, this.
projectiledeathtype, this.
weaponentity_fld,
NULL);
19 if(dt < this.dmg_duration)
25 void W_Hook_Explode2(
entity this)
39 this.teleport_time =
time;
46 W_Hook_Explode2(
this);
74 entity gren =
new(hookbomb);
75 gren.owner = gren.realowner = actor;
76 gren.bot_dodge =
true;
81 gren.weaponentity_fld = weaponentity;
83 setsize(gren,
'0 0 0',
'0 0 0');
87 gren.use = W_Hook_Explode2_use;
88 settouch(gren, W_Hook_Touch2);
93 gren.event_damage = W_Hook_Damage;
94 gren.damagedbycontents =
true;
100 gren.velocity = gren.velocity + actor.velocity;
105 gren.angles =
'0 0 0';
106 gren.flags = FL_PROJECTILE;
118 if(!actor.(weaponentity).hook)
120 if(
time > actor.(weaponentity).hook_refire)
137 W_Hook_Attack2(thiswep, actor, weaponentity);
142 if(actor.(weaponentity).hook)
148 if(!(actor.items & IT_UNLIMITED_AMMO))
152 if(actor.(weaponentity).hook && actor.(weaponentity).
hook.state == 1)
155 if(hooked_time_max > 0)
157 if(
time > actor.(weaponentity).hook_time_hooked + hooked_time_max )
164 if(
time > actor.(weaponentity).hook_time_fueldecrease )
166 if(!(actor.items & IT_UNLIMITED_AMMO))
168 if(
GetResource(actor, RES_FUEL) >= (
time - actor.(weaponentity).hook_time_fueldecrease) * hooked_fuel )
170 W_DecreaseAmmo(thiswep, actor, (
time - actor.(weaponentity).hook_time_fueldecrease) * hooked_fuel, weaponentity);
171 actor.(weaponentity).hook_time_fueldecrease =
time;
178 if(actor.(weaponentity).m_weapon != WEP_Null)
187 actor.(weaponentity).hook_time_hooked =
time;
195 if (actor.(weaponentity).hook)
203 if (actor.(weaponentity).hook)
216 if(actor.(weaponentity).hook)
233 actor.(weaponentity).hook_refire =
time;
238 return WEAPON_HOOK_MURDER;
247 org2 = w_org + w_backoff * 2;
259 float autocvar_cl_grapplehook_alpha = 1;
261 void Draw_CylindricLine(
vector from,
vector to,
float thickness,
string texture,
float aspect,
float shift,
vector rgb,
float theAlpha,
float drawflag,
vector vieworg);
270 string Draw_GrapplingHook_trace_callback_tex;
271 float Draw_GrapplingHook_trace_callback_rnd;
272 vector Draw_GrapplingHook_trace_callback_rgb;
273 float Draw_GrapplingHook_trace_callback_a;
279 for(i = 0; i < Draw_GrapplingHook_trace_callback_a; ++i)
280 Draw_CylindricLine(hit, start, 8, Draw_GrapplingHook_trace_callback_tex, 0.25, Draw_GrapplingHook_trace_callback_rnd, Draw_GrapplingHook_trace_callback_rgb,
min(1, Draw_GrapplingHook_trace_callback_a - i),
DRAWFLAG_NORMAL, vorg);
281 Draw_GrapplingHook_trace_callback_rnd += 0.25 *
vlen(hit - start) / 8;
285 void Draw_GrapplingHook(
entity this)
292 float intensity, offset;
294 if(this.teleport_time)
295 if(
time > this.teleport_time)
298 this.teleport_time = 0;
305 switch(this.HookType)
308 case NET_ENT_CLIENT_HOOK:
311 case NET_ENT_CLIENT_ARC_BEAM:
318 switch(this.HookType)
321 case NET_ENT_CLIENT_HOOK:
328 case NET_ENT_CLIENT_ARC_BEAM:
341 switch(this.HookType)
344 case NET_ENT_CLIENT_HOOK:
348 case NET_ENT_CLIENT_ARC_BEAM:
355 t = entcs_GetTeamColor(this.
owner.sv_entnum);
357 switch(this.HookType)
360 case NET_ENT_CLIENT_HOOK:
361 intensity = autocvar_cl_grapplehook_alpha;
365 case NUM_TEAM_1: tex =
"particles/hook_red"; rgb =
'1 0.3 0.3';
break;
366 case NUM_TEAM_2: tex =
"particles/hook_blue"; rgb =
'0.3 0.3 1';
break;
367 case NUM_TEAM_3: tex =
"particles/hook_yellow"; rgb =
'1 1 0.3';
break;
368 case NUM_TEAM_4: tex =
"particles/hook_pink"; rgb =
'1 0.3 1';
break;
369 default: tex =
"particles/hook_white"; rgb = entcs_GetColor(this.
sv_entnum - 1);
break;
372 case NET_ENT_CLIENT_ARC_BEAM:
375 tex =
"particles/lgbeam";
384 Draw_GrapplingHook_trace_callback_tex = tex;
385 Draw_GrapplingHook_trace_callback_rnd = offset;
386 Draw_GrapplingHook_trace_callback_rgb = rgb;
387 Draw_GrapplingHook_trace_callback_a = intensity;
389 Draw_GrapplingHook_trace_callback_tex =
string_null;
393 switch(this.HookType)
396 case NET_ENT_CLIENT_HOOK:
408 case NET_ENT_CLIENT_ARC_BEAM:
413 switch(this.HookType)
416 case NET_ENT_CLIENT_HOOK:
418 case NET_ENT_CLIENT_ARC_BEAM:
424 void Remove_GrapplingHook(
entity this)
438 this.HookType = NET_ENT_CLIENT_HOOK;
442 this.HookSilent = (sf & 0x80);
449 int myowner = ReadByte();
450 int slot = ReadByte();
456 switch(this.HookType)
459 case NET_ENT_CLIENT_HOOK:
462 case NET_ENT_CLIENT_ARC_BEAM:
463 this.HookRange = ReadCoord();
469 this.
origin = ReadVector();
479 if(bIsNew || !this.teleport_time)
481 this.draw = Draw_GrapplingHook;
483 this.entremove = Remove_GrapplingHook;
485 switch(this.HookType)
488 case NET_ENT_CLIENT_HOOK:
493 case NET_ENT_CLIENT_ARC_BEAM:
499 this.teleport_time =
time + 10;
#define WEP_CVAR_PRI(wepname, name)
void InterpolateOrigin_Note(entity this)
#define WEP_CVAR_SEC(wepname, name)
#define PHYS_INPUT_BUTTON_CROUCH(s)
void W_SwitchWeapon_Force(Player this, Weapon w,.entity weaponentity)
#define PROJECTILE_MAKETRIGGER(e)
void InterpolateOrigin_Undo(entity this)
snap origin to iorigin2 (actual origin)
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
#define w_getbestweapon(ent, wepent)
vector lightning_shotorigin[4]
float W_CheckProjectileDamage(entity inflictor, entity projowner, int deathtype, float exception)
entity viewmodels[MAX_WEAPONSLOTS]
IntrusiveList g_damagedbycontents
vector WarpZone_TransformOrigin(entity wz, vector v)
void w_ready(Weapon thiswep, entity actor,.entity weaponentity, int fire)
vector hook_shotorigin[4]
ERASEABLE float Noise_Brown(entity e, float dt)
#define NET_HANDLE(id, param)
float autocvar_g_balance_pause_fuel_regen
int W_GunAlign(entity this, int preferred_align)
#define METHOD(cname, name, prototype)
void CSQCProjectile(entity e, float clientanimate, int type, float docull)
int autocvar_g_projectiles_newton_style
IntrusiveList g_bot_dodge
vector WarpZone_UnTransformOrigin(entity wz, vector v)
ERASEABLE float Noise_Burst(entity e, float dt, float p)
+1 or -1
#define PROJECTILE_TOUCH(e, t)
#define setmodel(this, m)
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
void SetResource(entity e, Resource res_type, float amount)
Sets the current amount of resource the given entity will have.
const int MAX_WEAPONSLOTS
bool weapon_prepareattack(Weapon thiswep, entity actor,.entity weaponentity, bool secondary, float attacktime)
void W_PrepareExplosionByDamage(entity this, entity attacker, void(entity this) explode)
const float DRAWFLAG_NORMAL
const int HITTYPE_SECONDARY
#define W_SetupShot(ent, wepent, antilag, recoil, snd, chan, maxdamage, deathtype)
#define BITSET(var, mask, flag)
float autocvar_g_balance_grapplehook_refire
void RemoveGrapplingHooks(entity pl)
vector(float skel, float bonenum) _skel_get_boneabs_hidden
entity WarpZone_trace_transform
const float HOOK_REMOVING
void FireGrapplingHook(entity actor,.entity weaponentity)
IntrusiveList g_projectiles
const float HOOK_WAITING_FOR_RELEASE
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
void WarpZone_TraceLine(vector org, vector end, float nomonsters, entity forent)
entity Notification
always last
bool autocvar_g_balance_grapplehook_crouchslide
void weapon_thinkf(entity actor,.entity weaponentity, WFRAME fr, float t, void(Weapon thiswep, entity actor,.entity weaponentity, int fire) func)
float RadiusDamage(entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype,.entity weaponentity, entity directhitentity)
#define MUTATOR_CALLHOOK(id,...)
entity weaponentities[MAX_WEAPONSLOTS]
void adaptor_think2use_hittype_splash(entity this)
const int CH_SHOTS_SINGLE
void W_DecreaseAmmo(Weapon wep, entity actor, float ammo_use,.entity weaponentity)
int autocvar_chase_active
#define sound(e, c, s, v, a)
ERASEABLE float Noise_Pink(entity e, float dt)
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
float W_WeaponRateFactor(entity this)
void WarpZone_TraceBox_ThroughZone(vector org, vector mi, vector ma, vector end, float nomonsters, entity forent, entity zone, WarpZone_trace_callback_t cb)
void InterpolateOrigin_Do(entity this)
set origin based on iorigin1 (old pos), iorigin2 (desired pos), and time
IntrusiveList g_drawables
void set_movetype(entity this, int mt)
const int PROJECTILE_HOOKBOMB
void RemoveHook(entity this)