Files

27 lines
14 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><base href="../../"><link rel="stylesheet" href="dmdoc.css"><title>/obj/item/stack - 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="obj/item/stack.html#var">Var Details</a> - <a href="obj/item/stack.html#proc">Proc Details</a></header><main><h1>stack <aside>/<a href="obj.html">obj</a>/<a href="obj/item.html">item</a>/<a href="obj/item/stack.html">stack</a></aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/game/objects/items/stacks/stack.dm#L11"><img src="git.png" width="16" height="16" title="code/game/objects/items/stacks/stack.dm 11"></a></h1><table class="summary" cellspacing="0"><tr><td colspan="2"><h2>Vars</h2></td></tr><tr><th><a href="obj/item/stack.html#var/allow_splitting">allow_splitting</a></th><td>Whether this stack can be split into multiple independent stacks.</td></tr><tr><th><a href="obj/item/stack.html#var/amount">amount</a></th><td>The current amount of this stack.</td></tr><tr><th><a href="obj/item/stack.html#var/cost">cost</a></th><td>How much energy using 1 sheet from the stack costs. Used only with <code>/cyborg</code> type stacks.</td></tr><tr><th><a href="obj/item/stack.html#var/destroy_upon_empty">destroy_upon_empty</a></th><td>Whether this stack deletes itself when <code>amount</code> reaches 0.</td></tr><tr><th><a href="obj/item/stack.html#var/dynamic_icon_state">dynamic_icon_state</a></th><td>Whether this stack has a dynamic icon_state based on amount / max_amount.</td></tr><tr><th><a href="obj/item/stack.html#var/energy_type">energy_type</a></th><td>Which <code>robot_energy_storage</code> to choose when this stack is created in cyborgs. Used only with <code>/cyborg</code> type stacks.</td></tr><tr><th><a href="obj/item/stack.html#var/is_cyborg">is_cyborg</a></th><td>Whether this stack is a <code>/cyborg</code> subtype or not.</td></tr><tr><th><a href="obj/item/stack.html#var/max_amount">max_amount</a></th><td>The maximum amount of this stack. Also see stack recipes initialisation, param &quot;max_res_amount&quot; must be equal to this max_amount</td></tr><tr><th><a href="obj/item/stack.html#var/merge_type">merge_type</a></th><td>The path and its children that should merge with this stack, defaults to src.type.</td></tr><tr><th><a href="obj/item/stack.html#var/parent_stack">parent_stack</a></th><td>Whether this stack can't stack with subtypes.</td></tr><tr><th><a href="obj/item/stack.html#var/recipes">recipes</a></th><td>A list of recipes buildable with this stack.</td></tr><tr><th><a href="obj/item/stack.html#var/singular_name">singular_name</a></th><td>The singular name of this stack.</td></tr><tr><th><a href="obj/item/stack.html#var/source">source</a></th><td>The storage datum that will be used with this stack. Used only with <code>/cyborg</code> type stacks.</td></tr><tr><th><a href="obj/item/stack.html#var/table_type">table_type</a></th><td>The type of table that is made when applying this stack to a frame.</td></tr><tr><td colspan="2"><h2>Procs</h2></td></tr><tr><th><a href="obj/item/stack.html#proc/can_merge">can_merge</a></th><td></td></tr><tr><th><a href="obj/item/stack.html#proc/is_zero_amount">is_zero_amount</a></th><td>Returns TRUE if the item stack is the equivalent of a 0 amount item.</td></tr><tr><th><a href="obj/item/stack.html#proc/merge">merge</a></th><td>Merges as much of src into material as possible.</td></tr><tr><th><a href="obj/item/stack.html#proc/merge_without_del">merge_without_del</a></th><td>Merges as much of src into material as possible.</td></tr><tr><th><a href="obj/item/stack.html#proc/recursively_build_recipes">recursively_build_recipes</a></th><td>Recursively builds the recipes data for the given list of recipes, iterating through each recipe.
If recipe is of type /datum/stack_recipe, it adds the recipe data to the recipes_data list with the title as the key.
If recipe is of type /datum/stack_recipe_list, it recursively calls itself, scanning the entire list and adding each recipe to its category.</td></tr></table><h2 id="var">Var Details</h2><h3 id="var/allow_splitting"><aside class="declaration">var </aside>allow_splitting <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/game/objects/items/stacks/stack.dm#L40"><img src="git.png" width="16" height="16" title="code/game/objects/items/stacks/stack.dm 40"></a></h3><p>Whether this stack can be split into multiple independent stacks.</p><h3 id="var/amount"><aside class="declaration">var </aside>amount <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/game/objects/items/stacks/stack.dm#L27"><img src="git.png" width="16" height="16" title="code/game/objects/items/stacks/stack.dm 27"></a></h3><p>The current amount of this stack.</p><h3 id="var/cost"><aside class="declaration">var </aside>cost <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/game/objects/items/stacks/stack.dm#L21"><img src="git.png" width="16" height="16" title="code/game/objects/items/stacks/stack.dm 21"></a></h3><p>How much energy using 1 sheet from the stack costs. Used only with <code>/cyborg</code> type stacks.</p><h3 id="var/destroy_upon_empty"><aside class="declaration">var </aside>destroy_upon_empty <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/game/objects/items/stacks/stack.dm#L42"><img src="git.png" width="16" height="16" title="code/game/objects/items/stacks/stack.dm 42"></a></h3><p>Whether this stack deletes itself when <code>amount</code> reaches 0.</p><h3 id="var/dynamic_icon_state"><aside class="declaration">var </aside>dynamic_icon_state <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/game/objects/items/stacks/stack.dm#L36"><img src="git.png" width="16" height="16" title="code/game/objects/items/stacks/stack.dm 36"></a></h3><p>Whether this stack has a dynamic icon_state based on amount / max_amount.</p><h3 id="var/energy_type"><aside class="declaration">var </aside>energy_type <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/game/objects/items/stacks/stack.dm#L19"><img src="git.png" width="16" height="16" title="code/game/objects/items/stacks/stack.dm 19"></a></h3><p>Which <code>robot_energy_storage</code> to choose when this stack is created in cyborgs. Used only with <code>/cyborg</code> type stacks.</p><h3 id="var/is_cyborg"><aside class="declaration">var </aside>is_cyborg <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/game/objects/items/stacks/stack.dm#L15"><img src="git.png" width="16" height="16" title="code/game/objects/items/stacks/stack.dm 15"></a></h3><p>Whether this stack is a <code>/cyborg</code> subtype or not.</p><h3 id="var/max_amount"><aside class="declaration">var </aside>max_amount <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/game/objects/items/stacks/stack.dm#L30"><img src="git.png" width="16" height="16" title="code/game/objects/items/stacks/stack.dm 30"></a></h3><p>The maximum amount of this stack. Also see stack recipes initialisation, param &quot;max_res_amount&quot; must be equal to this max_amount</p><h3 id="var/merge_type"><aside class="declaration">var </aside>merge_type <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/game/objects/items/stacks/stack.dm#L32"><img src="git.png" width="16" height="16" title="code/game/objects/items/stacks/stack.dm 32"></a></h3><p>The path and its children that should merge with this stack, defaults to src.type.</p><h3 id="var/parent_stack"><aside class="declaration">var </aside>parent_stack <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/game/objects/items/stacks/stack.dm#L38"><img src="git.png" width="16" height="16" title="code/game/objects/items/stacks/stack.dm 38"></a></h3><p>Whether this stack can't stack with subtypes.</p><h3 id="var/recipes"><aside class="declaration">var </aside>recipes <aside> /list</aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/game/objects/items/stacks/stack.dm#L23"><img src="git.png" width="16" height="16" title="code/game/objects/items/stacks/stack.dm 23"></a></h3><p>A list of recipes buildable with this stack.</p><h3 id="var/singular_name"><aside class="declaration">var </aside>singular_name <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/game/objects/items/stacks/stack.dm#L25"><img src="git.png" width="16" height="16" title="code/game/objects/items/stacks/stack.dm 25"></a></h3><p>The singular name of this stack.</p><h3 id="var/source"><aside class="declaration">var </aside>source <aside> /<a href="datum.html">datum</a>/<a href="datum/robot_storage.html">robot_storage</a></aside> <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/game/objects/items/stacks/stack.dm#L17"><img src="git.png" width="16" height="16" title="code/game/objects/items/stacks/stack.dm 17"></a></h3><p>The storage datum that will be used with this stack. Used only with <code>/cyborg</code> type stacks.</p><h3 id="var/table_type"><aside class="declaration">var </aside>table_type <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/game/objects/items/stacks/stack.dm#L34"><img src="git.png" width="16" height="16" title="code/game/objects/items/stacks/stack.dm 34"></a></h3><p>The type of table that is made when applying this stack to a frame.</p><h2 id="proc">Proc Details</h2><h3 id="proc/can_merge"><aside class="declaration">proc </aside>can_merge<aside>(/<a href="obj.html">obj</a>/<a href="obj/item.html">item</a>/<a href="obj/item/stack.html">stack</a>/check, inhand) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/game/objects/items/stacks/stack.dm#L155"><img src="git.png" width="16" height="16" title="code/game/objects/items/stacks/stack.dm 155"></a></aside></h3><ul>
<li>
<p>Checks whether this stack can merge itself into another stack.</p>
</li>
<li>
<p>Arguments:</p>
</li>
<li>
<ul>
<li>check: The <a href="obj/item/stack.html" title="/obj/item/stack">/obj/item/stack</a> to check for mergeability.</li>
</ul>
</li>
<li>
<ul>
<li>inhand: <code>TRUE</code> if the stack should check should act like it's in a mob's hand, <code>FALSE</code> otherwise.</li>
</ul>
</li>
</ul><h3 id="proc/is_zero_amount"><aside class="declaration">proc </aside>is_zero_amount<aside>(delete_if_zero) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/game/objects/items/stacks/stack.dm#L356"><img src="git.png" width="16" height="16" title="code/game/objects/items/stacks/stack.dm 356"></a></aside></h3><p>Returns TRUE if the item stack is the equivalent of a 0 amount item.</p>
<p>Arguments: <code>delete_if_zero</code>: Deletes the stack if <code>TRUE</code> and the stack does not have
<code>is_cyborg</code> set to <code>TRUE</code> or <code>destroy_upon_empty</code> set to <code>FALSE</code>.</p><h3 id="proc/merge"><aside class="declaration">proc </aside>merge<aside>(/<a href="obj.html">obj</a>/<a href="obj/item.html">item</a>/<a href="obj/item/stack.html">stack</a>/material) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/game/objects/items/stacks/stack.dm#L403"><img src="git.png" width="16" height="16" title="code/game/objects/items/stacks/stack.dm 403"></a></aside></h3><p>Merges as much of src into material as possible.</p>
<p>This proc deletes src if the remaining amount after the transfer is 0.</p><h3 id="proc/merge_without_del"><aside class="declaration">proc </aside>merge_without_del<aside>(/<a href="obj.html">obj</a>/<a href="obj/item.html">item</a>/<a href="obj/item/stack.html">stack</a>/material) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/game/objects/items/stacks/stack.dm#L373"><img src="git.png" width="16" height="16" title="code/game/objects/items/stacks/stack.dm 373"></a></aside></h3><p>Merges as much of src into material as possible.</p>
<p>This calls use() without check = FALSE, preventing the item from qdeling itself if it reaches 0 stack size.</p>
<p>As a result, this proc can leave behind a 0 amount stack.</p><h3 id="proc/recursively_build_recipes"><aside class="declaration">proc </aside>recursively_build_recipes<aside>(/list/recipes_to_iterate) <a href="https://github.com/ParadiseSS13/Paradise/blob/8a8a00a2a9bec485351e5f219982b7315d3504fa/code/game/objects/items/stacks/stack.dm#L279"><img src="git.png" width="16" height="16" title="code/game/objects/items/stacks/stack.dm 279"></a></aside></h3><p>Recursively builds the recipes data for the given list of recipes, iterating through each recipe.
If recipe is of type /datum/stack_recipe, it adds the recipe data to the recipes_data list with the title as the key.
If recipe is of type /datum/stack_recipe_list, it recursively calls itself, scanning the entire list and adding each recipe to its category.</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>