Skip to content

Commit d9cbd83

Browse files
committed
Add shovel_flash_fix() to ini_rules
1 parent 0cafc06 commit d9cbd83

File tree

1 file changed

+42
-2
lines changed

1 file changed

+42
-2
lines changed

Python/ini_converting/ini_rules.py

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,15 @@ def apply_rules_on_sections(parsed_subset):
3434
if contains_property_shallowly(children, "MaxMass"):
3535
max_mass_to_max_inventory_mass(children)
3636

37-
iconfile_path = iconfile_path_to_thumbnail_generator(children)
37+
iconfile_path_to_thumbnail_generator(children)
3838

3939
for line_tokens in children:
4040
replace_property_and_value(line_tokens, "MinThrottleRange", "NegativeThrottleMultiplier", min_throttle_range_to_negative_throttle_multiplier)
4141
replace_property_and_value(line_tokens, "MaxThrottleRange", "PositiveThrottleMultiplier", max_throttle_range_to_positive_throttle_multiplier)
4242

43+
shovel_flash_fix(children)
44+
45+
4346
# TODO: Remove contains_property_and_value_shallowly() and write out what it does in this function
4447
# TODO: I don't remember whether this one works
4548
if contains_property_and_value_shallowly(section, "AddActor", "Leg"):
@@ -95,6 +98,7 @@ def max_mass_to_max_inventory_mass(children):
9598
if token["type"] == "property":
9699
if token["content"] == "MaxMass":
97100
token["content"] = "MaxInventoryMass"
101+
98102
for token_2 in line_tokens:
99103
if token_2["type"] == "value":
100104
token_2["content"] = max_inventory_mass
@@ -221,4 +225,40 @@ def iconfile_path_to_thumbnail_generator(children):
221225

222226

223227
def duplicate_script_path(parsed_subset):
224-
pass
228+
pass
229+
230+
231+
def shovel_flash_fix(children):
232+
"""
233+
SpriteFile = ContentFile
234+
FilePath = Ronin.rte/Effects/Pyro/Flashes/ShovelFlash.png
235+
FrameCount = 2
236+
->
237+
SpriteFile = ContentFile
238+
FilePath = Ronin.rte/Devices/Tools/Shovel/Effects/ShovelFlash.png
239+
FrameCount = 1
240+
"""
241+
242+
# TODO: Make this recursive somehow.
243+
for line_tokens in children:
244+
for token in line_tokens:
245+
if token["type"] == "property":
246+
if token["content"] == "SpriteFile":
247+
248+
for token_2 in line_tokens:
249+
if token_2["type"] == "children":
250+
for subline_tokens in token_2["content"]:
251+
for subtoken in subline_tokens:
252+
if subtoken["type"] == "property" and subtoken["content"] == "FilePath":
253+
for subtoken in subline_tokens:
254+
if subtoken["type"] == "value" and subtoken["content"] in ("Ronin.rte/Devices/Sprites/ShovelFlash.bmp", "Ronin.rte/Effects/Pyro/Flashes/ShovelFlash.png"):
255+
subtoken["content"] = "Ronin.rte/Devices/Tools/Shovel/Effects/ShovelFlash.png"
256+
257+
for line_tokens2 in children:
258+
for token2 in line_tokens2:
259+
if token2["type"] == "property":
260+
if token2["content"] == "FrameCount":
261+
for token3 in line_tokens2:
262+
if token3["type"] == "value":
263+
if token3["content"] == "2":
264+
token3["content"] = "1"

0 commit comments

Comments
 (0)