diff --git a/src/lua/CommandInterface.cpp b/src/lua/CommandInterface.cpp index 28eda0142..997fe1d55 100644 --- a/src/lua/CommandInterface.cpp +++ b/src/lua/CommandInterface.cpp @@ -349,7 +349,15 @@ AnyType CommandInterface::tptS_set(std::deque * words) ui::Point tempPoint = ((PointType)selector).Value(); if(tempPoint.X<0 || tempPoint.Y<0 || tempPoint.Y >= YRES || tempPoint.X >= XRES) throw GeneralException("Invalid position"); - + auto r = sim->pmap[tempPoint.Y][tempPoint.X]; + if (!r) + { + r = sim->photons[tempPoint.Y][tempPoint.X]; + } + if (r) + { + partIndex = ID(r); + } } else partIndex = ((NumberType)selector).Value();