mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-31 15:19:29 +07:00
modding: Mod checker displays *all* unknown uniques
This commit is contained in:
@ -16,9 +16,6 @@ import com.unciv.utils.debug
|
||||
* save all of the loaded rulesets somewhere for later use
|
||||
* */
|
||||
object RulesetCache : HashMap<String, Ruleset>() {
|
||||
/** Whether mod checking allows untyped uniques - set to `false` once all vanilla uniques are converted! */
|
||||
var modCheckerAllowUntypedUniques = true
|
||||
|
||||
/** Similarity below which an untyped unique can be considered a potential misspelling.
|
||||
* Roughly corresponds to the fraction of the Unique placeholder text that can be different/misspelled, but with some extra room for [getRelativeTextDistance] idiosyncrasies. */
|
||||
var uniqueMisspellingThreshold = 0.15 // Tweak as needed. Simple misspellings seem to be around 0.025, so would mostly be caught by 0.05. IMO 0.1 would be good, but raising to 0.15 also seemed to catch what may be an outdated Unique.
|
||||
|
@ -755,11 +755,9 @@ class RulesetValidator(val ruleset: Ruleset) {
|
||||
if (fixes.isNotEmpty()) return fixes
|
||||
}
|
||||
|
||||
if (RulesetCache.modCheckerAllowUntypedUniques) return emptyList()
|
||||
|
||||
return listOf(RulesetError(
|
||||
"$prefix unique \"${unique.text}\" not found in Unciv's unique types.",
|
||||
RulesetErrorSeverity.WarningOptionsOnly))
|
||||
RulesetErrorSeverity.OK))
|
||||
}
|
||||
|
||||
private fun isFilteringUniqueAllowed(unique: Unique): Boolean {
|
||||
|
@ -3,17 +3,17 @@ package com.unciv.ui.popups.options
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
import com.unciv.GUI
|
||||
import com.unciv.UncivGame
|
||||
import com.unciv.logic.files.UncivFiles
|
||||
import com.unciv.logic.files.MapSaver
|
||||
import com.unciv.logic.files.UncivFiles
|
||||
import com.unciv.models.ruleset.RulesetCache
|
||||
import com.unciv.models.ruleset.tile.ResourceType
|
||||
import com.unciv.ui.screens.basescreen.BaseScreen
|
||||
import com.unciv.ui.components.UncivSlider
|
||||
import com.unciv.ui.components.UncivTextField
|
||||
import com.unciv.ui.components.input.onClick
|
||||
import com.unciv.ui.components.extensions.toCheckBox
|
||||
import com.unciv.ui.components.extensions.toLabel
|
||||
import com.unciv.ui.components.extensions.toTextButton
|
||||
import com.unciv.ui.components.input.onClick
|
||||
import com.unciv.ui.screens.basescreen.BaseScreen
|
||||
import com.unciv.utils.DebugUtils
|
||||
|
||||
fun debugTab(
|
||||
@ -80,10 +80,6 @@ fun debugTab(
|
||||
BaseScreen.enableSceneDebug = it
|
||||
}).colspan(2).row()
|
||||
|
||||
add("Allow untyped Uniques in mod checker".toCheckBox(RulesetCache.modCheckerAllowUntypedUniques) {
|
||||
RulesetCache.modCheckerAllowUntypedUniques = it
|
||||
}).colspan(2).row()
|
||||
|
||||
add(Table().apply {
|
||||
add("Unique misspelling threshold".toLabel()).left().fillX()
|
||||
add(
|
||||
|
@ -91,7 +91,6 @@ class BasicTests {
|
||||
|
||||
@Test
|
||||
fun baseRulesetHasNoBugs() {
|
||||
RulesetCache.modCheckerAllowUntypedUniques = false
|
||||
for (baseRuleset in BaseRuleset.values()) {
|
||||
val ruleset = RulesetCache[baseRuleset.fullName]!!
|
||||
val modCheck = ruleset.checkModLinks()
|
||||
|
Reference in New Issue
Block a user