10 if(self.move_flags & FL_ONGROUND)
\r
12 self.move_angles_x = 0;
\r
13 self.move_angles_z = 0;
\r
14 self.flags &~= FL_ONGROUND;
\r
17 Movetype_Physics_MatchTicrate(autocvar_cl_casings_ticrate, autocvar_cl_casings_sloppy);
\r
19 self.renderflags = 0;
\r
20 self.alpha = bound(0, self.cnt - time, 1);
\r
22 if(self.alpha < ALPHA_MIN_VISIBLE)
\r
30 if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
\r
37 if(!trace_ent || trace_ent.solid == SOLID_BSP)
\r
39 if(vlen(self.velocity) > 50)
\r
41 if(time >= self.nextthink)
\r
46 f = floor(prandom() * 3) + 1;
\r
50 s = strcat("casings/fuel_casing", ftos(f), ".wav");
\r
56 sound (self, CHAN_PROJECTILE, s, VOL_BASE, ATTN_NORM);
\r
61 self.nextthink = time + 0.2;
\r
64 void Casing_Damage(float thisdmg, float hittype, vector org, vector thisforce)
\r
68 self.move_velocity = self.move_velocity + thisforce + '0 0 100';
\r
69 self.move_flags &~= FL_ONGROUND;
\r
72 void Ent_Casing(float isNew)
\r
76 casing = RubbleNew("casing");
\r
77 casing.state = ReadByte();
\r
78 casing.silent = (casing.state & 0x80);
\r
79 casing.state = (casing.state & 0x7F);
\r
80 casing.origin_x = ReadCoord();
\r
81 casing.origin_y = ReadCoord();
\r
82 casing.origin_z = ReadCoord();
\r
83 casing.velocity = decompressShortVector(ReadShort());
\r
84 casing.angles_x = ReadByte() * 360 / 256;
\r
85 casing.angles_y = ReadByte() * 360 / 256;
\r
86 casing.angles_z = ReadByte() * 360 / 256;
\r
88 if(cvar("cl_casings") && isNew) {
\r
89 casing.draw = Casing_Draw;
\r
90 casing.move_origin = casing.origin;
\r
91 casing.move_velocity = casing.velocity + 2 * prandomvec();
\r
92 casing.move_angles = casing.angles;
\r
93 casing.move_avelocity = '0 250 0' + 100 * prandomvec();
\r
94 casing.move_movetype = MOVETYPE_BOUNCE;
\r
95 casing.move_touch = Casing_Touch;
\r
96 casing.move_time = time;
\r
97 casing.event_damage = Casing_Damage;
\r
98 casing.solid = SOLID_TRIGGER;
\r
99 casing.cnt = time + cvar("cl_casings_time");
\r
101 switch(casing.state)
\r
104 setmodel(casing, "models/casings/fuel_casing.md3");
\r
110 setsize(casing, '0 0 -1', '0 0 -1');
\r
115 RubbleLimit("casing", cvar_or("cl_casings_maxcount",100), Casing_Delete);
\r
118 void Casings_Precache()
\r
120 precache_model("models/casings/fuel_casing.md3");
\r
121 precache_sound("casings/fuel_casing1.wav");
\r
122 precache_sound("casings/fuel_casing2.wav");
\r
123 precache_sound("casings/fuel_casing3.wav");
\r