From b6ad678d979c670113eda1f26e12e3abb16fea19 Mon Sep 17 00:00:00 2001 From: Exodia <67595890+DonRP@users.noreply.github.com> Date: Sun, 28 Aug 2022 17:24:14 +0200 Subject: [PATCH] fix --- game/tool/core.rpy | 3 -- game/tool/flags.rpy | 37 ------------------- game/tool/notify.rpy | 82 ------------------------------------------- game/tool/utility.rpy | 44 ----------------------- 4 files changed, 166 deletions(-) delete mode 100644 game/tool/core.rpy delete mode 100644 game/tool/flags.rpy delete mode 100644 game/tool/notify.rpy delete mode 100644 game/tool/utility.rpy diff --git a/game/tool/core.rpy b/game/tool/core.rpy deleted file mode 100644 index 467b459888..0000000000 --- a/game/tool/core.rpy +++ /dev/null @@ -1,3 +0,0 @@ -label after_load: - $ flags = updateFlags(flags, flag_keys) - return diff --git a/game/tool/flags.rpy b/game/tool/flags.rpy deleted file mode 100644 index 1ef68b138b..0000000000 --- a/game/tool/flags.rpy +++ /dev/null @@ -1,37 +0,0 @@ -# IMPORTANT: insert updateFlags() in start or before using flags -# flags are Boolean values, a good use is for example in quests to know quickly if MC has the possibility to do a certain thing, after unlocking it somehow. -# has the same alements as flag_keys, all set as False -# I suggest to leave it empty and add the elements only if it is an initial value and set as True -default flags = {} -define flag_keys = [ - # Block all actions with check_block_spendtime -] - -init python: - def updateFlags(flags: dict[str, bool], flag_keys: list[str]): - """update flags by making it with the same elements of flag_keys. in case you have to add them set them as False""" - # check if there are less elements than flag_keys - # in case you add them set with False - for x in flag_keys: - if ((x in flags) == False): - flags[x] = False - # check if there are more elements than flag_keys - # in case it eliminates them - flags_to_del = [] - for x in flags: - if ((x in flag_keys) == False): - flags_to_del.append(x) - for x in flags_to_del: - del flags[x] - del flags_to_del - return flags - - def getFlags(flag_id: str) -> bool: - """returns the value of the flag_id in flags""" - if (not flag_id in flags): - updateFlags(flags = flags, flag_keys = flag_keys) - if (not flag_id in flags): - renpy.log("Error(getFlags): in flags is not there flag_id: "+flag_id) - else: - return False - return flags[flag_id] diff --git a/game/tool/notify.rpy b/game/tool/notify.rpy deleted file mode 100644 index 221e364494..0000000000 --- a/game/tool/notify.rpy +++ /dev/null @@ -1,82 +0,0 @@ -init python: - class NotifyEx(renpy.python.RevertableObject): - """Notifications, to use: default ... = NotifyEx(msg="...", img="...")""" - def __init__(self, - msg: str, - img: str - ): - super(NotifyEx, self).__init__() - self.msg = msg - self.img = img - self.remain = gui.notifyEx_delay - - - def notifyEx(msg: str = None, img: str = None): - notifications.append(NotifyEx(msg, img)) - if len(store.notifications) == 1: - renpy.show_screen("notifyEx") - - - def notifyExClean(value): - if value in store.notifications: - store.notifications.remove(value) - if len(store.notifications) == 0: - renpy.hide_screen("notifyEx") - - - def notify(notific): - """View defined notifications. - to use: $ notify(...)""" - notifications.append(NotifyEx(notific.msg, notific.img)) - if len(store.notifications) == 1: - renpy.show_screen("notifyEx") - -# Delay of visibility of a notification. -define gui.notifyEx_delay = 10.0 -# Width of the images. -define gui.notifyEx_width = 64 -# Height of the images. -define gui.notifyEx_height = 64 - -define gui.notifyEx_color = "#000000" - -default notifications = [] - -style notify_text is default: - color gui.notifyEx_color - yalign 0.5 - -style notify_hbox is default: - ysize gui.notifyEx_height - -screen notifyEx(): - - zorder 100 - - style_prefix "notify" - - vbox: - for d in notifications: - use notifyExInternal( d ) - # aerate a little. - null height 5 - -screen notifyExInternal( n ): - - style_prefix "notify" - - frame at notify_appear: - hbox: - if not n.img is None: - add n.img - else: - # Ensure that all the texts will be aligned. - null width gui.notifyEx_width - - # aerate a little. - null width 5 - - if not n.msg is None: - text n.msg - - timer 0.05 repeat True action [ SetField( n, "remain", n.remain - 0.05 ), If( n.remain <= 0, Function( notifyExClean, n ), NullAction() ) ] diff --git a/game/tool/utility.rpy b/game/tool/utility.rpy deleted file mode 100644 index b051c4a4f0..0000000000 --- a/game/tool/utility.rpy +++ /dev/null @@ -1,44 +0,0 @@ -init -999 python: - def isNullOrEmpty(item: str) -> bool: - if not item: - return True - return False - - def IsNullOrWhiteSpace(item: str) -> bool: - if not item or item.isspace(): - return True - return False - - def null_or_image(s): - """It checks for the presence of an image, in case it is not there it returns a null value. Possible use: avoid mistakes in the management of clothes.""" - # s = renpy.substitute(s) - if renpy.has_image(s): - return s - elif renpy.list_files(s): - return s - else: - return Null() - config.displayable_prefix['check'] = null_or_image - - def compare(a= 0, b= 0) -> int: - if a is None and b is None: - return 0 - elif b is None: - return 1 - elif a is None: - return -1 - return a - b - - def isGreaterThan(a= 0, b= 0) -> bool: - return compare(a, b) > 0 - -label set_background(img): - scene expression (img) as bg - -screen popup(message): - zorder 100 - frame: - style_group "invstyle" - hbox: - text message - timer 1.5 action Hide("popup")