User Tools

Site Tools


prpl:isemergent

<- PRPL reference <- Particles

IsEmergent

ArgumentsResultNotation
pid bool [ int - bool ]

Description

Emergent is implemented as a virtual particle. Virtual particles exists for hit detection purpouses, but they are not discoverable by functions like GetParticlesInRange.

This function checks if the given pid is an virtual emergent particle.

One way to get the emergent ID is to watch the current PID counter (by creating a particle on each frame) and calling this function (IsEmergent) to check if that particle is a virtual emergent particle.

There are also virtual particles under each ship's hull (see IsHull).

Examples

#init
once
    0 ->lastPID
endonce
 
#get the current pid
0 0 0 0 0 0 CreateParticle ->pid
<-pid 1 DestroyParticle
 
#count hull particles
CreateList ->emergentParticles
<-pid <-lastPid do
    I IsEmergent if
        <-emergentParticles I AppendToList
    endif
loop
 
#update last Pid for the next frame
<-pid ->lastPid
 
#print the list of not empty
<-emergentParticles GetListCount neq0 if
    "Emergent created this frame:" <-emergentParticles Trace2
endif
prpl/isemergent.txt · Last modified: 2018/06/30 08:32 by kajacx