Merge pull request #8368 from PsiOmegaDelta/DoorPlox

Airlock/door changes
This commit is contained in:
Zuhayr
2015-03-06 22:18:59 +10:30
2 changed files with 75 additions and 43 deletions
+29 -14
View File
@@ -7,9 +7,10 @@
explosion_resistance = 15
var/aiControlDisabled = 0 //If 1, AI control is disabled until the AI hacks back in and disables the lock. If 2, the AI has bypassed the lock. If -1, the control is enabled but the AI had bypassed it earlier, so if it is disabled again the AI would have no trouble getting back in.
var/hackProof = 0 // if 1, this door can't be hacked by the AI
var/electrified_until = 0 // World time when the door is no longer electrified. -1 if it is permanently electrified until someone fixes it.
var/main_power_lost_until = 0 //World time when main power is restored.
var/backup_power_lost_until = -1 //World time when backup power is restored.
var/electrified_until = 0 //World time when the door is no longer electrified. -1 if it is permanently electrified until someone fixes it.
var/main_power_lost_until = 0 //World time when main power is restored.
var/backup_power_lost_until = -1 //World time when backup power is restored.
var/next_beep_at = 0 //World time when we may next beep due to doors being blocked by mobs
var/spawnPowerRestoreRunning = 0
var/welded = null
var/locked = 0
@@ -228,6 +229,8 @@
else if(electrified_until > 0 && world.time >= electrified_until)
electrify(0)
..()
/obj/machinery/door/airlock/uranium/process()
if(world.time > last_event+20)
if(prob(50))
@@ -438,7 +441,7 @@ About the new airlock wires panel:
/obj/machinery/door/airlock/update_icon()
if(overlays) overlays.Cut()
if(density)
if(locked && lights)
if(locked && lights && src.arePowerSystemsOn())
icon_state = "door_locked"
else
icon_state = "door_closed"
@@ -459,7 +462,6 @@ About the new airlock wires panel:
icon_state = "door_open"
if((stat & BROKEN) && !(stat & NOPOWER))
overlays += image(icon, "sparks_open")
return
/obj/machinery/door/airlock/do_animate(animation)
@@ -488,6 +490,7 @@ About the new airlock wires panel:
if("deny")
if(density && src.arePowerSystemsOn())
flick("door_deny", src)
playsound(src.loc, 'sound/machines/buzz-two.ogg', 50, 0)
return
/obj/machinery/door/airlock/attack_ai(mob/user as mob)
@@ -822,7 +825,7 @@ About the new airlock wires panel:
return
/obj/machinery/door/airlock/open(var/forced=0)
if( operating || welded || locked )
if(!can_open())
return 0
if(!forced)
if( !arePowerSystemsOn() || isWireCut(AIRLOCK_WIRE_OPEN_DOOR) )
@@ -836,20 +839,32 @@ About the new airlock wires panel:
src.closeOther.close()
return ..()
/obj/machinery/door/airlock/close(var/forced=0)
if(operating || welded || locked)
return
/obj/machinery/door/airlock/can_open()
if(locked || welded)
return 0
return ..()
/obj/machinery/door/airlock/can_close(var/forced)
if(locked || welded)
return 0
if(!forced)
//despite the name, this wire is for general door control.
//Bolts are already covered by the check for locked, above
if( !arePowerSystemsOn() || isWireCut(AIRLOCK_WIRE_OPEN_DOOR) )
return
if(!arePowerSystemsOn() || isWireCut(AIRLOCK_WIRE_OPEN_DOOR))
return 0
return ..()
/obj/machinery/door/airlock/close(var/forced=0)
if(!can_close(forced))
return
if(safe)
for(var/turf/turf in locs)
if(locate(/mob/living) in turf)
// playsound(src.loc, 'sound/machines/buzz-two.ogg', 50, 0) //THE BUZZING IT NEVER STOPS -Pete
spawn (60)
close()
if(world.time > next_beep_at)
playsound(src.loc, 'sound/machines/buzz-two.ogg', 50, 0)
next_beep_at = world.time + SecondsToTicks(10)
close_door_at = world.time + 6
return
for(var/turf/turf in locs)
+46 -29
View File
@@ -31,6 +31,7 @@
var/hitsound = 'sound/weapons/smash.ogg' //sound door makes when hit with a weapon
var/obj/item/stack/sheet/metal/repairing
var/block_air_zones = 1 //If set, air zones cannot merge across the door even when it is opened.
var/close_door_at = 0 //When to automatically close the door, if possible
//Multi-tile doors
dir = EAST
@@ -74,6 +75,24 @@
..()
return
/obj/machinery/door/process()
if(close_door_at && world.time >= close_door_at)
if(autoclose)
close_door_at = next_close_time()
close()
else
close_door_at = 0
/obj/machinery/door/proc/can_open()
if(!density || operating || !ticker)
return 0
return 1
/obj/machinery/door/proc/can_close(var/forced = 0)
if(!density && !operating && !(!forced && (stat & (BROKEN|NOPOWER))))
return 1
return 0
/obj/machinery/door/Bumped(atom/AM)
if(p_open || operating) return
if(ismob(AM))
@@ -97,7 +116,7 @@
if(mecha.occupant && (src.allowed(mecha.occupant) || src.check_access_list(mecha.operation_req_access)))
open()
else
flick("door_deny", src)
do_animate("deny")
return
if(istype(AM, /obj/structure/bed/chair/wheelchair))
var/obj/structure/bed/chair/wheelchair/wheel = AM
@@ -105,7 +124,7 @@
if(wheel.pulling && (src.allowed(wheel.pulling)))
open()
else
flick("door_deny", src)
do_animate("deny")
return
return
@@ -127,7 +146,7 @@
if(density)
if(allowed(user)) open()
else flick("door_deny", src)
else do_animate("deny")
return
/obj/machinery/door/meteorhit(obj/M as obj)
@@ -264,7 +283,7 @@
if(src.operating) return
if(src.density && (operable() && istype(I, /obj/item/weapon/card/emag)))
flick("door_spark", src)
do_animate("spark")
sleep(6)
open()
operating = -1
@@ -277,8 +296,8 @@
close()
return
if(src.density && !(stat & (NOPOWER|BROKEN)))
flick("door_deny", src)
if(src.density)
do_animate("deny")
return
/obj/machinery/door/proc/take_damage(var/damage)
@@ -355,23 +374,27 @@
flick("o_doorc1", src)
else
flick("doorc1", src)
if("spark")
if(density)
flick("door_spark", src)
if("deny")
flick("door_deny", src)
if(density && !(stat & (NOPOWER|BROKEN)))
flick("door_deny", src)
playsound(src.loc, 'sound/machines/buzz-two.ogg', 50, 0)
return
/obj/machinery/door/proc/open()
if(!density) return 1
if(operating > 0) return
if(!ticker) return 0
if(!operating) operating = 1
if(!can_open()) return
if(!operating) operating = 1
do_animate("opening")
icon_state = "door0"
src.SetOpacity(0)
sleep(10)
src.layer = open_layer
sleep(3)
src.density = 0
sleep(7)
src.layer = open_layer
explosion_resistance = 0
update_icon()
SetOpacity(0)
@@ -379,26 +402,26 @@
if(operating) operating = 0
if(autoclose && normalspeed)
spawn(150)
autoclose()
if(autoclose && !normalspeed)
spawn(5)
autoclose()
if(autoclose)
close_door_at = next_close_time()
return 1
/obj/machinery/door/proc/next_close_time()
return world.time + (normalspeed ? 150 : 5)
/obj/machinery/door/proc/close()
if(density) return 1
if(operating > 0) return
if(!can_close())
return
operating = 1
close_door_at = 0
do_animate("closing")
sleep(3)
src.density = 1
explosion_resistance = initial(explosion_resistance)
src.layer = closed_layer
do_animate("closing")
sleep(10)
sleep(7)
update_icon()
if(visible && !glass)
SetOpacity(1) //caaaaarn!
@@ -431,12 +454,6 @@
else
source.thermal_conductivity = initial(source.thermal_conductivity)
/obj/machinery/door/proc/autoclose()
var/obj/machinery/door/airlock/A = src
if(!A.density && !A.operating && !A.locked && !A.welded && !(A.stat & (BROKEN|NOPOWER)) && A.autoclose)
close()
return
/obj/machinery/door/Move(new_loc, new_dir)
//update_nearby_tiles()
. = ..()