2 float maxclients; // set by worldspawn code
7 //void(vector org, entity en, vector dir, float splattype, float importance) newbloodsplat;
8 //void(vector org, float bodydamage, float armordamage, vector vel, float damgtype) genericbleedfunc;
10 // removes the oldest decors each frame to maintain a certain maximum decors
13 local entity estart, e, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10;
14 local float bt1, bt2, bt3, bt4, bt5, bt6, bt7, bt8, bt9, bt10, iterations;
16 // numdecors is allowed to be bogus as long as it is >= the real number of decors
17 // (but perfection is clearly preferable)
18 if (numdecors <= maxdecors)
21 // recount all the decors
23 estart = e = findchain(classname, "decor");
26 numdecors = numdecors + 1;
29 if (numdecors <= maxdecors)
30 return; // nothing to do
32 // limit it to considering 10000 entities per frame,
33 // otherwise it can cause a runaway loop error
35 while (numdecors > maxdecors && iterations < 10000)
37 iterations = iterations + 1;
38 // find and remove the oldest decors (upto 10 at once)
39 b1 = b2 = b3 = b4 = b5 = b6 = b7 = b8 = b9 = b10 = world;
40 bt1 = bt2 = bt3 = bt4 = bt5 = bt6 = bt7 = bt8 = bt9 = bt10 = time + 10000;
42 estart = findchain(classname, "decor");
46 iterations = iterations + 1;
47 if (e.createdtime < bt10)
49 if (e.createdtime < bt9)
51 if (e.createdtime < bt8)
53 if (e.createdtime < bt7)
55 if (e.createdtime < bt6)
57 if (e.createdtime < bt5)
59 if (e.createdtime < bt4)
61 if (e.createdtime < bt3)
63 if (e.createdtime < bt2)
65 if (e.createdtime < bt1)
76 b1=e;bt1=e.createdtime;
88 b2=e;bt2=e.createdtime;
100 b3=e;bt3=e.createdtime;
111 b4=e;bt4=e.createdtime;
121 b5=e;bt5=e.createdtime;
130 b6=e;bt6=e.createdtime;
138 b7=e;bt7=e.createdtime;
145 b8=e;bt8=e.createdtime;
151 b9=e;bt9=e.createdtime;
156 b10=e;bt10=e.createdtime;
159 // failed all 10 slots
162 // remove the oldest decors
163 if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b1);}
164 if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b2);}
165 if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b3);}
166 if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b4);}
167 if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b5);}
168 if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b6);}
169 if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b7);}
170 if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b8);}
171 if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b9);}
172 if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b10);}
181 e.classname = "decor";
185 void(entity e) removedecor =
192 void(vector org, vector vel, float amount) blood =
194 te_blood(org, vel, amount);
197 void(vector org, vector vel, float amount) spark =
199 te_spark(org, vel, amount);
202 void(vector m1, vector m2, float vel, float amount) bloodshower =
204 te_bloodshower(m1, m2, vel, amount);
207 void(vector org, float quad) bulletpuff =
215 void(vector org, float quad) nailpuff =
218 te_superspikequad(org);
223 // used for various little bouncing debris to avoid getting stuck in the air
226 self.nextthink = time;
227 self.flags = self.flags - (self.flags & FL_ONGROUND);
228 if (pointcontents(self.origin) == CONTENT_SOLID)
236 // different number of decors in multi-player (to avoid lag on modems)
241 // overridable by saved2 cvar on server console
243 maxdecors = cvar("decors");