MCPcopy Create free account
hub / github.com/assaultcube/AC / entproperty

Function entproperty

source/src/world.cpp:208–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206COMMANDF(getclosestent, "", () { intret(closestent()); });
207
208void entproperty(int *prop, float *famount, int *unscaled)
209{
210 int n = closestent(), amount = *prop >= 100 ? -1 : 1;
211 *prop %= 100;
212 if(n < 0) return;
213 entity &e = ents[n];
214 int old_a1 = e.attr1;
215 int t = e.type < MAXENTTYPES ? e.type : 0;
216 amount *= int(*famount * (*prop >= 0 && *prop < 7 && !*unscaled ? entscale[t][*prop] : 1));
217
218 switch(*prop)
219 {
220 case 0: e.attr1 += amount; break;
221 case 1: e.attr2 += amount; break;
222 case 2: e.attr3 += amount; break;
223 case 3: e.attr4 += amount; break;
224 case 4: e.attr5 += amount; break;
225 case 5: e.attr6 += amount; break;
226 case 6: e.attr7 += amount; break;
227 case 11: e.x += amount; break;
228 case 12: e.y += amount; break;
229 case 13: e.z += amount; break;
230 }
231 clampentityattributes(e);
232 switch(e.type)
233 {
234 case LIGHT: calclight(); break;
235 case SOUND:
236 audiomgr.preloadmapsound(e);
237 entityreference entref(&e);
238 location *loc = audiomgr.locations.find(old_a1, &entref, mapsounds);
239 if(loc)
240 loc->drop();
241 }
242 if(changedents.find(n) == -1) changedents.add(n); // apply ent changes later (reduces network traffic)
243 unsavededits++;
244}
245COMMAND(entproperty, "ifi");
246
247hashtable<char *, enet_uint32> mapinfo, &resdata = mapinfo;

Callers

nothing calls this directly

Calls 7

closestentFunction · 0.85
clampentityattributesFunction · 0.85
calclightFunction · 0.85
preloadmapsoundMethod · 0.80
findMethod · 0.45
dropMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected