Проверка шаблона шины для iOS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

generateWorldParameters.py 962B

11 months ago
1234567891011121314151617181920212223242526272829303132333435
  1. from generation.worldFieldTypeInit import *
  2. def generateWorldParameters(c):
  3. fileName = f"{c.dir}/templates/world-parameter"
  4. lines = c.readFile(fileName)
  5. fmtInitType = lines[0]
  6. fmtEscInitType = lines[1]
  7. fmtInit = lines[2]
  8. fmtModel = lines[3]
  9. fmtNet = lines[4]
  10. params = []
  11. for key in c.structure.world.fields:
  12. values = c.structure.world.fields[key]
  13. if "init" in values:
  14. type = worldFieldTypeInit(key, c.structure)
  15. fmt = fmtInit
  16. if "escape" in values:
  17. fmt = fmtEscInitType
  18. elif len(values) > 1:
  19. fmt = fmtInitType
  20. ln = fmt \
  21. .replace("%NAME%", key) \
  22. .replace("%TYPE%", type)
  23. params.append(ln)
  24. elif key == "model":
  25. params.append(fmtModel)
  26. elif key == "net":
  27. params.append(fmtNet)
  28. c.worldParameters = ",\n".join(params)