mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-30 15:37:36 +01:00
35 lines
4.2 KiB
HTML
35 lines
4.2 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><base href="../"><link rel="stylesheet" href="dmdoc.css"><title>/mob/oranges_ear - Space Station 13</title></head><body><header><a href="index.html">Space Station 13</a> - <a href="index.html#modules">Modules</a> - <a href="index.html#types">Types</a> — <a href="mob/oranges_ear.html#var">Var Details</a> - <a href="mob/oranges_ear.html#proc">Proc Details</a></header><main><h1>oranges_ear <aside>/<a href="mob.html">mob</a>/<a href="mob/oranges_ear.html">oranges_ear</a></aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/edee60476d21ee840643bd1abe7f6003a8c65773/code/__HELPERS/spatial_info.dm#L17"><img src="git.png" width="16" height="16" title="code/__HELPERS/spatial_info.dm 17"></a></h1><ul>
|
||
<li><h1 id="oranges-ear">Oranges Ear</h1></li>
|
||
<li>
|
||
<p>turns out view() spends a significant portion of its processing time generating lists of contents of viewable turfs which includes EVERYTHING on it visible</p>
|
||
</li>
|
||
<li>
|
||
<p>and the turf itself. there is an optimization to view() which makes it only iterate through either /obj or /mob contents, as well as normal list typechecking filters</p>
|
||
</li>
|
||
<li>
|
||
<p>a fuckton of these are generated as part of its SS's init and stored in a list, when requested for a list of movables returned by the spatial grid or by some</p>
|
||
</li>
|
||
<li>
|
||
<p>superset of the final output that must be narrowed down by view(), one of these gets put on every turf that contains the movables that need filtering</p>
|
||
</li>
|
||
<li>
|
||
<p>and each is given references to the movables they represent. that way you can do for(var/mob/oranges_ear/ear in view(...)) and check what they reference</p>
|
||
</li>
|
||
<li>
|
||
<p>as opposed to for(var/atom/movable/target in view(...)) and checking if they have the properties you want which leads to much larger lists generated by view()</p>
|
||
</li>
|
||
<li>
|
||
<p>and also leads to iterating through more movables to filter them.</p>
|
||
</li>
|
||
<li>
|
||
<p>TLDR: iterating through just mobs is much faster than all movables when iterating through view() on average, this system leverages that to boost speed</p>
|
||
</li>
|
||
<li>
|
||
<p>enough to offset the cost of allocating the mobs</p>
|
||
</li>
|
||
<li>
|
||
<p>named because the idea was first made by oranges and i didnt know what else to call it (note that this system was originally made for get_hearers_in_view())</p>
|
||
</li>
|
||
</ul><table class="summary" cellspacing="0"><tr><td colspan="2"><h2>Vars</h2></td></tr><tr><th><a href="mob/oranges_ear.html#var/references">references</a></th><td>references to everything "on" the turf we are assigned to, that we care about. populated in assign() and cleared in unassign().
|
||
movables iside of other movables count as being "on" if they have get_turf(them) == our turf. intentionally not a lazylist</td></tr><tr><td colspan="2"><h2>Procs</h2></td></tr><tr><th><a href="mob/oranges_ear.html#proc/unassign">unassign</a></th><td>clean this oranges_ear up for future use</td></tr></table><h2 id="var">Var Details</h2><h3 id="var/references"><aside class="declaration">var </aside>references <aside>– /list</aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/edee60476d21ee840643bd1abe7f6003a8c65773/code/__HELPERS/spatial_info.dm#L28"><img src="git.png" width="16" height="16" title="code/__HELPERS/spatial_info.dm 28"></a></h3><p>references to everything "on" the turf we are assigned to, that we care about. populated in assign() and cleared in unassign().
|
||
movables iside of other movables count as being "on" if they have get_turf(them) == our turf. intentionally not a lazylist</p><h2 id="proc">Proc Details</h2><h3 id="proc/unassign"><aside class="declaration">proc </aside>unassign<aside>() <a href="https://github.com/ParadiseSS13/Paradise/blob/edee60476d21ee840643bd1abe7f6003a8c65773/code/__HELPERS/spatial_info.dm#L64"><img src="git.png" width="16" height="16" title="code/__HELPERS/spatial_info.dm 64"></a></aside></h3><p>clean this oranges_ear up for future use</p></main><footer>paradise.dme <a href="https://github.com/ParadiseSS13/Paradise/tree/edee60476d21ee840643bd1abe7f6003a8c65773">edee604</a> (master) — <a href="https://github.com/SpaceManiac/SpacemanDMM/blob/master/crates/dmdoc/README.md">dmdoc 1.11.0</a></footer></body></html> |