"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.toolAngles = {}; this.tarinai = []; this.frozenTarinai = []; 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.deadCount = 0; this.liveIdNext = 1; this.liveIdFree = []; this.liveIdSerial = 0; this.liveTarinai = new Map(); this.lastBirthAt = -999; this.maxGeneration = 1; this.family = {}; this.familyVersion = 0; this.familyTreeDirty = true; this.familyTreeDirtyReason = "init"; this.relationNotices = {}; this.resolvedFightIds = {}; this.pointer = { x: 0, y: 0, inside: false, motion: 0, movedAt: 0 }; 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); 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: "安定", description: "標準状態", effects: { personality: {} } }; this.lastColonyMoodDay = 0; this.foodSpoilagePenalty = 0; this.foodSpoilageEvents = 0; this.updateItemCounts(); this.updateEffectCounts(); this.markTerrainDirty?.("reset"); this.rebuildSpatial(true); } } if (typeof window !== "undefined") window.World = World; if (typeof globalThis !== "undefined") globalThis.World = World;