mirror of
https://github.com/Justuser3310/ss14_chemistry_site.git
synced 2025-01-18 16:58:48 +00:00
Добавлена функция получения предрасчётов
This commit is contained in:
parent
320a7204e3
commit
53d540c841
@ -1,4 +1,5 @@
|
|||||||
from precalc__ import precalc__
|
from precalc__ import precalc__
|
||||||
|
from db import load
|
||||||
|
|
||||||
global expanded
|
global expanded
|
||||||
def expand_recipe(recipe, recipes, main = False):
|
def expand_recipe(recipe, recipes, main = False):
|
||||||
@ -50,9 +51,17 @@ def calc(element, amount, recipes):
|
|||||||
|
|
||||||
return expanded, vol_in, vol_out
|
return expanded, vol_in, vol_out
|
||||||
|
|
||||||
|
|
||||||
def calc_all(recipes, amount):
|
def calc_all(recipes, amount):
|
||||||
precalc = {}
|
precalc = {}
|
||||||
for el in recipes:
|
for el in recipes:
|
||||||
precalc[el] = precalc__(calc(el, amount, recipes))
|
precalc[el] = precalc__(calc(el, amount, recipes))
|
||||||
return precalc
|
return precalc
|
||||||
|
|
||||||
|
|
||||||
|
def precalc(element, amount):
|
||||||
|
try:
|
||||||
|
# Загружаем рецепты с нужным количеством
|
||||||
|
recipes = load(f'{amount}_calc.json', 'precalc')
|
||||||
|
except:
|
||||||
|
return 'Нету такого файла или вещества'
|
||||||
|
return recipes[element]
|
||||||
|
Loading…
Reference in New Issue
Block a user