]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add achievements for weapons
authorAriosJentu <darthpoezd@gmail.com>
Fri, 23 Aug 2019 13:13:35 +0000 (23:13 +1000)
committerAriosJentu <darthpoezd@gmail.com>
Fri, 23 Aug 2019 13:13:35 +0000 (23:13 +1000)
qcsrc/common/weapons/weapon/devastator.qc
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/common/weapons/weapon/mortar.qc
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/common/weapons/weapon/vortex.qc

index 5654488ddb065d4e9aeb49b8f95cda1889de2132..77b0d811add4e81ad831acf6624e7a673eb632eb 100644 (file)
@@ -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;
index 2ba6b5da18628bc669f6de77668c32c23738ea11..eb9613efad2923da0f7ab36b3ae5ee3faa51a3d9 100644 (file)
@@ -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;
index 7f60c5b571d90c84b9d8ff52717c19462300d89d..312cfddfdac2f2236a0ebd16bc9a0c54aa5d575d 100644 (file)
@@ -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;
index 904f0c12838ff37b775847a0f4541d560406abd9..5db968bf4eb444a548502dff8033242cca88cb50 100644 (file)
@@ -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;
index dbf24c7964d94ff229b30ac068d4a0d315a251ba..83426ec15678b90db9385699a779ba060cf39791 100644 (file)
@@ -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;
index af7fac624195caa439ff0b54266f12ac80186353..3cf18adc5ae946f9e6c4e7516d8430d101dce2ef 100644 (file)
@@ -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
        }