X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fweapon%2Fdevastator.qc;h=997f6eb36865648470cf398e2b78294a1ffe1ee1;hb=002be87cfe10ccbfedaf09eec48a1c78b10f8476;hp=292f2d5d8852a58866c0170a3da473e080f465e7;hpb=3fc2359b7933352424af07db8f84cbb9342e934f;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index 292f2d5d8..997f6eb36 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -46,8 +46,8 @@ void W_Devastator_Explode(entity this, entity directhitentity) .entity weaponentity = this.weaponentity_fld; if(this.realowner.(weaponentity).m_weapon == thiswep) { - if(GetResourceAmount(this.realowner, thiswep.ammo_type) < WEP_CVAR(devastator, ammo)) - if(!(this.realowner.items & IT_UNLIMITED_WEAPON_AMMO)) + if(GetResource(this.realowner, thiswep.ammo_type) < WEP_CVAR(devastator, ammo)) + if(!(this.realowner.items & IT_UNLIMITED_AMMO)) { this.realowner.cnt = thiswep.m_id; ATTACK_FINISHED(this.realowner, weaponentity) = time; @@ -71,8 +71,11 @@ void W_Devastator_DoRemoteExplode(entity this, .entity weaponentity) bool handled_as_rocketjump = false; entity head = NULL; + bool allow_rocketjump = WEP_CVAR(devastator, remote_jump); + MUTATOR_CALLHOOK(AllowRocketJumping, allow_rocketjump); + allow_rocketjump = M_ARGV(0, bool); - if(WEP_CVAR(devastator, remote_jump_radius)) + if(allow_rocketjump && WEP_CVAR(devastator, remote_jump_radius)) { head = WarpZone_FindRadius( this.origin, @@ -139,8 +142,8 @@ void W_Devastator_DoRemoteExplode(entity this, .entity weaponentity) Weapon thiswep = WEP_DEVASTATOR; if(this.realowner.(weaponentity).m_weapon == thiswep) { - if(GetResourceAmount(this.realowner, thiswep.ammo_type) < WEP_CVAR(devastator, ammo)) - if(!(this.realowner.items & IT_UNLIMITED_WEAPON_AMMO)) + if(GetResource(this.realowner, thiswep.ammo_type) < WEP_CVAR(devastator, ammo)) + if(!(this.realowner.items & IT_UNLIMITED_AMMO)) { this.realowner.cnt = thiswep.m_id; ATTACK_FINISHED(this.realowner, weaponentity) = time; @@ -287,7 +290,7 @@ void W_Devastator_Touch(entity this, entity toucher) void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { - if(GetResourceAmount(this, RES_HEALTH) <= 0) + if(GetResource(this, RES_HEALTH) <= 0) return; if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions @@ -296,7 +299,7 @@ void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float d TakeResource(this, RES_HEALTH, damage); this.angles = vectoangles(this.velocity); - if(GetResourceAmount(this, RES_HEALTH) <= 0) + if(GetResource(this, RES_HEALTH) <= 0) W_PrepareExplosionByDamage(this, attacker, W_Devastator_Explode_think); } @@ -314,7 +317,7 @@ void W_Devastator_Attack(Weapon thiswep, entity actor, .entity weaponentity, int if(WEP_CVAR(devastator, detonatedelay) >= 0) missile.spawnshieldtime = time + WEP_CVAR(devastator, detonatedelay); else - missile.spawnshieldtime = -1; + missile.spawnshieldtime = -1; // NOTE: proximity based when rocket jumping missile.pushltime = time + WEP_CVAR(devastator, guidedelay); missile.classname = "rocket"; missile.bot_dodge = true; @@ -322,7 +325,7 @@ void W_Devastator_Attack(Weapon thiswep, entity actor, .entity weaponentity, int missile.takedamage = DAMAGE_YES; missile.damageforcescale = WEP_CVAR(devastator, damageforcescale); - SetResourceAmount(missile, RES_HEALTH, WEP_CVAR(devastator, health)); + SetResourceExplicit(missile, RES_HEALTH, WEP_CVAR(devastator, health)); missile.event_damage = W_Devastator_Damage; missile.damagedbycontents = true; IL_PUSH(g_damagedbycontents, missile); @@ -398,7 +401,7 @@ METHOD(Devastator, wr_aim, void(entity thiswep, entity actor, .entity weaponenti }); float desirabledamage; desirabledamage = enemydamage; - if(time > actor.invincible_finished && time > actor.spawnshieldtime) + if(time > STAT(INVINCIBLE_FINISHED, actor) && time > actor.spawnshieldtime) desirabledamage = desirabledamage - selfdamage * autocvar_g_balance_selfdamagepercent; if(teamplay && actor.team) desirabledamage = desirabledamage - teamdamage; @@ -435,7 +438,7 @@ METHOD(Devastator, wr_aim, void(entity thiswep, entity actor, .entity weaponenti // but don't fire a new shot at the same time! if(desirabledamage >= 0.75 * coredamage) //this should do group damage in rare fortunate events PHYS_INPUT_BUTTON_ATCK2(actor) = true; - if((skill > 6.5) && (selfdamage > GetResourceAmount(actor, RES_HEALTH))) + if((skill > 6.5) && (selfdamage > GetResource(actor, RES_HEALTH))) PHYS_INPUT_BUTTON_ATCK2(actor) = false; //if(PHYS_INPUT_BUTTON_ATCK2(actor) == true) // dprint(ftos(desirabledamage),"\n"); @@ -491,10 +494,10 @@ METHOD(Devastator, wr_checkammo1, bool(entity thiswep, entity actor, .entity wea ammo_amount = false; if(WEP_CVAR(devastator, reload_ammo)) { - if(GetResourceAmount(actor, thiswep.ammo_type) < WEP_CVAR(devastator, ammo) && actor.(weaponentity).(weapon_load[WEP_DEVASTATOR.m_id]) < WEP_CVAR(devastator, ammo)) + if(GetResource(actor, thiswep.ammo_type) < WEP_CVAR(devastator, ammo) && actor.(weaponentity).(weapon_load[WEP_DEVASTATOR.m_id]) < WEP_CVAR(devastator, ammo)) ammo_amount = true; } - else if(GetResourceAmount(actor, thiswep.ammo_type) < WEP_CVAR(devastator, ammo)) + else if(GetResource(actor, thiswep.ammo_type) < WEP_CVAR(devastator, ammo)) ammo_amount = true; return !ammo_amount; } @@ -502,18 +505,18 @@ METHOD(Devastator, wr_checkammo1, bool(entity thiswep, entity actor, .entity wea #if 0 if(actor.rl_release == 0) { - LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE", actor.rl_release, GetResourceAmount(actor, thiswep.ammo_type), WEP_CVAR(devastator, ammo)); + LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE", actor.rl_release, GetResource(actor, thiswep.ammo_type), WEP_CVAR(devastator, ammo)); return true; } else { - ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR(devastator, ammo); + ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(devastator, ammo); ammo_amount += actor.(weaponentity).(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo); - LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s", actor.rl_release, GetResourceAmount(actor, thiswep.ammo_type), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE")); + LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s", actor.rl_release, GetResource(actor, thiswep.ammo_type), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE")); return ammo_amount; } #else - float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR(devastator, ammo); + float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(devastator, ammo); ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(devastator, ammo); return ammo_amount; #endif