ID:2395659
 
(See the best response by Nadrew.)
Code:
// The guts of the system.

// NOTE: This can also be done without the darkness plane, by putting the master_plane and light sources on the same plane (eg: 2)
// However, this will cause things to be interlayered in a way that will make players running in software rendering mode able to see fully as if no darkness existed.
// This method will give them a fully black screen with no advantage.

image
master_plane
// I place the master plane on 0 so it'll on the default plane of most everything in the game.
// If things exist above plane 0, they'll appear above the master.
plane = 0
name = "darkness"
blend_mode = BLEND_MULTIPLY // Anything covered by this will have its color multiplied as they blend.
appearance_flags = PLANE_MASTER | PIXEL_SCALE | NO_CLIENT_COLOR // Specifies the plane is a master and it will ignore client.color values.
color = list(null,null,null,"#0000","#000f") // Sets a color matrix to pure black with full alpha.
mouse_opacity = 0 // Makes sure all mouse events ignore the plane.

darkness
// The darkness will appear behind the master plane and cover the entire screen
// I do it this way to allow finer control over the alpha levels and color of the "darkness" players see on their screen.
// In reality it's just a scaled-up white block.
name = "the darkness"
plane = -1
blend_mode = BLEND_ADD // Any color value applied to this image will be added to the color of anything blending with it.
mouse_opacity = 0
icon = 'darkness.dmi'
layer = 1
New()
..()
var/matrix/m = matrix()
m.Scale(100)
transform = m
// Scaling it up to cover the screen, I can probably use a single screen object for this...
// ... but I've found some cool screen-wide effects you can pull off by using a single graphic.
light
// The darkness will appear behind the master plane and cover the entire screen
// I do it this way to allow finer control over the alpha levels and color of the "darkness" players see on their screen.
// In reality it's just a scaled-up white block.
name = "the darkness"
plane = 0
blend_mode = BLEND_ADD // Any color value applied to this image will be added to the color of anything blending with it.
mouse_opacity = 0
icon = 'light.dmi'
layer = 1
New()
..()
var/matrix/m = matrix()
m.Scale(50)
transform = m
// Scaling it up to cover the screen, I can probably use a single screen object for this...
// ... but I've found some cool screen-wide effects you can pull off by using a single graphic.



obj
var
obj/light/light
matrix
on_matrix = matrix()
off_matrix = matrix()
light
plane = -1
blend_mode = BLEND_ADD
icon = 'light.dmi'
icon_state = "circle"
mouse_opacity = 0
// The light and darkness share a plane and most traits, when adding the pure white color of the light, and its alpha values.
// And the color and alpha values of the darkness image...
// ... you end up blending away the master plane's blacking out of the view.

lamp
icon = 'lamp.dmi'
icon_state = "off"
density = 1
// A basic light source object.
New()
// With some fancy turning off and on animation...
..()
light = new(src.loc)
light.alpha = 75
on_matrix.Scale(20)
off_matrix.Scale(0)
light.transform = off_matrix
Toggle()
Click()
Toggle()
proc/Toggle()
if(icon_state == "off")
icon_state = "on"
animate(light,transform=on_matrix,time=5)
sleep(6)
// And flickering...
animate(light,color=rgb(220,220,220),time=4,loop=-1)
else
icon_state = "off"
animate(light,transform=off_matrix,time=5)
light.color = null


mob
var
// You don't actually need variables for the master_plane and darkness, unless you plan on fiddling with them on the fly.
// You can get away with simply outputting the /image to the mob and being done with it.
// The light object has a variable for obvious purposes.
obj/light/light
image
darkness/darkness
master_plane/master_plane
light/light2

/*Move()
..()
// Simply keeps the player's light on the same tile as the player
if(light) light.loc = src.loc*/


Problem description:
SO I downloaded this light lib and love it. But I am trying to see, what is the best and most efficient way to make that light source only viewable on the client's screen. Right now the light is an obj that follows the player around, but....everyone can see it.....How can I make it a personal onscreen light....

One thng that came to mind was images, but I don't if thats possible or even a good way of going about it.
An image would do exactly what you're after, just create one with the same properties as the light object in the code above and use << to output it only to that player.
I actually just tried that, and I didn't get any results.
You'll need to show what you've tried.
/ The guts of the system.

// NOTE: This can also be done without the darkness plane, by putting the master_plane and light sources on the same plane (eg: 2)
// However, this will cause things to be interlayered in a way that will make players running in software rendering mode able to see fully as if no darkness existed.
// This method will give them a fully black screen with no advantage.

image
master_plane
// I place the master plane on 0 so it'll on the default plane of most everything in the game.
// If things exist above plane 0, they'll appear above the master.
plane = 0
name = "darkness"
blend_mode = BLEND_MULTIPLY // Anything covered by this will have its color multiplied as they blend.
appearance_flags = PLANE_MASTER | PIXEL_SCALE | NO_CLIENT_COLOR // Specifies the plane is a master and it will ignore client.color values.
color = list(null,null,null,"#0000","#000f") // Sets a color matrix to pure black with full alpha.
mouse_opacity = 0 // Makes sure all mouse events ignore the plane.

darkness
// The darkness will appear behind the master plane and cover the entire screen
// I do it this way to allow finer control over the alpha levels and color of the "darkness" players see on their screen.
// In reality it's just a scaled-up white block.
name = "the darkness"
plane = -1
blend_mode = BLEND_ADD // Any color value applied to this image will be added to the color of anything blending with it.
mouse_opacity = 0
icon = 'darkness.dmi'
layer = 1
New()
..()
var/matrix/m = matrix()
m.Scale(100)
transform = m
// Scaling it up to cover the screen, I can probably use a single screen object for this...
// ... but I've found some cool screen-wide effects you can pull off by using a single graphic.
light
plane = -1
blend_mode = BLEND_ADD
icon = 'light.dmi'
icon_state = "circle"
mouse_opacity = 0
// The light and darkness share a plane and most traits, when adding the pure white color of the light, and its alpha values.
// And the color and alpha values of the darkness image...
// ... you end up blending away the master plane's blacking out of the view.


mob/var/full_access

client/New()
..()
winset(src,"MainWindow","size = 1000x773") //dont delete when resetting login sequence
winset(src,"MainWindow.LoginPane","is-visible=false")
winset(src,"VillagePanel","is-visible = false")
winset(src,"HairPanel","is-visible = false")
winset(src,"ShirtPanel","is-visible = false")
winset(src,"PantsPanel","is-visible = false")
winset(src,"donebutton","is-visible = false")
winset(src,"MainWindow","size = 1331x800")
wincenter(src, "MainWindow")
mob
Login()
..()

if(client.CheckPassport("14c94b2e2dcd9e01"))
full_access = 1
else
src << "For full access, <a href=\
'http://www.byond.com/hub/
[world.hub]' >subscribe</a>!"
master_plane = new(loc=src)
darkness = new/image/darkness(loc=src)
light = new/image/light(src)

master_plane.name ="darkness"
darkness.name ="darkness"
// Then we output them to the player so that they're added to images and displayed.
src << master_plane
src << darkness
src << light
You've replaced the image/light from the library you were using. You should probably put that back how it was and create an entirely different object to serve as the light objects.
I figured it would still be the same end. How would you do that?
In response to Nadrew
Anything?
Best response
I think your argument in image/new() is wrong, it should be loc=src not just src.
In response to Nadrew
Oh, I just noticed. Thank you, I am going to give it a go once i reach home. Is there a way i can contact you personally to ask some questions and have you take a look at some things? Maybe, via BYOND Pager or skype?