# SPDX-FileCopyrightText: 2025 GoobBot <uristmchands@proton.me>
# SPDX-FileCopyrightText: 2025 Solstice <solsticeofthewinter@gmail.com>
# SPDX-FileCopyrightText: 2025 gluesniffler <linebarrelerenthusiast@gmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later


 ########### COSMIC MONUMENT, BASE ABSTRACT #############

- type: entity
  abstract: true
  parent: BaseStructure
  id: MonumentCosmicCultBase
  name: The Monument
  description: A great slab of unknowledge, only visible to those aware of it. Built of a thousand little nothings, its surface reflects a starless emptiness...
  placement:
    mode: AlignTileAny
  components:
  - type: StationAnchor # Goobstation - no monument shittles
  - type: Fixtures
    fixtures:
      MonumentCollider:
        shape:
          !type:PhysShapeAabb
          bounds: "-1.1,-0.2,1.1,0.7"
        mask:
        - LargeMobMask
        layer:
        - WallLayer
        density: 1000
        hard: false
  - type: Visibility
    layer: 16
#  - type: SpriteFade # - Supercode breaks clickability with this.
  - type: Sprite
    sprite: _DV/CosmicCult/Tileset/monument.rsi
    layers:
      - state: stage1
        visible: true
        map: ["enum.MonumentVisualLayers.MonumentLayer"]
      - state: transform-stage2
        visible: false
        map: ["enum.MonumentVisualLayers.TransformLayer"]
      - state: finale-overlay1
        shader: unshaded
        visible: false
        map: ["enum.MonumentVisualLayers.FinaleLayer"]
    offset: 0,1
    drawdepth: Overdoors
  - type: Appearance
  - type: GenericVisualizer
    visuals:
      enum.MonumentVisuals.Monument:
        enum.MonumentVisualLayers.MonumentLayer:
          1: {state: stage1}
          2: {state: stage2}
          3: {state: stage3}
      enum.MonumentVisuals.FinaleReached:
        enum.MonumentVisualLayers.FinaleLayer:
          True: { visible: true }
          False: { visible: false }
          1: {state: finale-overlay1}
          2: {state: finale-overlay2}
          3: {state: finale-overlay3}
  - type: InteractionOutline
  - type: Transform
    anchored: true
  - type: Physics
    bodyType: Static
  - type: PointLight
    enabled: true
    castShadows: false
    radius: 4.5
    energy: 4
    color: "#43286a"
  - type: LightBehaviour
    behaviours:
     - !type:FadeBehaviour
       interpolate: Linear
       minDuration: 3
       maxDuration: 5
       startValue: 4.5
       endValue: 1.5
       property: Energy
       enabled: true
       isLooped: true
       reverseWhenFinished: true
  - type: AmbientSound
    range: 3.5
    volume: -9
    sound:
      path: /Audio/_DV/CosmicCult/god_ambient.ogg
  - type: ActivatableUI
    singleUser: false
    requiresComplex: true
    blockSpectators: true
    key: enum.MonumentKey.Key
  - type: UserInterface
    interfaces:
      enum.MonumentKey.Key:
        type: MonumentBoundUserInterface
  - type: CosmicFinale
  - type: Monument
    unlockedGlyphs:
    - ccGlyphKnowledge
    - ccGlyphProjection
    selectedGlyph: ccGlyphKnowledge
    totalEntropy: 0
  - type: GuideHelp
    guides:
    - CosmicCult
  - type: WarpPoint
    location: The Monument
  - type: CosmicCultExamine
    cultistText: cosmic-examine-text-forthecult
  - type: CosmicCorrupting
    corruptionReduction: 0.01
    enabled: false
    floodFillStarting: true

 ########### SPAWN-IN ANIMATION #############

- type: entity
  categories: [ HideSpawnMenu ]
  id: MonumentCosmicCultSpawnIn
  name: The Monument
  parent: BaseStructure
  suffix: Spawn, DO NOT MAP
  components:
  - type: Visibility
    layer: 16
  - type: Sprite
    sprite: _DV/CosmicCult/Tileset/monument.rsi
    layers:
      - state: stage1-spawnin
      - state: stage1-spawnin-overlay
        shader: unshaded
    offset: 0,1
    drawdepth: Mobs
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-1.1,-0.2,1.1,0.7"
        hard: false
        mask:
        - LargeMobMask
        layer:
        - WallLayer
  - type: InteractionOutline
  - type: Transform
  - type: EmitSoundOnSpawn
    sound:
      path: /Audio/_DV/CosmicCult/monument_spawn.ogg
      params:
        volume: +8
        pitch: 0.8
  - type: TimedDespawn
    lifetime: 3.8
  - type: MonumentOnDespawn
    prototype: MonumentCosmicCult1
  - type: PointLight
    enabled: true
    radius: 4.5
    energy: 4
    color: "#43286a"
  - type: LightBehaviour
    behaviours:
     - !type:FadeBehaviour
       interpolate: Linear
       minDuration: 3.8
       maxDuration: 3.8
       startValue: 0.5
       endValue: 4.5
       property: Energy
       enabled: true

 ########### RELOCATION ANIMATIONS #############

- type: entity
  categories: [ HideSpawnMenu ]
  id: MonumentCosmicCultMoveStart
  name: The Monument
  parent: BaseStructure
  suffix: Spawn, DO NOT MAP
  components:
  - type: Visibility
    layer: 16
  - type: Sprite
    sprite: _DV/CosmicCult/Tileset/monument.rsi
    layers:
    - state: stage2-relocate-out
      shader: unshaded
    offset: 0,1
    drawdepth: Mobs
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-1.1,-0.2,1.1,0.7"
        hard: false
        mask:
        - LargeMobMask
        layer:
        - WallLayer
  - type: InteractionOutline
  - type: Transform
  - type: EmitSoundOnSpawn
    sound:
      path: /Audio/_DV/CosmicCult/monument_relocate.ogg
      params:
        volume: +8
        pitch: 0.8
  - type: TimedDespawn
    lifetime: 3.8
  - type: PointLight
    color: "#42a4ae"
    radius: 4.5
    energy: 4
    castShadows: false
  - type: LightBehaviour
    behaviours:
     - !type:FadeBehaviour
       interpolate: Linear
       minDuration: 3.8
       maxDuration: 3.8
       startValue: 0.1
       endValue: 4.5
       property: Energy
       enabled: true
       isLooped: true
       reverseWhenFinished: true

- type: entity
  categories: [ HideSpawnMenu ]
  id: MonumentCosmicCultMoveEnd
  name: The Monument
  parent: BaseStructure
  suffix: Spawn, DO NOT MAP
  components:
  - type: Visibility
    layer: 16
  - type: Sprite
    sprite: _DV/CosmicCult/Tileset/monument.rsi
    layers:
    - state: stage2-relocate-in
      shader: unshaded
    offset: 0,1
    drawdepth: Mobs
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-1.1,-0.2,1.1,0.7"
        hard: false
        mask:
        - LargeMobMask
        layer:
        - WallLayer
  - type: InteractionOutline
  - type: Transform
  - type: EmitSoundOnSpawn
    sound:
      path: /Audio/_DV/CosmicCult/monument_relocate.ogg
      params:
        volume: +8
        pitch: 0.8
  - type: TimedDespawn
    lifetime: 3.8
  - type: MonumentMoveDestination
  - type: PointLight
    color: "#42a4ae"
    radius: 4.5
    energy: 4
    castShadows: false
  - type: LightBehaviour
    behaviours:
     - !type:FadeBehaviour
       interpolate: Linear
       minDuration: 3.8
       maxDuration: 3.8
       startValue: 0.1
       endValue: 4.5
       property: Energy
       enabled: true
       isLooped: true
       reverseWhenFinished: true

 ########### COLLIDER LAY-Z FIX #############

- type: entity
  categories: [ HideSpawnMenu ]
  id: MonumentCollider
  suffix: Debug, DO NOT MAP
  parent: BaseStructure
  placement:
    mode: AlignTileAny
  components:
  - type: MonumentCollision
  - type: Fixtures
    fixtures:
      MonumentCollider:
        shape:
          !type:PhysShapeAabb
          bounds: "-1.08,-0.18,1.08,0.68"
        density: 9999
        mask:
        - LargeMobMask
        layer:
        - WallLayer

 ########### TIER 3 SUPPRESSION AURA #############

- type: entity
  categories: [ HideSpawnMenu ]
  id: MonumentSlowZone
  suffix: Debug, DO NOT MAP
  placement:
    mode: SnapgridCenter
    snap:
    - Wall
  components:
  - type: Transform
    anchored: true
  - type: SpeedModifierContacts
    walkSpeedModifier: 0.7
    sprintSpeedModifier: 0.75
    ignoreWhitelist:
      components:
      - CosmicCult
      - MindShield
      - BibleUser
  - type: Physics
    bodyType: Static
  - type: Fixtures
    fixtures:
      fix1:
        shape:
          !type:PhysShapeAabb
          bounds: "-8.5,-8.5,8.5,8.5"
        layer:
          - SlipLayer
        mask:
          - ItemMask
        density: 1000
        hard: false

 ########### STAGE 1 #############

- type: entity
  parent: MonumentCosmicCultBase
  id: MonumentCosmicCult1
  suffix: Base, DO NOT MAP
  components:
  - type: Monument # Causes test fail without
    targetProgress: 35


- type: entity
  id: MonumentCosmicCult2
  suffix: DO NOT MAP, DO NOT SPAWN
  categories: [ HideSpawnMenu ]
  components:
  - type: Sprite
    sprite: _DV/CosmicCult/Tileset/monument.rsi
    layers:
      - state: stage2

- type: entity
  id: MonumentCosmicCult3
  suffix: DO NOT MAP, DO NOT SPAWN
  categories: [ HideSpawnMenu ]
  components:
  - type: Sprite
    sprite: _DV/CosmicCult/Tileset/monument.rsi
    layers:
      - state: stage3
