Skip to content

Commit

Permalink
Mod Installer
Browse files Browse the repository at this point in the history
"Port" mods to work under this mod

Ideally this should be an executable but it is easy for me to write it on python for yet.
  • Loading branch information
Mikk155 committed Mar 16, 2024
1 parent 22c1914 commit cc22876
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
4 changes: 4 additions & 0 deletions game/mod_installer.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off
cd mods
mod_installer.py
pause
48 changes: 48 additions & 0 deletions game/mods/mod_installer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import os
import json
import shutil
import subprocess

data = ""

while True:

print( f'Note: You must install the original mod\'s resources within \"limitlesspotential/mods/assets/\" before using this tool.' )

package = input( f'Write the name of the .json installer package: ' )

if os.path.exists( f'{package}.json' ):
with open( f'{package}.json', 'r' ) as load:
data = json.load( load )
break
else:
print( f'\"limitlesspotential/mods/{package}.json\" not found.' )

if not data:
exit(0)

input( f'Press enter if you\'ve propertly installed the assets from {data.get( "url", "" ) }' )

ripent = os.path.join( os.path.dirname( __file__ ), 'tools/ripent.exe' )

if "ripent" in data:
r = data.get( "ripent", {} )
if "import" in r:
i = r.get( "import", {} )
for d, m in i.items():
if os.path.exists( f'assets/maps/{d}.ent' ):
shutil.copy( f'assets/maps/{d}.ent', f'mod/maps/{d}.ent' )
arguments = [ '-import', f'mod/maps/{d}.ent' ]
command = [ripent] + arguments
process = subprocess.Popen(command)
process.wait()

if "resources" in data:
r = data.get( "resources", {} )
for d, m in r.items():
if os.path.exists( f'mod/{d}' ):
shutil.move( f'mod/{d}', f'../{d}' )

shutil.rmtree( 'mod/')
if not os.path.exists( 'mod/' ):
os.makedirs( 'mod/' )
Binary file added game/mods/tools/ripent.exe
Binary file not shown.

0 comments on commit cc22876

Please sign in to comment.