@@ -24,6 +24,7 @@ def regex_replace(all_lines):
24
24
all_lines = replace_using_match (all_lines , "ModuleName = (.*) Tech\n " , "ModuleName = {}\n \t IsFaction = 1\n " )
25
25
all_lines = replace_using_match (all_lines , "FundsOfTeam(.*) =" , "Team{}Funds =" )
26
26
all_lines = replace_using_match (all_lines , "[bB]ase\.rte(.*?)\.wav" , "Base.rte{}.flac" )
27
+ all_lines = replace_using_match (all_lines , r"MovableMan:RemoveActor\((.*?)\)" , "{}.ToDelete = true" )
27
28
28
29
all_lines = special_replace_using_matches (all_lines , regex_replace_particle ,
29
30
"ParticleNumberToAdd = (.*)" \
@@ -55,16 +56,18 @@ def replace_without_using_match(all_lines, pattern, replacement):
55
56
def replace_using_match (all_lines , pattern , replacement ):
56
57
matches = re .findall (pattern , all_lines )
57
58
if len (matches ) > 0 :
58
- return re .sub (pattern , replacement , all_lines ).format (* matches )
59
+ escaped_all_lines = all_lines .replace ("{" , "{{" ).replace ("}" , "}}" )
60
+ return re .sub (pattern , replacement , escaped_all_lines ).format (* matches )
59
61
return all_lines
60
62
61
63
62
64
def special_replace_using_matches (all_lines , fn , pattern , replacement , dotall ):
63
65
matches = re .findall (pattern , all_lines , flags = re .DOTALL if dotall else 0 )
64
66
# print(matches)
65
67
if len (matches ) > 0 :
68
+ escaped_all_lines = all_lines .replace ("{" , "{{" ).replace ("}" , "}}" )
66
69
new = fn (all_lines , pattern , replacement , matches )
67
- return re .sub (pattern , replacement , all_lines , flags = re .DOTALL if dotall else 0 ).format (* new )
70
+ return re .sub (pattern , replacement , escaped_all_lines , flags = re .DOTALL if dotall else 0 ).format (* new )
68
71
return all_lines
69
72
70
73
0 commit comments