Совмещение изменений.

main
dttric 7 months ago
commit 21a77c1372

@ -1,5 +1,6 @@
from requests import get
from yaml import load, SafeLoader
from reag__ import reag__
def parse_yml(url = 'https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/Resources/Prototypes/Recipes/Reactions/medicine.yml'):
yml = load(get(url).content.decode('utf-8'), Loader=SafeLoader)
@ -15,3 +16,16 @@ def parse_ftl(url = 'https://raw.githubusercontent.com/SerbiaStrong-220/space-st
locale = splitted[2]
locales[name] = locale
return locales
def load_recipes(url = 'https://raw.githubusercontent.com/SerbiaStrong-220/space-station-14/master/Resources/Prototypes/Recipes/Reactions/medicine.yml', category = '-'):
yml = parse_yml(url)
recipes = {}
for element in yml:
product = element["id"]
comps = {}
for elem in element["reactants"]:
comps[elem] = element["reactants"][elem]["amount"]
for id, value in element["products"].items():
out = value
recipes[product] = reag__(category=category, comps=comps, out=out)
return recipes

@ -1,8 +1,11 @@
class reag__:
def __init__(category = '-', comps, out):
def __init__(self, category: str = '-', comps = {}, out: int = 0):
# medicine
self.category = category
# {'инапровалин': 1, 'углерод': 1}
self.comps = comps
# 2
self.out = out
def get_all(self):
return [self.category, self.comps, self.out]

Loading…
Cancel
Save