X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=qcsrc%2Fcommon%2Fweapons%2Fweapon%2Fhook.qc;h=d8cebd740ac49fc3daf8ec2c5d5111e30f27a740;hb=a3a388a32d0ea11fe79341ef44edc21c5ba460f4;hp=e04376b2f4fee279a289c1bb7bb8fcb4de320e36;hpb=bebef6b9a1c5d5d79cb9cf11180dbb6cda6fcd29;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/weapons/weapon/hook.qc b/qcsrc/common/weapons/weapon/hook.qc index e04376b2f..d8cebd740 100644 --- a/qcsrc/common/weapons/weapon/hook.qc +++ b/qcsrc/common/weapons/weapon/hook.qc @@ -48,15 +48,15 @@ void W_Hook_Explode2_use(entity this, entity actor, entity trigger) 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); } @@ -88,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; @@ -165,7 +165,7 @@ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity, { if(!(actor.items & IT_UNLIMITED_WEAPON_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; @@ -173,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); @@ -214,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)) { @@ -261,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; @@ -281,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; @@ -466,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);