# --ParticleRod-- 9/19/2016 7:51:10 PM $ParticleDistance:10.0 $FireEnergy:1000 #if mountedgem # $FireEnergy:500 #end SetImageRotation(Self "barrel" <-barrelRotation) #trace2(<-*GlobalEnergy <-energy) if (<-energy lt (<-FireEnergy)) if (<-hasFired and (<-*GlobalEnergy gte(1)) or (<-*GlobalEnergy gt(1499))) <-energy add(1) ->energy <-*GlobalEnergy sub(1) ->*GlobalEnergy if (<-*GlobalEnergy lt(0)) 0 ->*GlobalEnergy endif if (not(<-*showPRConv) and (<-energy gt(800))) true ->*showPRConv ShowConversation("ParticleRod") endif endif else @Fire 0 ->energy endif @DrawEnergyBar :RandomShip # removed the Not from ship.shipIsEnemy. should now target #enemies rather than Frendlies(unless a blue ParticleShip #is counted the same as a red ParticleShip #:Thinking that an AMPGem should halve the charge time. CreateList ->potentials GetAllShipsInRange(0 0 9999 true) ->ships do(<-ships.listCount 0) <-ships[I] ->ship if ((<-ship.shipIsEnemy) and (GetShipCMBuiltAmt(<-ship) gt(0))) AppendToList(<-potentials <-ship) endif loop if (<-potentials.listCount gt (0)) RandInt(0 <-potentials.listCount) ->randomShip GetShipPixelCoords(<-potentials[<-randomShip]) else -1 -1 endif :Fire #trace("FIRE") true ->hasFired PlaySound("Weapons28") MapWidth ->mapW MapHeight ->mapH @RandomShip ->y ->x if (<-x lt (0)) #Random target 0.0 ->x RandFloat mul (<-mapH mul(3)) sub(<-mapH) ->y # let it pick a value a full screen below or higher than than actual screen. endif CurrentPixelCoords ->cy ->cx <-x sub(<-cx) ->deltaX <-y sub(<-cy) ->deltaY Sqrt(<-deltaX mul(<-deltaX) add (<-deltaY mul(<-deltaY))) ->distance <-ParticleDistance div(<-distance) ->frac atan2(<-deltaY <-deltaX) ->barrelRotation #trace3(<-cx <-cy <-frac) while <-cx gt(0) repeat <-cx add(<-deltaX mul(<-frac)) ->cx <-cy add(<-deltaY mul(<-frac)) ->cy if (<-cx gte(0) and (<-cy gte(0)) and (<-cx lt(<-mapW)) and (<-cy lt(<-mapH)) ) #If we make a particle right on top of a command module, the ship explodes instantly. #As fun as that can be, it might be too frustrating for the player. We want ship damage, not instant destruction Distance(<-cx <-cy <-x <-y) ->distanceFromCM if (<-distanceFromCM lt (12)) #nothing else if (<-distanceFromCM lt (70)) #If we are near the ship but not too close, make more particles do(8 0) @CreateParticle(<-cx add(@Jitter) <-cy add(@Jitter)) loop else @CreateParticle(<-cx <-cy) endif endif endif endwhile :DrawEnergyBar #0.33333 scale equals 1 cell width 9.0 ->barHeight <-energy asfloat div(<-FireEnergy) ->fraction <-fraction mul(<-barHeight) div(3) ->scaleY SetImageScale(Self "bar" 0.2 <-scaleY) SetImagePosition(Self "bar" 21 -18 add(<-fraction mul (72) div(4)) -0.05) :Jitter RandFloat mul(2) sub(1) :CreateParticle ->py ->px CreateParticle(<-px <-py 0 0 3 true) ->particle if (<-particle gte(0)) 1200 ->particle.particleMaxAge 2 ->particle.particleMaxSpeed endif :Awake if (GetUpdateCount eq0) PI ->barrelRotation SetImage(Self "barrel" "Custom1_128") SetImagePositionZ(Self "barrel" -0.05) SetImageScale(Self "barrel" 3.1 3.1) SetImageRotation(Self "barrel" <-barrelRotation) SetImage(Self "bar" "Custom0pp") SetImageColor(Self "bar" 255 0 0 255) @DrawEnergyBar endif