Phase 5: Cobblebase jobs take back gated work, dig only zone ores
From Adrian's Mining test (2026-10-31): - A gated job assigned to a pastured Pokemon that doesn't pass its gate is taken back at once (BaseManager assignment cleared, Cobblebase's assignment sync sent, owner told what the Pokemon needs), so it no longer sticks or shows under Buffs -> Active. - Mining, Ore Finder and Evolution-item Finder only give the ores and evolution stones of the pasture's zone: new loot condition cobblesurvival:in_zone, the pack's versions of the 12 Cobblebase tables (tools/cobblebase_loot.py), Cobblebase's built-in copies removed at server start (ore/BaseLoot.kt). Mining adds quartz and the evolution stones, drops the type gems. - Mining's loot reaching the chest needs an Item Gatherer in the same pasture (Cobblebase's design); documented, not changed. - Self-tests gated_jobs_are_taken_back, base_jobs_dig_their_zones_ores; docs, balance table, licenses, Phase 5 checklist. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
70cc2cad50
commit
11a583db01
27 files changed
+1458
-28
No files matched your search
@@ -0,0 +1,58 @@
|
||||
package dev.cobblesurvival.selftest
|
||||
|
||||
import dev.cobblesurvival.ore.BaseLoot
|
||||
import dev.cobblesurvival.zone.InZoneCondition
|
||||
import dev.cobblesurvival.zone.Zones
|
||||
import net.minecraft.core.BlockPos
|
||||
import net.minecraft.core.registries.BuiltInRegistries
|
||||
import net.minecraft.gametest.framework.GameTestAssertException
|
||||
import net.minecraft.world.level.storage.loot.LootContext
|
||||
import net.minecraft.world.level.storage.loot.LootParams
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams
|
||||
import net.minecraft.world.phys.Vec3
|
||||
import java.util.Optional
|
||||
|
||||
/**
|
||||
* Cobblebase's base jobs only dig up the pasture zone's ores (Adrian, 2026-10-31): Cobblebase's built-in copies of the
|
||||
* mining and finder tables are gone, `cobblesurvival:in_zone` holds only inside its zones, and Mining's common table
|
||||
* gives Button Isle coal but no iron and Westmarch iron but no coal (world/zones.json: coal is Button Isle's only ore,
|
||||
* raw iron comes from Westmarch).
|
||||
*/
|
||||
object BaseLootTests {
|
||||
private const val ROLLS = 200
|
||||
|
||||
fun all() = listOf(SelfTestCase("base_jobs_dig_their_zones_ores", 40, ::baseJobsDigTheirZonesOres))
|
||||
|
||||
/** A spot in [zone], high above the ground so no cave zone lies there. */
|
||||
private fun spotIn(s: Scenario, zone: String): BlockPos {
|
||||
val sample = Zones.samples[zone] ?: throw GameTestAssertException("no sample point for $zone")
|
||||
val pos = BlockPos(sample.x, 250, sample.z)
|
||||
s.check(Zones.at(s.level, pos)?.id == zone) { "the sample point of $zone lies in ${Zones.at(s.level, pos)?.id}" }
|
||||
return pos
|
||||
}
|
||||
|
||||
private fun baseJobsDigTheirZonesOres(s: Scenario) {
|
||||
val level = s.level
|
||||
s.check(BaseLoot.builtInLeft().isEmpty()) { "Cobblebase still rolls its own copies of ${BaseLoot.builtInLeft()}" }
|
||||
val isle = spotIn(s, "button_isle")
|
||||
val westmarch = spotIn(s, "westmarch")
|
||||
|
||||
val params = LootParams.Builder(level).withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(isle)).create(LootContextParamSets.CHEST)
|
||||
val context = LootContext.Builder(params).create(Optional.empty())
|
||||
s.check(InZoneCondition(listOf("button_isle")).test(context)) { "in_zone [button_isle] is false on Button Isle" }
|
||||
s.check(!InZoneCondition(listOf("westmarch")).test(context)) { "in_zone [westmarch] is true on Button Isle" }
|
||||
|
||||
fun dug(pos: BlockPos, table: String) = (1..ROLLS).flatMap { BaseLoot.roll(table, level, pos) }
|
||||
.map { BuiltInRegistries.ITEM.getKey(it.item).path }.toSet()
|
||||
val onIsle = dug(isle, "cobblebase:mining_common")
|
||||
s.check("coal" in onIsle && "raw_iron" !in onIsle && "raw_copper" !in onIsle) { "Mining on Button Isle dug up $onIsle" }
|
||||
val inWestmarch = dug(westmarch, "cobblebase:mining_common")
|
||||
s.check("raw_iron" in inWestmarch && "coal" !in inWestmarch) { "Mining in Westmarch dug up $inWestmarch" }
|
||||
val gems = (dug(isle, "cobblebase:mining_uncommon") + dug(isle, "cobblebase:mining_ultra_rare")).filter { it.endsWith("_gem") }
|
||||
s.check(gems.isEmpty()) { "Mining still digs up type gems: $gems" }
|
||||
val stones = dug(isle, "cobblebase:finder_evo_common")
|
||||
s.check(stones.isEmpty()) { "the Evolution-item Finder found $stones on Button Isle, which has no evolution stones" }
|
||||
s.helper.succeed()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user