Camera Script By x[N]ir #4841

##########################
##  Description         ##
##########################

This script allows you to place security cameras on the map.
These cameras have a lot of parameters which can be customized.
For instance, the starting rotation, the laser range and color,
the camera type and so on.
At the moment, the cameras just play an alarm sound if a player
walked into a camera laser.
You can also destroy these cameras !! 
However they respawn on each restart.

##########################
##  Summary             ##
##########################

	I.Installation
	II.Dependencies
	III. How to add cameras
	IV. Additional Informations

##########################
## I.Installation       ##
##########################

First copy & paste the camera folder inside your CS2D lua
folder. Then in order to install this script, 
you must add the following line inside this file <sys/lua/server.lua>:

dofile("sys/lua/camera/init.lua")

##########################
## II. Dependencies     ##
##########################

This script uses 2 external files, be sure to add them into your
servertransfer.lst file.

gfx/xNir/camera/camera.png
gfx/xNir/camera/laser.png

##########################
III. How to add cameras ##
##########################

First, open the config file which is located there
<sys/lua/camera/cfg/config.cfg>

Then add your cameras into the camera.Locations array !
For instance:

#Example 1: I want to add one default camera on de_dust
What I need it's the position in pixels of my camera.
Then the type of the camera:
	camera.IDLE: a camera which doesn't move
	camera.MOBILE: a camere which moves

camera.Locations = {
	["de_dust"] = {
		{
			pos = { 656, 2408 },
			type = camera.MOBILE,
		},
	}
}

This code will add a mobile camera at the position [656:2408],
with these default attributes:
- startRotation = 0
- laserRange = 2 tiles
- laserColor = RED {255,0,0}
- hp = 100
- rotDelay = 5 seconds (only for mobile cameras)
- endRot = the final angle (only for mobile cameras)

#Example 2: I want to add two camera but I want to customize them
more ?! For instance one mobile camera at the same position as before
but with a starting Rotation as 90°, a laserRange of 5 tiles,
a blue laser, 200 hp, 5 seconds for rotating from startRot to endRot.
For the last parameter I leave it as it.
So the endRot will be startRot + 90 so 90 + 90 = 180. 
The second one will be an idle camera just below the previous one with 
same parameters except color which will be green in this case and
a laser Range of 10 !

camera.Locations = {
	["de_dust"] = {
		{
			pos = { 656, 2408 },
			type = camera.MOBILE,
			rot = 90,
			laserRange = 5,
			laserColor = { 0, 0, 255 },
			hp = 200,
			rotDelay = 5,
		},
		{
			pos = { 656, 2500 },
			type = camera.IDLE,
			rot = 90,
			laserRange = 10,
			laserColor = { 0, 255, 0 },
			hp = 200,
			rotDelay = 5,
		}
	}
}

##########################
## IV. Additional Infos ##
##########################

- Lasers are buggy ?! (In terms of rendering) 
I didn't find a way to fix it manually so instead of creating each 
camera with different sizes and different colors I've decided to stay
with this option.
- Cameras spawn on each restart remember !
- Feel free to report bugs/suggestions on the camera script topic
on usgn.de
- Enjoy !