- // casing code
- if (cvar("g_casings") >= 1)
- for (sc = 0;sc < ammoamount;sc = sc + 1)
- SpawnCasing (((random () * 50 + 50) * v_right) - (v_forward * (random () * 25 + 25)) - ((random () * 5 - 30) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 1, self);
-
- flash = spawn();
- setmodel(flash, "models/uziflash.md3"); // precision set below
- flash.scale = 1.2;
- flash.think = SUB_Remove;
- flash.nextthink = time + 0.06;
- flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
- W_AttachToShotorg(flash, '5 0 0');
+ // apply the damage, also remove self
+ if(trace_fraction < 1 && trace_ent.takedamage == DAMAGE_AIM && (trace_ent.classname == "player" || trace_ent.classname == "body"))
+ {
+ vector force;
+ force = angle * cvar("g_balance_shotgun_secondary_force");
+ Damage (trace_ent, self.owner, self.owner, cvar("g_balance_shotgun_secondary_damage") * min(1, f + 1), WEP_SHOTGUN | HITTYPE_SECONDARY , self.owner.origin + self.owner.view_ofs, force);
+ Damage_RecordDamage(self.owner, WEP_SHOTGUN | HITTYPE_SECONDARY, cvar("g_balance_shotgun_secondary_damage") * min(1, f + 1));
+ remove(self);
+ }
+ else if(time >= self.cnt + cvar("g_balance_shotgun_secondary_melee_time")) // missed, remove ent
+ remove(self);
+ else // continue swinging the weapon in hope of hitting someone :)
+ self.nextthink = time;