How to allow PHOT to pass through?

  • RedVelvetCake
    30th Jul 2017 Member 0 Permalink

    I have made an element and it has a reaction with PHOT and i dont like the fact that the PHOT keeps bounceing off of the element instead of passing through it and actually interacting with it for a bit. How do i make it so that PHOT can pass right through my element?

  • zaccybot2
    30th Jul 2017 Member 0 Permalink

    Lua or c++?

  • RedVelvetCake
    30th Jul 2017 Member 0 Permalink

    lua

  • zaccybot2
    30th Jul 2017 Member 0 Permalink
    elements.property(x, "Properties", <whatever else> + PROP_NEUTPASS) I think
  • RedVelvetCake
    30th Jul 2017 Member 0 Permalink

    nah, does nothing.

  • zaccybot2
    30th Jul 2017 Member 0 Permalink

    Ah sorry, I don't do Lua coding, that's just what I could assume from the Lua API wiki page..

    Im assuming you replace <whatever else> with any other properties, or with nothing if there are no other properties.

    Edited once by zaccybot2. Last: 30th Jul 2017
  • ssccsscc
    30th Jul 2017 Member 0 Permalink

    I think its not possible to do it with Lua because all elements that able to pass PHOT is defined here: https://github.com/ThePowderToy/The-Powder-Toy/blob/541417008e082447d47f33a8a529b98a0eed8a7e/src/simulation/Simulation.cpp#L2123

  • jacob1
    30th Jul 2017 Developer 0 Permalink
    @zaccybot2 (View Post)
    @ssccsscc (View Post)
    You're both wrong.

    You can use the sim.can_move function
  • RedVelvetCake
    30th Jul 2017 Member 0 Permalink

    While im here could someone tell me why this code isnt working

    local isweird = 0
    local nearphots = 0

    for k, v in pairs(sim.partNeighbours(x, y, 3, elements.DEFAULT_PT_PHOT)) do
    nearphots = nearphots + 1
    end

    if nearphots > 1 then

    isweird = 1

    end

    if isweird == 1 then

    tpt.set_property("vy", -1, i);

    end

    Its supposed to make it so when the element is touched with a photon it starts moving up and wolnt stop until deleted but instead it just jump up a bit and has to be touched with another photon to keep going up.

  • ssccsscc
    30th Jul 2017 Member 0 Permalink

    @jacob1 (View Post)

     But how to use that command?
    sim.can_move(elements.DEFAULT_PT_PHOT,elements.DEFAULT_PT_DMND)

    Does nothing