]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Use a weapon flag to mark weapons that induce bleeding 640/head
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 9 Mar 2019 12:50:23 +0000 (14:50 +0200)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 9 Mar 2019 12:58:45 +0000 (14:58 +0200)
qcsrc/common/effects/qc/damageeffects.qc
qcsrc/common/weapons/weapon.qh
qcsrc/common/weapons/weapon/machinegun.qh
qcsrc/common/weapons/weapon/shotgun.qh

index cc487a552a26e4180f175da845f085615fb9e498..fe509e3d4988cfce22f0e88f84b15a9402642124 100644 (file)
@@ -108,7 +108,7 @@ void DamageEffect(entity this, vector hitorg, float thedamage, int type, int spe
        int nearestbone = 0;
        float life;
        string effectname;
-       entity e;
+       entity e, wep;
 
        if(!autocvar_cl_damageeffect || autocvar_cl_gentle || autocvar_cl_gentle_damage)
                return;
@@ -148,9 +148,11 @@ void DamageEffect(entity this, vector hitorg, float thedamage, int type, int spe
 
        life = bound(autocvar_cl_damageeffect_lifetime_min, thedamage * autocvar_cl_damageeffect_lifetime, autocvar_cl_damageeffect_lifetime_max);
 
-       effectname = strcat("damage_", DEATH_WEAPONOF(type).netname);
-       if(DEATH_WEAPONOF(type) == WEP_SHOTGUN || DEATH_WEAPONOF(type) == WEP_MACHINEGUN)
+       wep = DEATH_WEAPONOF(type);
+       effectname = strcat("damage_", wep.netname);
+       if((wep.spawnflags & WEP_FLAG_BLEED))
        {
+               // if this weapon induces bleeding, use the effect name with the proper species prefix (blood type)
                if((this.isplayermodel & ISPLAYER_MODEL))
                {
                        string specstr = species_prefix(specnum);
index 0d65bbef9d51f3e410981232ca62a0d31e035cad..c4f16cd2139ab03ff633a8f9ebc33a3f55365095 100644 (file)
@@ -197,6 +197,7 @@ const int WEP_TYPE_MELEE_SEC      =  BIT(10); // secondary attack is melee swing
 const int WEP_FLAG_DUALWIELD      =  BIT(11); // weapon can be dual wielded
 const int WEP_FLAG_NODUAL         =  BIT(12); // weapon doesn't work well with dual wielding (fireball etc just explode on fire), doesn't currently prevent anything
 const int WEP_FLAG_PENETRATEWALLS =  BIT(13); // weapon has high calibur bullets that can penetrate thick walls (WEAPONTODO)
+const int WEP_FLAG_BLEED          =  BIT(14); // weapon pierces and causes bleeding (used for damage effects)
 
 // variables:
 string weaponorder_byid;
index 2ecd8082fbdff7707fbef7610a0e0154711f15f4..a53d17a8d97ee5b0cc94e0ae078c28c86866733c 100644 (file)
@@ -4,7 +4,7 @@ CLASS(MachineGun, Weapon)
 /* spawnfunc */ ATTRIB(MachineGun, m_canonical_spawnfunc, string, "weapon_machinegun");
 /* ammotype  */ ATTRIB(MachineGun, ammo_type, int, RES_BULLETS);
 /* impulse   */ ATTRIB(MachineGun, impulse, int, 3);
-/* flags     */ ATTRIB(MachineGun, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_PENETRATEWALLS);
+/* flags     */ ATTRIB(MachineGun, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_PENETRATEWALLS | WEP_FLAG_BLEED);
 /* rating    */ ATTRIB(MachineGun, bot_pickupbasevalue, float, 7000);
 /* color     */ ATTRIB(MachineGun, wpcolor, vector, '1 1 0');
 /* modelname */ ATTRIB(MachineGun, mdl, string, "uzi");
index 5a47a18890cda1246024982d4f9a1ec90bce7dc0..dc6dae157d7f81d345076370d116a92d332d1eb4 100644 (file)
@@ -4,7 +4,7 @@ CLASS(Shotgun, Weapon)
 /* spawnfunc */ ATTRIB(Shotgun, m_canonical_spawnfunc, string, "weapon_shotgun");
 /* ammotype  */ ATTRIB(Shotgun, ammo_type, int, RES_SHELLS);
 /* impulse   */ ATTRIB(Shotgun, impulse, int, 2);
-/* flags     */ ATTRIB(Shotgun, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_TYPE_MELEE_SEC);
+/* flags     */ ATTRIB(Shotgun, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_TYPE_MELEE_SEC | WEP_FLAG_BLEED);
 /* rating    */ ATTRIB(Shotgun, bot_pickupbasevalue, float, 6000);
 /* color     */ ATTRIB(Shotgun, wpcolor, vector, '0.5 0.25 0');
 /* modelname */ ATTRIB(Shotgun, mdl, string, "shotgun");