Merge pull request #5297 from comma/fancy

Nextgen lights
This commit is contained in:
Ccomp5950
2014-06-20 20:30:11 -05:00
11 changed files with 361 additions and 171 deletions
+3
View File
@@ -356,6 +356,7 @@
switchcount = L.switchcount
rigged = L.rigged
brightness = L.brightness
l_color = L.color
on = has_power()
update()
@@ -514,6 +515,7 @@
L.status = status
L.rigged = rigged
L.brightness = src.brightness
L.color = l_color
// light item inherits the switchcount, then zero it
L.switchcount = switchcount
@@ -539,6 +541,7 @@
L.status = status
L.rigged = rigged
L.brightness = brightness
L.color = l_color
// light item inherits the switchcount, then zero it
L.switchcount = switchcount
+6 -7
View File
@@ -34,7 +34,7 @@
var/blue = mixOneColor(weight,bluecolor)
//assemble all the pieces
var/finalcolor = "#[red][green][blue]"
var/finalcolor = rgb(red, green, blue)
return finalcolor
/proc/mixOneColor(var/list/weight, var/list/color)
@@ -58,10 +58,9 @@
mixedcolor = round(mixedcolor)
//until someone writes a formal proof for this algorithm, let's keep this in
if(mixedcolor<0x00 || mixedcolor>0xFF)
return 0
// if(mixedcolor<0x00 || mixedcolor>0xFF)
// return 0
//that's not the kind of operation we are running here, nerd
mixedcolor=min(max(mixedcolor,0),255)
var/finalcolor = num2hex(mixedcolor)
while(length(finalcolor)<2)
finalcolor = text("0[]",finalcolor) //Takes care of leading zeroes
return finalcolor
return mixedcolor
+17 -2
View File
@@ -44,6 +44,10 @@
var/emergency_alert = "CRYSTAL DELAMINATION IMMINENT."
var/explosion_point = 1000
l_color = "#8A8A00"
var/warning_color = "#B8B800"
var/emergency_color = "#D9D900"
var/grav_pulling = 0
var/pull_radius = 14
@@ -99,6 +103,13 @@
del src
return
//Changes color and luminosity of the light to these values if they were not already set
/obj/machinery/power/supermatter/proc/shift_light(var/lum, var/clr)
if(l_color != clr)
l_color = clr
if(luminosity != lum)
SetLuminosity(lum)
/obj/machinery/power/supermatter/process()
var/turf/L = loc
@@ -109,12 +120,15 @@
if(!istype(L)) //We are in a crate or somewhere that isn't turf, if we return to turf resume processing but for now.
return //Yeah just stop.
if(damage > warning_point) // while the core is still damaged and it's still worth noting its status
shift_light(5, warning_color)
if((world.timeofday - lastwarning) / 10 >= WARNING_DELAY)
var/stability = num2text(round((damage / explosion_point) * 100))
if(damage > emergency_point)
shift_light(7, emergency_color)
radio.autosay(addtext(emergency_alert, " Instability: ",stability,"%"), "Supermatter Monitor")
lastwarning = world.timeofday
@@ -135,7 +149,8 @@
mob.apply_effect(rads, IRRADIATE)
explode()
else
shift_light(4,initial(l_color))
if(grav_pulling)
supermatter_pull()