forked from Cavemanon/SnootGame
Mod Loader v2
This commit is contained in:
@ -13,11 +13,43 @@
|
||||
#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:
|
||||
init -3 python:
|
||||
# Modding Support variables
|
||||
# All mod rpy files must run a small init python script
|
||||
mod_dir = "mods/";
|
||||
mod_menu_access = [];
|
||||
class ModLoader():
|
||||
def __init__(self):
|
||||
self.mod_dir = "mods/"
|
||||
self.mod_menu_access = []
|
||||
self.mod_id = -1
|
||||
self.mod_variables = []
|
||||
|
||||
def add_mod(self, name, label):
|
||||
self.mod_menu_access += [{
|
||||
'Name': name,
|
||||
'Label': label
|
||||
}]
|
||||
self.mod_id += 1
|
||||
self.mod_variables.append({})
|
||||
return self.mod_id
|
||||
|
||||
# name, filename
|
||||
def add_image(self, name, filename):
|
||||
s = str(self.mod_id)+name
|
||||
renpy.image(s, Image(filename))
|
||||
#z = renpy.get_registered_image(s)
|
||||
#self.mod_variables[self.mod_id][name] = z
|
||||
self.mod_variables[self.mod_id][name] = s
|
||||
print(self.mod_variables[self.mod_id])
|
||||
|
||||
def add_variable(name, default):
|
||||
self.mod_variables[self.mod_id][name] = default
|
||||
|
||||
def get(self, _id):
|
||||
return self.mod_variables[_id]
|
||||
|
||||
|
||||
mod_loader = ModLoader()
|
||||
|
||||
|
||||
init python:
|
||||
import random
|
||||
|
Reference in New Issue
Block a user