def init_inject(root, console): info("Adding el rainbow") extention_loader.safepost(console, "Adding el rainbow", color=(170, 0, 170), bold=1) for c in xrange(COUNT): root.extentions["rainbow" + hex(c)] = Rainbow(root)
def init_inject(root, console): info("Injecting the SecretHook") extention_loader.safepost( console, "[sebastianmod:supersecreteasteregg]: Injecting the SecretHook", color=(0, 255, 255), bold=1) root.extentions["x_test_secret"] = supersecreteasteregg(root)
def init_inject(root, console): info("[cheats:insert_cheat_hook]: Injecting the CheatHook") extention_loader.safepost( console, "[cheats:insert_cheat_hook]: Injecting the CheatHook", color=(0, 255, 255), bold=1) root.extentions["cheathook"] = CheatHook(root)
def init_inject(root, console): info("Injecting the ExplosionHook") extention_loader.safepost( console, "[moreexplosions:ExplosionSFXManager]: Injecting the ExplosionHook", color=(0, 255, 255), bold=1) root.extentions["x_more_explosions"] = ExplosionSFXManager(root)
def init_inject(root, console): info("Injecting the SoundHook") extention_loader.safepost( console, "[eventsounds:sound_click]: Injecting the SoundHook", color=(0, 255, 255), bold=1) root.extentions["x_sounds_clickhook"] = ClickHook(root)
def init_state(self, console): extention_loader.safepost( console, "[stock]: Adding the ANIMCutscenePlayer StateFactory", color=(0, 255, 255), bold=1) debug("Adding the state") absroot.state_manager.factories[ "cutscene_anim"] = state.InterdictingStateFactory(ANIMCutscenePlayer) primitives.register_primitive(absroot, "play_cutsceneanim", ANIMCutscenePlayerPrimitive)
def apply_mm_patch(json_data, basepath, dirn, filen, console): c=0 for asset in absroot.json_patches: patch=jsonpatch.JsonPatch(asset["patch"]) try: patch.apply(json_data, True) debug("Applied "+asset["name"]+" ...") c+=1 except jsonpatch.JsonPatchTestFailed: pass if c>0: extention_loader.safepost(absroot.loader_renderer, " (Applied "+str(c)+" JsonPatch operations)", italic=1)
def load_file(self, basepath, dirn, filen, console, pattern): #print sorted(self.assets.keys()) #print filen with open(dirn + "/" + filen, 'r') as fp: json_data = json.load(fp) if not "require" in json_data: json_data["require"] = [] #json_data["require"].extend(jsonutil.get_inserts(json_data)) # <-- Causes assetkeys that define A and then reference it in B to never load #print json_data["require"] for dep in json_data["require"]: if not self.has_asset(dep): # print dep debug("Dependency '" + dep + "' not met, aborting for now...") for config in self.delayed_load_files: if config[0] == basepath and config[1] == dirn and config[ 2] == filen: # print "already found" return self.delayed_load_files.append( (basepath, dirn, filen, console, pattern, dep)) # print "actually added" return if pattern in self.extention_loaders: debug("Loading " + dirn + "/" + filen + " (matched pattern " + pattern + ") using all known loaders") extention_loader.safepost( console, "Loading " + dirn + "/" + filen + " --> " + ", ".join( [f.func_name for f in self.extention_loaders[pattern]])) for loader in self.extention_loaders[pattern]: try: loader(json_data, basepath, dirn, filen, console) except BaseException as e: tasks.display_hanging_message( "An unknown error appeared while loading the file `" + dirn + "/" + filen + "` : Check log (" + str(e) + ")", color=(255, 0, 0)) for config in self.delayed_load_files: if config[0] == basepath and config[1] == dirn and config[ 2] == filen: del self.delayed_load_files[self.delayed_load_files.index( config)] for delayed in self.delayed_load_files: if self.has_asset(delayed[-1]): self.load_file(*delayed[:-1])
def apply_mm_patch(json_data, basepath, dirn, filen, console): c = 0 for asset in absroot.json_patches: patch = jsonpatch.JsonPatch(asset["patch"]) try: patch.apply(json_data, True) debug("Applied " + asset["name"] + " ...") c += 1 except jsonpatch.JsonPatchTestFailed: pass if c > 0: extention_loader.safepost(absroot.loader_renderer, " (Applied " + str(c) + " JsonPatch operations)", italic=1)
def load_file(self, basepath, dirn, filen, console, pattern): #print sorted(self.assets.keys()) #print filen with open(dirn+"/"+filen, 'r') as fp: json_data=json.load(fp) if not "require" in json_data: json_data["require"]=[] #json_data["require"].extend(jsonutil.get_inserts(json_data)) # <-- Causes assetkeys that define A and then reference it in B to never load #print json_data["require"] for dep in json_data["require"]: if not self.has_asset(dep): # print dep debug("Dependency '"+dep+"' not met, aborting for now...") for config in self.delayed_load_files: if config[0]==basepath and config[1]==dirn and config[2]==filen: # print "already found" return self.delayed_load_files.append((basepath, dirn, filen, console, pattern, dep)) # print "actually added" return if pattern in self.extention_loaders: debug("Loading "+dirn+"/"+filen+" (matched pattern "+pattern+") using all known loaders") extention_loader.safepost(console, "Loading "+dirn+"/"+filen+" --> "+", ".join([f.func_name for f in self.extention_loaders[pattern]])) for loader in self.extention_loaders[pattern]: try: loader(json_data, basepath, dirn, filen, console) except BaseException as e: tasks.display_hanging_message("An unknown error appeared while loading the file `"+dirn+"/"+filen+"` : Check log ("+str(e)+")", color=(255,0,0)) for config in self.delayed_load_files: if config[0]==basepath and config[1]==dirn and config[2]==filen: del self.delayed_load_files[self.delayed_load_files.index(config)] for delayed in self.delayed_load_files: if self.has_asset(delayed[-1]): self.load_file(*delayed[:-1])
def init_inject(root, console): info("Injecting the ExplosionHook") extention_loader.safepost(console, "[moreexplosions:ExplosionSFXManager]: Injecting the ExplosionHook", color=(0,255,255), bold=1) root.extentions["x_more_explosions"]=ExplosionSFXManager(root)
def init_inject(root, console): info("Adding el rainbow") extention_loader.safepost(console, "Adding el rainbow", color=(170, 0, 170), bold=1) for c in xrange(COUNT): root.extentions["rainbow"+hex(c)]=Rainbow(root)
def init_regwarps(root, console): extention_loader.safepost(console, "[stock]: Setting up SectorChangeManager", color=(0, 255, 255), bold=1) root.extentions["dialog_interact_manager"] = SectorChangeManager(root)
def init_inject(root, console): info("Injecting the SecretHook") extention_loader.safepost(console, "[sebastianmod:supersecreteasteregg]: Injecting the SecretHook", color=(0,255,255), bold=1) root.extentions["x_test_secret"]=supersecreteasteregg(root)
def wditem_hook(json_data, basepath, dirn, filen, console): json_data=jsonutil.get_expanded_json2(json_data) extention_loader.safepost(console, "Loading Item from assetkey:"+json_data["id"]+" with WarpdriveItemFactory...") absroot.item_factories[json_data["id"]]=WarpdriveItemFactory(absroot, json_data)
def init_inject(root, console): info("Injecting the SoundHook") extention_loader.safepost(console, "[eventsounds:sound_click]: Injecting the SoundHook", color=(0,255,255), bold=1) root.extentions["x_sounds_clickhook"]=ClickHook(root)
def init_state(self, console): extention_loader.safepost(console, "[stock]: Adding the ANIMCutscenePlayer StateFactory", color=(0,255,255), bold=1) debug("Adding the state") absroot.state_manager.factories["cutscene_anim"]=state.InterdictingStateFactory(ANIMCutscenePlayer) primitives.register_primitive(absroot, "play_cutsceneanim", ANIMCutscenePlayerPrimitive)
def init_regwarps(root, console): extention_loader.safepost(console, "[stock]: Setting up SectorChangeManager", color=(0,255,255), bold=1) root.extentions["dialog_interact_manager"]=SectorChangeManager(root)
def init_test_multi(root, console): extention_loader.safepost(console, "(Multi-init works)")
def init_test_multi(root, console): extention_loader.safepost(console, "(Multi-init works)")