Files

15 lines
10 KiB
HTML

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><base href="../../"><link rel="stylesheet" href="dmdoc.css"><title>code/__DEFINES/directions.dm - 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="code/__DEFINES/directions.html#define">Define Details</a></header><main><h1>code/__DEFINES/directions.dm <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/__DEFINES/directions.dm"><img src="git.png" width="16" height="16" title="code/__DEFINES/directions.dm"></a></h1><table class="summary" cellspacing="0"><tr><th><a href="code/__DEFINES/directions.html#define/NO_DIRECTION">NO_DIRECTION</a></th><td>define purely for readability, cables especially need to use this as <code>NO_DIRECTION</code> represents a &quot;node&quot;</td></tr><tr><th><a href="code/__DEFINES/directions.html#define/FLIP_DIR_HORIZONTALLY">FLIP_DIR_HORIZONTALLY</a></th><td>Using the ^ operator or XOR, we can compared TRUE East and West bits against our direction,
since XOR will only return TRUE if one bit is False and the other is True, if East is 0, that bit will return TRUE
and if West is 1, then that bit will return 0
hence EAST (0010) XOR EAST|WEST (0011) --&gt; WEST (0001)
Flips a direction along the horizontal axis, will convert E -&gt; W, W -&gt; E, NE -&gt; NW, SE -&gt; SW, etc</td></tr><tr><th><a href="code/__DEFINES/directions.html#define/FLIP_DIR_VERTICALLY">FLIP_DIR_VERTICALLY</a></th><td>Flips a direction along the vertical axis, will convert N -&gt; S, S -&gt; N, NE -&gt; SE, SW -&gt; NW, etc</td></tr><tr><th><a href="code/__DEFINES/directions.html#define/IS_DIR_DIAGONAL">IS_DIR_DIAGONAL</a></th><td>for directions, each cardinal direction only has 1 TRUE bit, so <code>1000</code> or <code>0100</code> for example, so when you subtract 1
from a cardinal direction it results in that directions initial TRUE bit always switching to FALSE, so if you &amp; check it
against its initial self, it will return false, indicating that the direction is straight and not diagonal
returns TRUE if direction is diagonal and false if not</td></tr><tr><th><a href="code/__DEFINES/directions.html#define/IS_DIR_CARDINAL">IS_DIR_CARDINAL</a></th><td>returns TRUE if direction is cardinal and false if not</td></tr><tr><th><a href="code/__DEFINES/directions.html#define/NSCOMPONENT">NSCOMPONENT</a></th><td>True if the dir is north or south, false therwise</td></tr><tr><th><a href="code/__DEFINES/directions.html#define/EWCOMPONENT">EWCOMPONENT</a></th><td>True if the dir is east/west, false otherwise</td></tr><tr><th><a href="code/__DEFINES/directions.html#define/REVERSE_DIR">REVERSE_DIR</a></th><td>Inverse direction, taking into account UP|DOWN if necessary.</td></tr><tr><th><a href="code/__DEFINES/directions.html#define/DIR_JUST_HORIZONTAL">DIR_JUST_HORIZONTAL</a></th><td>returns TRUE if the direction is EAST or WEST</td></tr><tr><th><a href="code/__DEFINES/directions.html#define/DIR_JUST_VERTICAL">DIR_JUST_VERTICAL</a></th><td>returns TRUE if the direction is NORTH or SOUTH</td></tr><tr><th><a href="code/__DEFINES/directions.html#define/TEXT_NORTH">TEXT_NORTH</a></th><td>North direction as a string &quot;[1]&quot;</td></tr><tr><th><a href="code/__DEFINES/directions.html#define/TEXT_SOUTH">TEXT_SOUTH</a></th><td>South direction as a string &quot;[2]&quot;</td></tr><tr><th><a href="code/__DEFINES/directions.html#define/TEXT_EAST">TEXT_EAST</a></th><td>East direction as a string &quot;[4]&quot;</td></tr><tr><th><a href="code/__DEFINES/directions.html#define/TEXT_WEST">TEXT_WEST</a></th><td>West direction as a string &quot;[8]&quot;</td></tr></table><h2 id="define">Define Details</h2><h3 id="define/DIR_JUST_HORIZONTAL"><aside class="declaration">#define </aside>DIR_JUST_HORIZONTAL<aside>(dir)</aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/__DEFINES/directions.dm#L40"><img src="git.png" width="16" height="16" title="code/__DEFINES/directions.dm 40"></a></h3><p>returns TRUE if the direction is EAST or WEST</p><h3 id="define/DIR_JUST_VERTICAL"><aside class="declaration">#define </aside>DIR_JUST_VERTICAL<aside>(dir)</aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/__DEFINES/directions.dm#L42"><img src="git.png" width="16" height="16" title="code/__DEFINES/directions.dm 42"></a></h3><p>returns TRUE if the direction is NORTH or SOUTH</p><h3 id="define/EWCOMPONENT"><aside class="declaration">#define </aside>EWCOMPONENT<aside>(d)</aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/__DEFINES/directions.dm#L35"><img src="git.png" width="16" height="16" title="code/__DEFINES/directions.dm 35"></a></h3><p>True if the dir is east/west, false otherwise</p><h3 id="define/FLIP_DIR_HORIZONTALLY"><aside class="declaration">#define </aside>FLIP_DIR_HORIZONTALLY<aside>(dir)</aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/__DEFINES/directions.dm#L19"><img src="git.png" width="16" height="16" title="code/__DEFINES/directions.dm 19"></a></h3><p>Using the ^ operator or XOR, we can compared TRUE East and West bits against our direction,
since XOR will only return TRUE if one bit is False and the other is True, if East is 0, that bit will return TRUE
and if West is 1, then that bit will return 0
hence EAST (0010) XOR EAST|WEST (0011) --&gt; WEST (0001)
Flips a direction along the horizontal axis, will convert E -&gt; W, W -&gt; E, NE -&gt; NW, SE -&gt; SW, etc</p><h3 id="define/FLIP_DIR_VERTICALLY"><aside class="declaration">#define </aside>FLIP_DIR_VERTICALLY<aside>(dir)</aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/__DEFINES/directions.dm#L21"><img src="git.png" width="16" height="16" title="code/__DEFINES/directions.dm 21"></a></h3><p>Flips a direction along the vertical axis, will convert N -&gt; S, S -&gt; N, NE -&gt; SE, SW -&gt; NW, etc</p><h3 id="define/IS_DIR_CARDINAL"><aside class="declaration">#define </aside>IS_DIR_CARDINAL<aside>(dir)</aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/__DEFINES/directions.dm#L30"><img src="git.png" width="16" height="16" title="code/__DEFINES/directions.dm 30"></a></h3><p>returns TRUE if direction is cardinal and false if not</p><h3 id="define/IS_DIR_DIAGONAL"><aside class="declaration">#define </aside>IS_DIR_DIAGONAL<aside>(dir)</aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/__DEFINES/directions.dm#L28"><img src="git.png" width="16" height="16" title="code/__DEFINES/directions.dm 28"></a></h3><p>for directions, each cardinal direction only has 1 TRUE bit, so <code>1000</code> or <code>0100</code> for example, so when you subtract 1
from a cardinal direction it results in that directions initial TRUE bit always switching to FALSE, so if you &amp; check it
against its initial self, it will return false, indicating that the direction is straight and not diagonal
returns TRUE if direction is diagonal and false if not</p><h3 id="define/NO_DIRECTION"><aside class="declaration">#define </aside>NO_DIRECTION <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/__DEFINES/directions.dm#L3"><img src="git.png" width="16" height="16" title="code/__DEFINES/directions.dm 3"></a></h3><p>define purely for readability, cables especially need to use this as <code>NO_DIRECTION</code> represents a &quot;node&quot;</p><h3 id="define/NSCOMPONENT"><aside class="declaration">#define </aside>NSCOMPONENT<aside>(d)</aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/__DEFINES/directions.dm#L33"><img src="git.png" width="16" height="16" title="code/__DEFINES/directions.dm 33"></a></h3><p>True if the dir is north or south, false therwise</p><h3 id="define/REVERSE_DIR"><aside class="declaration">#define </aside>REVERSE_DIR<aside>(dir)</aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/__DEFINES/directions.dm#L38"><img src="git.png" width="16" height="16" title="code/__DEFINES/directions.dm 38"></a></h3><p>Inverse direction, taking into account UP|DOWN if necessary.</p><h3 id="define/TEXT_EAST"><aside class="declaration">#define </aside>TEXT_EAST <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/__DEFINES/directions.dm#L49"><img src="git.png" width="16" height="16" title="code/__DEFINES/directions.dm 49"></a></h3><p>East direction as a string &quot;[4]&quot;</p><h3 id="define/TEXT_NORTH"><aside class="declaration">#define </aside>TEXT_NORTH <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/__DEFINES/directions.dm#L45"><img src="git.png" width="16" height="16" title="code/__DEFINES/directions.dm 45"></a></h3><p>North direction as a string &quot;[1]&quot;</p><h3 id="define/TEXT_SOUTH"><aside class="declaration">#define </aside>TEXT_SOUTH <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/__DEFINES/directions.dm#L47"><img src="git.png" width="16" height="16" title="code/__DEFINES/directions.dm 47"></a></h3><p>South direction as a string &quot;[2]&quot;</p><h3 id="define/TEXT_WEST"><aside class="declaration">#define </aside>TEXT_WEST <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/__DEFINES/directions.dm#L51"><img src="git.png" width="16" height="16" title="code/__DEFINES/directions.dm 51"></a></h3><p>West direction as a string &quot;[8]&quot;</p></main><footer>paradise.dme <a href="https://github.com/ParadiseSS13/Paradise/tree/8a8a00a2a9bec485351e5f219982b7315d3504fa">8a8a00a</a> (master) — <a href="https://github.com/SpaceManiac/SpacemanDMM/blob/master/crates/dmdoc/README.md">dmdoc 1.11.0</a></footer></body></html>