Glowsticks (#24761)

* Ports glowsticks from Bay

* Adds glowstick sprites

* Glowsticks in party crates, maint and emergency toolboxes
This commit is contained in:
coiax
2017-03-08 08:38:15 +00:00
committed by Cheridan
parent df99e69fb3
commit f88184937a
5 changed files with 123 additions and 17 deletions

View File

@@ -97,6 +97,7 @@
/obj/item/device/assembly/timer = 3,
/obj/item/device/flashlight = 4,
/obj/item/device/flashlight/pen = 1,
/obj/item/device/flashlight/glowstick/random = 4,
/obj/item/device/multitool = 2,
/obj/item/device/radio/off = 2,
/obj/item/device/t_scanner = 5,

View File

@@ -205,9 +205,10 @@
// Usual checks
if(!fuel)
user << "<span class='warning'>It's out of fuel!</span>"
user << "<span class='warning'>[src] is out of fuel!</span>"
return
if(on)
user << "<span class='notice'>[src] is already on.</span>"
return
. = ..()
@@ -259,19 +260,20 @@
/obj/item/device/flashlight/emp/New()
..()
START_PROCESSING(SSobj, src)
..()
START_PROCESSING(SSobj, src)
/obj/item/device/flashlight/emp/Destroy()
STOP_PROCESSING(SSobj, src)
return ..()
STOP_PROCESSING(SSobj, src)
. = ..()
/obj/item/device/flashlight/emp/process()
charge_tick++
if(charge_tick < 10) return 0
charge_tick = 0
emp_cur_charges = min(emp_cur_charges+1, emp_max_charges)
return 1
charge_tick++
if(charge_tick < 10)
return FALSE
charge_tick = 0
emp_cur_charges = min(emp_cur_charges+1, emp_max_charges)
return TRUE
/obj/item/device/flashlight/emp/attack(mob/living/M, mob/living/user)
if(on && user.zone_selected == "eyes") // call original attack proc only if aiming at the eyes
@@ -297,3 +299,97 @@
else
user << "<span class='warning'>\The [src] needs time to recharge!</span>"
return
// Glowsticks, in the uncomfortable range of similar to flares,
// but not similar enough to make it worth a refactor
/obj/item/device/flashlight/glowstick
name = "green glowstick"
desc = "A military-grade glowstick."
w_class = WEIGHT_CLASS_SMALL
brightness_on = 4
color = LIGHT_COLOR_GREEN
icon_state = "glowstick"
item_state = "glowstick"
var/fuel = 0
/obj/item/device/flashlight/glowstick/Initialize()
fuel = rand(1600, 2000)
light_color = color
..()
/obj/item/device/flashlight/glowstick/Destroy()
STOP_PROCESSING(SSobj, src)
. = ..()
/obj/item/device/flashlight/glowstick/process()
fuel = max(fuel - 1, 0)
if(!fuel)
turn_off()
STOP_PROCESSING(SSobj, src)
update_icon()
/obj/item/device/flashlight/glowstick/proc/turn_off()
on = 0
update_icon()
/obj/item/device/flashlight/glowstick/update_icon()
item_state = "glowstick"
overlays.Cut()
if(!fuel)
icon_state = "glowstick-empty"
cut_overlays()
set_light(0)
else if(on)
var/image/I = image(icon,"glowstick-glow",color)
add_overlay(I)
item_state = "glowstick-on"
set_light(brightness_on)
else
icon_state = "glowstick"
cut_overlays()
/obj/item/device/flashlight/glowstick/attack_self(mob/user)
if(!fuel)
user << "<span class='notice'>[src] is spent.</span>"
return
if(on)
user << "<span class='notice'>[src] is already lit.</span>"
return
. = ..()
if(.)
user.visible_message("<span class='notice'>[user] cracks and shakes [src].</span>", "<span class='notice'>You crack and shake [src], turning it on!</span>")
START_PROCESSING(SSobj, src)
/obj/item/device/flashlight/glowstick/red
name = "red glowstick"
color = LIGHT_COLOR_RED
/obj/item/device/flashlight/glowstick/blue
name = "blue glowstick"
color = LIGHT_COLOR_BLUE
/obj/item/device/flashlight/glowstick/orange
name = "orange glowstick"
color = LIGHT_COLOR_ORANGE
/obj/item/device/flashlight/glowstick/yellow
name = "yellow glowstick"
color = LIGHT_COLOR_YELLOW
/obj/item/device/flashlight/glowstick/pink
name = "pink glowstick"
color = LIGHT_COLOR_PINK
/obj/item/device/flashlight/glowstick/random
name = "random colored glowstick"
/obj/item/device/flashlight/glowstick/random/Initialize()
var/list/glowtypes = typesof(/obj/item/device/flashlight/glowstick)
glowtypes -= /obj/item/device/flashlight/glowstick/random
var/obj/item/device/flashlight/glowstick/glowtype = pick(glowtypes)
name = initial(glowtype.name)
color = initial(glowtype.color)
. = ..()

View File

@@ -46,10 +46,13 @@
new /obj/item/weapon/crowbar/red(src)
new /obj/item/weapon/weldingtool/mini(src)
new /obj/item/weapon/extinguisher/mini(src)
if(prob(50))
new /obj/item/device/flashlight(src)
else
new /obj/item/device/flashlight/flare(src)
switch(rand(1,3))
if(1)
new /obj/item/device/flashlight(src)
if(2)
new /obj/item/device/flashlight/glowstick(src)
if(3)
new /obj/item/device/flashlight/flare(src)
new /obj/item/device/radio/off(src)
/obj/item/weapon/storage/toolbox/emergency/old
@@ -185,4 +188,4 @@
new/obj/item/stack/cable_coil/pink(src)
new/obj/item/stack/cable_coil/orange(src)
new/obj/item/stack/cable_coil/cyan(src)
new/obj/item/stack/cable_coil/white(src)
new/obj/item/stack/cable_coil/white(src)

View File

@@ -1006,7 +1006,13 @@
/obj/item/weapon/reagent_containers/food/drinks/beer,
/obj/item/weapon/reagent_containers/food/drinks/beer,
/obj/item/weapon/reagent_containers/food/drinks/beer,
/obj/item/weapon/reagent_containers/food/drinks/beer)
/obj/item/weapon/reagent_containers/food/drinks/beer,
/obj/item/device/flashlight/glowstick,
/obj/item/device/flashlight/glowstick/red,
/obj/item/device/flashlight/glowstick/blue,
/obj/item/device/flashlight/glowstick/orange,
/obj/item/device/flashlight/glowstick/yellow,
/obj/item/device/flashlight/glowstick/pink)
crate_name = "party equipment crate"
/datum/supply_pack/organic/critter
@@ -1746,4 +1752,4 @@
cost = 1000000
contains = list(/obj/vehicle/bicycle)
crate_name = "Bicycle Crate"
crate_type = /obj/structure/closet/crate/large
crate_type = /obj/structure/closet/crate/large

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 55 KiB