2 float maxclients; // set by worldspawn code
8 //void(vector org, entity en, vector dir, float splattype, float importance) newbloodsplat;
9 //void(vector org, float bodydamage, float armordamage, vector vel, float damgtype) genericbleedfunc;
11 // removes the oldest decors each frame to maintain a certain maximum decors
14 local entity estart, e, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10;
15 local float bt1, bt2, bt3, bt4, bt5, bt6, bt7, bt8, bt9, bt10, iterations;
17 // numdecors is allowed to be bogus as long as it is >= the real number of decors
18 // (but perfection is clearly preferable)
19 if (numdecors <= maxdecors)
22 // recount all the decors
24 estart = e = findchain(classname, "decor");
27 numdecors = numdecors + 1;
30 if (numdecors <= maxdecors)
31 return; // nothing to do
33 // limit it to considering 10000 entities per frame,
34 // otherwise it can cause a runaway loop error
36 while (numdecors > maxdecors && iterations < 10000)
38 iterations = iterations + 1;
39 // find and remove the oldest decors (upto 10 at once)
40 b1 = b2 = b3 = b4 = b5 = b6 = b7 = b8 = b9 = b10 = world;
41 bt1 = bt2 = bt3 = bt4 = bt5 = bt6 = bt7 = bt8 = bt9 = bt10 = time + 10000;
43 estart = findchain(classname, "decor");
47 iterations = iterations + 1;
48 if (e.createdtime < bt10)
50 if (e.createdtime < bt9)
52 if (e.createdtime < bt8)
54 if (e.createdtime < bt7)
56 if (e.createdtime < bt6)
58 if (e.createdtime < bt5)
60 if (e.createdtime < bt4)
62 if (e.createdtime < bt3)
64 if (e.createdtime < bt2)
66 if (e.createdtime < bt1)
77 b1=e;bt1=e.createdtime;
89 b2=e;bt2=e.createdtime;
101 b3=e;bt3=e.createdtime;
112 b4=e;bt4=e.createdtime;
122 b5=e;bt5=e.createdtime;
131 b6=e;bt6=e.createdtime;
139 b7=e;bt7=e.createdtime;
146 b8=e;bt8=e.createdtime;
152 b9=e;bt9=e.createdtime;
157 b10=e;bt10=e.createdtime;
160 // failed all 10 slots
163 // remove the oldest decors
164 if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b1);}
165 if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b2);}
166 if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b3);}
167 if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b4);}
168 if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b5);}
169 if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b6);}
170 if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b7);}
171 if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b8);}
172 if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b9);}
173 if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b10);}
182 e.classname = "decor";
186 void(entity e) removedecor =
193 void(vector org, vector vel, float amount) blood =
195 te_blood(org, vel, amount);
198 void(vector org, vector vel, float amount) spark =
200 te_spark(org, vel, amount);
203 void(vector m1, vector m2, float vel, float amount) bloodshower =
205 te_bloodshower(m1, m2, vel, amount);
208 void(vector org, float quad) bulletpuff =
216 void(vector org, float quad) nailpuff =
219 te_superspikequad(org);
224 // used for various little bouncing debris to avoid getting stuck in the air
227 self.nextthink = time;
228 self.flags = self.flags - (self.flags & FL_ONGROUND);
229 if (pointcontents(self.origin) == CONTENT_SOLID)
237 // different number of decors in multi-player (to avoid lag on modems)
242 // overridable by saved2 cvar on server console
244 maxdecors = cvar("decors");