mirror of
https://git.cavemanon.xyz/Cavemanon/SnootGame.git
synced 2025-01-22 09:16:56 +01:00
Fix mods without defined names not being assigned their folder name
Remove checks for the 'None' language as the user will never be assigned to it Some comment typo fixes Make reloading mods not play the splash screen Pressing backspace will now hide the mod details pane, and shoe mod errors if there's any Attempt at making a button for android to hide the details pane.
This commit is contained in:
parent
2c2899e734
commit
033175500c
4 changed files with 158 additions and 152 deletions
|
@ -144,6 +144,10 @@ define config.defer_tl_scripts = True
|
|||
define config.linear_fades = True
|
||||
|
||||
|
||||
## The variable used for making the splashscreen not show when reloading a mod
|
||||
default persistent.reloading_mods = False
|
||||
|
||||
|
||||
## Snoot-specific config variables
|
||||
|
||||
define config.developer = "auto"
|
||||
|
|
|
@ -57,6 +57,9 @@ label before_main_menu:
|
|||
if preferences.language == None:
|
||||
$ preferences.language = 'en'
|
||||
|
||||
# Setting this here means we're past reloading scripts, therefore we're not reloading mods
|
||||
$ persistent.reloading_mods = False
|
||||
|
||||
# Call initial language setup screen
|
||||
# languaged_up is set within lang_sel
|
||||
if (persistent.languaged_up is None):
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
# etc...
|
||||
# }
|
||||
#
|
||||
# Note that some keys may exist, but simple be 'None', likely as a result of improperly filled out metadata files.
|
||||
# Note that some keys may exist, but end up as 'None', likely as a result of improperly filled out metadata files.
|
||||
|
||||
|
||||
init -999 python:
|
||||
|
@ -145,7 +145,7 @@ init -999 python:
|
|||
destination_dict[key] = source_dict[key]
|
||||
del source_dict[key]
|
||||
|
||||
# Checks to see if the key in the metadata dict exists/is correct, and tries to set a default if it isn't.
|
||||
# Checks to see if the key in the metadata dict exists/is correct.
|
||||
# For keys that are set to None, it will be treated as if it doesn't exist
|
||||
def value_isnt_valid_string(metadata, key):
|
||||
return metadata.get(key) != None and not isinstance(metadata.get(key), str)
|
||||
|
@ -298,7 +298,7 @@ init -999 python:
|
|||
lang_data[x] = renpy.revertable.RevertableList(lang_data[x])
|
||||
|
||||
# Automatically give the name of the mod from the folder it's using if there's no defined name, but report an error if one is defined but not a string
|
||||
if value_isnt_valid_string(lang_data, "Name"):
|
||||
if not isinstance(lang_data.get("Name"), str):
|
||||
if lang_data.get("Name") != None:
|
||||
mod_menu_errorcodes.append([ ModError.Name_Not_String, { "mod_name": mod_name, "lang_code": lang_key }])
|
||||
|
||||
|
@ -575,10 +575,10 @@ init -999 python:
|
|||
# Now convert our errorcodes to errorstrings
|
||||
init python:
|
||||
def return_translated_mod_name(mod_dict):
|
||||
if _preferences.language == None and "None" in mod_dict.keys():
|
||||
return "'{color=#ffbdbd}" + mod_dict["None"] + "{/color}'"
|
||||
elif _preferences.language in mod_dict.keys():
|
||||
if _preferences.language in mod_dict.keys():
|
||||
return "'{color=#ffbdbd}" + mod_dict[_preferences.language] + "{/color}'"
|
||||
elif "None" in mod_dict.keys():
|
||||
return "'{color=#ffbdbd}" + mod_dict["None"] + "{/color}'"
|
||||
else:
|
||||
if mod_dict["Folder"] == None:
|
||||
return __("the root of the mods folder")
|
||||
|
@ -670,7 +670,7 @@ init python:
|
|||
|
||||
# All operations that use this function need to be able to parse "None" as a safeguard.
|
||||
def return_translated_metadata(mod_metadata, key):
|
||||
if _preferences.language != None and _preferences.language in mod_metadata.keys() and mod_metadata[_preferences.language].get(key) != None:
|
||||
if _preferences.language in mod_metadata.keys() and mod_metadata[_preferences.language].get(key) != None:
|
||||
return mod_metadata[_preferences.language][key]
|
||||
elif "None" in mod_metadata.keys():
|
||||
return mod_metadata["None"].get(key)
|
||||
|
@ -711,6 +711,7 @@ screen mod_menu():
|
|||
if reload_game:
|
||||
python:
|
||||
reload_game = False
|
||||
persistent.reloading_mods = True
|
||||
renpy.reload_script()
|
||||
use mod_menu_top_buttons(main_menu_button_img, _("Return"), ShowMenu("extras"))
|
||||
|
||||
|
@ -892,170 +893,168 @@ screen mod_menu():
|
|||
xalign 0.5 yalign 0.5
|
||||
outlines [(3, "#342F6C", absolute(0), absolute(0))]
|
||||
|
||||
# Clears the mod details pane, consequently bringing up mod errors if there's any
|
||||
key ["any_K_BACKSPACE"] action SetScreenVariable("mod_metadata", {})
|
||||
|
||||
# Displays the mod metadata on the left side
|
||||
# This has two seperate viewports for error display because renpy is retarded
|
||||
if mod_metadata != {}:
|
||||
|
||||
# Mod play button for android
|
||||
# I'm too fuckin tired to make this not shit and just put this and the viewport into a vbox, forgive me
|
||||
$ mod_has_label_android = renpy.variant(["mobile", "steam_deck"]) and mod_metadata.get("Label") != None
|
||||
if mod_has_label_android:
|
||||
$ mod_button_alpha = 1.0 if mod_metadata["Enabled"] == True else 0.4 # Fade mod button out if mod is disabled
|
||||
button:
|
||||
xpos 13
|
||||
ypos 928
|
||||
transform:
|
||||
alpha mod_button_alpha
|
||||
frame:
|
||||
xsize 1190
|
||||
ysize 129
|
||||
|
||||
if persistent.use_epilogue_menu:
|
||||
background Frame("gui/button/menubuttons/template_idle_epilogue.png", 12, 12)
|
||||
else:
|
||||
background Frame("gui/button/menubuttons/template_full_idle.png", 12, 12)
|
||||
text _("Start") xalign 0.5 yalign 0.5 size 50
|
||||
|
||||
action Start(mod_metadata["Label"])
|
||||
activate_sound "audio/ui/snd_ui_click.wav"
|
||||
|
||||
|
||||
$ needs_android_buttons = renpy.variant(["mobile", "steam_deck"]) and (mod_metadata.get("Label") != None or (mod_metadata != {} and len(mod_menu_errorcodes) != 0))
|
||||
vbox:
|
||||
style_prefix "mod_menu"
|
||||
xmaximum 1190
|
||||
ymaximum 1050
|
||||
xpos 15
|
||||
ypos 15
|
||||
# Mod details pane
|
||||
viewport:
|
||||
xmaximum 1190
|
||||
if mod_has_label_android:
|
||||
if needs_android_buttons:
|
||||
ymaximum 900
|
||||
else:
|
||||
ymaximum 1050
|
||||
xpos 15
|
||||
ypos 15
|
||||
|
||||
scrollbars "vertical"
|
||||
vscrollbar_unscrollable "hide"
|
||||
mousewheel True
|
||||
draggable True
|
||||
vbox:
|
||||
style_prefix "mod_menu"
|
||||
|
||||
# Thumbnail
|
||||
python:
|
||||
if mod_metadata["Enabled"] == True and return_translated_metadata(mod_metadata, "Thumbnail Displayable") != None:
|
||||
mod_thumbnail = return_translated_metadata(mod_metadata, "Thumbnail Displayable")
|
||||
elif return_translated_metadata(mod_metadata, "Thumbnail") != None:
|
||||
mod_thumbnail = return_translated_metadata(mod_metadata, "Thumbnail")
|
||||
else:
|
||||
mod_thumbnail = None
|
||||
|
||||
if mod_thumbnail:
|
||||
frame:
|
||||
background None
|
||||
xpadding 30
|
||||
bottom_padding 30
|
||||
xalign 0.5
|
||||
add mod_thumbnail fit 'scale-down'
|
||||
|
||||
# Mod details
|
||||
# Omits checking for mod name, since we'll always have some kind of mod name.
|
||||
# This will also not show anything if there's only a mod name, since we already show one in the mod button.
|
||||
# Unless the display is set to "icon".
|
||||
if return_translated_metadata(mod_metadata, "Version") != None or return_translated_metadata(mod_metadata, "Authors") != None or return_translated_metadata(mod_metadata, "Links") != None or mod_metadata.get("Display") == "icon":
|
||||
if mod_metadata == {} and len(mod_menu_errorcodes) != 0:
|
||||
frame:
|
||||
background Frame("gui/mod_frame.png", 30, 30)
|
||||
padding (30, 30)
|
||||
xfill True
|
||||
|
||||
vbox:
|
||||
if return_translated_metadata(mod_metadata, "Name") != None:
|
||||
hbox:
|
||||
text _("Name: ")
|
||||
text return_translated_metadata(mod_metadata, "Name")
|
||||
if return_translated_metadata(mod_metadata, "Version") != None:
|
||||
hbox:
|
||||
text _("Version: ")
|
||||
text return_translated_metadata(mod_metadata, "Version")
|
||||
if return_translated_metadata(mod_metadata, "Authors") != None:
|
||||
if isinstance(return_translated_metadata(mod_metadata, "Authors"), list):
|
||||
hbox:
|
||||
text _("Authors: ")
|
||||
text ", ".join(return_translated_metadata(mod_metadata, "Authors"))
|
||||
else:
|
||||
hbox:
|
||||
text _("Author: ")
|
||||
text return_translated_metadata(mod_metadata, "Authors")
|
||||
if return_translated_metadata(mod_metadata, "Links") != None:
|
||||
if isinstance(return_translated_metadata(mod_metadata, "Links"), list):
|
||||
hbox:
|
||||
text _("Links: ")
|
||||
text ", ".join(return_translated_metadata(mod_metadata, "Links"))
|
||||
else:
|
||||
hbox:
|
||||
text _("Link: ")
|
||||
text return_translated_metadata(mod_metadata, "Links")
|
||||
|
||||
# Description
|
||||
if return_translated_metadata(mod_metadata, "Description") != None or return_translated_metadata(mod_metadata, "Mobile Description") != None:
|
||||
frame:
|
||||
background Frame("gui/mod_frame.png", 30, 30)
|
||||
padding (30, 30)
|
||||
xfill True
|
||||
|
||||
# If there's no mobile description, display the regular description on Android.
|
||||
if (not renpy.android or return_translated_metadata(mod_metadata, "Mobile Description") == None) and (return_translated_metadata(mod_metadata, "Description") != None):
|
||||
text return_translated_metadata(mod_metadata, "Description")
|
||||
elif return_translated_metadata(mod_metadata, "Mobile Description") != None:
|
||||
text return_translated_metadata(mod_metadata, "Mobile Description")
|
||||
|
||||
# Screenshots
|
||||
python:
|
||||
if mod_metadata["Enabled"] == True and return_translated_metadata(mod_metadata, "Screenshot Displayables") != None:
|
||||
mod_screenshot_list = return_translated_metadata(mod_metadata, "Screenshot Displayables")
|
||||
elif return_translated_metadata(mod_metadata, "Screenshots") != None:
|
||||
mod_screenshot_list = return_translated_metadata(mod_metadata, "Screenshots")
|
||||
else:
|
||||
mod_screenshot_list = None
|
||||
|
||||
if persistent.show_mod_screenshots and mod_screenshot_list:
|
||||
frame:
|
||||
background Frame("gui/mod_frame.png", 30, 30)
|
||||
padding (30, 30)
|
||||
xfill True
|
||||
|
||||
hbox:
|
||||
xoffset 12
|
||||
box_wrap True
|
||||
box_wrap_spacing 25
|
||||
spacing 25
|
||||
for t in mod_menu_errorcodes:
|
||||
text convert_errorcode_to_errorstring(t[0], t[1])
|
||||
elif mod_metadata != {}:
|
||||
# Thumbnail
|
||||
python:
|
||||
if mod_metadata["Enabled"] == True and return_translated_metadata(mod_metadata, "Thumbnail Displayable") != None:
|
||||
mod_thumbnail = return_translated_metadata(mod_metadata, "Thumbnail Displayable")
|
||||
elif return_translated_metadata(mod_metadata, "Thumbnail") != None:
|
||||
mod_thumbnail = return_translated_metadata(mod_metadata, "Thumbnail")
|
||||
else:
|
||||
mod_thumbnail = None
|
||||
|
||||
for i in mod_screenshot_list:
|
||||
imagebutton:
|
||||
at transform:
|
||||
ysize 200 subpixel True
|
||||
fit "scale-down"
|
||||
xalign 0.5 yalign 0.5
|
||||
if mod_thumbnail:
|
||||
frame:
|
||||
background None
|
||||
xpadding 30
|
||||
bottom_padding 30
|
||||
xalign 0.5
|
||||
add mod_thumbnail fit 'scale-down'
|
||||
|
||||
idle i
|
||||
hover Transform(i, matrixcolor=BrightnessMatrix(0.1))
|
||||
action Show("mod_screenshot_preview", Dissolve(0.5), img=i)
|
||||
# Mod details
|
||||
# Omits checking for mod name, since we'll always have some kind of mod name.
|
||||
# This will also not show anything if there's only a mod name, since we already show one in the mod button.
|
||||
# Unless the display is set to "icon".
|
||||
if return_translated_metadata(mod_metadata, "Version") != None or return_translated_metadata(mod_metadata, "Authors") != None or return_translated_metadata(mod_metadata, "Links") != None or mod_metadata.get("Display") == "icon":
|
||||
frame:
|
||||
background Frame("gui/mod_frame.png", 30, 30)
|
||||
padding (30, 30)
|
||||
xfill True
|
||||
|
||||
elif len(mod_menu_errorcodes) != 0:
|
||||
viewport:
|
||||
xmaximum 1190
|
||||
ymaximum 1050
|
||||
xpos 15
|
||||
ypos 15
|
||||
scrollbars "vertical"
|
||||
vscrollbar_unscrollable "hide"
|
||||
mousewheel True
|
||||
draggable True
|
||||
vbox:
|
||||
style_prefix "mod_menu"
|
||||
frame:
|
||||
background Frame("gui/mod_frame.png", 30, 30)
|
||||
padding (30, 30)
|
||||
xfill True
|
||||
vbox:
|
||||
spacing 25
|
||||
for t in mod_menu_errorcodes:
|
||||
text convert_errorcode_to_errorstring(t[0], t[1])
|
||||
vbox:
|
||||
if return_translated_metadata(mod_metadata, "Name") != None:
|
||||
hbox:
|
||||
text _("Name: ")
|
||||
text return_translated_metadata(mod_metadata, "Name")
|
||||
if return_translated_metadata(mod_metadata, "Version") != None:
|
||||
hbox:
|
||||
text _("Version: ")
|
||||
text return_translated_metadata(mod_metadata, "Version")
|
||||
if return_translated_metadata(mod_metadata, "Authors") != None:
|
||||
if isinstance(return_translated_metadata(mod_metadata, "Authors"), list):
|
||||
hbox:
|
||||
text _("Authors: ")
|
||||
text ", ".join(return_translated_metadata(mod_metadata, "Authors"))
|
||||
else:
|
||||
hbox:
|
||||
text _("Author: ")
|
||||
text return_translated_metadata(mod_metadata, "Authors")
|
||||
if return_translated_metadata(mod_metadata, "Links") != None:
|
||||
if isinstance(return_translated_metadata(mod_metadata, "Links"), list):
|
||||
hbox:
|
||||
text _("Links: ")
|
||||
text ", ".join(return_translated_metadata(mod_metadata, "Links"))
|
||||
else:
|
||||
hbox:
|
||||
text _("Link: ")
|
||||
text return_translated_metadata(mod_metadata, "Links")
|
||||
|
||||
# Description
|
||||
if return_translated_metadata(mod_metadata, "Description") != None or return_translated_metadata(mod_metadata, "Mobile Description") != None:
|
||||
frame:
|
||||
background Frame("gui/mod_frame.png", 30, 30)
|
||||
padding (30, 30)
|
||||
xfill True
|
||||
|
||||
# If there's no mobile description, display the regular description on Android.
|
||||
if (not renpy.android or return_translated_metadata(mod_metadata, "Mobile Description") == None) and (return_translated_metadata(mod_metadata, "Description") != None):
|
||||
text return_translated_metadata(mod_metadata, "Description")
|
||||
elif return_translated_metadata(mod_metadata, "Mobile Description") != None:
|
||||
text return_translated_metadata(mod_metadata, "Mobile Description")
|
||||
|
||||
# Screenshots
|
||||
python:
|
||||
if mod_metadata["Enabled"] == True and return_translated_metadata(mod_metadata, "Screenshot Displayables") != None:
|
||||
mod_screenshot_list = return_translated_metadata(mod_metadata, "Screenshot Displayables")
|
||||
elif return_translated_metadata(mod_metadata, "Screenshots") != None:
|
||||
mod_screenshot_list = return_translated_metadata(mod_metadata, "Screenshots")
|
||||
else:
|
||||
mod_screenshot_list = None
|
||||
|
||||
if persistent.show_mod_screenshots and mod_screenshot_list:
|
||||
frame:
|
||||
background Frame("gui/mod_frame.png", 30, 30)
|
||||
padding (30, 30)
|
||||
xfill True
|
||||
|
||||
hbox:
|
||||
xoffset 12
|
||||
box_wrap True
|
||||
box_wrap_spacing 25
|
||||
spacing 25
|
||||
|
||||
for i in mod_screenshot_list:
|
||||
imagebutton:
|
||||
at transform:
|
||||
ysize 200 subpixel True
|
||||
fit "scale-down"
|
||||
xalign 0.5 yalign 0.5
|
||||
|
||||
idle i
|
||||
hover Transform(i, matrixcolor=BrightnessMatrix(0.1))
|
||||
action Show("mod_screenshot_preview", Dissolve(0.5), img=i)
|
||||
# Mod play and hide mod details pane buttons for android
|
||||
if needs_android_buttons:
|
||||
hbox:
|
||||
if mod_metadata.get("Label") != None:
|
||||
$ mod_button_alpha = 1.0 if mod_metadata["Enabled"] == True else 0.4 # Fade mod button out if mod is disabled
|
||||
button:
|
||||
transform:
|
||||
alpha mod_button_alpha
|
||||
|
||||
frame:
|
||||
if persistent.use_epilogue_menu:
|
||||
background Frame("gui/button/menubuttons/template_idle_epilogue.png", 12, 12)
|
||||
else:
|
||||
background Frame("gui/button/menubuttons/template_full_idle.png", 12, 12)
|
||||
|
||||
text _("Start") xalign 0.5 yalign 0.5 size 50 outlines [ (absolute(1), "#000", absolute(0), absolute(0)) ]
|
||||
action Start(mod_metadata["Label"])
|
||||
activate_sound "audio/ui/snd_ui_click.wav"
|
||||
|
||||
if len(mod_menu_errorcodes) != 0:
|
||||
button:
|
||||
frame:
|
||||
if persistent.use_epilogue_menu:
|
||||
background Frame("gui/button/menubuttons/template_idle_epilogue.png", 12, 12)
|
||||
else:
|
||||
background Frame("gui/button/menubuttons/template_full_idle.png", 12, 12)
|
||||
|
||||
text _("Show Errors") xalign 0.5 yalign 0.5 size 50 outlines [ (absolute(1), "#000", absolute(0), absolute(0)) ]
|
||||
action SetScreenVariable("mod_metadata", {})
|
||||
activate_sound "audio/ui/snd_ui_click.wav"
|
||||
|
||||
if not persistent.seenModWarning:
|
||||
$ persistent.seenModWarning = True
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
label splashscreen:
|
||||
if not renpy.get_autoreload():
|
||||
if not renpy.get_autoreload() and not persistent.reloading_mods:
|
||||
show caveintrosequence
|
||||
play sound 'audio/OST/startup.ogg'
|
||||
pause 11.2
|
||||
|
|
Loading…
Reference in a new issue