10 if(self.move_flags & FL_ONGROUND)
12 self.move_angles_x = 0;
13 self.move_angles_z = 0;
14 self.flags &~= FL_ONGROUND;
17 Movetype_Physics_MatchTicrate(autocvar_cl_casings_ticrate, autocvar_cl_casings_sloppy);
20 self.alpha = bound(0, self.cnt - time, 1);
22 if(self.alpha < ALPHA_MIN_VISIBLE)
30 if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
37 if(!trace_ent || trace_ent.solid == SOLID_BSP)
39 if(vlen(self.velocity) > 50)
41 if(time >= self.nextthink)
46 f = floor(prandom() * 3) + 1;
50 s = strcat("weapons/casings", ftos(f), ".wav");
53 s = strcat("weapons/brass", ftos(f), ".wav");
57 sound (self, CHAN_PROJECTILE, s, VOL_BASE, ATTN_NORM);
62 self.nextthink = time + 0.2;
65 void Casing_Damage(float thisdmg, float hittype, vector org, vector thisforce)
69 self.move_velocity = self.move_velocity + thisforce + '0 0 100';
70 self.move_flags &~= FL_ONGROUND;
73 void Ent_Casing(float isNew)
77 casing = RubbleNew("casing");
78 casing.state = ReadByte();
79 casing.silent = (casing.state & 0x80);
80 casing.state = (casing.state & 0x7F);
81 casing.origin_x = ReadCoord();
82 casing.origin_y = ReadCoord();
83 casing.origin_z = ReadCoord();
84 casing.velocity = decompressShortVector(ReadShort());
85 casing.angles_x = ReadByte() * 360 / 256;
86 casing.angles_y = ReadByte() * 360 / 256;
87 casing.angles_z = ReadByte() * 360 / 256;
89 if(cvar("cl_casings") && isNew) {
90 casing.draw = Casing_Draw;
91 casing.move_origin = casing.origin;
92 casing.move_velocity = casing.velocity + 2 * prandomvec();
93 casing.move_angles = casing.angles;
94 casing.move_avelocity = '0 250 0' + 100 * prandomvec();
95 casing.move_movetype = MOVETYPE_BOUNCE;
96 casing.move_touch = Casing_Touch;
97 casing.move_time = time;
98 casing.event_damage = Casing_Damage;
99 casing.solid = SOLID_TRIGGER;
104 setmodel(casing, "models/casing_shell.mdl");
105 casing.cnt = time + cvar("cl_casings_shell_time");
108 setmodel(casing, "models/casing_bronze.mdl");
109 casing.cnt = time + cvar("cl_casings_bronze_time");
113 setsize(casing, '0 0 -1', '0 0 -1');
118 RubbleLimit("casing", cvar_or("cl_casings_maxcount",100), Casing_Delete);
121 void Casings_Precache()
123 precache_model("models/casing_shell.mdl");
124 precache_model("models/casing_bronze.mdl");
125 precache_sound("weapons/brass1.wav");
126 precache_sound("weapons/brass2.wav");
127 precache_sound("weapons/brass3.wav");
128 precache_sound("weapons/casings1.wav");
129 precache_sound("weapons/casings2.wav");
130 precache_sound("weapons/casings3.wav");