From: AriosJentu Date: Fri, 23 Aug 2019 13:13:35 +0000 (+1000) Subject: Add achievements for weapons X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=45e05e8343af235bb4183c073f2c08e0fe444ddb;p=xonotic%2Fxonotic-data.pk3dir.git Add achievements for weapons --- diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index 5654488dd..77b0d811a 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -18,12 +18,16 @@ void W_Devastator_Explode(entity this, entity directhitentity) { W_Devastator_Unregister(this); + entity achs = this.realowner.achievements; if(directhitentity.takedamage == DAMAGE_AIM) if(IS_PLAYER(directhitentity)) if(DIFF_TEAM(this.realowner, directhitentity)) if(!IS_DEAD(directhitentity)) - if(IsFlying(directhitentity)) + if(IsFlying(directhitentity)) { Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_AIRSHOT); + achs.inc_achievement(achs, "airshot"); + achs.announce(achs, this.realowner, "Air Shot!", "airshot"); + } this.event_damage = func_null; this.takedamage = DAMAGE_NO; diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index 2ba6b5da1..eb9613efa 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -74,12 +74,16 @@ void W_Electro_ExplodeCombo(entity this) void W_Electro_Explode(entity this, entity directhitentity) { + entity achs = this.realowner.achievements; if(directhitentity.takedamage == DAMAGE_AIM) if(IS_PLAYER(directhitentity)) if(DIFF_TEAM(this.realowner, directhitentity)) if(!IS_DEAD(directhitentity)) - if(IsFlying(directhitentity)) + if(IsFlying(directhitentity)) { Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH); + achs.inc_achievement(achs, "electrobitch"); + achs.announce(achs, this.realowner, "Electro-BITCH!", "electrobitch"); + } this.event_damage = func_null; this.takedamage = DAMAGE_NO; diff --git a/qcsrc/common/weapons/weapon/minelayer.qc b/qcsrc/common/weapons/weapon/minelayer.qc index 7f60c5b57..312cfddfd 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qc +++ b/qcsrc/common/weapons/weapon/minelayer.qc @@ -54,12 +54,16 @@ void W_MineLayer_Stick(entity this, entity to) void W_MineLayer_Explode(entity this, entity directhitentity) { + entity achs = this.realowner.achievements; if(directhitentity.takedamage == DAMAGE_AIM) if(IS_PLAYER(directhitentity)) if(DIFF_TEAM(this.realowner, directhitentity)) if(!IS_DEAD(directhitentity)) - if(IsFlying(directhitentity)) + if(IsFlying(directhitentity)) { Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_AIRSHOT); + achs.inc_achievement(achs, "airshot"); + achs.announce(achs, this.realowner, "Air Shot!", "airshot"); + } this.event_damage = func_null; this.takedamage = DAMAGE_NO; diff --git a/qcsrc/common/weapons/weapon/mortar.qc b/qcsrc/common/weapons/weapon/mortar.qc index 904f0c128..5db968bf4 100644 --- a/qcsrc/common/weapons/weapon/mortar.qc +++ b/qcsrc/common/weapons/weapon/mortar.qc @@ -4,12 +4,16 @@ void W_Mortar_Grenade_Explode(entity this, entity directhitentity) { + entity achs = this.realowner.achievements; if(directhitentity.takedamage == DAMAGE_AIM) if(IS_PLAYER(directhitentity)) if(DIFF_TEAM(this.realowner, directhitentity)) if(!IS_DEAD(directhitentity)) - if(IsFlying(directhitentity)) + if(IsFlying(directhitentity)) { Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_AIRSHOT); + achs.inc_achievement(achs, "airshot"); + achs.announce(achs, this.realowner, "Air Shot!", "airshot"); + } this.event_damage = func_null; this.takedamage = DAMAGE_NO; @@ -29,12 +33,16 @@ void W_Mortar_Grenade_Explode_use(entity this, entity actor, entity trigger) void W_Mortar_Grenade_Explode2(entity this, entity directhitentity) { + entity achs = this.realowner.achievements; if(directhitentity.takedamage == DAMAGE_AIM) if(IS_PLAYER(directhitentity)) if(DIFF_TEAM(this.realowner, directhitentity)) if(!IS_DEAD(directhitentity)) - if(IsFlying(directhitentity)) + if(IsFlying(directhitentity)){ Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_AIRSHOT); + achs.inc_achievement(achs, "airshot"); + achs.announce(achs, this.realowner, "Air Shot!", "airshot"); + } this.event_damage = func_null; this.takedamage = DAMAGE_NO; diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index dbf24c796..83426ec15 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -130,11 +130,23 @@ void W_Vaporizer_Attack(Weapon thiswep, entity actor, .entity weaponentity) // do this now, as goodhits is disabled below SendCSQCVaporizerBeamParticle(actor, damage_goodhits); - if(yoda && flying) + entity achs = actor.achievements; + if (damage_goodhits > 1) { + Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH); + achs.inc_achievement(achs, "multirailed"); + achs.announce(achs, actor, "Multi Railed!", "multirailed"); + } + + if(yoda && flying) { Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA); + achs.inc_achievement(achs, "flyingyoda"); + } + if(damage_goodhits && actor.vaporizer_lasthit) { Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE); + achs.inc_achievement(achs, "impressive"); + achs.announce(achs, actor, "Impressive!", "impressive"); damage_goodhits = 0; // only every second time } @@ -149,12 +161,16 @@ void W_Vaporizer_Attack(Weapon thiswep, entity actor, .entity weaponentity) void W_RocketMinsta_Laser_Explode (entity this, entity directhitentity) { + entity achs = this.realowner.achievements; if(directhitentity.takedamage == DAMAGE_AIM) if(IS_PLAYER(directhitentity)) if(DIFF_TEAM(this.realowner, directhitentity)) if(!IS_DEAD(directhitentity)) - if(IsFlying(directhitentity)) + if(IsFlying(directhitentity)) { Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH); + achs.inc_achievement(achs, "electrobitch"); + achs.announce(achs, this.realowner, "Electro-BITCH!", "electrobitch"); + } this.event_damage = func_null; this.takedamage = DAMAGE_NO; diff --git a/qcsrc/common/weapons/weapon/vortex.qc b/qcsrc/common/weapons/weapon/vortex.qc index af7fac624..3cf18adc5 100644 --- a/qcsrc/common/weapons/weapon/vortex.qc +++ b/qcsrc/common/weapons/weapon/vortex.qc @@ -141,11 +141,23 @@ void W_Vortex_Attack(Weapon thiswep, entity actor, .entity weaponentity, float i damage_goodhits = 0; FireRailgunBullet(actor, weaponentity, w_shotorg, w_shotorg + w_shotdir * max_shot_distance, mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, dtype); - if(yoda && flying) + entity achs = actor.achievements; + if (damage_goodhits > 1) { + Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH); + achs.inc_achievement(achs, "multirailed"); + achs.announce(achs, actor, "Multi Railed!", "multirailed"); + } + + if(yoda && flying) { Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA); + achs.inc_achievement(achs, "flyingyoda"); + } + if(damage_goodhits && actor.vortex_lasthit) { Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE); + achs.inc_achievement(achs, "impressive"); + achs.announce(achs, actor, "Impressive!", "impressive"); damage_goodhits = 0; // only every second time }