<?xml version="1.0" encoding="utf-8"?>
<Items>
  <Override>
    <Item name="" identifier="piezocrystal" category="Material" Tags="piezocrystal" canbepicked="false" description="" scale="0.5" sonarsize="30" health="60" damagedbyexplosions="true" damagedbymonsters="true" damagedbyprojectiles="true" damagedbymeleeweapons="true" damagedbyrepairtools="true">
      <Sprite texture="Content/Items/Materials/Crystal.png" depth="1.0" sourcerect="0,4,1024,1020" origin="0.5,0.6" />
      <Body width="500" height="500" density="25" bodytype="Static" />
      <TriggerComponent triggeredby="Submarine" radius="6000">
        <StatusEffect type="OnActive" target="This" Voltage="1.0" setvalue="true">
          <ParticleEmitter particle="ElectricShock" distancemin="100" distancemax="120" particlespersecond="5.0" particleamount="5" emitinterval="2.1" anglemin="0" anglemax="360" scalemin="1.0" scalemax="1.2" />
        </StatusEffect>
        <StatusEffect type="OnActive" target="NearbyItems" targettags="junctionbox" range="3000.0" setvalue="true" stackable="false" duration="1" interval="1" extraload="500" />
      </TriggerComponent>
      <LightComponent lightcolor="178,196,207,255" range="2000.0" powerconsumption="0" flicker="0.2" flickerspeed="0.5" pulsefrequency="0.2" pulseamount="0.8" ison="true" drawbehindsubs="true">
        <IsActive targetitemcomponent="TriggerComponent" triggeractive="true" />
      </LightComponent>
      <LightComponent lightcolor="178,196,207,255" range="2000.0" powerconsumption="0" flicker="0.0" flickerspeed="0.5" pulsefrequency="0.4" pulseamount="0.2" ison="true" drawbehindsubs="true">
        <IsActive targetitemcomponent="TriggerComponent" triggeractive="true" />
        <LightTexture texture="Content/Lights/pointlight_rays.png" origin="0.5,0.5" />
      </LightComponent>
      <ElectricalDischarger duration="0.2" outdoorsonly="true" powerconsumption="0" range="6000" rangemultiplierinwalls="1">
        <Attack targetimpulse="50">
          <Affliction identifier="stun" strength="2" />
          <Affliction identifier="burn" strength="4" />
          <Affliction identifier="shocked" strength="2" />
        </Attack>
        <!-- explode when the item is destroyed | applies severe damage within a 20m range and a lower amount of damage within a 50m range -->
        <StatusEffect type="OnBroken" target="This" disabledeltatime="true">
          <particleemitter particle="iceshards" particleamount="200" velocitymin="100" velocitymax="3000" anglemin="0" anglemax="360" scalemin="0.5" scalemax="3.0" />
          <Explosion range="2000.0" ballastfloradamage="1000" structuredamage="600" itemdamage="1000" force="50.0" severlimbsprobability="1.5" decal="explosion" decalsize="1.0" camerashake="500" camerashakerange="50000" flashrange="10000" flashduration="5.0" screencolor="255,255,255,255" screencolorrange="5000" screencolorduration="3.0">
            <Affliction identifier="explosiondamage" strength="600" />
            <Affliction identifier="burn" strength="450" />
            <Affliction identifier="stun" strength="30" />
          </Explosion>
          <Explosion range="5000.0" ballastfloradamage="250" structuredamage="150" itemdamage="250" force="25.0" decalsize="1.0" camerashake="500" camerashakerange="50000" flashrange="10000" flashduration="5.0" screencolor="255,255,255,255" screencolorrange="5000" screencolorduration="3.0">
            <Affliction identifier="explosiondamage" strength="50" />
            <Affliction identifier="burn" strength="50" />
            <Affliction identifier="stun" strength="10" />
            <Affliction identifier="blind" strength="30" />
            <Affliction identifier="shocked" strength="15" />
          </Explosion>
          <Sound file="%ModDir:2532991202%/Sounds/Explosions/ExplosionMassive1.ogg" selectionmode="Random" volume="5" range="10000" />
          <Sound file="%ModDir:2532991202%/Sounds/Explosions/ExplosionMassive2.ogg" selectionmode="Random" volume="5" range="10000" />
          <Sound file="%ModDir:2532991202%/Sounds/Explosions/ExplosionMassive3.ogg" selectionmode="Random" volume="5" range="10000" />
          <RemoveItem />
        </StatusEffect>
        <!-- trigger a random sound when the electrical discharger was triggered and cause a camera shake effect to all players within 70m -->
        <StatusEffect type="OnUse" target="This">
          <sound file="%ModDir:2532991202%/Sounds/Explosions/Piezo_ReallyClose.ogg" range="10000" volume="3" selectionmode="random" />
          <sound file="%ModDir:2532991202%/Sounds/Explosions/Piezo_ReallyClose2.ogg" range="10000" volume="3" />
          <sound file="%ModDir:2532991202%/Sounds/Explosions/Piezo_ReallyClose3.ogg" range="10000" volume="3" />
          <sound file="%ModDir:2532991202%/Sounds/Explosions/Piezo_ReallyClose4.ogg" range="10000" volume="3" />
          <Explosion range="7000.0" camerashake="3" stun="0" force="0.0" flames="false" shockwave="false" sparks="false" underwaterbubble="false" />
        </StatusEffect>
        <!-- trigger an additional random explosion sound alongside the piezo sound when the electrical discharger was triggered -->
        <StatusEffect type="OnUse" target="This">
          <sound file="Content/Items/Weapons/ExplosionMedium1.ogg" range="10000" selectionmode="Random" />
          <sound file="Content/Items/Weapons/ExplosionMedium2.ogg" range="10000" />
          <sound file="Content/Items/Weapons/ExplosionMedium3.ogg" range="10000" />
        </StatusEffect>
        <StatusEffect type="Always" target="This" interval="10.0">
          <Conditional voltage="gt 0" />
          <Use />
        </StatusEffect>
      </ElectricalDischarger>
      <LevelResource deattachduration="Infinity">
        <Commonness fixedquantity="true" clusterquantity="30" clustersize="1" leveltype="thegreatsea" isislandspecific="false" allowatstart="false" />
        <Commonness fixedquantity="true" clusterquantity="10" clustersize="1" leveltype="thegreatsea" isislandspecific="true" allowatstart="false" />
        <Commonness fixedquantity="true" clusterquantity="0" commonness="0" leveltype="greatseaoutpost" />
        <RequiredItem items="nonexistentitem" type="Equipped" />
      </LevelResource>
      <aitarget minsightrange="1000" maxsightrange="10000" soundrange="10000" />
    </Item>
  </Override>
  <Item name="Piezo Crystal (Wired)" identifier="piezocrystalPA" category="Material" Tags="" canbepicked="false" description="" scale="0.5" sonarsize="30" health="100" damagedbyexplosions="false" damagedbyprojectiles="false" damagedbymeleeweapons="false" damagedbyrepairtools="false">
    <Sprite texture="Content/Items/Materials/Crystal.png" depth="1.0" sourcerect="0,4,1024,1020" origin="0.5,0.6" />
    <LightComponent lightcolor="178,196,207,255" range="4000.0" powerconsumption="0" flicker="0.2" flickerspeed="0.5" pulsefrequency="0.2" pulseamount="0.8" ison="true" drawbehindsubs="true">
      <StatusEffect type="OnBroken" target="This" disabledeltatime="true">
        <particleemitter particle="iceshards" particleamount="200" velocitymin="100" velocitymax="3000" anglemin="0" anglemax="360" scalemin="0.5" scalemax="3.0" />
        <Explosion range="1000.0" ballastfloradamage="1000" structuredamage="600" itemdamage="1000" force="50.0" severlimbsprobability="1.5" decal="explosion" decalsize="1.0" camerashake="500" camerashakerange="50000" flashrange="10000" flashduration="5.0" screencolor="255,255,255,255" screencolorrange="5000" screencolorduration="3.0">
          <Affliction identifier="explosiondamage" strength="600" />
          <Affliction identifier="burn" strength="450" />
          <Affliction identifier="stun" strength="30" />
        </Explosion>
        <RemoveItem />
      </StatusEffect>
    </LightComponent>
    <LightComponent lightcolor="178,196,207,255" range="4000.0" powerconsumption="0" flicker="0.0" flickerspeed="0.5" pulsefrequency="0.4" pulseamount="1.0" ison="true" drawbehindsubs="true">
      <LightTexture texture="Content/Lights/pointlight_rays.png" origin="0.5,0.5" />
    </LightComponent>
    <ElectricalDischarger duration="0.2" outdoorsonly="true" powerconsumption="0" range="3500" rangemultiplierinwalls="1">
      <StatusEffect type="OnUse" target="This">
        <sound file="Content/Items/Weapons/WEAPONS_electricalDischarge1.ogg" range="6000" selectionmode="random" />
        <sound file="Content/Items/Weapons/WEAPONS_electricalDischarge2.ogg" range="6000" />
        <Explosion range="7000.0" camerashake="3" stun="0" force="0.0" flames="false" shockwave="false" sparks="false" underwaterbubble="false" />
      </StatusEffect>
      <StatusEffect type="OnUse" target="This">
        <sound file="Content/Items/Weapons/ExplosionMedium1.ogg" range="6000" selectionmode="Random" />
        <sound file="Content/Items/Weapons/ExplosionMedium2.ogg" range="6000" />
        <sound file="Content/Items/Weapons/ExplosionMedium3.ogg" range="6000" />
      </StatusEffect>
    </ElectricalDischarger>
    <ItemComponent>
      <!-- when the component activates, apply extra load to nearby items and deactive the component -->
      <StatusEffect type="OnActive" target="NearbyItems" targettags="junctionbox" range="3000.0" setvalue="true" stackable="false" extraload="600">
        <Conditional HasTas="neq donthit" />
      </StatusEffect>
      <StatusEffect type="OnActive" target="This" IsActive="false" />
      <!-- reactivate after one second -->
      <StatusEffect type="Always" target="This" stackable="false" delay="1.0" IsActive="true" />
      <StatusEffect type="Always" target="This" stackable="false" delay="10.0">
        <Use />
      </StatusEffect>
      <StatusEffect type="Always" target="This">
        <ParticleEmitter particle="ElectricShock" distancemin="100" distancemax="120" particlespersecond="5.0" particleamount="5" emitinterval="2.1" anglemin="0" anglemax="360" scalemin="1.0" scalemax="1.2" />
      </StatusEffect>
    </ItemComponent>
    <ConnectionPanel canbeselected="true" hudpriority="10">
      <GuiFrame relativesize="0.2,0.32" minsize="400,350" maxsize="480,420" anchor="Center" style="ConnectionPanel" />
      <RequiredItem items="screwdriver" type="Equipped" />
      <!-- break the item when a shutdown signal is received -->
      <input name="activate" displayname="connection.activate">
        <StatusEffect type="OnUse" target="This" condition="-100" setvalue="true" />
      </input>
      <output name="power_out" displayname="connection.powerout"  maxwires="10" />
    </ConnectionPanel>
  </Item>
</Items>