X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fweapon%2Fhagar.qc;h=bfda2124de9119b3c7d87804a25f895a88786510;hb=fbd3279e575e41377901f1536e14fe45e540405b;hp=58be8f835f490ff3eac82c615a8257c8d047c27a;hpb=5009dab34356180df0978102855cb2a02d06db84;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/weapons/weapon/hagar.qc b/qcsrc/common/weapons/weapon/hagar.qc index 58be8f835..bfda2124d 100644 --- a/qcsrc/common/weapons/weapon/hagar.qc +++ b/qcsrc/common/weapons/weapon/hagar.qc @@ -32,7 +32,7 @@ void W_Hagar_Explode2_use(entity this, entity actor, entity trigger) void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { - if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0) + if(GetResource(this, RES_HEALTH) <= 0) return; float is_linkexplode = ( ((inflictor.owner != NULL) ? (inflictor.owner == this.owner) : true) @@ -47,10 +47,10 @@ void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, is_linkexplode)) return; // g_projectiles_damage says to halt - TakeResource(this, RESOURCE_HEALTH, damage); + TakeResource(this, RES_HEALTH, damage); this.angles = vectoangles(this.velocity); - if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0) + if(GetResource(this, RES_HEALTH) <= 0) W_PrepareExplosionByDamage(this, attacker, getthink(this)); } @@ -83,7 +83,7 @@ void W_Hagar_Attack(Weapon thiswep, entity actor, .entity weaponentity) W_SetupShot(actor, weaponentity, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(hagar, damage), thiswep.m_id); - Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); + W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir); missile = new(missile); missile.owner = missile.realowner = actor; @@ -91,7 +91,7 @@ void W_Hagar_Attack(Weapon thiswep, entity actor, .entity weaponentity) missile.bot_dodgerating = WEP_CVAR_PRI(hagar, damage); missile.takedamage = DAMAGE_YES; - SetResourceAmountExplicit(missile, RESOURCE_HEALTH, WEP_CVAR_PRI(hagar, health)); + SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR_PRI(hagar, health)); missile.damageforcescale = WEP_CVAR_PRI(hagar, damageforcescale); missile.event_damage = W_Hagar_Damage; missile.damagedbycontents = true; @@ -129,7 +129,7 @@ void W_Hagar_Attack2(Weapon thiswep, entity actor, .entity weaponentity) W_SetupShot(actor, weaponentity, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage), thiswep.m_id | HITTYPE_SECONDARY); - Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); + W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir); missile = new(missile); missile.owner = missile.realowner = actor; @@ -137,7 +137,7 @@ void W_Hagar_Attack2(Weapon thiswep, entity actor, .entity weaponentity) missile.bot_dodgerating = WEP_CVAR_SEC(hagar, damage); missile.takedamage = DAMAGE_YES; - SetResourceAmountExplicit(missile, RESOURCE_HEALTH, WEP_CVAR_SEC(hagar, health)); + SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR_SEC(hagar, health)); missile.damageforcescale = WEP_CVAR_SEC(hagar, damageforcescale); missile.event_damage = W_Hagar_Damage; missile.damagedbycontents = true; @@ -185,7 +185,7 @@ void W_Hagar_Attack2_Load_Release(Weapon thiswep, entity actor, .entity weaponen shots = actor.(weaponentity).hagar_load; W_SetupShot(actor, weaponentity, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage) * shots, thiswep.m_id | HITTYPE_SECONDARY); - Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); + W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir); forward = v_forward; right = v_right; @@ -200,7 +200,7 @@ void W_Hagar_Attack2_Load_Release(Weapon thiswep, entity actor, .entity weaponen missile.bot_dodgerating = WEP_CVAR_SEC(hagar, damage); missile.takedamage = DAMAGE_YES; - SetResourceAmountExplicit(missile, RESOURCE_HEALTH, WEP_CVAR_SEC(hagar, health)); + SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR_SEC(hagar, health)); missile.damageforcescale = WEP_CVAR_SEC(hagar, damageforcescale); missile.event_damage = W_Hagar_Damage; missile.damagedbycontents = true; @@ -221,7 +221,7 @@ void W_Hagar_Attack2_Load_Release(Weapon thiswep, entity actor, .entity weaponen // per-shot spread calculation: the more shots there are, the less spread is applied (based on the bias cvar) spread_pershot = ((shots - 1) / (WEP_CVAR_SEC(hagar, load_max) - 1)); spread_pershot = (1 - (spread_pershot * WEP_CVAR_SEC(hagar, load_spread_bias))); - spread_pershot = (WEP_CVAR_SEC(hagar, spread) * spread_pershot * g_weaponspreadfactor); + spread_pershot = (WEP_CVAR_SEC(hagar, spread) * spread_pershot * autocvar_g_weaponspreadfactor); // pattern spread calculation s = '0 0 0'; @@ -233,7 +233,7 @@ void W_Hagar_Attack2_Load_Release(Weapon thiswep, entity actor, .entity weaponen s.y = v_forward.x; s.z = v_forward.y; } - s = s * WEP_CVAR_SEC(hagar, load_spread) * g_weaponspreadfactor; + s = s * WEP_CVAR_SEC(hagar, load_spread) * autocvar_g_weaponspreadfactor; W_SetupProjVelocity_Explicit(missile, w_shotdir + right * s.y + up * s.z, v_up, WEP_CVAR_SEC(hagar, speed), 0, 0, spread_pershot, false); @@ -257,19 +257,19 @@ void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity) // loadable hagar secondary attack, must always run each frame if(time < game_starttime || time < actor.race_penalty || timeout_status == TIMEOUT_ACTIVE) return; - if (round_handler_IsActive() && !round_handler_IsRoundStarted()) + if (weaponUseForbidden(actor)) return; bool loaded = actor.(weaponentity).hagar_load >= WEP_CVAR_SEC(hagar, load_max); // this is different than WR_CHECKAMMO when it comes to reloading bool enough_ammo; - if(actor.items & IT_UNLIMITED_WEAPON_AMMO) + if(actor.items & IT_UNLIMITED_AMMO) enough_ammo = true; else if(autocvar_g_balance_hagar_reload_ammo) enough_ammo = actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(hagar, ammo); else - enough_ammo = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(hagar, ammo); + enough_ammo = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(hagar, ammo); bool stopped = loaded || !enough_ammo; @@ -352,7 +352,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity) // we aren't checking ammo during an attack, so we must do it here if(!(thiswep.wr_checkammo1(thiswep, actor, weaponentity) + thiswep.wr_checkammo2(thiswep, actor, weaponentity))) - if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) + if(!(actor.items & IT_UNLIMITED_AMMO)) { // note: this doesn't force the switch W_SwitchToOtherWeapon(actor, weaponentity); @@ -370,7 +370,7 @@ void W_Hagar_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int } if(!thiswep.wr_checkammo1(thiswep, actor, weaponentity)) - if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO)) + if(!(actor.items & IT_UNLIMITED_AMMO)) { W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity); w_ready(thiswep, actor, weaponentity, fire); @@ -435,13 +435,13 @@ METHOD(Hagar, wr_setup, void(entity thiswep, entity actor, .entity weaponentity) } METHOD(Hagar, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) { - float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(hagar, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(hagar, ammo); ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(hagar, ammo); return ammo_amount; } METHOD(Hagar, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity)) { - float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(hagar, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(hagar, ammo); ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(hagar, ammo); return ammo_amount; }