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)
31 if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
38 if(!trace_ent || trace_ent.solid == SOLID_BSP)
40 if(vlen(self.velocity) > 50)
42 if(time >= self.nextthink)
47 f = floor(prandom() * 3) + 1;
51 s = strcat("weapons/casings", ftos(f), ".wav");
54 s = strcat("weapons/brass", ftos(f), ".wav");
58 sound (self, CH_SHOTS, s, VOL_BASE, ATTN_NORM);
63 self.nextthink = time + 0.2;
66 void Casing_Damage(float thisdmg, float hittype, vector org, vector thisforce)
70 self.move_velocity = self.move_velocity + thisforce + '0 0 100';
71 self.move_flags &~= FL_ONGROUND;
74 void Ent_Casing(float isNew)
78 casing = RubbleNew("casing");
79 casing.state = ReadByte();
80 casing.silent = (casing.state & 0x80);
81 casing.state = (casing.state & 0x7F);
82 casing.origin_x = ReadCoord();
83 casing.origin_y = ReadCoord();
84 casing.origin_z = ReadCoord();
85 casing.velocity = decompressShortVector(ReadShort());
86 casing.angles_x = ReadByte() * 360 / 256;
87 casing.angles_y = ReadByte() * 360 / 256;
88 casing.angles_z = ReadByte() * 360 / 256;
89 casing.drawmask = MASK_NORMAL;
91 if(autocvar_cl_casings && isNew) {
92 casing.draw = Casing_Draw;
93 casing.move_origin = casing.origin;
94 casing.move_velocity = casing.velocity + 2 * prandomvec();
95 casing.move_angles = casing.angles;
96 casing.move_avelocity = '0 250 0' + 100 * prandomvec();
97 casing.move_movetype = MOVETYPE_BOUNCE;
98 casing.move_touch = Casing_Touch;
99 casing.move_time = time;
100 casing.event_damage = Casing_Damage;
101 casing.solid = SOLID_TRIGGER;
106 setmodel(casing, "models/casing_shell.mdl");
107 casing.cnt = time + autocvar_cl_casings_shell_time;
110 setmodel(casing, "models/casing_bronze.iqm");
111 casing.cnt = time + autocvar_cl_casings_bronze_time;
115 setsize(casing, '0 0 -1', '0 0 -1');
120 RubbleLimit("casing", autocvar_cl_casings_maxcount, Casing_Delete);
123 void Casings_Precache()
125 precache_model("models/casing_shell.mdl");
126 precache_model("models/casing_bronze.iqm");
127 precache_sound("weapons/brass1.wav");
128 precache_sound("weapons/brass2.wav");
129 precache_sound("weapons/brass3.wav");
130 precache_sound("weapons/casings1.wav");
131 precache_sound("weapons/casings2.wav");
132 precache_sound("weapons/casings3.wav");