mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 02:54:04 +09:00
worldinfo writer
This commit is contained in:
@@ -61,6 +61,7 @@ object ModMgr {
|
||||
}
|
||||
const val modDir = "./assets/mods"
|
||||
|
||||
/** Module name (directory name), ModuleMetadata */
|
||||
val moduleInfo = HashMap<String, ModuleMetadata>()
|
||||
|
||||
init {
|
||||
@@ -156,6 +157,7 @@ object ModMgr {
|
||||
checkExistence(module)
|
||||
return "$modDir/$module/${path.sanitisePath()}"
|
||||
}
|
||||
/** Returning files are read-only */
|
||||
fun getGdxFile(module: String, path: String): FileHandle {
|
||||
return Gdx.files.internal(getPath(module, path))
|
||||
}
|
||||
@@ -174,6 +176,40 @@ object ModMgr {
|
||||
}
|
||||
}
|
||||
|
||||
/** Get a common file from all the installed mods. Files are guaranteed to exist. If a mod does not
|
||||
* contain the file, the mod will be skipped. */
|
||||
fun getFilesFromEveryMod(path: String): List<File> {
|
||||
val path = path.sanitisePath()
|
||||
val moduleNames = moduleInfo.keys.toList()
|
||||
|
||||
val filesList = ArrayList<File>()
|
||||
moduleNames.forEach {
|
||||
val file = File(getPath(it, path))
|
||||
|
||||
if (file.exists()) filesList.add(file)
|
||||
}
|
||||
|
||||
return filesList.toList()
|
||||
}
|
||||
|
||||
/** Get a common file from all the installed mods. Files are guaranteed to exist. If a mod does not
|
||||
* contain the file, the mod will be skipped.
|
||||
*
|
||||
* Returning files are read-only. */
|
||||
fun getGdxFilesFromEveryMod(path: String): List<FileHandle> {
|
||||
val path = path.sanitisePath()
|
||||
val moduleNames = moduleInfo.keys.toList()
|
||||
|
||||
val filesList = ArrayList<FileHandle>()
|
||||
moduleNames.forEach {
|
||||
val file = Gdx.files.internal(getPath(it, path))
|
||||
|
||||
if (file.exists()) filesList.add(file)
|
||||
}
|
||||
|
||||
return filesList.toList()
|
||||
}
|
||||
|
||||
|
||||
|
||||
object GameBlockLoader {
|
||||
|
||||
Reference in New Issue
Block a user