#Edible Chocolate!
@name Edible Chocolate NOM
@inputs 
@outputs 
@persist Eating Edible InRange Red2 OName:string Green2 Blue2 Red3 Green3 Blue3 IR:vector OUR:vector Alpha Red Green Blue Red1 Green1 Blue1 AEdible AHealth OHealth ONHealth
@trigger 
@model models/hunter/plates/plate025x05.mdl
runOnTick(1)
#Health Shit
OHealth=owner():health()
ONHealth=OHealth+AHealth
#Settings
#Chocolate Color
Alpha=255
Red=144
Green=87
Blue=63
#Chocolate Secondary/Out of Range Color
Red1=0
Green1=255
Blue1=0
#Wrapper Color
Red2=255
Green2=180
Blue2=0
#Wrapper2 Color
Red3=255
Green3=255
Blue3=255
#Indicator/Label Color Settings
#In Range
IR=vec(255,255,255)
#Out of Range is same as Secondary Color
#Edible Settings
Edible=1
AHealth=35
#Able to to !hp <name> <hp> ? If so put 1, if you can't put 0
AEdible=0
#Part of your name for adding health
OName="PartOfName"
#End Settings
if (first())
{
    #Start Up Code
    entity():setAlpha(0)
    runOnTick(1)
    O=owner()
    Eating=0
    InRange=0
    #The Chocolate itself
    holoCreate(1)
    holoModel(1,"hq_rcube_thin")
    holoMaterial(1, "models/debug/debugwhite")
    holoPos(1, holoEntity(1):pos() + vec(0,1,0))
    holoColor(1, vec(Red,Green,Blue))
    holoScale(1, vec(0.45,1.5,0.1))
    holoAlpha(1,Alpha)
    holoParent(1,entity())
    #The Wrapper
    holoCreate(2)
    holoModel(2,"hq_rcube_thin")
    holoMaterial(2, "models/debug/debugwhite")
    holoScale(2, vec(0.5,1,0.2))
    holoPos(2, holoEntity(2):pos() + vec(0,-4,0))
    holoColor(2, vec(Red2,Green2,Blue2))
    holoAlpha(2,Alpha)
    holoParent(2,holoEntity(1))
    #The Wrapper2
    holoCreate(4)
    holoModel(4,"hq_rcube_thin")
    holoMaterial(4, "models/debug/debugwhite")
    holoScale(4, vec(0.48,0.1,0.15))
    holoPos(4, holoEntity(4):pos() + vec(0,2,0))
    holoColor(4, vec(Red3,Green3,Blue3))
    holoAlpha(4,Alpha)
    holoParent(4,holoEntity(1))
    #The Indicator/Label
    holoCreate(3)
    holoModel(3,"hq_rcube_thin")
    holoMaterial(3, "models/debug/debugwhite")
    holoScale(3, vec(0.3,0.75,0.2))
    holoColor(3, vec(Red1,Green1,Blue1))
    holoPos(3, holoEntity(3):pos() + vec(0,-4,0.2))
    holoAlpha(3,Alpha)
    holoParent(3,holoEntity(1))
}
if (owner():keyUse() & (owner():aimEntity()==entity()) & (InRange==1) & (owner():keyAttack1()==0) & (Edible==1))
{
    Eating=1
    print(_HUD_PRINTCENTER,"OM NOM NOM OM NOM")
    selfDestruct()
}
else
{
    Eating=0
}
if (owner():keyUse() & (owner():aimEntity()==entity()) & (Edible==0))
{
    print(_HUD_PRINTCENTER,"Edible must be set to 1 to eat the chocolate!")
}
if (Eating==1 & (AEdible==1))
{
 concmd("say !hp "+OName+" "+ONHealth:toString())
}
if (owner():pos():distance(entity():pos())<125)
{
    InRange=1
    holoColor(3,IR)
}
else
{
    InRange=0
    holoColor(3,vec(Red1,Green1,Blue1))
}
