From f9edccabd4f211f3b408c8559ccba2eef7399f34 Mon Sep 17 00:00:00 2001 From: nutbuster Date: Sun, 4 Jul 2021 16:06:59 +1000 Subject: [PATCH] Add Mod Support --- game/mods/storyline_ex.rpy | 12 ++++++++++ game/mods/template/chapter2_redo.rpy | 9 +++++++ game/mods/template/img/sample.png | Bin 0 -> 468 bytes game/options.rpy | 4 ++++ game/screens.rpy | 34 ++++++++++++++++++++++++--- game/script.rpy | 16 +++++++++---- game/storyline.rpy | 2 +- 7 files changed, 68 insertions(+), 9 deletions(-) create mode 100644 game/mods/storyline_ex.rpy create mode 100644 game/mods/template/chapter2_redo.rpy create mode 100644 game/mods/template/img/sample.png diff --git a/game/mods/storyline_ex.rpy b/game/mods/storyline_ex.rpy new file mode 100644 index 0000000..1d2b34c --- /dev/null +++ b/game/mods/storyline_ex.rpy @@ -0,0 +1,12 @@ + +init python: + # Modding Support variables + # All mod rpy files must have title of their mod (this shows up on a button) + # and finally the label that controls the flow of dialogue + + mod_menu_access += [["Example Mod", "storyline_ex"]]; + +image template_sample = Image("mods/template/img/sample.png") + +label storyline_ex: + call chapter_2_new diff --git a/game/mods/template/chapter2_redo.rpy b/game/mods/template/chapter2_redo.rpy new file mode 100644 index 0000000..bbc2fe0 --- /dev/null +++ b/game/mods/template/chapter2_redo.rpy @@ -0,0 +1,9 @@ + + +label chapter_2_new: + show template_sample at scenter + "Sample Text" + hide template_sample + show anon neutral flip at aright with dissolve + A "Sample Text" + return diff --git a/game/mods/template/img/sample.png b/game/mods/template/img/sample.png new file mode 100644 index 0000000000000000000000000000000000000000..a90472f6d53bd1abd70ac0c2eafa3f83019ab11b GIT binary patch literal 468 zcmeAS@N?(olHy`uVBq!ia0vp^DImFdh=l%0h|*i6n@oDnD_S>hT|;+&tGo0?a`;9QiNSdyBeP@Y+mq2TW68xY>eC(gjY z=;!I;7*cWT?H$LyW(5X^K*M|gPnD!P@oG)t@VMunX51V6nt9D;g(DJ=7bQl;GAS@I zxi~a%a0oCmDv`pTkjbs6qsXGbWKP=VrA% z(F^PO`2P9H`zu^`F!{x=mKAYsma#u^_vrpvmcO%KZrpi)s!TZ7{i6QuYp<@kp`T}^ z9o4sI*1^k<_iUTy9s2IDocsN|wM(ymvU<9G&7GjB(d(;|zT9itbkkO)_J`H(%zd2` ztKX|1-%?c(6WzZ{PD1s4Z1KMJa~{9BePrI<)ix`+JL>21+_)Z=V$9Ofz#u39^&qkA d3H;xg{pa@YSXe)K7clr4JYD@<);T3K0RZZtrR)Fz literal 0 HcmV?d00001 diff --git a/game/options.rpy b/game/options.rpy index 76119cc..04a6d16 100644 --- a/game/options.rpy +++ b/game/options.rpy @@ -185,6 +185,10 @@ init python: build.classify('**/#**', None) build.classify('**/thumbs.db', None) + # Do not include mods as part of the build process + build.classify('game/mods/**', None) + build.classify('game/mods/.**', None) + ## To archive files, classify them as 'archive'. # build.classify('game/**.png', 'archive') diff --git a/game/screens.rpy b/game/screens.rpy index 2031d83..7deea1e 100644 --- a/game/screens.rpy +++ b/game/screens.rpy @@ -4,7 +4,6 @@ init offset = -1 - ################################################################################ ## Styles ################################################################################ @@ -416,12 +415,13 @@ screen main_menu(): else: add "gui/snootgame.png" vbox: - spacing 25 + spacing 10 xpos 1885 - yalign 0.9 + yalign 0.98 use main_menu_buttons("gui/button/menubuttons/template_idle.png", [ \ [ "Start", Start() ], \ + [ "Mods", ShowMenu("mod_menu") ], \ [ "Load", ShowMenu("load") ], \ [ "Options", ShowMenu("preferences") ], \ [ "Help & About", ShowMenu("extras") ], \ @@ -467,6 +467,34 @@ style main_menu_title: # properties gui.text_properties("version") + +## Mod Menu screen ############################################################ +## +## Handles jumping to the mods scripts +## +screen mod_menu(): + + + tag menu + viewport: + yinitial 0 + scrollbars "vertical" + mousewheel True + draggable True + pagekeys True + +#side_yfill True + + vbox: + spacing 10 + xpos 1885 + yalign 0.98 + + for x in mod_menu_access: + use main_menu_button("gui/button/menubuttons/template_idle.png", + x[0], Start(x[1]) ) + + ## Game Menu screen ############################################################ ## ## This lays out the basic common structure of a game menu screen. It's called diff --git a/game/script.rpy b/game/script.rpy index adbb5a5..f0b584e 100644 --- a/game/script.rpy +++ b/game/script.rpy @@ -13,17 +13,23 @@ #Why yes all my code was formerly in one massive file called "script" thats 28k lines long, how could you tell? #Licensed under the GNU AGPL v3, for more information check snootgame.xyz or the LICENSE file that should have came with this work. +init -1 python: + # Modding Support variables + # All mod rpy files must run a small init python script + mod_dir = "mods/"; + mod_menu_access = []; + init python: - import random - import webbrowser - #function for insult layers - def showCG(): + import random + import webbrowser + #function for insult layers + def showCG(): files = ["text0", "text1", "text2", "text3", "text4", "text5", "text6", "text7", "text8", "text9"] length = len(files) picked = random.randint(0,length - 1) fileName = files[picked] renpy.show(fileName, at_list=[randPosition]) - if persistent.scroll == True: + if persistent.scroll == True: config.keymap['dismiss'].append('mousedown_4') transform randPosition: diff --git a/game/storyline.rpy b/game/storyline.rpy index 5c1e906..846d6ba 100644 --- a/game/storyline.rpy +++ b/game/storyline.rpy @@ -58,4 +58,4 @@ label ending: if tradwife: scene c10 with fade pause 20 - return \ No newline at end of file + return