code/__HELPERS/construction.dm
OPTIMAL_COST | Makes sure only integer values are used when consuming, removing & checking for mats |
---|---|
GET_MATERIAL_REF | Wrapper for fetching material references. Exists exclusively so that people don't need to wrap everything in a list every time. |
/proc/rcd_result_with_memory | Produces a new RCD result from the given one if it can be calculated that the RCD should speed up with the remembered form. |
/proc/amount2sheet | Turns material amount into the number of sheets, returning FALSE if the number is less than SHEET_MATERIAL_AMOUNT |
/proc/sheet2amount | Turns number of sheets into material amount, returning FALSE if the number is <= 0 |
/proc/fast_split_stack | Splits a stack. we don't use /obj/item/stack/proc/split_stack because Byond complains that should only be called asynchronously. This proc is also more faster because it doesn't deal with mobs, copying evidences or refreshing atom storages Has special internal uses for e.g. by the material container & RPED |
/proc/split_materials_uniformly | divides a list of materials uniformly among all contents of the target_object recursively Used to set materials of printed items with their design cost by taking into consideration their already existing materials e.g. if 12 iron is to be divided uniformly among 2 objects A, B who's current iron contents are 3 & 7 Then first we normalize those values i.e. find their weights to decide who gets an higher share of iron total_sum = 3 + 7 = 10, A = 3/10 = 0.3, B = 7/10 = 0.7 Then we finally multiply those weights with the user value of 12 we get A = 0.3 * 12 = 3.6, B = 0.7 * 12 = 8.4 i.e. 3.6 + 8.4 = 12!! Off course we round the values so we don't have to deal with floating point materials so the actual value ends being less but that's not an issue Arguments |
Define Details
GET_MATERIAL_REF
Wrapper for fetching material references. Exists exclusively so that people don't need to wrap everything in a list every time.
OPTIMAL_COST
Makes sure only integer values are used when consuming, removing & checking for mats