mob
var
aura
myAura
aura
parent_type=/obj
var
r
g
b
on
New(mob/M)
var/icon/I=new('Auras.dmi')
var/obj/I2=new
I2.icon=icon('Auras.dmi',"2")
I2.pixel_y = 32
while(r == null)
r=input(M,"How much red would you like in your aura?") as num
while(g == null)
g=input(M,"How much green would you like in your aura?") as num
while(b == null)
b=input(M,"How much blue would you like in your aura?") as num
I.Blend(rgb(r,g,b))
src.icon=I
I.icon=I2.icon
I.Blend(rgb(r,g,b))
I2.icon=I
src.overlays+=I2
openMe(M)
proc
closeMe(mob/M)
M.overlays -= src
on=0
openMe(mob/M)
M.overlays += src
on=1
mob
verb
Aura()
if(!myAura)
myAura = new(src)
return
myAura.on ? myAura.closeMe(src) : myAura.openMe(src)
Change_Aura_Color()
myAura ? myAura.closeMe(src) : 0
myAura = new(src)
Everything works the way I intended it, it was made for a friend so I wanted to make sure it was done correctly. Does anyone have any advice for me to make it better, if so?
Cheetoz wrote:
While this might work in this specific circumstance, usually you will want to pass the mob in question to the function. If you expand your system at all, this could easily break by letting it default to usr.
Just curious, why are you shifting it there? Also, why have two auras and stack one over the other, why not just have them blended together right in auras.dmi in the first place?
Since you are going the extra step to do the right thing and use a parameter (M) instead of user throughout this function, you might as well use it instead of usr for input as well. That is, input(M, "How much blue...?")as num
If there is no myAura (!myAura) then being null will be caught by the first part, therefor the "|| myAura == null" is redundant. If it's null, it's false and won't get to that part in the first place.
</dm>
A bit redundant again. If you are going to create a new aura regardless (you do it in both if and else) you might as well just do it once. Doing so would make it instead look like the following.