Region

Overview

Core per-area simulation unit. Tracks severity (Police/Cartel), Control, Demand/Supply, and building state (Laboratory and Distribution Spot). Subscribes to the global tick and advances severity/control over time depending on presence and supply vs demand. Raises UI and analytics events on key changes and exposes helpers to add/remove/upgrade infrastructure.

Serialized Atoms & Data

  • Per‑tick base rates: controlGainPerTick, controlLossPerTick, severityPoliceGainPerTick, severityPoliceLossPerTick, severityCriminalGainPerTick, severityCriminalLossPerTick
  • Multipliers: controlGainPerTickMult, controlLossPerTickMult, severityPoliceGainPerTickMult, severityPoliceLossPerTickMult, severityCriminalGainPerTickMult, severityCriminalLossPerTickMult
  • Economy & upgrade: currentMoney, LabUpgradeCostTable upgradeLabCostTable, labCost, labRefund, labCount
  • Selection/UI: RegionVariable selectedRegion, VoidEvent updateRegionUI
  • Progression: totalRegionsSecured
  • Personality/Affinity: selectedPersonality, schemerNotorietyLossOnControlled, subterfugeLoyaltyGainOnControlled, mobsterAffinityGainOnControlled, affinityMobster, affinitySchemer, affinitySubterfuge, loyalty, notorietyProgress, captureProgress, schemerSeverityOverflowMult
  • Events: labAddedEvent, routeAddedEvent, regionSecured
  • Prefabs: labPrefab, localLabPrefab (Distribution Spot), routePrefab
  • UI: biome enum, PresenceParticleSpawner, Image labIcon, sprites for lab levels and Distribution Spot

Runtime Properties

  • LocalDemand, LocalProduction (from regionLab.TotalProduction), PoliceSeverity, CartelSeverity, SupplyPerTick, Control, Presence, OverSupply, RegionName, RegionLab, RegionLocalLab, Biome

Tick Behavior

  • If presence this tick:
    • If not secured:
      • Normal flow (not Schemer or supply ≤ demand): increase Police/Cartel severity by gain×mult (clamped to 1), fire severity band VFX if crossing thresholds, increase Control by gain×mult; when Control ≥ 1:
        • Call OnControlGained(), raise regionSecured, mark secured, and auto‑add a Distribution Spot if there is no Lab/Spot.
      • Schemer overflow (Schemer and supply > demand): dampen severity gains by (1 - (supply - demand) * schemerSeverityOverflowMult) and apply, firing VFX on band changes.
  • If no presence and not secured: decay severities by loss×mult to their minimums and reduce Control by loss×mult to 0.
  • Always: update region icon UI, set OverSupply = SupplyPerTick > LocalDemand, raise updateRegionUI if this region is selected, then reset SupplyPerTick = 0 and Presence = false. fileciteturn15file2

Severity Bands

  • Static thresholds: Low < 0.35 ≤ Mid < 0.8 ≤ High. Crossing into a new band triggers PresenceParticleSpawner.OnPoliceSeverityChange(...). fileciteturn15file2

Control Gained Effects

When Control reaches 1 for the first time:

  • Mobster: randomly splits mobsterAffinityGainOnControlled into three non‑negative integers and adds them to Mobster/Schemer/Subterfuge affinities.
  • Schemer: reduces Notoriety (or Capture if Notoriety is full) by schemerNotorietyLossOnControlled.
  • Subterfuge: increases Loyalty by subterfugeLoyaltyGainOnControlled. Also increments totalRegionsSecured and calls PresenceParticleSpawner.OnControlChange(). fileciteturn15file2

Localization

GetLocalizedName() returns I2 key "REGION_" + name (uppercase with underscores). SelectRegion() writes itself into selectedRegion (raising change). fileciteturn15file2

Infrastructure API

  • Distribution Spot
    • AddLocaLab() — instantiates the Distribution Spot prefab, assigns .region = this, and refreshes UI.
    • RemoveLocalLab() — destroys the Spot and refreshes UI.
  • Laboratory
    • AddLaboratory() — removes Distribution Spot if present, instantiates a Lab, assigns .region = this, updates icon, and raises labAddedEvent.
    • RemoveLaboratory(bool refund) — removes all routes, updates counts and costs, optionally refunds, restores Distribution Spot if secured, and refreshes UI.
    • UpgradeLab()BaseProduction += 0.5f, spend cost from upgradeLabCostTable at the current level, UpgradeLevel++, UpdateSupply(), update icon, refresh UI. fileciteturn15file2

Routes

  • AddRoute(List<Node> routeNodes) — instantiates a Route under the Lab, initializes it with the node path, registers it in the Lab, raises routeAddedEvent, and refreshes UI.
  • HasRouteToNode(Node dest) — returns true if any Lab route already targets the given node’s Region. fileciteturn15file2

Save/Load

  • SaveKey = gameObject.name.
  • Save() → DTO with demand, min/current severities, and control.
  • Load(dto, updateUI) → applies DTO (by key/name match), optionally updates icon and raises UI if selected, and marks loadedData=true. fileciteturn15file2