Revert "Use IconProcs lib ReadRGB instead of another same functionality proc."

This reverts commit 11f1d82c65.
This commit is contained in:
ZomgPonies
2014-07-19 11:43:48 -04:00
parent e650eed15d
commit e2a9e93a59
2 changed files with 34 additions and 17 deletions
+33 -17
View File
@@ -1,24 +1,40 @@
/proc/mix_color_from_reagents(var/list/reagent_list)
if(!reagent_list || !reagent_list.len) return 0
if(!reagent_list || !length(reagent_list))
return 0
var/list/rgbcolor = list(0,0,0,0)
var/finalcolor = 0
for(var/datum/reagent/re in reagent_list) // natural color mixing bullshit/algorithm
if(!finalcolor)
rgbcolor = ReadRGB(re.color)
finalcolor = re.color
else
var/newcolor[4]
var/prergbcolor[4]
prergbcolor = rgbcolor
newcolor = ReadRGB(re.color)
var/contents = length(reagent_list)
var/list/weight = new /list(contents)
var/list/redcolor = new /list(contents)
var/list/greencolor = new /list(contents)
var/list/bluecolor = new /list(contents)
var/i
rgbcolor[1] = (prergbcolor[1]+newcolor[1])/2
rgbcolor[2] = (prergbcolor[2]+newcolor[2])/2
rgbcolor[3] = (prergbcolor[3]+newcolor[3])/2
rgbcolor[4] = (prergbcolor[4]+newcolor[4])/2
//fill the list of weights
for(i=1; i<=contents; i++)
var/datum/reagent/re = reagent_list[i]
var/reagentweight = re.volume
if(istype(re, /datum/reagent/paint))
reagentweight *= 20 //Paint colours a mixture twenty times as much
weight[i] = reagentweight
finalcolor = rgb(rgbcolor[1], rgbcolor[2], rgbcolor[3], rgbcolor[4])
//fill the lists of colours
for(i=1; i<=contents; i++)
var/datum/reagent/re = reagent_list[i]
var/hue = re.color
if(length(hue) != 7)
return 0
redcolor[i]=hex2num(copytext(hue,2,4))
greencolor[i]=hex2num(copytext(hue,4,6))
bluecolor[i]=hex2num(copytext(hue,6,8))
//mix all the colors
var/red = mixOneColor(weight,redcolor)
var/green = mixOneColor(weight,greencolor)
var/blue = mixOneColor(weight,bluecolor)
//assemble all the pieces
var/finalcolor = rgb(red, green, blue)
return finalcolor
/proc/mixOneColor(var/list/weight, var/list/color)
@@ -1,3 +1,4 @@
/obj/item/weapon/reagent_containers/borghypo
name = "Cyborg Hypospray"
desc = "An advanced chemical synthesizer and injection system, designed for heavy-duty medical equipment."