- type: entity
  id: ActionWebball
  name: Webball
  description: Fires a webball towards the clicked location.
  components:
  - type: Action
    useDelay: 30
    itemIconStyle: BigAction
    raiseOnUser: true
    sound:
      path: /Audio/Weapons/Xeno/alien_spitacid.ogg
    icon:
      sprite: _Starlight/Interface/Actions/actions_spider.rsi
      state: web
  - type: TargetAction
    range: 20
    checkCanAccess: false
  - type: WorldTargetAction
    event: !type:ProjectileSpellEvent
      prototype: ProjectileWebball

- type: entity
  id: ProjectileWebball
  name: webball
  parent: BaseBulletTrigger
  categories: [ HideSpawnMenu ]
  components:
  - type: Projectile
    damage:
      types:
        Blunt: 3
  - type: Sprite
    sprite: _Starlight/Interface/Actions/actions_spider.rsi
    layers:
    - state: web
      shader: unshaded
  - type: SpawnOnCollide
    prototype: SpiderWeb

# Terror spiders

- type: entity
  id: ActionAcidVent
  name: Acid Vent
  description: Unwelds vents.
  components:
  - type: Action
    useDelay: 30
    itemIconStyle: BigAction
    raiseOnUser: true
    sound:
      path: /Audio/Effects/pop.ogg
    icon:
      sprite: _Starlight/Interface/Actions/actions_spider.rsi
      state: acid_vent
  - type: TargetAction
    range: 2
    checkCanAccess: true
  - type: EntityTargetAction
    event: !type:AcidVentEvent

- type: entity
  id: ActionEvolve
  name: Evolve
  description: evolve into a new entity.
  components:
  - type: Action
    useDelay: 3
    itemIconStyle: BigAction
    sound: /Audio/Effects/pop.ogg
    icon:
      sprite: _Starlight/Interface/Actions/actions_spider.rsi
      state: evolve
  - type: InstantAction
    event: !type:EvolveEvent

- type: entity
  id: ActionSpiderEMPScream
  name: EMP Scream
  description: Emit an EMP scream that disables electronics in a radius.
  components:
  - type: Action
    useDelay: 3
    itemIconStyle: BigAction
    sound: /Audio/Effects/pop.ogg
    icon:
      sprite:  _Starlight/Interface/Actions/actions_spider.rsi
      state: spiderscream
  - type: LimitedCharges
    maxCharges: 2
  - type: AutoRecharge
    rechargeDuration: 60
  - type: InstantAction
    event: !type:EMPScreamEvent

- type: entity
  id: ActionEggInjection
  name: Egg injection
  description: Injection of eggs into the body.
  components:
  - type: Action
    useDelay: 3
    itemIconStyle: BigAction
    sound: /Audio/Effects/pop.ogg
    icon:
      sprite:  _Starlight/Interface/Actions/actions_spider.rsi
      state: lay_eggs
  - type: TargetAction
    interactOnMiss: false
  - type: EntityTargetAction
    canTargetSelf: false
    whitelist:
      components:
      - WrapEntityHolder
    event: !type:EggInjectionEvent

- type: entity
  id: ActionEggsLaying
  name: Lay the egg.
  description: Lay the egg.
  components:
  - type: Action
    itemIconStyle: BigAction
    useDelay: 5
    icon:
      sprite: _Starlight/Interface/Actions/actions_spider.rsi
      state: lay_eggs
  - type: LimitedCharges
    maxCharges: 3
  - type: AutoRecharge
    rechargeDuration: 90
  - type: InstantAction
    event: !type:EggsLayingEvent

- type: entity
  id: ActionRoyalJelly
  name: Royal Jelly
  description: lay royal jelly which can be eaten by spiders and heal them.
  components:
  - type: Action
    useDelay: 3
    itemIconStyle: BigAction
    sound: /Audio/Effects/pop.ogg
    icon:
      sprite: _Starlight/Objects/Consumable/Food/spiderjelly.rsi
      state: action
  - type: LimitedCharges
    maxCharges: 3
  - type: AutoRecharge
    rechargeDuration: 90
  - type: InstantAction
    event: !type:SpawnOnActionEvent

- type: entity
  parent: BaseAction
  id: ActionSpiderBuildingPole
  name: Web pole
  description: Spawns a web pole that spawns webs around at free tiles.
  components:
  - type: Action
    icon:
      sprite: _Starlight/Structures/Specific/TerrorSpiders/buildings_48.rsi
      state: pole
    useDelay: 3
  - type: LimitedCharges
    maxCharges: 1
  - type: AutoRecharge
    rechargeDuration: 300 # 5 mins
  - type: InstantAction
    event: !type:SpiderWebBuildingActionEvent
      building: WebEntityBeacon

- type: entity
  parent: BaseAction
  id: ActionSpiderBuildingCocoon
  name: Web cocoon
  description: Spawns a web cocoon that heals spider which entered in it.
  components:
  - type: Action
    icon:
      sprite: _Starlight/Structures/Specific/TerrorSpiders/buildings.rsi
      state: cocoon
    useDelay: 3
  - type: LimitedCharges
    maxCharges: 1
  - type: AutoRecharge
    rechargeDuration: 300 # 5 mins
  - type: InstantAction
    event: !type:SpiderWebBuildingActionEvent
      building: WebCocoon

- type: entity
  parent: BaseAction
  id: ActionSpiderBuildingGenerator
  name: Ammonia generator
  description: Spawns an ammonia generator that fills rooms with atmosphere.
  components:
  - type: Action
    icon:
      sprite: _Starlight/Structures/Specific/TerrorSpiders/buildings.rsi
      state: ammonia_gen
    useDelay: 3
  - type: LimitedCharges
    maxCharges: 1
  - type: AutoRecharge
    rechargeDuration: 600 # 10 mins
  - type: InstantAction
    event: !type:SpiderWebBuildingActionEvent
      building: AmmoniaEggGenerator

- type: entity
  id: ActionEntityWrap
  name: Wrap
  description: Wrap a target in web, immobilizing them.
  components:
  - type: Action
    useDelay: 3
    itemIconStyle: BigAction
    sound: /Audio/Effects/pop.ogg
    icon:
      sprite:  _Starlight/Interface/Actions/actions_spider.rsi
      state: wrap
  - type: TargetAction
    interactOnMiss: false
  - type: EntityTargetAction
    canTargetSelf: false
    whitelist:
      components:
      - HumanoidAppearance
    event: !type:WrapActionEvent
