Good way to make element virus res?

  • Hecker
    10th Aug 2022 Member 0 Permalink
    I would say this is good but it is very laggy 
    for r in sim.neighbors(x,y,2,2) do
               if (sim.partProperty(r, 'type') == elem.DEFAULT_PT_VRSS or elem.DEFAULT_PT_VRSG or elem.VIRS) then
                 tpt.set_property("pavg0",10,r)
           end
     end
    any optimizations?
  • RebMiami
    11th Aug 2022 Member 0 Permalink

    Try this:

    sim.partNeighbours(x, y, 2, elem.DEFAULT_PT_VIRS)

    This returns a list of particle IDs matching the element in the 4th field, which you can iterate through. You'd need to do this for all three elements, though.

  • Hecker
    12th Aug 2022 Member 0 Permalink

    Thanks I'll try that