if to switch

From ugly if to beautiful switch
This commit is contained in:
tristan1333
2016-08-11 09:45:11 +10:00
committed by GitHub
parent 06d45d696c
commit deed273dba
+10 -10
View File
@@ -71,16 +71,16 @@
/obj/spacepod/proc/apply_paint(mob/user as mob)
var/part_type
var/part = input(user, "Choose part", null) as null|anything in list("Lights","Rim","Paint","Windows")
if(part == "Lights")
part_type = LIGHT
if(part == "Rim")
part_type = RIM
if(part == "Paint")
part_type = PAINT
if(part == "Windows")
part_type = WINDOW
if(!part)
return
switch (part)
if("Lights")
part_type = LIGHT
if("Rim")
part_type = RIM
if("Paint")
part_type = PAINT
if("Windows")
part_type = WINDOW
else
var/coloradd = input(user, "Choose a color", "Color") as color
colors[part_type] = coloradd
if(!has_paint)