Upgradeable Laser Pointers!

Laser pointers can be upgraded with laser stock parts, which increases the odds of hitting a target.
Whee!

Conflicts:
	code/game/objects/items/devices/laserpointer.dm
This commit is contained in:
Cheridan
2014-01-07 19:54:51 -06:00
committed by ZomgPonies
parent a405189383
commit 2b87fcf581
@@ -1,4 +1,3 @@
/obj/item/device/laser_pointer
name = "laser pointer"
desc = "Don't shine it in your eyes!"
@@ -10,14 +9,17 @@
slot_flags = SLOT_BELT
m_amt = 500
g_amt = 500
w_class = 1.0
w_class = 2 //Increased to 2, because diodes are w_class 2. Conservation of matter.
origin_tech = "combat=1"
origin_tech = "magnets=2"
var/turf/pointer_loc
var/energy = 5
var/max_energy = 5
var/effectchance = 33
var/recharging = 0
var/recharge_locked = 0
var/obj/item/weapon/stock_parts/micro_laser/diode //used for upgrading!
/obj/item/device/laser_pointer/red
pointer_icon_state = "red_laser"
@@ -30,12 +32,38 @@
/obj/item/device/laser_pointer/New()
..()
diode = new(src)
if(!pointer_icon_state)
pointer_icon_state = pick("red_laser","green_laser","blue_laser","purple_laser")
/obj/item/device/laser_pointer/upgraded/New()
..()
diode = new /obj/item/weapon/stock_parts/micro_laser/ultra
/obj/item/device/laser_pointer/attack(mob/living/M, mob/user)
laser_act(M, user)
/obj/item/device/laser_pointer/attackby(obj/item/W, mob/user)
if(istype(W, /obj/item/weapon/stock_parts/micro_laser))
if(!diode)
user.drop_item()
W.loc = src
diode = W
user << "<span class='notice'>You install a [diode.name] in [src].</span>"
else
user << "<span class='notice'>[src] already has a cell.</span>"
else if(istype(W, /obj/item/weapon/screwdriver))
if(diode)
user << "<span class='notice'>You remove the [diode.name] from the [src].</span>"
diode.loc = get_turf(src.loc)
diode = null
return
..()
return
/obj/item/device/laser_pointer/afterattack(var/atom/target, var/mob/living/user, flag, params)
if(flag) //we're placing the object on a table or in backpack
return
@@ -44,6 +72,9 @@
/obj/item/device/laser_pointer/proc/laser_act(var/atom/target, var/mob/living/user)
if( !(user in (viewers(7,target))) )
return
if (!diode)
user << "<span class='notice'>You point [src] at [target], but nothing happens!</span>"
return
if (!user.IsAdvancedToolUser())
user << "<span class='warning'>You don't have the dexterity to do this!</span>"
return
@@ -64,10 +95,10 @@
var/mob/living/carbon/C = target
//20% chance to actually hit the eyes
if(prob(20))
C.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has had a laser pointer shone in their eyes by [user.name] ([user.ckey])</font>")
user.attack_log += text("\[[time_stamp()]\] <font color='orange'>Shone a laser pointer in the eyes of [C.name] ([C.ckey])</font>")
log_attack("<font color='orange'>[user.name] ([user.ckey]) Shone a laser pointer in the eyes of [C.name] ([C.ckey])</font>")
if(prob(effectchance * diode.rating))
add_logs(user, C, "shone in the eyes", object="laser pointer")
//eye target check
outmsg = "<span class='notice'>You blind [C] by shining [src] in their eyes.</span>"
@@ -117,7 +148,7 @@
else if(issilicon(target))
var/mob/living/silicon/S = target
//20% chance to actually hit the sensors
if(prob(20))
if(prob(effectchance * diode.rating))
S.Weaken(rand(5,10))
S << "<span class='warning'>Your sensors were overloaded by a laser!</span>"
outmsg = "<span class='notice'>You overload [S] by shining [src] at their sensors.</span>"
@@ -131,7 +162,7 @@
//cameras
else if(istype(target, /obj/machinery/camera))
var/obj/machinery/camera/C = target
if(prob(20))
if(prob(effectchance * diode.rating))
C.emp_act(1)
outmsg = "<span class='notice'>You hit the lens of [C] with [src], temporarily disabling the camera!</span>"