소스 검색

Random Images in Beverages

Stephan Fuchs 1 년 전
부모
커밋
b41ad5a071
2개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      beverage_convert.py
  2. 3 0
      sugarcube/src/autogenerated/beverage/compiled/foodcompiled.js

+ 5 - 0
beverage_convert.py

@@ -70,6 +70,11 @@ def file_convert(filename):
                 elif match := re.search(r"""<<image\s+"(.*?)"\s*>>""",line):
                     image =match.group(1)
                     file.write(f'\timage: "{image}",\n')
+                elif match := re.search(r"""<<image\s+`('.*?)'\s*\+\s*rand\((\d+)\s*,\s*(\d+)\s*\)\s*\+\s*'(.*?')`\s*>>""",line):
+                    image = match.group(1) + '#' + match.group(4)
+                    rand0 = match.group(2)
+                    rand1 = match.group(3)
+                    file.write('\timageRand: {template:"'+image+'",min:'+rand0+',max:'+rand1+'},\n')
 
         file.write("}\n")
 

+ 3 - 0
sugarcube/src/autogenerated/beverage/compiled/foodcompiled.js

@@ -278,6 +278,7 @@ setup.beverages['s_meal'] = {
 	energy_inc: 40,
 	cumclean: 2,
 	breath: 0,
+	imageRand: {template:"'images/shared/food/food_#.jpg'",min:1,max:4},
 	$_eat: 0,
 	hydra_inc: 40,
 }
@@ -290,6 +291,7 @@ setup.beverages['m_meal'] = {
 	energy_inc: 60,
 	cumclean: 2,
 	breath: 0,
+	imageRand: {template:"'images/shared/food/food_#.jpg'",min:1,max:4},
 	$_eat: 0,
 	hydra_inc: 60,
 }
@@ -302,6 +304,7 @@ setup.beverages['l_meal'] = {
 	energy_inc: 100,
 	cumclean: 2,
 	breath: 0,
+	imageRand: {template:"'images/shared/food/food_#.jpg'",min:1,max:4},
 	$_eat: 0,
 	hydra_inc: 100,
 }