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,50 +893,39 @@ 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"
|
||||
|
||||
|
||||
# Mod details pane
|
||||
viewport:
|
||||
$ 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
|
||||
if mod_has_label_android:
|
||||
ymaximum 900
|
||||
else:
|
||||
ymaximum 1050
|
||||
xpos 15
|
||||
ypos 15
|
||||
# Mod details pane
|
||||
viewport:
|
||||
if needs_android_buttons:
|
||||
ymaximum 900
|
||||
|
||||
scrollbars "vertical"
|
||||
vscrollbar_unscrollable "hide"
|
||||
mousewheel True
|
||||
draggable True
|
||||
vbox:
|
||||
style_prefix "mod_menu"
|
||||
|
||||
if mod_metadata == {} and len(mod_menu_errorcodes) != 0:
|
||||
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])
|
||||
elif mod_metadata != {}:
|
||||
# Thumbnail
|
||||
python:
|
||||
if mod_metadata["Enabled"] == True and return_translated_metadata(mod_metadata, "Thumbnail Displayable") != None:
|
||||
|
@ -1035,27 +1025,36 @@ screen mod_menu():
|
|||
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
|
||||
|
||||
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])
|
||||
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