X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fg_hook.qc;h=0fc60b2cdc1ffef3f4a2bac6832822e2a0c91db3;hb=d865de7a9a17c5a1d9286aec40f68c3530697660;hp=32cce331a50776da625ffa35df7544f86afbcc5f;hpb=9f4cfb447ad03702023b20379cb3179cd762a221;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/g_hook.qc b/qcsrc/server/g_hook.qc index 32cce331a..0fc60b2cd 100644 --- a/qcsrc/server/g_hook.qc +++ b/qcsrc/server/g_hook.qc @@ -1,5 +1,8 @@ #include "g_hook.qh" +#include +#include +#include #include "weapons/common.qh" #include "weapons/csqcprojectile.qh" #include "weapons/weaponsystem.qh" @@ -13,6 +16,7 @@ #include "../common/vehicles/all.qh" #include "../common/constants.qh" #include "../common/util.qh" +#include #include #include "../lib/warpzone/common.qh" #include "../lib/warpzone/server.qh" @@ -78,11 +82,11 @@ void RemoveGrapplingHooks(entity pl) 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; @@ -90,15 +94,14 @@ void RemoveGrapplingHooks(entity pl) 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); } @@ -162,7 +165,7 @@ void GrapplingHookThink(entity this) error("Owner lost the hook!\n"); return; } - if(LostMovetypeFollow(this) || intermission_running || (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; @@ -414,6 +417,8 @@ void FireGrapplingHook(entity actor, .entity weaponentity) missile.takedamage = DAMAGE_AIM; missile.damageforcescale = 0; missile.damagedbycontents = (autocvar_g_balance_grapplehook_damagedbycontents); + if(missile.damagedbycontents) + IL_PUSH(g_damagedbycontents, missile); missile.hook_start = missile.hook_end = missile.origin;