"use strict"; class World { constructor() { this.w = 1000; this.h = 720; this.viewportW = 1000; this.viewportH = 720; this.time = 0; this.day = 1; this.paused = false; this.speed = 1; this.tool = "observe"; this.toolSize = "medium"; this.toolSizes = {}; this.toolPickMode = "free"; this.toolAngles = {}; this.tarinaiPopulationLimit = 0; this.objectLimit = 0; this.resetRuntimeCollections(); this.pointer = { x: 0, y: 0, inside: false, motion: 0 }; this.hoverGrabTarget = null; this.hoverDeleteTarget = null; this.hoverGiveTarget = null; this.hoverPokeTarget = null; this.shootCursorActive = false; this.shootPointerRawX = 0; this.shootPointerRawY = 0; this.shootCursorOffsetX = 0; this.shootCursorOffsetY = 0; this.lastShootAt = -999; this.lastPhase = ""; this.weather = "sunny"; this.worldSeed = window.TarinaiSeedFactory.createWorldSeed() || `w${Date.now().toString(36)}`; this.birthSerial = 0; this.fieldType = "garden"; this.groundType = "soil"; this.fieldZoom = 1; this.cameraX = 0; this.cameraY = 0; this.shakeTimer = 0; this.shakeDuration = 0; this.shakeStrength = 0; this.nextWeatherChange = rand(CONFIG.weatherChangeMin, CONFIG.weatherChangeMax); const tempAnnualUnit = typeof stableUnit === "function" ? stableUnit(`${this.worldSeed}:temperature`, "annual-range") : Math.random(); this.temperatureAuto = true; this.manualTemperature = 10; this.currentTemperature = 10; this.temperatureAnnualRange = 25 + tempAnnualUnit * 10; this.temperatureDailyRange = 0; this.spatial = new SpatialGrid(96); this.spatialItemScratch = []; this.spatialTarinaiScratch = []; this.spatialAntScratch = []; this.spatialObstacleScratch = []; this.spatialFoodScratch = []; this.spatialHazardScratch = []; this.spatialVersion = 0; this.spatialDirty = true; this.terrainDirty = true; this.terrainVersion = 1; this.terrainDirtyReason = "init"; this.terrainLastDirtyAt = 0; this.lastTerrainSignature = ""; this.drawList = []; this.itemCounts = {}; this.effectCounts = {}; this.colonyMood = { id: "relaxed", label: "\u5b89\u5b9a", description: "\u6a19\u6e96\u72b6\u614b", effects: { personality: {} } }; this.updateItemCounts(); this.updateEffectCounts(); this.markTerrainDirty?.("reset"); this.rebuildSpatial(true); } resetRuntimeCollections() { this.tarinai = []; this.items = []; this.ants = []; this.effects = []; this.logs = []; this.events = window.TarinaiEvents || null; this.eventCounters = {}; this.countsTimer = 0; this.compactTimer = 0; this.drawSortTimer = 0; this.drawListDirty = true; this.antUpdatePhase = 0; this.selected = null; this.hoverGiveTarget = null; this.hoverPokeTarget = null; this.deadCount = 0; this.birthEventCount = 0; this.achievementNaturalSlaveGenerations = []; this.achievementNaturalKingGenerations = []; this.achievementPlayerPlacementCount = 0; this.achievementDirectFeedCount = 0; this.achievementRobotCleanCount = 0; this.achievementEnemyAntKills = 0; this.achievementLastTarinaiDamageAt = -Infinity; this.achievementSelfSufficientStartAt = -1; this.achievementLastDirectFeedAt = -Infinity; this.achievementLastInterventionAt = 0; this.achievementNoDeathStartAt = -1; this.achievementHappyStartAt = -1; this.liveIdNext = 1; this.liveIdSerial = 0; this.liveTarinai = new Map(); this.lastBirthAt = -999; this.lastColonyMoodPopulation = NaN; this.nextColonyMoodEvalAt = 0; this.maxGeneration = 1; this.family = {}; this.familyVersion = 0; this.familyTreeDirty = true; this.relationNotices = {}; this.resolvedFightIds = {}; this.fightPairCooldowns = {}; } } if (typeof window !== "undefined") window.World = World; if (typeof globalThis !== "undefined") globalThis.World = World;