ID:2179630
 
(See the best response by Kaiochao.)
                        p.current_light=image(new/obj/light, p)
var/matrix/m = new()
m.Scale(3)
animate(p.current_light, alpha=100, transform = m)

p.overlays+=p.current_light


Hey everyone. I'm trying to make spotlights on players that are solely visible to themselves. I didn't take into account that once current_light becomes a player's overlay, that it will no longer be treated as an image.

I believe Ter 13's object pools has some sort of KEEP_TOGETHER feature that may be able to accomplish this although I'm not too familiar with the library? I couldn't be certain. Essentially though, I'd like to accomplish something around the lines of this:
//image bullshit
//keep the image on the player somehow
p<<current_light
To use an image as an image, you add it to client.images of the client you want to show it to, either by client.images += image or simply client << image.

Adding an image to overlays is the same as adding the image's appearance to overlays, because overlays only contains appearances.
Thanks for the quick response Kaio, always on point brotha!

I want the light to stay and follow the player so they can navigate a dark map. Not to just be an image stationary in the world.

I guess an easy solution would be to make sure there's no camera lag and set the center of the map as a spotlight. I feel like that method would be more of a quick fix then an actual solution though. Like, can I not have an image just stick to an actual mob?
In response to Flame Guardian
Best response
Images are anchored to their loc. Since you passed p as the loc in image(), that's where it will appear. It's like an overlay in that way.
oooooooooooooooooooooooooooooooooooommmmmmmmgg thank you
I believe Ter 13's object pools has some sort of KEEP_TOGETHER feature that may be able to accomplish this

Nope.
Yeah, my mistake. I looked at objectpools after posting that.