-Fixed being able to open the paintjob selection window and just walking away to paint the airlock from a distance.

-Fixed a few runtimes that could occur if the toner cardridge were removed while the paintjob selection window is still open.
-If you remove the toner cardridge from the airlock painter, it will now try to be put in your hand before falling to the ground.
This commit is contained in:
Ricotez
2013-09-29 17:40:41 +02:00
parent 09663b8507
commit b012829467
3 changed files with 104 additions and 50 deletions
+31 -5
View File
@@ -949,10 +949,7 @@ About the new airlock wires panel:
spawn(0) close(1)
else if(istype(C, /obj/item/weapon/airlock_painter))
var/obj/item/weapon/airlock_painter/WT = C
if(WT.ink.charges)
src.change_paintjob(user)
WT.use()
change_paintjob(C, user)
else
..()
return
@@ -1049,30 +1046,46 @@ About the new airlock wires panel:
if(!density && !operating && !locked && !welded && autoclose)
close()
/obj/machinery/door/airlock/proc/change_paintjob(user)
/obj/machinery/door/airlock/proc/change_paintjob(obj/item/C as obj, mob/user as mob)
var/obj/item/weapon/airlock_painter/W
if(istype(C, /obj/item/weapon/airlock_painter))
W = C
else
return
if(!W.ink)
return
if(glass == 1)
//These airlocks have a glass version.
var optionlist = list("Default", "Engineering", "Atmospherics", "Security", "Command", "Medical", "Research", "Mining")
var paintjob = input(user, "Please select a paintjob for this airlock.") in optionlist
if((!in_range(src, usr) && src.loc != usr) || !W.use(user)) return
switch(paintjob)
if("Default")
icon = 'icons/obj/doors/Doorglass.dmi'
doortype = 7
heat_proof = 0
if("Engineering")
icon = 'icons/obj/doors/Doorengglass.dmi'
doortype = 15
heat_proof = 0
if("Atmospherics")
icon = 'icons/obj/doors/Dooratmoglass.dmi'
doortype = 23
heat_proof = 0
if("Security")
icon = 'icons/obj/doors/Doorsecglass.dmi'
doortype = 16
heat_proof = 0
if("Command")
icon = 'icons/obj/doors/Doorcomglass.dmi'
doortype = 14
heat_proof = 0
if("Medical")
icon = 'icons/obj/doors/Doormedglass.dmi'
doortype = 17
heat_proof = 0
if("Research")
icon = 'icons/obj/doors/Doorresearchglass.dmi'
doortype = 21
@@ -1080,44 +1093,57 @@ About the new airlock wires panel:
if("Mining")
icon = 'icons/obj/doors/Doorminingglass.dmi'
doortype = 22
heat_proof = 0
else
//These airlocks have a regular version.
var optionlist = list("Default", "Engineering", "Atmospherics", "Security", "Command", "Medical", "Research", "Mining", "Maintenance", "External", "High Security")
var paintjob = input(user, "Please select a paintjob for this airlock.") in optionlist
if((!in_range(src, usr) && src.loc != usr) || !W.use(user)) return
switch(paintjob)
if("Default")
icon = 'icons/obj/doors/Doorint.dmi'
doortype = 0
heat_proof = 0
if("Engineering")
icon = 'icons/obj/doors/Dooreng.dmi'
doortype = 3
heat_proof = 0
if("Atmospherics")
icon = 'icons/obj/doors/Dooratmo.dmi'
doortype = 19
heat_proof = 0
if("Security")
icon = 'icons/obj/doors/Doorsec.dmi'
doortype = 2
heat_proof = 0
if("Command")
icon = 'icons/obj/doors/Doorcom.dmi'
doortype = 1
heat_proof = 0
if("Medical")
icon = 'icons/obj/doors/Doormed.dmi'
doortype = 4
heat_proof = 0
if("Research")
icon = 'icons/obj/doors/Doorresearch.dmi'
doortype = 20
heat_proof = 0
if("Mining")
icon = 'icons/obj/doors/Doormining.dmi'
doortype = 18
heat_proof = 0
if("Maintenance")
icon = 'icons/obj/doors/Doormaint.dmi'
doortype = 5
heat_proof = 0
if("External")
icon = 'icons/obj/doors/Doorext.dmi'
doortype = 6
heat_proof = 0
if("High Security")
icon = 'icons/obj/doors/hightechsecurity.dmi'
doortype = 33
heat_proof = 0
update_icon()
@@ -15,13 +15,16 @@
slot_flags = SLOT_BELT
var/obj/item/device/toner/ink = null
//var/active = 0
New()
ink = new /obj/item/device/toner(src)
proc/use()
if(/*!active ||*/ !ink || ink.charges < 1)
proc/use(mob/user as mob)
if(!ink)
user << "<span class='notice'>There is no toner cardridge installed installed in \the [name]!</span>"
return 0
else if(ink.charges < 1)
user << "<span class='notice'>\the [name] is out of ink!.</span>"
return 0
else
ink.charges--
@@ -29,38 +32,36 @@
return 1
examine()
..()
if(!ink)
usr << "<span class='notice'>It doesn't have a toner cardridge installed.</span>"
return
var/ink_level = "high"
if(!ink || ink.charges < 1)
if(ink.charges < 1)
ink_level = "empty"
else if((ink.charges/ink.max_charges) <= 0.25) //25%
ink_level = "low"
else if((ink.charges/ink.max_charges) > 1) //Over 100% (admin var edit)
ink_level = "dangerously high"
..()
//set src in usr
usr << "<span class='notice'>Its ink levels look [ink_level].</span>"
return
attackby(obj/item/weapon/W, mob/user)
..()
if(istype(W, /obj/item/device/toner))
if(ink)
user << "<span class='notice'>The airlock painter already contains a toner cardridge.</span>"
user << "<span class='notice'>\the [name] already contains \a [ink].</span>"
return
user.drop_item()
W.loc = src
user << "<span class='notice'>You install \the [W] into \the [name].</span>"
ink = W
playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
user << "<span class='notice'>You install the toner cardridge into the airlock painter.</span>"
attack_self(mob/user)
//Change the mode
if(ink)
playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
var/turf/T = loc
if(ismob(T))
T = T.loc
ink.loc = T
ink.loc = user.loc
user.put_in_hands(ink)
user << "<span class='notice'>You remove \the [ink] from \the [name].</span>"
ink = null
user << "<span class='notice'>You remove the toner cardridge from the airlock painter.</span>"
+57 -30
View File
@@ -308,69 +308,94 @@ obj/structure/door_assembly
//INFORMATION ABOUT ADDING A NEW AIRLOCK TO THE PAINT LIST:
//If your airlock has a regular version, add it to the list with regular versions.
//If your airlock has a glass version, add it to the list with glass versions.
//Don't forget to also set has_solid and has_glass to the proper value.
//Do NOT add your airlock to a list if it does not have a version for that list,
// or you will get broken icons.
var/obj/item/weapon/airlock_painter/WT = W
if(WT.ink.charges)
if(WT.ink && WT.ink.charges)
var/icontype
var/optionlist
if(src.mineral)
if(src.mineral == "glass")
//These airlocks have a glass version.
optionlist = list("Default", "Engineering", "Atmospherics", "Security", "Command", "Medical", "Research", "Mining")
else
user << "The painter does not work on airlocks coated in minerals!"
return
if(mineral && mineral == "glass")
//These airlocks have a glass version.
optionlist = list("Default", "Engineering", "Atmospherics", "Security", "Command", "Medical", "Research", "Mining")
else
//These airlocks have a regular version.
optionlist = list("Default", "Engineering", "Atmospherics", "Security", "Command", "Medical", "Research", "Mining", "Maintenance", "External", "High Security")
icontype = input(user, "Please select a paintjob for this airlock.") in optionlist
if(!in_range(src, usr) && src.loc != usr) return
if((!in_range(src, usr) && src.loc != usr) || !WT.use(user)) return
var/has_solid = 0
var/has_glass = 0
switch(icontype)
if("Default")
typetext = ""
icontext = ""
//For Default the standard options suffice.
if("Engineering")
typetext = "engineering"
icontext = "eng"
has_solid = 1
has_glass = 1
if("Atmospherics")
typetext = "atmos"
icontext = "atmo"
has_solid = 1
has_glass = 1
if("Security")
typetext = "security"
icontext = "sec"
has_solid = 1
has_glass = 1
if("Command")
typetext = "command"
icontext = "com"
has_solid = 1
has_glass = 1
if("Medical")
typetext = "medical"
icontext = "med"
has_solid = 1
has_glass = 1
if("Research")
typetext = "research"
icontext = "res"
has_solid = 1
has_glass = 1
if("Mining")
typetext = "mining"
icontext = "min"
has_solid = 1
has_glass = 1
if("Maintenance")
typetext = "maintenance"
icontext = "mai"
has_solid = 1
has_glass = 0
if("External")
typetext = "external"
icontext = "ext"
has_solid = 1
has_glass = 0
if("High Security")
typetext = "highsecurity"
icontext = "highsec"
src.airlock_type = text2path("/obj/machinery/door/airlock/[typetext]")
src.glass_type = text2path("/obj/machinery/door/airlock/glass_[typetext]")
src.base_icon_state = "door_as_[icontext]"
src.glass_base_icon_state = "door_as_g[icontext]"
has_solid = 1
has_glass = 0
if(has_solid)
airlock_type = text2path("/obj/machinery/door/airlock/[typetext]")
base_icon_state = "door_as_[icontext]"
else
airlock_type = /obj/machinery/door/airlock
base_icon_state = "door_as_"
if(has_glass)
glass_type = text2path("/obj/machinery/door/airlock/glass_[typetext]")
glass_base_icon_state = "door_as_g[icontext]"
else
glass_type = /obj/machinery/door/airlock/glass
glass_base_icon_state = "door_as_g"
if(mineral && mineral != "glass")
mineral = null //I know this is stupid, but until we change glass to a boolean it's how this code works.
user << "\blue You change the paintjob on the airlock assembly."
WT.use()
else
user << "\blue There aren't any charges left!"
return
else if(istype(W, /obj/item/weapon/weldingtool) && !anchored )
var/obj/item/weapon/weldingtool/WT = W
@@ -477,20 +502,20 @@ obj/structure/door_assembly
if(do_after(user, 40))
user << "\blue You've installed reinforced glass windows into the airlock assembly."
G.use(1)
src.mineral = "glass"
src.name = "Near finished Window Airlock Assembly"
mineral = "glass"
name = "Near finished Window Airlock Assembly"
//This list contains the airlock paintjobs that have a glass version:
if(icontext in list("eng", "atmo", "sec", "com", "med", "res", "min"))
src.airlock_type = text2path("/obj/machinery/door/airlock/[typetext]")
src.glass_type = text2path("/obj/machinery/door/airlock/glass_[typetext]")
else
//This airlock is default or does not have a glass version, so we revert to the default glass airlock. |- Ricotez
src.airlock_type = /obj/machinery/door/airlock
src.glass_type = /obj/machinery/door/airlock/glass
airlock_type = /obj/machinery/door/airlock
glass_type = /obj/machinery/door/airlock/glass
typetext = ""
icontext = ""
src.base_icon_state = "door_as_[icontext]"
src.glass_base_icon_state = "door_as_g[icontext]"
base_icon_state = "door_as_[icontext]"
glass_base_icon_state = "door_as_g[icontext]"
else if(istype(G, /obj/item/stack/sheet/mineral))
var/M = G.sheettype
if(G.amount>=2)
@@ -499,10 +524,12 @@ obj/structure/door_assembly
if(do_after(user, 40))
user << "\blue You've installed [M] plating into the airlock assembly."
G.use(2)
src.mineral = "[M]"
src.name = "Near finished [M] Airlock Assembly"
src.airlock_type = text2path ("/obj/machinery/door/airlock/[M]")
src.base_icon_state = "door_as_[M]"
mineral = "[M]"
name = "Near finished [M] Airlock Assembly"
airlock_type = text2path ("/obj/machinery/door/airlock/[M]")
base_icon_state = "door_as_[M]"
glass_base_icon_state = "door_as_g"
glass_type = /obj/machinery/door/airlock/glass
else if(istype(W, /obj/item/weapon/screwdriver) && state == 2 )
playsound(src.loc, 'sound/items/Screwdriver.ogg', 100, 1)