Merge pull request #11769 from Couls/unrestricted-airlocks

One-way Airlocks!
This commit is contained in:
variableundefined
2019-08-14 14:14:41 +08:00
committed by GitHub
7 changed files with 2131 additions and 1605 deletions
File diff suppressed because it is too large Load Diff
+26 -1
View File
@@ -311,6 +311,7 @@ About the new airlock wires panel:
/obj/machinery/door/airlock/update_icon(state=0, override=0)
if(operating && !override)
return
check_unres()
icon_state = density ? "closed" : "open"
switch(state)
if(0)
@@ -333,7 +334,6 @@ About the new airlock wires panel:
var/image/sparks_overlay
var/image/note_overlay
var/notetype = note_type()
switch(state)
if(AIRLOCK_CLOSED)
frame_overlay = get_airlock_overlay("closed", icon)
@@ -621,6 +621,31 @@ About the new airlock wires panel:
if(user)
attack_ai(user)
/obj/machinery/door/airlock/proc/check_unres() //unrestricted sides. This overlay indicates which directions the player can access even without an ID
if(hasPower() && unres_sides)
if(unres_sides & NORTH)
var/image/I = image(icon='icons/obj/doors/airlocks/station/overlays.dmi', icon_state="unres_n") //layer=src.layer+1
I.pixel_y = 32
set_light(l_range = 1, l_power = 1, l_color = "#00FF00")
add_overlay(I)
if(unres_sides & SOUTH)
var/image/I = image(icon='icons/obj/doors/airlocks/station/overlays.dmi', icon_state="unres_s") //layer=src.layer+1
I.pixel_y = -32
set_light(l_range = 1, l_power = 1, l_color = "#00FF00")
add_overlay(I)
if(unres_sides & EAST)
var/image/I = image(icon='icons/obj/doors/airlocks/station/overlays.dmi', icon_state="unres_e") //layer=src.layer+1
I.pixel_x = 32
set_light(l_range = 1, l_power = 1, l_color = "#00FF00")
add_overlay(I)
if(unres_sides & WEST)
var/image/I = image(icon='icons/obj/doors/airlocks/station/overlays.dmi', icon_state="unres_w") //layer=src.layer+1
I.pixel_x = -32
set_light(l_range = 1, l_power = 1, l_color = "#00FF00")
add_overlay(I)
else
set_light(0)
/obj/machinery/door/airlock/CanPass(atom/movable/mover, turf/target, height=0)
if(isElectrified() && density && istype(mover, /obj/item))
var/obj/item/I = mover
@@ -11,6 +11,8 @@
var/list/conf_access = null
var/one_access = 0 //if set to 1, door would receive req_one_access instead of req_access
var/const/max_brain_damage = 60 // Maximum brain damage a mob can have until it can't use the electronics
var/unres_sides = 0
var/unres_direction = null
/obj/item/airlock_electronics/attack_self(mob/user)
if(!ishuman(user) && !isrobot(user))
@@ -23,14 +25,22 @@
return
var/t1 = text("<B>Access control</B><br>\n")
t1 += "<hr>"
t1 += "<B> Unrestricted Access Settings</B><br>"
var/list/Directions = list("North","South",,"East",,,,"West")
for(var/direction in cardinal)
if (unres_direction && unres_direction == direction)
t1 += "<a style='color: red' href='?src=[UID()];unres_direction=[direction]'>[Directions[direction]]</a><br>"
else
t1 += "<a href='?src=[UID()];unres_direction=[direction]'>[Directions[direction]]</a><br>"
t1 += "<hr>"
t1 += "Access requirement is set to "
t1 += one_access ? "<a style='color: green' href='?src=[UID()];one_access=1'>ONE</a><hr>" : "<a style='color: red' href='?src=[UID()];one_access=1'>ALL</a><hr>"
t1 += conf_access == null ? "<font color=red>All</font><br>" : "<a href='?src=[UID()];access=all'>All</a><br>"
t1 += "<br>"
var/list/accesses = get_all_accesses()
for(var/acc in accesses)
var/aname = get_access_desc(acc)
@@ -64,6 +74,14 @@
if(href_list["access"])
toggle_access(href_list["access"])
if(href_list["unres_direction"])
unres_direction = text2num(href_list["unres_direction"])
if (unres_sides == unres_direction)
unres_sides = 0
unres_direction = null
else
unres_sides = unres_direction
attack_self(usr)
+10 -1
View File
@@ -28,7 +28,7 @@
var/real_explosion_block //ignore this, just use explosion_block
var/heat_proof = FALSE // For rglass-windowed airlocks and firedoors
var/emergency = FALSE
var/unres_sides = 0 //Unrestricted sides. A bitflag for which direction (if any) can open the door with no access
//Multi-tile doors
var/width = 1
@@ -55,6 +55,10 @@
..()
update_dir()
/obj/machinery/door/power_change()
..()
update_icon()
/obj/machinery/door/proc/update_dir()
if(width > 1)
if(dir in list(EAST, WEST))
@@ -175,10 +179,15 @@
/obj/machinery/door/allowed(mob/M)
if(emergency)
return TRUE
if(unrestricted_side(M))
return TRUE
if(!requiresID())
return FALSE // Intentional. machinery/door/requiresID() always == 1. airlocks, however, == 0 if ID scan is disabled. Yes, this var is poorly named.
return ..()
/obj/machinery/door/proc/unrestricted_side(mob/M) //Allows for specific side of airlocks to be unrestrected (IE, can exit maint freely, but need access to enter)
return get_dir(src, M) & unres_sides
/obj/machinery/door/proc/try_to_weld(obj/item/weldingtool/W, mob/user)
return
@@ -67,6 +67,23 @@
/obj/effect/mapping_helpers/no_lava
icon_state = "no_lava"
/obj/effect/mapping_helpers/airlock
layer = DOOR_HELPER_LAYER
/obj/effect/mapping_helpers/airlock/unres
name = "airlock unresctricted side helper"
icon_state = "airlock_unres_helper"
/obj/effect/mapping_helpers/airlock/unres/Initialize(mapload)
if(!mapload)
log_world("### MAP WARNING, [src] spawned outside of mapload!")
return
var/obj/machinery/door/airlock/airlock = locate(/obj/machinery/door/airlock) in src.loc
if(airlock)
airlock.unres_sides ^= dir
else
log_world("### MAP WARNING, [src] failed to find an airlock at [AREACOORD(src)]")
..()
/obj/effect/mapping_helpers/no_lava/New()
var/turf/T = get_turf(src)
T.flags |= NO_LAVA_GEN
@@ -226,6 +226,7 @@
door = new airlock_type(loc)
door.setDir(dir)
door.electronics = electronics
door.unres_sides = electronics.unres_sides
door.heat_proof = heat_proof_finished
if(electronics.one_access)
door.req_access = null
Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB