Still can't figure it out

  • Videogamer555
    17th Mar 2012 Member 0 Permalink
    How do energy particles disapear when something is drawn over them in a way that does NOT leave holes in the material that was drawn over them.

    Take for example Phot, or Neut. Put some on the screen. Draw a metal box (with ctrl+click+drag) over them. Unpause the simulation and they are INSTANTLY replaced by the metal. Not only did they disappear, but they did NOT act as a barrier to the placement of the metal box.

    Where in the code is it responsible for this happening? I have been trying to make a new energy particle for the LONGEST TIME. It will have all the properties to make it more realistic for the simulation I'm trying to do, but it should still have the basic properties of an energy particle. And that is it should disappear and be replaced by anything else, just like PHOT and NEUT. I keep being stumped by this behavior in the already existing energy particles. I don't know how they do it. Energy particles are supposed to have lower placement priority than any other particle, but I can't figure out how that is achieved. Some code snippets or line numbers would go a long way of helping me here.
    I'm 99.999999% done with my mod, but this last feature will make it 100%. I'll post it in the mods section here when it has reached 100%, and not one second before it has reached 100% completion. So to those who want to see my mod, it will help you out greatly in your quest to see my mod if you help me, because I won't release it until it's 100% done.
  • Catelite
    17th Mar 2012 Former Staff 0 Permalink
    Probably right next to the line of code that prevents photons inside of CLNE from erasing CLNE when stamped or save.

    It used to be an enormous pain in the butt, and honestly I'm not really 100% sure why you'd want to remove it. I don't remember where it is, though. @_@
  • Pilihp64
    17th Mar 2012 Developer 0 Permalink
    Your answer is still in your old thread.
    https://powdertoy.co.uk/Discussions/Thread/View.html?Thread=12742
    Examine where PHOT and NEUT are used in the code, they are placed in the energy particle map called photons[][] which is just like the pmap, an array of particle numbers.
    And photons in your example are NOT being replaced by metal being drawn over them, they simply are trapped and die when unpaused.
  • jacob1
    17th Mar 2012 Developer 0 Permalink
    @Videogamer555 (View Post)
    I would just do a search for PT_NEUT in the code, and then add your particle's name in the if statement if it's some kind of energy particle thing or has something to do with photons[y][x]. Most/All of the changes would be in powder.c. I know you definitely need to change create_part, update_particles, do_move (or maybe try_move or both), kill_part, and part_change_type. Searching for PT_NEUT should bring you to all those places though.