set g_telefrags_avoid 1 "when teleporters have a random destination, avoid teleporting to locations where a telefrag would happen"
set g_teleport_maxspeed 0 "maximum speed that a player can keep when going through a teleporter (if a misc_teleporter_dest also has a cap the smallest one of these will be used), 0 = don't limit, -1 = keep no speed"
+set cl_damageeffect_player 0.05 "enable weapon damage effects on players, value specifies how often to show the effect"
+set cl_damageeffect_gibs 0.125 "enable weapon damage effects on gibs, value specifies how often to show the effect"
+set cl_damageeffect_gibs_randomize 0.5 "probability for effects to show on gibs each tick, used so gibs don't generate particles at the same time and look ugly"
+set cl_damageeffect_lifetime 0.04 "how much a damage effect lasts, multiplied by damage amount"
+set cl_damageeffect_lifetime_max 5 "maximum amount of lifetime a damage effect may have at a time"
+
set g_respawn_ghosts 1 "if 1 dead bodies become ghosts and float away when the player respawns"
set g_respawn_ghosts_speed 5 "the speed with which respawn ghosts float and rotate"
set g_respawn_ghosts_maxtime 6 "maximum amount of time a respawn ghost can last, minimum time is half this value. 0 disables and ghosts fade when the body would"
color 0x4F4B46 0x000000
rotate -180 180 -20 20
+// tuba does not use the weapon damage effect
+
+// laser damage effect
+// used in qcsrc/client/gibs.qc: pointparticles(particleeffectnum(effectnum), org, '0 0 0', 1);
+effect weapondamage_laser
+count 3
+type smoke
+tex 0 8
+color 0x880000 0xff4400
+size 8 16
+sizeincrease 10
+alpha 128 16 128
+gravity 0
+originjitter 4 4 16
+velocityjitter 0.4 0.4 0.6
+velocitymultiplier 0
+airfriction -0.35
+rotate 0 180 -30 30
+
+// shotgun damage effect, normal blood
+// used in qcsrc/client/gibs.qc: pointparticles(particleeffectnum(effectnum), org, '0 0 0', 1);
+effect weapondamage_shotgun
+count 0.5
+type blood
+tex 24 32
+size 4 9
+alpha 256 256 64
+color 0xA8FFFF 0xA8FFFFF
+bounce -1
+airfriction 1
+liquidfriction 4
+velocityjitter 64 64 64
+velocitymultiplier 5
+staincolor 0x808080 0x808080
+staintex 16 24
+//blood mist
+effect weapondamage_shotgun
+countabsolute 1
+type alphastatic
+tex 0 8
+size 8 16
+alpha 100 256 400
+color 0x000000 0x420000
+originjitter 11 11 11
+
+// shotgun damage effect, alien blood
+// used in qcsrc/client/gibs.qc: pointparticles(particleeffectnum(effectnum), org, '0 0 0', 1);
+effect weapondamage_shotgun_alien
+count 0.5
+type blood
+tex 24 32
+size 4 9
+alpha 256 256 64
+color 0xDC9BCD 0xDC9BCD
+bounce -1
+airfriction 1
+liquidfriction 4
+velocityjitter 64 64 64
+velocitymultiplier 5
+staincolor 0x808080 0x808080
+staintex 16 24
+//blood mist
+effect weapondamage_shotgun_alien
+countabsolute 1
+type alphastatic
+tex 0 8
+size 8 16
+alpha 100 256 400
+color 0x000000 0x204010
+originjitter 11 11 11
+
+// shotgun damage effect, robot blood
+// used in qcsrc/client/gibs.qc: pointparticles(particleeffectnum(effectnum), org, '0 0 0', 1);
+effect weapondamage_shotgun_robot
+count 0.5
+type blood
+tex 24 32
+size 4 9
+alpha 256 256 64
+color 0xC0D890 0xC0D890
+bounce -1
+airfriction 1
+liquidfriction 4
+velocityjitter 64 64 64
+velocitymultiplier 5
+staincolor 0x808080 0x808080
+staintex 16 24
+//blood mist
+effect weapondamage_shotgun_robot
+countabsolute 1
+type alphastatic
+tex 0 8
+size 8 16
+alpha 100 256 400
+color 0x000000 0x301860
+originjitter 11 11 11
+
+// uzi damage effect, normal blood
+// used in qcsrc/client/gibs.qc: pointparticles(particleeffectnum(effectnum), org, '0 0 0', 1);
+effect weapondamage_uzi
+count 0.25
+type blood
+tex 24 32
+size 3 8
+alpha 256 256 64
+color 0xA8FFFF 0xA8FFFFF
+bounce -1
+airfriction 1
+liquidfriction 4
+velocityjitter 64 64 64
+velocitymultiplier 5
+staincolor 0x808080 0x808080
+staintex 16 24
+//blood mist
+effect weapondamage_uzi
+countabsolute 1
+type alphastatic
+tex 0 8
+size 6 12
+alpha 100 256 400
+color 0x000000 0x420000
+originjitter 11 11 11
+
+// uzi damage effect, alien blood
+// used in qcsrc/client/gibs.qc: pointparticles(particleeffectnum(effectnum), org, '0 0 0', 1);
+effect weapondamage_uzi_alien
+count 0.25
+type blood
+tex 24 32
+size 3 8
+alpha 256 256 64
+color 0xDC9BCD 0xDC9BCD
+bounce -1
+airfriction 1
+liquidfriction 4
+velocityjitter 64 64 64
+velocitymultiplier 5
+staincolor 0x808080 0x808080
+staintex 16 24
+//blood mist
+effect weapondamage_uzi_alien
+countabsolute 1
+type alphastatic
+tex 0 8
+size 6 12
+alpha 100 256 400
+color 0x000000 0x204010
+originjitter 11 11 11
+
+// uzi damage effect, robot blood
+// used in qcsrc/client/gibs.qc: pointparticles(particleeffectnum(effectnum), org, '0 0 0', 1);
+effect weapondamage_uzi_robot
+count 0.25
+type blood
+tex 24 32
+size 3 8
+alpha 256 256 64
+color 0xC0D890 0xC0D890
+bounce -1
+airfriction 1
+liquidfriction 4
+velocityjitter 64 64 64
+velocitymultiplier 5
+staincolor 0x808080 0x808080
+staintex 16 24
+//blood mist
+effect weapondamage_uzi_robot
+countabsolute 1
+type alphastatic
+tex 0 8
+size 6 12
+alpha 100 256 400
+color 0x000000 0x301860
+originjitter 11 11 11
+
+// minelayer damage effect
+// used in qcsrc/client/gibs.qc: pointparticles(particleeffectnum(effectnum), org, '0 0 0', 1);
+effect weapondamage_minelayer
+//notunderwater
+count 2
+type smoke
+tex 48 55
+size 6 12
+alpha 256 16 256
+gravity -0.5
+color 0x8f0d00 0xff5a00
+sizeincrease -10
+originoffset 0 0 10
+originjitter 6 6 8
+velocityjitter 22 22 50
+// smoke
+effect weapondamage_minelayer
+type alphastatic
+count 2
+tex 0 8
+size 4 8
+sizeincrease 5
+alpha 128 32 128
+color 0x000000 0x111111
+gravity -0.3
+originoffset 0 0 10
+originjitter 6 6 8
+velocityjitter 11 11 50
+// light
+effect weapondamage_minelayer
+trailspacing 8
+lightradius 60
+lightradiusfade 280
+lightcolor 0.9 0.6 0.2
+
+// grenadelauncher damage effect
+// used in qcsrc/client/gibs.qc: pointparticles(particleeffectnum(effectnum), org, '0 0 0', 1);
+effect weapondamage_grenadelauncher
+//notunderwater
+count 2
+type smoke
+tex 48 55
+size 6 12
+alpha 256 16 256
+gravity -0.5
+color 0x8f0d00 0xff5a00
+sizeincrease -10
+originoffset 0 0 10
+originjitter 6 6 8
+velocityjitter 22 22 50
+// smoke
+effect weapondamage_grenadelauncher
+type alphastatic
+count 2
+tex 0 8
+size 4 8
+sizeincrease 5
+alpha 128 32 128
+color 0x000000 0x111111
+gravity -0.3
+originoffset 0 0 10
+originjitter 6 6 8
+velocityjitter 11 11 50
+// light
+effect weapondamage_grenadelauncher
+trailspacing 8
+lightradius 60
+lightradiusfade 280
+lightcolor 0.9 0.6 0.2
+
+// electro damage effect
+// used in qcsrc/client/gibs.qc: pointparticles(particleeffectnum(effectnum), org, '0 0 0', 1);
+effect weapondamage_electro
+count 2
+type static
+tex 47 47
+color 0x66ffff 0x2288ff
+size 10 20
+sizeincrease -16
+alpha 48 8 48
+gravity -0.0001
+airfriction 0.2
+liquidfriction 0.8
+originjitter 16 16 32
+velocityjitter 8 8 16
+velocitymultiplier 0
+airfriction -0.5
+rotate 180 360 -30 30
+// plasma smoke
+effect weapondamage_electro
+count 4
+type smoke
+tex 0 8
+color 0x2244ff 0x002266
+size 8 16
+sizeincrease 10
+alpha 64 16 64
+gravity 0
+originjitter 4 4 16
+velocityjitter 0.4 0.4 0.6
+velocitymultiplier 0
+airfriction -0.35
+rotate 0 180 -30 30
+// light
+effect weapondamage_electro
+trailspacing 8
+lightradius 50
+lightradiusfade 220
+lightcolor 0.2 0.8 1.0
+
+// crylink damage effect
+// used in qcsrc/client/gibs.qc: pointparticles(particleeffectnum(effectnum), org, '0 0 0', 1);
+effect weapondamage_crylink
+count 2
+type static
+tex 38 38
+color 0xff44ff 0x9966ff
+size 8 16
+sizeincrease -8
+alpha 48 16 48
+gravity -0.0001
+airfriction 0.6
+liquidfriction 0.8
+originjitter 8 8 16
+velocityjitter 10 10 20
+velocitymultiplier 0
+airfriction -0.5
+rotate 180 360 -30 30
+// plasma smoke
+effect weapondamage_crylink
+count 4
+type smoke
+tex 0 8
+color 0x8844ff 0x662244
+size 10 20
+sizeincrease 6
+alpha 64 16 64
+gravity 0.001
+originjitter 6 6 12
+velocityjitter 0.4 0.4 0.6
+velocitymultiplier 0
+airfriction -0.35
+rotate 0 180 -30 30
+// light
+effect weapondamage_crylink
+trailspacing 8
+lightradius 50
+lightradiusfade 240
+lightcolor 0.8 0.2 1.0
+
+// hlac damage effect
+// used in qcsrc/client/gibs.qc: pointparticles(particleeffectnum(effectnum), org, '0 0 0', 1);
+effect weapondamage_hlac
+count 3
+type smoke
+tex 0 8
+color 0x880000 0xff4400
+size 8 16
+sizeincrease 10
+alpha 128 16 128
+gravity 0
+originjitter 4 4 16
+velocityjitter 0.4 0.4 0.6
+velocitymultiplier 0
+airfriction -0.35
+rotate 0 180 -30 30
+
+// nex damage effect
+// used in qcsrc/client/gibs.qc: pointparticles(particleeffectnum(effectnum), org, '0 0 0', 1);
+effect weapondamage_nex
+count 1
+type static
+tex 47 47
+color 0xffffff 0x88ffff
+size 7 14
+sizeincrease -14
+alpha 64 8 64
+gravity -0.0001
+airfriction 0.1
+liquidfriction 0.6
+originjitter 4 4 8
+velocityjitter 8 8 16
+velocitymultiplier 0
+airfriction -0.5
+rotate 180 360 -30 30
+// plasma smoke
+effect weapondamage_nex
+count 2
+type smoke
+tex 0 8
+color 0x6688ff 0x226688
+size 5 10
+sizeincrease 8
+alpha 64 16 64
+gravity 0
+originjitter 6 6 12
+velocityjitter 0.5 0.5 0.8
+velocitymultiplier 0
+airfriction -0.35
+rotate 0 180 -30 30
+// light
+effect weapondamage_nex
+trailspacing 8
+lightradius 60
+lightradiusfade 280
+lightcolor 0.8 1.0 1.0
+
+// minstanex damage effect
+// used in qcsrc/client/gibs.qc: pointparticles(particleeffectnum(effectnum), org, '0 0 0', 1);
+effect weapondamage_minstanex
+count 2
+type static
+tex 47 47
+color 0xffffff 0x88ffff
+size 10 20
+sizeincrease -14
+alpha 64 8 64
+gravity -0.0001
+airfriction 0.1
+liquidfriction 0.6
+originjitter 4 4 8
+velocityjitter 8 8 16
+velocitymultiplier 0
+airfriction -0.5
+rotate 180 360 -30 30
+// plasma smoke
+effect weapondamage_minstanex
+count 4
+type smoke
+tex 0 8
+color 0x6688ff 0x226688
+size 8 16
+sizeincrease 8
+alpha 64 16 64
+gravity 0
+originjitter 6 6 12
+velocityjitter 0.5 0.5 0.8
+velocitymultiplier 0
+airfriction -0.35
+rotate 0 180 -30 30
+// light
+effect weapondamage_minstanex
+trailspacing 8
+lightradius 60
+lightradiusfade 240
+lightcolor 0.8 1.0 1.0
+
+// sniperrifle damage effect, normal blood
+// used in qcsrc/client/gibs.qc: pointparticles(particleeffectnum(effectnum), org, '0 0 0', 1);
+effect weapondamage_sniperrifle
+count 0.25
+type blood
+tex 24 32
+size 3 8
+alpha 256 256 64
+color 0xA8FFFF 0xA8FFFFF
+bounce -1
+airfriction 1
+liquidfriction 4
+velocityjitter 64 64 64
+velocitymultiplier 5
+staincolor 0x808080 0x808080
+staintex 16 24
+//blood mist
+effect weapondamage_sniperrifle
+countabsolute 1
+type alphastatic
+tex 0 8
+size 6 12
+alpha 100 256 400
+color 0x000000 0x420000
+originjitter 11 11 11
+
+// sniperrifle damage effect, alien blood
+// used in qcsrc/client/gibs.qc: pointparticles(particleeffectnum(effectnum), org, '0 0 0', 1);
+effect weapondamage_sniperrifle_alien
+count 0.25
+type blood
+tex 24 32
+size 3 8
+alpha 256 256 64
+color 0xDC9BCD 0xDC9BCD
+bounce -1
+airfriction 1
+liquidfriction 4
+velocityjitter 64 64 64
+velocitymultiplier 5
+staincolor 0x808080 0x808080
+staintex 16 24
+//blood mist
+effect weapondamage_sniperrifle_alien
+countabsolute 1
+type alphastatic
+tex 0 8
+size 6 12
+alpha 100 256 400
+color 0x000000 0x204010
+originjitter 11 11 11
+
+// sniperrifle damage effect, robot blood
+// used in qcsrc/client/gibs.qc: pointparticles(particleeffectnum(effectnum), org, '0 0 0', 1);
+effect weapondamage_sniperrifle_robot
+count 0.25
+type blood
+tex 24 32
+size 3 8
+alpha 256 256 64
+color 0xC0D890 0xC0D890
+bounce -1
+airfriction 1
+liquidfriction 4
+velocityjitter 64 64 64
+velocitymultiplier 5
+staincolor 0x808080 0x808080
+staintex 16 24
+//blood mist
+effect weapondamage_sniperrifle_robot
+countabsolute 1
+type alphastatic
+tex 0 8
+size 6 12
+alpha 100 256 400
+color 0x000000 0x301860
+originjitter 11 11 11
+
+// seeker damage effect
+// used in qcsrc/client/gibs.qc: pointparticles(particleeffectnum(effectnum), org, '0 0 0', 1);
+effect weapondamage_seeker
+//notunderwater
+count 2
+type smoke
+tex 48 55
+size 5 10
+alpha 256 16 256
+gravity -0.5
+color 0x8f0d00 0xff5a00
+sizeincrease -10
+originoffset 0 0 10
+originjitter 5 5 7
+velocityjitter 22 22 50
+// smoke
+effect weapondamage_seeker
+type alphastatic
+count 2
+tex 0 8
+size 3 6
+sizeincrease 5
+alpha 128 32 128
+color 0x000000 0x111111
+gravity -0.3
+originoffset 0 0 10
+originjitter 5 5 7
+velocityjitter 11 11 50
+// light
+effect weapondamage_seeker
+trailspacing 8
+lightradius 65
+lightradiusfade 280
+lightcolor 0.9 0.7 0.2
+
+// hagar damage effect
+// used in qcsrc/client/gibs.qc: pointparticles(particleeffectnum(effectnum), org, '0 0 0', 1);
+effect weapondamage_hagar
+//notunderwater
+count 2
+type smoke
+tex 48 55
+size 5 10
+alpha 256 16 256
+gravity -0.5
+color 0x8f0d00 0xff5a00
+sizeincrease -10
+originoffset 0 0 10
+originjitter 5 5 7
+velocityjitter 22 22 50
+// smoke
+effect weapondamage_hagar
+type alphastatic
+count 2
+tex 0 8
+size 3 6
+sizeincrease 5
+alpha 128 32 128
+color 0x000000 0x111111
+gravity -0.3
+originoffset 0 0 10
+originjitter 5 5 7
+velocityjitter 11 11 50
+// light
+effect weapondamage_hagar
+trailspacing 8
+lightradius 65
+lightradiusfade 280
+lightcolor 0.9 0.7 0.2
+
+// fireball damage effect
+// used in qcsrc/client/gibs.qc: pointparticles(particleeffectnum(effectnum), org, '0 0 0', 1);
+effect weapondamage_fireball
+//notunderwater
+count 4
+type smoke
+tex 48 55
+size 10 20
+alpha 192 16 192
+gravity -0.5
+color 0x8f0d00 0xff5a00
+sizeincrease -10
+originoffset 0 0 10
+originjitter 8 8 24
+velocityjitter 22 22 50
+// smoke
+effect weapondamage_fireball
+type alphastatic
+count 4
+tex 0 8
+size 8 16
+sizeincrease 5
+alpha 128 32 128
+color 0x000000 0x111111
+gravity -0.3
+originoffset 0 0 10
+originjitter 8 8 24
+velocityjitter 11 11 50
+// light
+effect weapondamage_fireball
+trailspacing 8
+lightradius 65
+lightradiusfade 280
+lightcolor 0.9 0.6 0.2
+
+// rocketlauncher damage effect
+// used in qcsrc/client/gibs.qc: pointparticles(particleeffectnum(effectnum), org, '0 0 0', 1);
+effect weapondamage_rocketlauncher
+//notunderwater
+count 3
+type smoke
+tex 48 55
+size 7 14
+alpha 256 16 256
+gravity -0.5
+color 0x8f0d00 0xff5a00
+sizeincrease -10
+originoffset 0 0 10
+originjitter 6 6 8
+velocityjitter 22 22 50
+// smoke
+effect weapondamage_rocketlauncher
+type alphastatic
+count 3
+tex 0 8
+size 5 10
+sizeincrease 5
+alpha 128 32 128
+color 0x000000 0x111111
+gravity -0.3
+originoffset 0 0 10
+originjitter 6 6 8
+velocityjitter 11 11 50
+// light
+effect weapondamage_rocketlauncher
+trailspacing 8
+lightradius 60
+lightradiusfade 280
+lightcolor 0.9 0.6 0.2
+
+// porto does not use the weapon damage effect
+
+// hook does not use the weapon damage effect
+
// metal impact effect
// used in qcsrc/server/mutators/sandbox.qc: pointparticles(particleeffectnum("impact_metal"), self.origin, '0 0 0', 1);
effect impact_metal
case ENT_CLIENT_ACCURACY: Ent_ReadAccuracy(); break;
case ENT_CLIENT_AUXILIARYXHAIR: Net_AuXair2(bIsNewEntity); break;
case ENT_CLIENT_TURRET: ent_turret(); break;
+ case ENT_CLIENT_DAMAGEEFFECT: Ent_DamageEffect(); break;
case ENT_CLIENT_MODEL: CSQCModel_Read(bIsNewEntity); break;
default:
//error(strcat(_("unknown entity type in CSQC_Ent_Update: %d\n"), self.enttype));
var float autocvar_cl_eventchase_speed = 1.3;
float autocvar_cl_lerpexcess;
string autocvar__togglezoom;
+float autocvar_cl_damageeffect_player;
+float autocvar_cl_damageeffect_gibs;
+float autocvar_cl_damageeffect_gibs_randomize;
+float autocvar_cl_damageeffect_lifetime;
+float autocvar_cl_damageeffect_lifetime_max;
float autocvar_cl_playerdetailreduction;
float autocvar_cl_loddistance1 = 1024;
float autocvar_cl_loddistance2 = 4096;
for(i = WEP_FIRST; i <= WEP_LAST; ++i)
(get_weaponinfo(i)).weapon_func(WR_PRECACHE);
}
+
+// damage effect
+
+.entity dmgent;
+.float dmgpartnum, dmgtime;
+.float lifetime;
+
+void Ent_DamageEffect_Think()
+{
+ self.nextthink = time;
+
+ float foundgib;
+ vector org;
+
+ if(time >= self.lifetime)
+ {
+ remove(self);
+ self = world;
+ return;
+ }
+ if(self.dmgtime > time)
+ return;
+ org = getplayerorigin(self.team);
+ if(org == GETPLAYERORIGIN_ERROR)
+ return;
+
+ // Scan the owner of all gibs in the world. If a gib owner is the same as the player we're applying
+ // the effect to, it means our player is gibbed. Therefore, apply particles to the gibs instead.
+ entity head;
+ for(head = world; (head = find(head, classname, "gib")); )
+ {
+ if(head.team == self.team)
+ {
+ if(autocvar_cl_damageeffect_gibs)
+ {
+ if(autocvar_cl_damageeffect_gibs_randomize >= random())
+ pointparticles(self.dmgpartnum, head.origin, '0 0 0', 1);
+ self.dmgtime = time + autocvar_cl_damageeffect_gibs;
+ }
+ foundgib = TRUE;
+ }
+ }
+
+ if(foundgib || !autocvar_cl_damageeffect_player)
+ return; // don't show effects on the invisible dead body if gibs exist
+ if(self.team == player_localentnum - 1 && !autocvar_chase_active)
+ return; // if we aren't in third person mode, hide own damage effect
+
+ // Now apply the effect to actual players
+ pointparticles(self.dmgpartnum, org, '0 0 0', 1);
+ self.dmgtime = time + autocvar_cl_damageeffect_player;
+}
+
+void Ent_DamageEffect()
+{
+ float dmg, type, specnum1, specnum2, entnumber, life;
+ vector org;
+ string specstr, effectnum;
+ entity e;
+
+ dmg = ReadByte(); // damage amount
+ type = ReadByte(); // damage weapon
+ specnum1 = ReadByte(); // player species
+ entnumber = ReadByte(); // player entnum
+
+ if(!autocvar_cl_damageeffect_player && !autocvar_cl_damageeffect_gibs)
+ return;
+ if(autocvar_cl_gentle || autocvar_cl_gentle_damage)
+ return;
+
+ specnum2 = (specnum1 & 0x78) / 8; // blood type: using four bits (0..7, bit indexes 3,4,5)
+ specstr = species_prefix(specnum2);
+ life = bound(0, dmg * autocvar_cl_damageeffect_lifetime, autocvar_cl_damageeffect_lifetime_max);
+
+ e = get_weaponinfo(type);
+ effectnum = strcat("weapondamage_", e.netname);
+ // If the weapon is a bullet weapon, its damage effect is blood.
+ // Since blood is species dependent, we make this effect per-species.
+ if(type == WEP_SHOTGUN || type == WEP_UZI || type == WEP_RIFLE)
+ if(specstr != "")
+ {
+ effectnum = strcat(effectnum, "_", specstr);
+ effectnum = substring(effectnum, 0, strlen(effectnum) - 1); // remove the _ symbol at the end of the species name
+ }
+
+ // if the player already has a damage effect, update it instead of spawning a new one
+ entity head;
+ for(head = world; (head = find(head, classname, "damageeffect")); )
+ {
+ if(head.team == entnumber - 1)
+ {
+ head.dmgpartnum = particleeffectnum(effectnum);
+ head.lifetime += life;
+ return;
+ }
+ }
+
+ entity e;
+ e = spawn();
+ e.classname = "damageeffect";
+ e.team = entnumber - 1;
+ e.dmgpartnum = particleeffectnum(effectnum);
+ e.lifetime = time + life;
+ e.think = Ent_DamageEffect_Think;
+ e.nextthink = time;
+}
}
}
-void TossGib (string mdlname, vector safeorg, vector org, vector vconst, vector vrand, float specnum, float destroyontouch, float issilent)
+void TossGib (string mdlname, vector safeorg, vector org, vector vconst, vector vrand, float specnum, float destroyontouch, float issilent, float gibownernum)
{
entity gib;
// TODO remove some gibs according to cl_nogibs
gib = RubbleNew("gib");
+ gib.classname = "gib";
gib.move_movetype = MOVETYPE_BOUNCE;
gib.gravity = 1;
gib.solid = SOLID_CORPSE;
gib.cnt = specnum;
gib.silent = issilent;
+ gib.team = gibownernum - 1;
Gib_setmodel(gib, mdlname, specnum);
setsize (gib, '-8 -8 -8', '8 8 8');
void Ent_GibSplash(float isNew)
{
- float amount, type, specnum;
+ float amount, type, specnum, entnumber;
vector org, vel;
string specstr;
float issilent;
type = ReadByte(); // gibbage type
amount = ReadByte() / 16.0; // gibbage amount
+ entnumber = ReadByte(); // player num
org_x = ReadShort() * 4 + 2;
org_y = ReadShort() * 4 + 2;
org_z = ReadShort() * 4 + 2;
sound (self, CH_PAIN, "misc/gib.wav", VOL_BASE, ATTN_NORM);
if(prandom() < amount)
- TossGib ("models/gibs/eye.md3", org, org, vel, prandomvec() * 150, specnum, 0, issilent);
+ TossGib ("models/gibs/eye.md3", org, org, vel, prandomvec() * 150, specnum, 0, issilent, entnumber);
new_te_bloodshower(particleeffectnum(strcat(specstr, "bloodshower")), org, 1200, amount);
if(prandom() < amount)
- TossGib ("models/gibs/bloodyskull.md3", org, org + 16 * prandomvec(), vel, prandomvec() * 100, specnum, 0, issilent);
+ TossGib ("models/gibs/bloodyskull.md3", org, org + 16 * prandomvec(), vel, prandomvec() * 100, specnum, 0, issilent, entnumber);
for(c = 0; c < amount; ++c)
{
randomvalue = amount - c;
if(prandom() < randomvalue)
- TossGib ("models/gibs/arm.md3", org, org + 16 * prandomvec() + '0 0 8', vel, prandomvec() * (prandom() * 120 + 90), specnum,0, issilent);
+ TossGib ("models/gibs/arm.md3", org, org + 16 * prandomvec() + '0 0 8', vel, prandomvec() * (prandom() * 120 + 90), specnum,0, issilent, entnumber);
if(prandom() < randomvalue)
- TossGib ("models/gibs/arm.md3", org, org + 16 * prandomvec() + '0 0 8', vel, prandomvec() * (prandom() * 120 + 90), specnum,0, issilent);
+ TossGib ("models/gibs/arm.md3", org, org + 16 * prandomvec() + '0 0 8', vel, prandomvec() * (prandom() * 120 + 90), specnum,0, issilent, entnumber);
if(prandom() < randomvalue)
- TossGib ("models/gibs/chest.md3", org, org + 16 * prandomvec(), vel, prandomvec() * (prandom() * 120 + 80), specnum,0, issilent);
+ TossGib ("models/gibs/chest.md3", org, org + 16 * prandomvec(), vel, prandomvec() * (prandom() * 120 + 80), specnum,0, issilent, entnumber);
if(prandom() < randomvalue)
- TossGib ("models/gibs/smallchest.md3", org, org + 16 * prandomvec(), vel, prandomvec() * (prandom() * 120 + 80), specnum,0, issilent);
+ TossGib ("models/gibs/smallchest.md3", org, org + 16 * prandomvec(), vel, prandomvec() * (prandom() * 120 + 80), specnum,0, issilent, entnumber);
if(prandom() < randomvalue)
- TossGib ("models/gibs/leg1.md3", org, org + 16 * prandomvec() + '0 0 -5', vel, prandomvec() * (prandom() * 120 + 85), specnum,0, issilent);
+ TossGib ("models/gibs/leg1.md3", org, org + 16 * prandomvec() + '0 0 -5', vel, prandomvec() * (prandom() * 120 + 85), specnum,0, issilent, entnumber);
if(prandom() < randomvalue)
- TossGib ("models/gibs/leg2.md3", org, org + 16 * prandomvec() + '0 0 -5', vel, prandomvec() * (prandom() * 120 + 85), specnum,0, issilent);
+ TossGib ("models/gibs/leg2.md3", org, org + 16 * prandomvec() + '0 0 -5', vel, prandomvec() * (prandom() * 120 + 85), specnum,0, issilent, entnumber);
// these splat on impact
if(prandom() < randomvalue)
- TossGib ("models/gibs/chunk.mdl", org, org + 16 * prandomvec(), vel, prandomvec() * 450, specnum,1, issilent);
+ TossGib ("models/gibs/chunk.mdl", org, org + 16 * prandomvec(), vel, prandomvec() * 450, specnum,1, issilent, entnumber);
if(prandom() < randomvalue)
- TossGib ("models/gibs/chunk.mdl", org, org + 16 * prandomvec(), vel, prandomvec() * 450, specnum,1, issilent);
+ TossGib ("models/gibs/chunk.mdl", org, org + 16 * prandomvec(), vel, prandomvec() * 450, specnum,1, issilent, entnumber);
if(prandom() < randomvalue)
- TossGib ("models/gibs/chunk.mdl", org, org + 16 * prandomvec(), vel, prandomvec() * 450, specnum,1, issilent);
+ TossGib ("models/gibs/chunk.mdl", org, org + 16 * prandomvec(), vel, prandomvec() * 450, specnum,1, issilent, entnumber);
if(prandom() < randomvalue)
- TossGib ("models/gibs/chunk.mdl", org, org + 16 * prandomvec(), vel, prandomvec() * 450, specnum,1, issilent);
+ TossGib ("models/gibs/chunk.mdl", org, org + 16 * prandomvec(), vel, prandomvec() * 450, specnum,1, issilent, entnumber);
}
break;
case 0x02:
break;
case 0x03:
if(prandom() < amount)
- TossGib ("models/gibs/chunk.mdl", org, org, vel, prandomvec() * (prandom() * 30 + 20), specnum, 1, issilent); // TODO maybe adjust to more randomization?
+ TossGib ("models/gibs/chunk.mdl", org, org, vel, prandomvec() * (prandom() * 30 + 20), specnum, 1, issilent, entnumber); // TODO maybe adjust to more randomization?
break;
case 0x81:
pointparticles(particleeffectnum(strcat(gentle_prefix, "damage_dissolve")), org, vel, amount);
const float ENT_CLIENT_ACCURACY = 30;
const float ENT_CLIENT_SHOWNAMES = 31;
const float ENT_CLIENT_WARPZONE_TELEPORTED = 32;
-const float ENT_CLIENT_MODEL = 33;
+const float ENT_CLIENT_DAMAGEEFFECT = 33;
+const float ENT_CLIENT_MODEL = 34;
const float ENT_CLIENT_TURRET = 40;
const float ENT_CLIENT_AUXILIARYXHAIR = 50;
Drag_MoveDrag(oldself, self);
+ self.owner = oldself;
+
if(self.colormap <= maxclients && self.colormap > 0)
self.colormap = 1024 + oldself.clientcolors;
Violence_GibSplash(self, 1, 1, attacker);
self.alpha = -1;
self.solid = SOLID_NOT; // restore later
+ self.takedamage = DAMAGE_NO; // restore later
}
}
void Damage (entity targ, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
{
+ // if the target is a player or dead body, activate damage effects
+ if(targ.classname == "player" || targ.classname == "body")
+ Violence_DamageEffect(targ, damage, DEATH_WEAPONOF(deathtype));
+
float mirrordamage;
float mirrorforce;
float teamdamage0;
WriteByte(MSG_ENTITY, ENT_CLIENT_GIBSPLASH);
WriteByte(MSG_ENTITY, self.state); // actually type
WriteByte(MSG_ENTITY, bound(1, self.cnt * 16, 255)); // gibbage amount multiplier
+ WriteByte(MSG_ENTITY, self.team); // player num
WriteShort(MSG_ENTITY, floor(self.origin_x / 4)); // not using a coord here, as gibs don't need this accuracy
WriteShort(MSG_ENTITY, floor(self.origin_y / 4)); // not using a coord here, as gibs don't need this accuracy
WriteShort(MSG_ENTITY, floor(self.origin_z / 4)); // not using a coord here, as gibs don't need this accuracy
if(!sound_allowed(MSG_BROADCAST, gibowner) || !sound_allowed(MSG_BROADCAST, attacker))
e.state |= 0x40; // "silence" bit
e.state |= 8 * self.species; // gib type, ranges from 0 to 15
+
+ // if this is a copied dead body, send the num of its player instead
+ if(self.classname == "body")
+ e.team = num_for_edict(self.owner);
+ else
+ e.team = num_for_edict(self);
+
setorigin(e, org);
e.velocity = dir;
{
Violence_GibSplash_At(source.origin + source.view_ofs, source.velocity, type, amount, source, attacker);
}
+
+// damage effect
+
+float Violence_DamageEffect_SendEntity(entity to, float sf)
+{
+ WriteByte(MSG_ENTITY, ENT_CLIENT_DAMAGEEFFECT);
+ WriteByte(MSG_ENTITY, self.cnt); // damage amount
+ WriteByte(MSG_ENTITY, self.weapon); // damage weapon
+ WriteByte(MSG_ENTITY, self.state); // player species
+ WriteByte(MSG_ENTITY, self.team); // player entnum
+ return TRUE;
+}
+
+void Violence_DamageEffect(entity pl, float damage, float type)
+{
+ if(sv_gentle || !type)
+ return; // return if gentle mode is enabled or the damage was not caused by a weapon
+
+ entity e;
+ e = spawn();
+ e.cnt = damage;
+ e.weapon = type;
+ e.state |= 8 * pl.species; // gib type, ranges from 0 to 15
+
+ // if this is a copied dead body, send the num of its player instead
+ if(pl.classname == "body")
+ e.team = num_for_edict(pl.owner);
+ else
+ e.team = num_for_edict(pl);
+
+ Net_LinkEntity(e, FALSE, 0.2, Violence_DamageEffect_SendEntity);
+}