From 6a437d3400d040dbe5f9a40a4206e5a634fe81b5 Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Sun, 5 Feb 2023 17:09:49 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C=D1=88?= =?UTF-8?q?=D0=BE=D0=B9=20=D1=82=D0=B5=D1=81=D1=82=20=D0=BF=D0=BE=D0=B4?= =?UTF-8?q?=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D0=B8=20=D0=B2=D1=81=D0=B5=D1=85?= =?UTF-8?q?=20=D0=BC=D0=BE=D0=B4=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kotlin/ru/dbotthepony/kstarbound/Main.kt | 11 +++++ .../ru/dbotthepony/kstarbound/Starbound.kt | 26 +++++++--- .../kstarbound/defs/IThingWithDescription.kt | 4 +- .../defs/item/ArmorItemDefinition.kt | 2 +- .../defs/item/CurrencyItemDefinition.kt | 2 +- .../defs/item/FlashlightDefinition.kt | 2 +- .../defs/item/HarvestingToolDefinition.kt | 2 +- .../kstarbound/defs/item/IItemDefinition.kt | 6 ++- .../kstarbound/defs/item/ItemDefinition.kt | 2 +- .../kstarbound/defs/item/ItemPrototype.kt | 2 +- .../kstarbound/defs/item/ItemTooltipKind.kt | 48 ------------------- .../defs/item/LiquidItemDefinition.kt | 2 +- .../defs/item/MaterialItemDefinition.kt | 2 +- 13 files changed, 44 insertions(+), 67 deletions(-) delete mode 100644 src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/ItemTooltipKind.kt diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/Main.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/Main.kt index 3d51df8a..e0165ecd 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/Main.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/Main.kt @@ -23,6 +23,8 @@ private val LOGGER = LogManager.getLogger() fun main() { LOGGER.info("Running LWJGL ${Version.getVersion()}") + //Thread.sleep(6_000L) + val db = BTreeDB(File("F:\\SteamLibrary\\steamapps\\common\\Starbound - Unstable\\storage\\universe\\389760395_938904237_-238610574_5.world")) //val db = BTreeDB(File("world.world")) @@ -30,6 +32,15 @@ fun main() { //Starbound.addFilePath(File("./unpacked_assets/")) Starbound.addPakPath(File("J:\\Steam\\steamapps\\common\\Starbound\\assets\\packed.pak")) + + /*for (folder in File("J:\\Steam\\steamapps\\workshop\\content\\211820").list()!!) { + val f = File("J:\\Steam\\steamapps\\workshop\\content\\211820\\$folder\\contents.pak") + + if (f.exists()) { + Starbound.addPakPath(f) + } + }*/ + //Starbound.addPakPath(File("packed.pak")) Starbound.initializeGame { finished, replaceStatus, status -> diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/Starbound.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/Starbound.kt index 4195ee29..ce95063a 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/Starbound.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/Starbound.kt @@ -322,7 +322,10 @@ object Starbound { it("Loading $listedFile") val def = pathStack(listedFile.computeDirectory()) { GSON.fromJson(listedFile.reader(), clazz) } val key = getKey.invoke(def) - check(put.invoke(key, def) == null) { "Already has $name with name $key loaded!" } + + if (put.invoke(key, def) != null) { + LOGGER.warn("Already had $name with name $key loaded! Older prototype was overwritten (loading $listedFile)") + } } catch (err: Throwable) { LOGGER.error("Loading $name definition file $listedFile", err) } @@ -351,8 +354,14 @@ object Starbound { val def = pathStack(listedFile.computeDirectory()) { GSON.fromJson(listedFile.reader(), clazz) } val key0 = getKey0.invoke(def) val key1 = getKey1.invoke(def) - check(put0.invoke(key0, def) == null) { "Already has $name with name $key0 loaded!" } - check(put1.invoke(key1, def) == null) { "Already has $name with ID $key1 loaded!" } + + if (put0.invoke(key0, def) != null) { + LOGGER.warn("Already had $name with name $key0 loaded! Older prototype was overwritten (loading $listedFile)") + } + + if (put1.invoke(key1, def) != null) { + LOGGER.warn("Already had $name with ID $key1 loaded! Older prototype was overwritten (loading $listedFile)") + } } catch (err: Throwable) { LOGGER.error("Loading $name definition file $listedFile", err) } @@ -371,10 +380,10 @@ object Starbound { callback(false, false, "Searching for pak archives...".also(LOGGER::info)) for (path in archivePaths) { - callback(false, false, "Reading index of ${path.name}...".also(LOGGER::info)) + callback(false, false, "Reading index of ${path}...".also(LOGGER::info)) addPak(StarboundPak(path) { _, status -> - callback(false, true, "${path.name}: $status") + callback(false, true, "${path.parent}/${path.name}: $status") }) } } @@ -433,7 +442,7 @@ object Starbound { callback(false, false, "Finished building file index in ${System.currentTimeMillis() - time}ms".also(LOGGER::info)) loadStage(callback, this::loadFunctions, "functions") - loadStage(callback, this::loadProjectiles, "projectiles") + //loadStage(callback, this::loadProjectiles, "projectiles") loadStage(callback, this::loadParallax, "parallax definitions") loadStage(callback, this::loadItemDefinitions, "item definitions") @@ -565,7 +574,10 @@ object Starbound { try { callback("Loading $listedFile") val def: ItemPrototype = pathStack(listedFile.computeDirectory()) { GSON.fromJson(listedFile.reader(), files.entries.first { listedFile.name.endsWith(it.key) }.value) } - check(items.put(def.itemName, def.assemble()) == null) { "Already has item with name ${def.itemName} loaded!" } + + if (items.put(def.itemName, def.assemble()) != null) { + LOGGER.warn("Already has item with name ${def.itemName} loaded! Older prototype was overwritten (loading $listedFile)") + } } catch (err: Throwable) { LOGGER.error("Loading item definition file $listedFile", err) } diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/IThingWithDescription.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/IThingWithDescription.kt index aaf84317..68e09f60 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/IThingWithDescription.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/IThingWithDescription.kt @@ -85,8 +85,8 @@ data class ThingDescription( override fun read(`in`: JsonReader): ThingDescription { `in`.beginObject() - var shortdescription: String by NotNullVar() - var description: String by NotNullVar() + var shortdescription = "..." + var description = "..." val racial = ImmutableMap.Builder() val racialShort = ImmutableMap.Builder() diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/ArmorItemDefinition.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/ArmorItemDefinition.kt index 54a93ae1..638852f9 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/ArmorItemDefinition.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/ArmorItemDefinition.kt @@ -18,7 +18,7 @@ data class ArmorItemDefinition( override val pickupQuestTemplates: List, override val scripts: List, override val scriptDelta: Int, - override val tooltipKind: ItemTooltipKind, + override val tooltipKind: String, override val twoHanded: Boolean, override val radioMessagesOnPickup: List, override val fuelAmount: Long?, diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/CurrencyItemDefinition.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/CurrencyItemDefinition.kt index a4f7ea46..94edeb65 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/CurrencyItemDefinition.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/CurrencyItemDefinition.kt @@ -15,7 +15,7 @@ data class CurrencyItemDefinition( override val eventCategory: String?, override val consumeOnPickup: Boolean, override val pickupQuestTemplates: List, - override val tooltipKind: ItemTooltipKind, + override val tooltipKind: String, override val twoHanded: Boolean, override val radioMessagesOnPickup: List, override val fuelAmount: Long?, diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/FlashlightDefinition.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/FlashlightDefinition.kt index 11a91a01..387ed9ba 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/FlashlightDefinition.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/FlashlightDefinition.kt @@ -18,7 +18,7 @@ data class FlashlightDefinition( override val eventCategory: String?, override val consumeOnPickup: Boolean, override val pickupQuestTemplates: ImmutableList, - override val tooltipKind: ItemTooltipKind, + override val tooltipKind: String, override val twoHanded: Boolean, override val radioMessagesOnPickup: ImmutableList, override val fuelAmount: Long?, diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/HarvestingToolDefinition.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/HarvestingToolDefinition.kt index 445ededd..2bbae579 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/HarvestingToolDefinition.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/HarvestingToolDefinition.kt @@ -17,7 +17,7 @@ data class HarvestingToolDefinition( override val eventCategory: String?, override val consumeOnPickup: Boolean, override val pickupQuestTemplates: ImmutableList, - override val tooltipKind: ItemTooltipKind, + override val tooltipKind: String, override val twoHanded: Boolean, override val radioMessagesOnPickup: ImmutableList, override val fuelAmount: Long?, diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/IItemDefinition.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/IItemDefinition.kt index bd8264ed..df70092e 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/IItemDefinition.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/IItemDefinition.kt @@ -115,9 +115,11 @@ interface IItemDefinition : IThingWithDescription { val pickupQuestTemplates: List /** - * это где либо ещё применяется кроме брони? + * тип tooltip'а + * + * ссылается на конфиг окон */ - val tooltipKind: ItemTooltipKind + val tooltipKind: String /** * Занимает ли предмет обе руки diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/ItemDefinition.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/ItemDefinition.kt index 1d16e081..aadaccb7 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/ItemDefinition.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/ItemDefinition.kt @@ -18,7 +18,7 @@ data class ItemDefinition( override val eventCategory: String?, override val consumeOnPickup: Boolean, override val pickupQuestTemplates: ImmutableList, - override val tooltipKind: ItemTooltipKind, + override val tooltipKind: String, override val twoHanded: Boolean, override val radioMessagesOnPickup: ImmutableList, override val fuelAmount: Long?, diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/ItemPrototype.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/ItemPrototype.kt index bf4f9e13..dc6bd434 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/ItemPrototype.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/ItemPrototype.kt @@ -28,7 +28,7 @@ open class ItemPrototype : IItemDefinition, INativeJsonHolder { final override var eventCategory: String? = null final override var consumeOnPickup: Boolean = false final override var pickupQuestTemplates: ImmutableList = ImmutableList.of() - final override var tooltipKind: ItemTooltipKind = ItemTooltipKind.NORMAL + final override var tooltipKind: String = "normal" final override var twoHanded: Boolean = false final override var radioMessagesOnPickup: ImmutableList = ImmutableList.of() final override var fuelAmount: Long? = null diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/ItemTooltipKind.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/ItemTooltipKind.kt deleted file mode 100644 index 1504abbc..00000000 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/ItemTooltipKind.kt +++ /dev/null @@ -1,48 +0,0 @@ -package ru.dbotthepony.kstarbound.defs.item - -enum class ItemTooltipKind { - /** - * Обычные предметы - */ - NORMAL, - - /** - * Инструмент (кирка, музыкальный инструмент, мотыга, т.п.) - */ - TOOL, - - /** - * Улучшение для рюкзака - */ - BASE_AUGMENT, - - /** - * Рюкзаки - */ - BACK, - - /** - * Броня - */ - ARMOR, - - /** - * "Руки" меха - */ - MECH_ARM, - - /** - * "Ноги" меха - */ - MECH_LEGS, - - /** - * Ускорители меха - */ - MECH_BOOSTER, - - /** - * Тело меха - */ - MECH_BODY, -} diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/LiquidItemDefinition.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/LiquidItemDefinition.kt index 6ea7727f..d0f4a62e 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/LiquidItemDefinition.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/LiquidItemDefinition.kt @@ -16,7 +16,7 @@ data class LiquidItemDefinition( override val eventCategory: String?, override val consumeOnPickup: Boolean, override val pickupQuestTemplates: List, - override val tooltipKind: ItemTooltipKind, + override val tooltipKind: String, override val twoHanded: Boolean, override val radioMessagesOnPickup: List, override val fuelAmount: Long?, diff --git a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/MaterialItemDefinition.kt b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/MaterialItemDefinition.kt index c51221e0..7b974071 100644 --- a/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/MaterialItemDefinition.kt +++ b/src/main/kotlin/ru/dbotthepony/kstarbound/defs/item/MaterialItemDefinition.kt @@ -16,7 +16,7 @@ data class MaterialItemDefinition( override val eventCategory: String?, override val consumeOnPickup: Boolean, override val pickupQuestTemplates: List, - override val tooltipKind: ItemTooltipKind, + override val tooltipKind: String, override val twoHanded: Boolean, override val radioMessagesOnPickup: List, override val fuelAmount: Long?,