forked from SilverStudioGames/WTS
Optimizations
* Disabled detection of orphaned scripts for non-devs * Added cache to renpy.list_files to reduce IO overhead (~14s -> ~0.01s per 10k calls) * Fixed wrong module call in weather.
This commit is contained in:
parent
43d18f0de1
commit
2c35c2d5df
@ -59,7 +59,7 @@ init python:
|
|||||||
@weather.setter
|
@weather.setter
|
||||||
def weather(self, value):
|
def weather(self, value):
|
||||||
if value == "random":
|
if value == "random":
|
||||||
value = renpy.python.random.choices(self.weather_types, weights=self.weather_weights)[0]
|
value = renpy.random.choices(self.weather_types, weights=self.weather_weights)[0]
|
||||||
|
|
||||||
if not value in self.weather_types:
|
if not value in self.weather_types:
|
||||||
raise ValueError("Unsupported weather type: '{}'".format(value))
|
raise ValueError("Unsupported weather type: '{}'".format(value))
|
||||||
|
@ -14,6 +14,9 @@ init -1000 python early:
|
|||||||
def get_renderer():
|
def get_renderer():
|
||||||
return "DirectX" if preferences.renderer == "angle2" else "OpenGL"
|
return "DirectX" if preferences.renderer == "angle2" else "OpenGL"
|
||||||
|
|
||||||
|
if config.developer:
|
||||||
|
# Debug
|
||||||
|
|
||||||
def detect_orphaned_rpyc_files():
|
def detect_orphaned_rpyc_files():
|
||||||
excluded = ["tl/"]
|
excluded = ["tl/"]
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ init python:
|
|||||||
|
|
||||||
config.statement_callbacks.append(crashdefender)
|
config.statement_callbacks.append(crashdefender)
|
||||||
|
|
||||||
init -10 python:
|
init python early:
|
||||||
|
|
||||||
if renpy.windows:
|
if renpy.windows:
|
||||||
# On windows, Renpy does not support backslashes in some of its functions,
|
# On windows, Renpy does not support backslashes in some of its functions,
|
||||||
@ -75,3 +75,19 @@ init -10 python:
|
|||||||
return renpy.loader.loadable(filename)
|
return renpy.loader.loadable(filename)
|
||||||
|
|
||||||
renpy.loadable = _loadable
|
renpy.loadable = _loadable
|
||||||
|
|
||||||
|
# renpy.list_files does not use cached results, let's fix that.
|
||||||
|
|
||||||
|
def _list_files(common=False, quick=True):
|
||||||
|
cache = "_list_files_common_cache" if common else "_list_files_cache"
|
||||||
|
files = getattr(renpy.store, cache, [])
|
||||||
|
|
||||||
|
if not quick or not files:
|
||||||
|
rv = [fn for dir, fn in renpy.loader.listdirfiles(common) if not fn.startswith("saves/")]
|
||||||
|
rv.sort()
|
||||||
|
|
||||||
|
setattr(renpy.store, cache, rv)
|
||||||
|
|
||||||
|
return files
|
||||||
|
|
||||||
|
renpy.list_files = _list_files
|
||||||
|
Loading…
Reference in New Issue
Block a user