diff --git a/code/datums/spells/knock.dm b/code/datums/spells/knock.dm index 0054c9f33c7..98d1b3b0fa9 100644 --- a/code/datums/spells/knock.dm +++ b/code/datums/spells/knock.dm @@ -19,6 +19,7 @@ if(istype(door,/obj/machinery/door/airlock/hatch/gamma)) return if(istype(door,/obj/machinery/door/airlock)) - door:unlock(1) //forced because it's magic! + var/obj/machinery/door/airlock/A = door + A.unlock(1) //forced because it's magic! door.open() return \ No newline at end of file diff --git a/code/datums/wires/airlock.dm b/code/datums/wires/airlock.dm index 62f9628b467..007917ded3d 100644 --- a/code/datums/wires/airlock.dm +++ b/code/datums/wires/airlock.dm @@ -74,8 +74,7 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048 if(!mended) //Cutting this wire also drops the door bolts, and mending it does not raise them. (This is what happens now, except there are a lot more wires going to door bolts at present) - if(A.locked!=1) - A.locked = 1 + A.lock(1) A.update_icon() if(AIRLOCK_WIRE_AI_CONTROL) @@ -96,12 +95,9 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048 if(AIRLOCK_WIRE_ELECTRIFY) if(!mended) //Cutting this wire electrifies the door, so that the next person to touch the door without insulated gloves gets electrocuted. - if(A.electrified_until != -1) - A.shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])") - add_logs(usr, A, "electrified", null, addition="at [A.x],[A.y],[A.z]") - A.electrified_until = -1 + A.electrify(-1) else - A.electrified_until = 0 + A.electrify(0) return // Don't update the dialog. if (AIRLOCK_WIRE_SAFETY) @@ -135,13 +131,9 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048 //one wire for door bolts. Sending a pulse through this drops door bolts if they're not down (whether power's on or not), //raises them if they are down (only if power's on) if(!A.locked) - A.locked = 1 - A.audible_message("You hear a click from the bottom of the door.", null, 1) + A.lock() else - if(A.arePowerSystemsOn()) //only can raise bolts if power's on - A.locked = 0 - A.audible_message("You hear a click from the bottom of the door.", null, 1) - A.update_icon() + A.unlock() if(AIRLOCK_WIRE_BACKUP_POWER1 || AIRLOCK_WIRE_BACKUP_POWER2) //two wires for backup power. Sending a pulse through either one causes a breaker to trip, but this does not disable it unless main power is down too (in which case it is disabled for 1 minute or however long it takes main power to come back, whichever is shorter). @@ -161,11 +153,7 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048 if(AIRLOCK_WIRE_ELECTRIFY) //one wire for electrifying the door. Sending a pulse through this electrifies the door for 30 seconds. - if(A.electrified_until >= 0) - A.shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])") - add_logs(usr, A, "electrified", null, addition="at [A.x],[A.y],[A.z]") - A.electrified_until = world.time + SecondsToTicks(30) - return + A.electrify(30) if(AIRLOCK_WIRE_OPEN_DOOR) //tries to open the door without ID //will succeed only if the ID wire is cut or the door requires no access and it's not emagged diff --git a/code/game/machinery/door_control.dm b/code/game/machinery/door_control.dm index da5a81b7fcb..2d2d65b7c8d 100644 --- a/code/game/machinery/door_control.dm +++ b/code/game/machinery/door_control.dm @@ -98,17 +98,16 @@ if(specialfunctions & BOLTS) D.lock() if(specialfunctions & SHOCK) - D.electrified_until = -1 + D.electrify(-1) if(specialfunctions & SAFE) D.safe = 0 else if(specialfunctions & IDSCAN) D.aiDisabledIdScanner = 0 if(specialfunctions & BOLTS) - if(!D.isWireCut(4) && D.arePowerSystemsOn()) - D.unlock() + D.unlock() if(specialfunctions & SHOCK) - D.electrified_until = 0 + D.electrify(0) if(specialfunctions & SAFE) D.safe = 1 diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 44dc0fc8542..92424115b29 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -28,6 +28,7 @@ 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/spawnPowerRestoreRunning = 0 @@ -209,23 +210,15 @@ var/last_event = 0 /obj/machinery/door/airlock/process() - // Deliberate no call to parent - if(src.isWireCut(AIRLOCK_WIRE_MAIN_POWER1) || src.isWireCut(AIRLOCK_WIRE_MAIN_POWER2)) - main_power_lost_until = -1 - else if(main_power_lost_until > 0 && world.time > main_power_lost_until) + // Deliberate no call to parent. + if(main_power_lost_until > 0 && world.time >= main_power_lost_until) regainMainPower() - if(src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER1) || src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER2)) - backup_power_lost_until = -1 - if(backup_power_lost_until > 0&& world.time > backup_power_lost_until) + if(backup_power_lost_until > 0 && world.time >= backup_power_lost_until) regainBackupPower() - if(electrified_until && !arePowerSystemsOn()) - electrified_until = 0 - else if(isWireCut(AIRLOCK_WIRE_ELECTRIFY)) - electrified_until = -1 - else if(electrified_until > 0 && world.time > electrified_until) - electrified_until = 0 + else if(electrified_until > 0 && world.time >= electrified_until) + electrify(0) /obj/machinery/door/airlock/uranium/process() if(world.time > last_event+20) @@ -390,32 +383,72 @@ About the new airlock wires panel: return !(src.isWireCut(AIRLOCK_WIRE_IDSCAN) || aiDisabledIdScanner) /obj/machinery/door/airlock/proc/isAllPowerLoss() - if(stat & NOPOWER) + if(stat & (NOPOWER|BROKEN)) + return 1 + if(mainPowerCablesCut() && backupPowerCablesCut()) return 1 - if(src.isWireCut(AIRLOCK_WIRE_MAIN_POWER1) || src.isWireCut(AIRLOCK_WIRE_MAIN_POWER2)) - if(src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER1) || src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER2)) - return 1 return 0 + +/obj/machinery/door/airlock/proc/mainPowerCablesCut() + return src.isWireCut(AIRLOCK_WIRE_MAIN_POWER1) || src.isWireCut(AIRLOCK_WIRE_MAIN_POWER2) + +/obj/machinery/door/airlock/proc/backupPowerCablesCut() + return src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER1) || src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER2) /obj/machinery/door/airlock/proc/loseMainPower() - // process() will handle the case of cut power cables - main_power_lost_until = world.time + SecondsToTicks(60) - backup_power_lost_until = max(backup_power_lost_until, world.time + SecondsToTicks(10)) + main_power_lost_until = mainPowerCablesCut() ? -1 : world.time + SecondsToTicks(60) + + // If backup power is permanently disabled then activate in 10 seconds if possible, otherwise it's already enabled or a timer is already running + if(backup_power_lost_until == -1 && !backupPowerCablesCut()) + backup_power_lost_until = world.time + SecondsToTicks(10) + + // Disable electricity if required + if(electrified_until && isAllPowerLoss()) + electrify(0) /obj/machinery/door/airlock/proc/loseBackupPower() - // process() will handle the case of cut power cables - backup_power_lost_until = world.time + SecondsToTicks(60) + backup_power_lost_until = backupPowerCablesCut() ? -1 : world.time + SecondsToTicks(60) + + // Disable electricity if required + if(electrified_until && isAllPowerLoss()) + electrify(0) /obj/machinery/door/airlock/proc/regainMainPower() - if(!src.isWireCut(AIRLOCK_WIRE_MAIN_POWER1) && !src.isWireCut(AIRLOCK_WIRE_MAIN_POWER2)) + if(!mainPowerCablesCut()) main_power_lost_until = 0 - backup_power_lost_until = -1 + // If backup power is currently active then disable, otherwise let it count down and disable itself later + if(!backup_power_lost_until) + backup_power_lost_until = -1 update_icon() /obj/machinery/door/airlock/proc/regainBackupPower() - if(!src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER1) && !src.isWireCut(AIRLOCK_WIRE_BACKUP_POWER2)) - backup_power_lost_until = 0 + if(!backupPowerCablesCut()) + // Restore backup power only if main power is offline, otherwise permanently disable + backup_power_lost_until = main_power_lost_until == 0 ? -1 : 0 update_icon() + +/obj/machinery/door/airlock/proc/electrify(var/duration, var/feedback = 0) + var/message = "" + if(src.isWireCut(AIRLOCK_WIRE_ELECTRIFY) && arePowerSystemsOn()) + message = text("The electrification wire is cut - Door permanently electrified.") + src.electrified_until = -1 + else if(duration && !arePowerSystemsOn()) + message = text("The door is unpowered - Cannot electrify the door.") + src.electrified_until = 0 + else if(!duration && electrified_until != 0) + message = "The door is now un-electrified." + src.electrified_until = 0 + else if(duration) //electrify door for the given duration seconds + if(usr) + shockedby += text("\[[time_stamp()]\] - [usr](ckey:[usr.ckey])") + usr.attack_log += text("\[[time_stamp()]\] Electrified the [name] at [x] [y] [z]") + else + shockedby += text("\[[time_stamp()]\] - EMP)") + message = "The door is now electrified [duration == -1 ? "permanently" : "for [duration] second\s"]." + src.electrified_until = duration == -1 ? -1 : world.time + SecondsToTicks(duration) + + if(feedback && message) + usr << message // shock user with probability prb (if all connections & power are working) // returns 1 if shocked, 0 otherwise @@ -917,23 +950,29 @@ About the new airlock wires panel: return /obj/machinery/door/airlock/proc/lock(var/forced=0) - if (operating || src.locked) return + if(locked) + return 0 + + if (operating && !forced) return 0 src.locked = 1 for(var/mob/M in range(1,src)) M.show_message("You hear a click from the bottom of the door.", 2) update_icon() + return 1 /obj/machinery/door/airlock/proc/unlock(var/forced=0) - if (operating || !src.locked) return + if(!src.locked) + return - if (forced || (src.arePowerSystemsOn())) //only can raise bolts if power's on - src.locked = 0 - for(var/mob/M in range(1,src)) - M.show_message("You hear a click from the bottom of the door.", 2) - update_icon() - return 1 - return 0 + if (!forced) + if(operating || !src.arePowerSystemsOn() || isWireCut(AIRLOCK_WIRE_DOOR_BOLTS)) return + + src.locked = 0 + for(var/mob/M in range(1,src)) + M.show_message("You hear a click from the bottom of the door.", 2) + update_icon() + return 1 /obj/machinery/door/airlock/New() ..() @@ -1013,7 +1052,21 @@ About the new airlock wires panel: else return - /obj/machinery/door/airlock/CanAStarPass(var/obj/item/weapon/card/id/ID) //Airlock is passable if it is open (!density), bot has access, and is not bolted shut) return !density || (check_access(ID) && !locked) + +/obj/machinery/door/airlock/emp_act(var/severity) + if(prob(40/severity)) + var/duration = world.time + SecondsToTicks(30 / severity) + if(duration > electrified_until) + electrify(duration) + ..() + +/obj/machinery/door/airlock/power_change() //putting this is obj/machinery/door itself makes non-airlock doors turn invisible for some reason + ..() + if(stat & NOPOWER) + // If we lost power, disable electrification + // Keeping door lights on, runs on internal battery or something. + electrified_until = 0 + update_icon() diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 4993445b545..aa340a6110d 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -10,7 +10,6 @@ density = 1 layer = 2.7 - var/electrified_until = 0 // World time when the door is no longer electrified. -1 if it is permanently electrified until someone fixes it. var/visible = 1 var/p_open = 0 var/operating = 0 @@ -57,10 +56,6 @@ ..() return -/obj/machinery/door/process() - if(electrified_until > 0 && world.time > electrified_until) - electrified_until = 0 - /obj/machinery/door/Bumped(atom/AM) if(p_open || operating) return if(ismob(AM)) @@ -184,8 +179,6 @@ /obj/machinery/door/emp_act(severity) if(prob(20/severity) && (istype(src,/obj/machinery/door/airlock) || istype(src,/obj/machinery/door/window)) ) open() - if(prob(40/severity)) - electrified_until = max(electrified_until, world.time + SecondsToTicks(30 / severity)) ..() diff --git a/nano/css/shared.css b/nano/css/shared.css index 45f2dedccc8..46136aa2a4b 100644 --- a/nano/css/shared.css +++ b/nano/css/shared.css @@ -232,51 +232,48 @@ div.notice { clear: both; } + .item { width: 100%; margin: 4px 0 0 0; clear: both; } -.itemLabel, .itemLabelWide, .itemLabelFull { +.itemContentNarrow, .itemContent { + float: left; +} + +.itemContentNarrow { + width: 30%; +} + +.itemContent { + width: 69%; +} + +.itemLabelNarrow, .itemLabel, .itemLabelWide, .itemLabelWider, .itemLabelWidest { float: left; color: #e9c183; } +.itemLabelNarrow { + width: 20%; +} + .itemLabel { width: 30%; } .itemLabelWide { - width: 69%; -} - -.itemLabelFull { - width: 100%; -} - -.itemContent, .itemContentThin { - float: left; -} - -.itemContent { - width: 69%; -} - -.itemContentThin { - width: 30%; -} - -.itemLabelNarrow { - float: left; - width: 20%; - color: #e9c183; -} - -.itemLabelWide { - float: left; width: 45%; - color: #e9c183; +} + +.itemLabelWider { + width: 69%; +} + +.itemLabelWidest { + width: 100%; } .itemContentWide { diff --git a/nano/templates/door_control.tmpl b/nano/templates/door_control.tmpl index 30281d6f9c0..80faafa15bb 100644 --- a/nano/templates/door_control.tmpl +++ b/nano/templates/door_control.tmpl @@ -1,5 +1,16 @@ + +
-
+
Main power is {{if data.main_power_loss == 0}} online @@ -9,13 +20,13 @@ offline for {{:data.main_power_loss}} second{{:data.main_power_loss == 1 ? '' : 's'}} {{/if}}.
-
+
{{:helper.link(data.main_power_loss ? 'Disabled' : 'Disable', null, {'command' : 'main_power'}, data.main_power_loss == 0 ? null : 'disabled', data.main_power_loss == 0 ? 'redButton' : null)}}
-
+
Backup power is {{if data.backup_power_loss == 0}} online @@ -25,16 +36,16 @@ offline for {{:data.backup_power_loss}} second{{:data.backup_power_loss == 1 ? '' : 's'}} {{/if}}.
-
+
{{:helper.link(data.backup_power_loss ? 'Disabled' : 'Disable', null, {'command' : 'backup_power'}, data.backup_power_loss == 0 ? null : 'disabled', data.backup_power_loss == 0 ? 'redButton' : null)}}
-
+
Electrified Status:
-
+
{{:helper.link('Offline' , null, {'command' : 'electrify_permanently', 'activate' : "0" }, null, data.electrified == 0 ? 'selected' : null)}} {{:helper.link(data.electrified <= 0 ? 'Temporary (30s)' : 'Temporary (' + data.electrified +'s)', null, {'command' : 'electrify_temporary', 'activate' : "1"}, null, data.electrified > 0 ? 'redButton' : null)}} {{:helper.link('Permanent', null, {'command' : 'electrify_permanently', 'activate' : "1"}, null, data.electrified == -1 ? 'redButton' : null)}} @@ -42,14 +53,13 @@

-{{for data.commands}} -
-
- {{:value.name}}: -
-
- {{:helper.link(value.enabled, null, {'command' : value.command, 'activate' : value.act ? 1 : 0}, null, value.active ? 'selected' : null)}} - {{:helper.link(value.disabled,null, {'command' : value.command, 'activate' : value.act ? 0 : 1}, null,!value.active ? (value.danger ? 'redButton' : 'selected') : null)}} -
-
-{{/for}} + + + {{for data.commands}} + + + + + + {{/for}} +
{{:value.name}}:{{:helper.link(value.enabled, null, {'command' : value.command, 'activate' : value.act ? 1 : 0}, null, value.active ? 'selected' : null)}}{{:helper.link(value.disabled,null, {'command' : value.command, 'activate' : value.act ? 0 : 1}, null,!value.active ? (value.danger ? 'redButton' : 'selected') : null)}}
diff --git a/nano/templates/turret_control.tmpl b/nano/templates/turret_control.tmpl index 645ca241061..ff9733ae30e 100644 --- a/nano/templates/turret_control.tmpl +++ b/nano/templates/turret_control.tmpl @@ -9,7 +9,7 @@
Turret Status:
-
+
{{:helper.link('Enabled', null, {'command' : 'enable', 'value' : 1}, null, data.enabled ?'redButton' : null)}} {{:helper.link('Disabled',null, {'command' : 'enable', 'value' : 0}, null,!data.enabled ? 'selected' : null)}}
@@ -20,7 +20,7 @@
Lethal Mode:
-
+
{{:helper.link('On', null, {'command' : 'lethal', 'value' : 1}, null, data.lethal ?'redButton' : null)}} {{:helper.link('Off',null, {'command' : 'lethal', 'value' : 0}, null,!data.lethal ? 'selected' : null)}}
@@ -32,7 +32,7 @@
{{:value.category}}
-
+
{{:helper.link('On', null, {'command' : value.setting, 'value' : 1}, null, value.value ? 'selected' : null)}} {{:helper.link('Off',null, {'command' : value.setting, 'value' : 0}, null,!value.value ? 'selected' : null)}}