Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- entity multi_ent;
- float multi_damage;
- void() ClearMultiDamage =
- {
- multi_ent = world;
- multi_damage = 0;
- };
- void() ApplyMultiDamage =
- {
- if (multi_ent == world)
- return;
- Damage(multi_ent, self, self, multi_damage, "shotgun");
- };
- void(entity hit, float damage) AddMultiDamage =
- {
- if (hit == world)
- return;
- if (hit != multi_ent)
- {
- ApplyMultiDamage();
- multi_damage = damage;
- multi_ent = hit;
- }
- else
- multi_damage = multi_damage + damage;
- };
- void(float damage, vector dir) TraceAttack =
- {
- local vector vel, org;
- vel = normalize(dir + v_up*crandom() + v_right*crandom());
- vel = vel + 2*trace_plane_normal;
- vel = vel * 4;
- org = trace_endpos - dir*8;
- W_Impact (trace_ent, org, vel, damage*8, TE_GUNSHOT);
- if (trace_ent.takedamage)
- AddMultiDamage (trace_ent, damage);
- };
- void(float shotcount, vector spread) FireBullets =
- {
- local vector direction;
- local vector src;
- local entity ignore;
- makevectors(self.v_angle);
- ClearMultiDamage();
- while (shotcount > 0)
- {
- src = self.origin + v_forward*10;
- src_z = self.absmin_z + self.size_z * 0.7;
- direction = v_forward + crandom()*spread_x*v_right + crandom()*spread_y*v_up;
- ignore = self;
- do
- {
- traceline (src, src + direction*2048, FALSE, ignore);
- if (trace_fraction != 1)
- {
- TraceAttack (4, direction);
- src = trace_endpos;
- ignore = trace_ent;
- }
- } while ((trace_ent != world) && (trace_fraction != 1)/* && (trace_ent.solid != SOLID_BSP)*/);
- shotcount = shotcount - 1;
- }
- ApplyMultiDamage();
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement