Bombsquad-Ballistica-Modded.../dist/ba_root/mods/setting.py

28 lines
535 B
Python
Raw Normal View History

2021-04-02 20:53:19 +05:30
# Released under the MIT License. See LICENSE for details.
2021-04-17 13:22:30 +05:30
import _ba, json
settings_path = _ba.env()["python_directory_user"]+"/setting.json"
def get_settings_data():
with open(settings_path, "r") as f:
data = json.load(f)
return data
def commit(data):
with open(settings_path, "w") as f:
json.dump(data, f, indent=4)
def sendError(msg : str, client_id : int = None):
if client_id == None:
_ba.screenmessage(msg, color=(1,0,0))
else:
_ba.screenmessage(msg, color=(1,0,0), transient=True, clients=[client_id])