#include "g_hook.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+#include <common/effects/all.qh>
#include "weapons/common.qh"
#include "weapons/csqcprojectile.qh"
#include "weapons/weaponsystem.qh"
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
.entity weaponentity = weaponentities[slot];
+ if(!pl.(weaponentity))
+ continue; // continue incase other slots exist?
if(pl.(weaponentity).hook)
- {
delete(pl.(weaponentity).hook);
- pl.(weaponentity).hook = NULL;
- }
+ pl.(weaponentity).hook = NULL;
}
//pl.disableclientprediction = false;
void RemoveHook(entity this)
{
- for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
- {
- .entity weaponentity = weaponentities[slot];
- if(this.realowner.(weaponentity).hook == this)
- this.realowner.(weaponentity).hook = NULL;
- }
+ entity player = this.realowner;
+ .entity weaponentity = this.weaponentity_fld;
+
+ if(player.(weaponentity).hook == this)
+ player.(weaponentity).hook = NULL;
- if(this.realowner.move_movetype == MOVETYPE_FLY)
- set_movetype(this.realowner, MOVETYPE_WALK);
+ if(player.move_movetype == MOVETYPE_FLY)
+ set_movetype(player, MOVETYPE_WALK);
delete(this);
}
}
if(sf & 2)
{
- WriteCoord(MSG_ENTITY, this.hook_start.x);
- WriteCoord(MSG_ENTITY, this.hook_start.y);
- WriteCoord(MSG_ENTITY, this.hook_start.z);
+ WriteVector(MSG_ENTITY, this.hook_start);
}
if(sf & 4)
{
- WriteCoord(MSG_ENTITY, this.hook_end.x);
- WriteCoord(MSG_ENTITY, this.hook_end.y);
- WriteCoord(MSG_ENTITY, this.hook_end.z);
+ WriteVector(MSG_ENTITY, this.hook_end);
}
return true;
}
error("Owner lost the hook!\n");
return;
}
- if(LostMovetypeFollow(this) || gameover || (round_handler_IsActive() && !round_handler_IsRoundStarted()) || ((this.aiment.flags & FL_PROJECTILE) && this.aiment.classname != "nade"))
+ if(LostMovetypeFollow(this) || game_stopped || (round_handler_IsActive() && !round_handler_IsRoundStarted()) || ((this.aiment.flags & FL_PROJECTILE) && this.aiment.classname != "nade"))
{
RemoveHook(this);
return;
//this.realowner.disableclientprediction = true;
}
-void GrapplingHook_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
+void GrapplingHook_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
{
if(this.health <= 0)
return;