# --VirusModule-- #attributes for the spawner $EnergyNeeded:32 $EnergyCooldown:5 #consume 1 energy every X frames $ImageEnemy:"Custom4_128" $ImageFriendly:"Custom5_128" $Range:30 #SpawnRange for the Virus #attributes for the virus $Count:32 $Speed:2.0 $VirusImageEnemy:"Custom6_128" $VirusImageFriendly:"Custom7_128" $Timer:900 once Self "ShipModule.prpl" "Ship" GetScriptVar ->sid <-sid GetShipIsEnemy ->Enemy <-Enemy if <-ImageEnemy ->image else <-ImageFriendly ->image endif Self "main" <-image SetImage # needs to be an 128x128 pixel image Self "main" 1 1 SetImageScale #scale 1 = 3 cells 0 OperateWhilePaused 0 ->energy 0 ->cooldown 1 ->a 1 "a" ->! <-b "b" <-! endonce Self "ShipModule.prpl" "ShipAngle" GetScriptVar ->angle Self "ShipModule.prpl" "exist" GetScriptVar ->exist #0 - the hull is destroyed, 1 - building, 2 - build Self "main" <-angle SetImageRotation <-exist 0 eq if Self "main" 255 255 255 0 SetImageColor # RGBA A = visibily 0 ->energy <-cooldown 1 sub ->cooldown endif <-exist 1 eq if Self "main" 255 255 255 128 SetImageColor 0 ->energy <-cooldown 1 sub ->cooldown endif <-exist 2 eq if Self "main" 255 255 255 255 SetImageColor <-Ship GetShipHasAmp ->GemPresent <-GemPresent if 35 ->range else 30 ->range endif <-cooldown 0 lte if <-sid.ShipEnergy 1 gte if <-energy 1 add ->energy <-sid.ShipEnergy 1 sub ->sid.ShipEnergy <-EnergyCooldown ->cooldown <-energy <-EnergyNeeded gte if @Fire 0 ->energy endif endif else <-cooldown 1 sub ->cooldown endif endif :Fire "Virus.prpl" ->scriptName "PRPLCORE" CurrentCoords CreateUnit ->virus <-virus <-scriptName AddScriptToUnit <-virus <-scriptName "Count" <-Count SetScriptVar <-virus <-scriptName "Speed" <-Speed SetScriptVar <-virus <-scriptName "Enemy" <-Enemy SetScriptVar <-virus <-scriptName "ImageEnemy" <-VirusImageEnemy SetScriptVar <-virus <-scriptName "ImageFriendly" <-VirusImageFriendly SetScriptVar <-virus <-scriptName "Timer" <-Timer SetScriptVar <-virus <-scriptName "Direction" <-angle SetScriptVar <-virus CurrentCoords SetUnitCoords