]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/w_minelayer.qc
Merge branch 'master' into divVerent/weapons-field-rewrite
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / w_minelayer.qc
index 4e56d2d94ed99916ff21662fa019e944100785ab..a3036af81db635f26e6c2c316b0cc0c031a25f76 100644 (file)
@@ -1,15 +1,17 @@
 #ifdef REGISTER_WEAPON
-REGISTER_WEAPON(MINE_LAYER, w_minelayer, IT_ROCKETS, 4, WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_HIGH, "minelayer", "minelayer", _("Mine Layer"))
+REGISTER_WEAPON(MINE_LAYER, w_minelayer, IT_ROCKETS, 4, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_HIGH, "minelayer", "minelayer", _("Mine Layer"))
 #else
 #ifdef SVQC
 void W_Mine_Think (void);
 .float minelayer_detonate, mine_explodeanyway;
 .float mine_time;
 
+/*
 void spawnfunc_weapon_minelayer (void)
 {
        weapon_defaultspawnfunc(WEP_MINE_LAYER);
 }
+*/
 
 void W_Mine_Stick (entity to)
 {
@@ -38,6 +40,7 @@ void W_Mine_Stick (entity to)
        newmine.health = self.health;
        newmine.event_damage = self.event_damage;
        newmine.spawnshieldtime = self.spawnshieldtime;
+       newmine.damagedbycontents = TRUE;
 
        newmine.movetype = MOVETYPE_NONE; // lock the mine in place
        newmine.projectiledeathtype = self.projectiledeathtype;
@@ -241,8 +244,15 @@ void W_Mine_Damage (entity inflictor, entity attacker, float damage, float death
 {
        if (self.health <= 0)
                return;
+               
+       float is_from_enemy = (inflictor.realowner != self.realowner);
+               
+       if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, (is_from_enemy ? 1 : -1)))
+               return; // g_projectiles_damage says to halt
+               
        self.health = self.health - damage;
        self.angles = vectoangles(self.velocity);
+       
        if (self.health <= 0)
                W_PrepareExplosionByDamage(attacker, W_Mine_Explode);
 }
@@ -259,7 +269,7 @@ void W_Mine_Attack (void)
                if(W_Mine_Count(self) >= autocvar_g_balance_minelayer_limit)
                {
                        // the refire delay keeps this message from being spammed
-                       sprint(self, strcat("You cannot place more than ^2", ftos(autocvar_g_balance_minelayer_limit), " ^7mines at a time\n") );
+                       sprint(self, strcat("minelayer: You cannot place more than ^2", ftos(autocvar_g_balance_minelayer_limit), " ^7mines at a time\n") );
                        play2(self, "weapons/unavailable.wav");
                        return;
                }
@@ -284,6 +294,7 @@ void W_Mine_Attack (void)
        mine.damageforcescale = autocvar_g_balance_minelayer_damageforcescale;
        mine.health = autocvar_g_balance_minelayer_health;
        mine.event_damage = W_Mine_Damage;
+       mine.damagedbycontents = TRUE;
 
        mine.movetype = MOVETYPE_TOSS;
        PROJECTILE_MAKETRIGGER(mine);
@@ -316,8 +327,6 @@ void W_Mine_Attack (void)
        self.minelayer_mines = W_Mine_Count(self);
 }
 
-void spawnfunc_weapon_minelayer (void); // defined in t_items.qc
-
 float W_PlacedMines(float detonate)
 {
        entity mine;
@@ -486,7 +495,7 @@ float w_minelayer(float req)
                if (ATTACK_FINISHED(self) <= time || self.weapon != WEP_MINE_LAYER)
                {
                        ammo_amount = self.ammo_rockets >= autocvar_g_balance_minelayer_ammo;
-                       ammo_amount += self.weapon_load[WEP_MINE_LAYER] >= autocvar_g_balance_minelayer_ammo;
+                       ammo_amount += self.(weapon_load[WEP_MINE_LAYER]) >= autocvar_g_balance_minelayer_ammo;
                        return ammo_amount;
                }
        }
@@ -502,7 +511,7 @@ float w_minelayer(float req)
                W_Reload(autocvar_g_balance_minelayer_ammo, autocvar_g_balance_minelayer_reload_ammo, autocvar_g_balance_minelayer_reload_time, "weapons/reload.wav");
        }
        return TRUE;
-};
+}
 #endif
 #ifdef CSQC
 float w_minelayer(float req)
@@ -520,7 +529,10 @@ float w_minelayer(float req)
                precache_sound("weapons/mine_exp.wav");
        }
        else if (req == WR_SUICIDEMESSAGE)
-               w_deathtypestring = _("%s exploded");
+               if(w_deathtype & HITTYPE_BOUNCE) // (remote detonation)
+                       w_deathtypestring = _("%s blew themself up with their minelayer");
+               else
+                       w_deathtypestring = _("%s forgot about their mine");
        else if (req == WR_KILLMESSAGE)
        {
                if(w_deathtype & HITTYPE_BOUNCE) // (remote detonation)