state sync, many changes:
* separated css/js/rule files to pak file (glorified zip) to reduce full rebuilds * implemented build cache * some frontend UI spiffing up
This commit is contained in:
@@ -4,17 +4,18 @@ import subprocess
|
||||
|
||||
import lxml.etree as xmltree
|
||||
|
||||
from . import core
|
||||
from . import core, gamedata
|
||||
|
||||
valid_resources = [
|
||||
"food", "shinies", "psi" # early game
|
||||
]
|
||||
|
||||
rant_env = os.environ.copy()
|
||||
rant_env["RANT_MODULES_PATH"] = (core.path_appdir / "rant").as_posix()
|
||||
rant_env["RANT_MODULES_PATH"] = (core.path_appdir / "basepak/rant").as_posix()
|
||||
|
||||
fd_item_schema = xmltree.parse(core.path_appdir / "rules/schemas/items.xsd")
|
||||
item_schema = xmltree.XMLSchema(fd_item_schema)
|
||||
pth_item_schema = core.path_appdir / "basepak/rules/schemas/items.xsd"
|
||||
doc_item_schema = xmltree.parse(pth_item_schema.as_posix())
|
||||
item_schema = xmltree.XMLSchema(doc_item_schema)
|
||||
item_schema_parser = xmltree.XMLParser(schema=item_schema)
|
||||
|
||||
def generate_item_description(resource, target):
|
||||
@@ -22,7 +23,8 @@ def generate_item_description(resource, target):
|
||||
rant_path = core.path_appdir / "opt/rant/bin/rant"
|
||||
else:
|
||||
rant_path = "rant" # rely on OS PATH
|
||||
proc_rant = subprocess.run([rant_path, (core.path_appdir / f"rant/{resource}/{target}.rant").as_posix()], env=rant_env, capture_output=True)
|
||||
pth_rantfile = gamedata.vfs.copy_out(f"rant/{resource}/{target}.rant")
|
||||
proc_rant = subprocess.run([rant_path, (core.path_appdir / pth_rantfile).as_posix()], env=rant_env, capture_output=True)
|
||||
if proc_rant.stderr:
|
||||
core.log.warning("rant is throwing up:\n" + proc_rant.stderr.decode())
|
||||
return proc_rant.stdout.decode().strip()
|
||||
@@ -30,7 +32,7 @@ def generate_item_description(resource, target):
|
||||
def generate_item_list(resource, target, min, max, storybeat=0):
|
||||
count = random.randint(min, max)
|
||||
result = []
|
||||
rulefile = xmltree.parse(core.path_appdir / f"rules/items/{target}.xml", item_schema_parser)
|
||||
rulefile = xmltree.parse(gamedata.vfs.open(f"/rules/items/{target}.xml"), item_schema_parser)
|
||||
ruleset = rulefile.getroot()
|
||||
resource_rules = []
|
||||
for res_rule in ruleset.iter(f"{{seagull:rules/items}}{resource.title()}"):
|
||||
|
Reference in New Issue
Block a user