Create pre-commit hook for default mvmz settings

This commit is contained in:
DazedAnon 2025-03-01 11:18:04 -06:00
parent c89340fe4c
commit 4b1b8840c0
4 changed files with 2675 additions and 2641 deletions

33
.gitignore vendored
View file

@ -1,16 +1,17 @@
.env
*.json
*.js
*.yaml
*.yml
*.txt
*.rpy
!vocab.txt
!requirements.txt
*.csv
*.ks
*.cid
*.png
*.script
!screens/*.png
__pycache__
.env
*.json
*.js
*.yaml
*.yml
*.txt
*.rpy
!vocab.txt
!requirements.txt
*.csv
*.ks
*.cid
*.png
*.script
!screens/*.png
__pycache__
!.pre-commit-config.yaml

8
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,8 @@
repos:
- repo: local
hooks:
- id: set-defaults
name: Set Defaults in rpgmakermvmz.py
entry: python set_defaults.py
language: python
files: ^modules/rpgmakermvmz.py$

File diff suppressed because it is too large Load diff

25
set_defaults.py Normal file
View file

@ -0,0 +1,25 @@
import re
def set_defaults(file_path):
with open(file_path, 'r', encoding='utf-8') as file:
content = file.read()
# Define the default values with comments
defaults = {
'FIRSTLINESPEAKERS': 'False # If 1st line of 401 is a speaker, set to True (False)',
'FACENAME101': 'False # Find Speakers in 101 Codes based on Face Name (False)',
'NAMES': 'False # Output a list of all the character names found (False)',
'BRFLAG': 'False # If the game uses <br> instead (False)',
'FIXTEXTWRAP': 'True # Overwrites textwrap (True)',
'IGNORETLTEXT': 'False # Ignores all translated text. (False)'
}
# Update the content with the default values
for key, value in defaults.items():
content = re.sub(f'{key} = .*', f'{key} = {value}', content)
with open(file_path, 'w', encoding='utf-8') as file:
file.write(content)
if __name__ == "__main__":
set_defaults('modules/rpgmakermvmz.py')