X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fweapon%2Fhook.qc;h=d9e11dc012fb9d2736a0f04a56853d4ab9c9e14d;hb=07a09abd9a97bbd7939e38bea4841e7d5e88dcce;hp=13b5661fecae03d87bbe6de17346c2b4a5e549f2;hpb=d97cbb2d38b0b1c25a686b9b14ff681eb82528eb;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/weapons/weapon/hook.qc b/qcsrc/common/weapons/weapon/hook.qc index 13b5661fe..d9e11dc01 100644 --- a/qcsrc/common/weapons/weapon/hook.qc +++ b/qcsrc/common/weapons/weapon/hook.qc @@ -12,7 +12,7 @@ void W_Hook_ExplodeThink(entity this) f = this.dmg_last - dmg_remaining_next; this.dmg_last = dmg_remaining_next; - RadiusDamage(this, this.realowner, this.dmg * f, this.dmg_edge * f, this.dmg_radius, this.realowner, NULL, this.dmg_force * f, this.projectiledeathtype, NULL); + 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); this.projectiledeathtype |= HITTYPE_BOUNCE; //RadiusDamage(this, NULL, this.dmg * f, this.dmg_edge * f, this.dmg_radius, NULL, NULL, this.dmg_force * f, this.projectiledeathtype, NULL); @@ -46,17 +46,17 @@ void W_Hook_Explode2_use(entity this, entity actor, entity trigger) W_Hook_Explode2(this); } -void W_Hook_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) +void W_Hook_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { - if(this.health <= 0) + if(GetResource(this, RES_HEALTH) <= 0) return; if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions return; // g_projectiles_damage says to halt - this.health = this.health - damage; + SetResourceExplicit(this, RES_HEALTH, GetResource(this, RES_HEALTH)); - if(this.health <= 0) + if(GetResource(this, RES_HEALTH) <= 0) W_PrepareExplosionByDamage(this, this.realowner, W_Hook_Explode2); } @@ -69,7 +69,7 @@ void W_Hook_Touch2(entity this, entity toucher) void W_Hook_Attack2(Weapon thiswep, entity actor, .entity weaponentity) { //W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(hook, ammo)); // WEAPONTODO: Figure out how to handle ammo with hook secondary (gravitybomb) - W_SetupShot(actor, weaponentity, false, 4, SND_HOOKBOMB_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hook, damage)); + W_SetupShot(actor, weaponentity, false, 4, SND_HOOKBOMB_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hook, damage), WEP_HOOK.m_id | HITTYPE_SECONDARY); entity gren = new(hookbomb); gren.owner = gren.realowner = actor; @@ -78,6 +78,7 @@ void W_Hook_Attack2(Weapon thiswep, entity actor, .entity weaponentity) set_movetype(gren, MOVETYPE_TOSS); PROJECTILE_MAKETRIGGER(gren); gren.projectiledeathtype = WEP_HOOK.m_id | HITTYPE_SECONDARY; + gren.weaponentity_fld = weaponentity; setorigin(gren, w_shotorg); setsize(gren, '0 0 0', '0 0 0'); @@ -87,7 +88,7 @@ void W_Hook_Attack2(Weapon thiswep, entity actor, .entity weaponentity) settouch(gren, W_Hook_Touch2); gren.takedamage = DAMAGE_YES; - gren.health = WEP_CVAR_SEC(hook, health); + SetResourceExplicit(gren, RES_HEALTH, WEP_CVAR_SEC(hook, health)); gren.damageforcescale = WEP_CVAR_SEC(hook, damageforcescale); gren.event_damage = W_Hook_Damage; gren.damagedbycontents = true; @@ -144,7 +145,7 @@ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity, actor.(weaponentity).hook_refire = max(actor.(weaponentity).hook_refire, time + WEP_CVAR_PRI(hook, refire) * W_WeaponRateFactor(actor)); // hook also inhibits health regeneration, but only for 1 second - if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) + if(!(actor.items & IT_UNLIMITED_AMMO)) actor.pauseregen_finished = max(actor.pauseregen_finished, time + autocvar_g_balance_pause_fuel_regen); } @@ -162,9 +163,9 @@ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity, { if( time > actor.(weaponentity).hook_time_fueldecrease ) { - if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) + if(!(actor.items & IT_UNLIMITED_AMMO)) { - if( actor.ammo_fuel >= (time - actor.(weaponentity).hook_time_fueldecrease) * hooked_fuel ) + if( GetResource(actor, RES_FUEL) >= (time - actor.(weaponentity).hook_time_fueldecrease) * hooked_fuel ) { W_DecreaseAmmo(thiswep, actor, (time - actor.(weaponentity).hook_time_fueldecrease) * hooked_fuel, weaponentity); actor.(weaponentity).hook_time_fueldecrease = time; @@ -172,7 +173,7 @@ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity, } else { - actor.ammo_fuel = 0; + SetResource(actor, RES_FUEL, 0); actor.(weaponentity).hook_state |= HOOK_REMOVING; if(actor.(weaponentity).m_weapon != WEP_Null) // offhand W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity); @@ -213,9 +214,9 @@ METHOD(Hook, wr_checkammo1, bool(Hook thiswep, entity actor, .entity weaponentit if (!thiswep.ammo_factor) return true; if(actor.(weaponentity).hook) - return actor.ammo_fuel > 0; + return GetResource(actor, RES_FUEL) > 0; - return actor.ammo_fuel >= WEP_CVAR_PRI(hook, ammo); + return GetResource(actor, RES_FUEL) >= WEP_CVAR_PRI(hook, ammo); } METHOD(Hook, wr_checkammo2, bool(Hook thiswep, entity actor, .entity weaponentity)) { @@ -260,11 +261,11 @@ float autocvar_cl_grapplehook_alpha = 1; void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float theAlpha, float drawflag, vector vieworg); entityclass(Hook); -class(Hook) .entity HookType; // ENT_CLIENT_* -class(Hook) .vector origin; -class(Hook) .vector velocity; -class(Hook) .float HookSilent; -class(Hook) .float HookRange; +classfield(Hook) .entity HookType; // ENT_CLIENT_* +classfield(Hook) .vector origin; +classfield(Hook) .vector velocity; +classfield(Hook) .float HookSilent; +classfield(Hook) .float HookRange; string Draw_GrapplingHook_trace_callback_tex; float Draw_GrapplingHook_trace_callback_rnd; @@ -280,7 +281,7 @@ void Draw_GrapplingHook_trace_callback(vector start, vector hit, vector end) Draw_GrapplingHook_trace_callback_rnd += 0.25 * vlen(hit - start) / 8; } -class(Hook) .float teleport_time; +classfield(Hook) .float teleport_time; void Draw_GrapplingHook(entity this) { vector a, b, atrans; @@ -465,16 +466,12 @@ NET_HANDLE(ENT_CLIENT_HOOK, bool bIsNew) } if(sf & 2) { - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); setorigin(this, this.origin); } if(sf & 4) { - this.velocity_x = ReadCoord(); - this.velocity_y = ReadCoord(); - this.velocity_z = ReadCoord(); + this.velocity = ReadVector(); } InterpolateOrigin_Note(this);