[READY] NTNet airlocks
This commit is contained in:
committed by
CitadelStationBot
parent
7bb63b0a21
commit
f0cf4ad29d
@@ -153,6 +153,7 @@
|
||||
|
||||
/obj/machinery/door/airlock/ComponentInitialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/ntnet_interface)
|
||||
AddComponent(/datum/component/rad_insulation, RAD_MEDIUM_INSULATION)
|
||||
|
||||
/obj/machinery/door/airlock/proc/update_other_id()
|
||||
@@ -188,6 +189,55 @@
|
||||
if ("cyclelinkeddir")
|
||||
cyclelinkairlock()
|
||||
|
||||
/obj/machinery/door/airlock/check_access_ntnet(datum/netdata/data)
|
||||
return !requiresID() || ..()
|
||||
|
||||
/obj/machinery/door/airlock/ntnet_recieve(datum/netdata/data)
|
||||
// Check if the airlock is powered and can accept control packets.
|
||||
if(!hasPower() || !canAIControl())
|
||||
return
|
||||
|
||||
// Check packet access level.
|
||||
if(!check_access_ntnet(data))
|
||||
return
|
||||
|
||||
// Handle recieved packet.
|
||||
var/command = lowertext(data.plaintext_data)
|
||||
var/command_value = lowertext(data.plaintext_data_secondary)
|
||||
switch(command)
|
||||
if("open")
|
||||
if(command_value == "on" && !density)
|
||||
return
|
||||
|
||||
if(command_value == "off" && density)
|
||||
return
|
||||
|
||||
if(density)
|
||||
INVOKE_ASYNC(src, .proc/open)
|
||||
else
|
||||
INVOKE_ASYNC(src, .proc/close)
|
||||
|
||||
if("bolt")
|
||||
if(command_value == "on" && locked)
|
||||
return
|
||||
|
||||
if(command_value == "off" && !locked)
|
||||
return
|
||||
|
||||
if(locked)
|
||||
unbolt()
|
||||
else
|
||||
bolt()
|
||||
|
||||
if("emergency")
|
||||
if(command_value == "on" && emergency)
|
||||
return
|
||||
|
||||
if(command_value == "off" && !emergency)
|
||||
return
|
||||
|
||||
emergency = !emergency
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/door/airlock/lock()
|
||||
bolt()
|
||||
@@ -197,6 +247,7 @@
|
||||
return
|
||||
locked = TRUE
|
||||
playsound(src,boltDown,30,0,3)
|
||||
audible_message("<span class='italics'>You hear a click from the bottom of the door.</span>", null, 1)
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/door/airlock/unlock()
|
||||
@@ -207,6 +258,7 @@
|
||||
return
|
||||
locked = FALSE
|
||||
playsound(src,boltUp,30,0,3)
|
||||
audible_message("<span class='italics'>You hear a click from the bottom of the door.</span>", null, 1)
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/door/airlock/narsie_act()
|
||||
@@ -320,7 +372,7 @@
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/door/airlock/proc/canAIControl(mob/user)
|
||||
return ((aiControlDisabled != 1) && (!isAllPowerCut()));
|
||||
return ((aiControlDisabled != 1) && !isAllPowerCut())
|
||||
|
||||
/obj/machinery/door/airlock/proc/canAIHack()
|
||||
return ((aiControlDisabled==1) && (!hackProof) && (!isAllPowerCut()));
|
||||
|
||||
@@ -45,11 +45,6 @@
|
||||
if(!poddoor)
|
||||
to_chat(user, "<span class='notice'>Its maintenance panel is <b>screwed</b> in place.</span>")
|
||||
|
||||
/obj/machinery/door/check_access(access)
|
||||
if(red_alert_access && GLOB.security_level >= SEC_LEVEL_RED)
|
||||
return TRUE
|
||||
return ..()
|
||||
|
||||
/obj/machinery/door/check_access_list(list/access_list)
|
||||
if(red_alert_access && GLOB.security_level >= SEC_LEVEL_RED)
|
||||
return TRUE
|
||||
|
||||
@@ -64,17 +64,6 @@
|
||||
time_coeff = round(initial(time_coeff) - (initial(time_coeff)*(T))/5,0.01)
|
||||
|
||||
|
||||
/obj/machinery/mecha_part_fabricator/check_access(obj/item/card/id/I)
|
||||
if(istype(I, /obj/item/device/pda))
|
||||
var/obj/item/device/pda/pda = I
|
||||
I = pda.id
|
||||
if(!istype(I) || !I.access) //not ID or no access
|
||||
return FALSE
|
||||
for(var/req in req_access)
|
||||
if(!(req in I.access)) //doesn't have this access
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/mecha_part_fabricator/emag_act()
|
||||
if(obj_flags & EMAGGED)
|
||||
return
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
var/mode = WAND_OPEN
|
||||
var/region_access = 1 //See access.dm
|
||||
var/obj/item/card/id/ID
|
||||
var/list/access_list
|
||||
|
||||
/obj/item/door_remote/New()
|
||||
..()
|
||||
ID = new /obj/item/card/id
|
||||
ID.access = get_region_accesses(region_access)
|
||||
/obj/item/door_remote/Initialize()
|
||||
. = ..()
|
||||
access_list = get_region_accesses(region_access)
|
||||
AddComponent(/datum/component/ntnet_interface)
|
||||
|
||||
/obj/item/door_remote/attack_self(mob/user)
|
||||
switch(mode)
|
||||
@@ -30,35 +30,30 @@
|
||||
mode = WAND_OPEN
|
||||
to_chat(user, "Now in mode: [mode].")
|
||||
|
||||
/obj/item/door_remote/afterattack(obj/machinery/door/airlock/D, mob/user)
|
||||
if(!istype(D))
|
||||
// Airlock remote works by sending NTNet packets to whatever it's pointed at.
|
||||
/obj/item/door_remote/afterattack(atom/A, mob/user)
|
||||
GET_COMPONENT_FROM(target_interface, /datum/component/ntnet_interface, A)
|
||||
|
||||
if(!target_interface)
|
||||
return
|
||||
if(!(D.hasPower()))
|
||||
to_chat(user, "<span class='danger'>[D] has no power!</span>")
|
||||
return
|
||||
if(!D.requiresID())
|
||||
to_chat(user, "<span class='danger'>[D]'s ID scan is disabled!</span>")
|
||||
return
|
||||
if(D.check_access(ID) && D.canAIControl(user))
|
||||
switch(mode)
|
||||
if(WAND_OPEN)
|
||||
if(D.density)
|
||||
D.open()
|
||||
else
|
||||
D.close()
|
||||
if(WAND_BOLT)
|
||||
if(D.locked)
|
||||
D.unbolt()
|
||||
else
|
||||
D.bolt()
|
||||
if(WAND_EMERGENCY)
|
||||
if(D.emergency)
|
||||
D.emergency = FALSE
|
||||
else
|
||||
D.emergency = TRUE
|
||||
D.update_icon()
|
||||
else
|
||||
to_chat(user, "<span class='danger'>[src] does not have access to this door.</span>")
|
||||
|
||||
// Generate a control packet.
|
||||
var/datum/netdata/data = new
|
||||
data.recipient_ids = list(target_interface.hardware_id)
|
||||
|
||||
switch(mode)
|
||||
if(WAND_OPEN)
|
||||
data.plaintext_data = "open"
|
||||
if(WAND_BOLT)
|
||||
data.plaintext_data = "bolt"
|
||||
if(WAND_EMERGENCY)
|
||||
data.plaintext_data = "emergency"
|
||||
|
||||
data.plaintext_data_secondary = "toggle"
|
||||
data.passkey = access_list
|
||||
|
||||
ntnet_send(data)
|
||||
|
||||
|
||||
/obj/item/door_remote/omni
|
||||
name = "omni door remote"
|
||||
|
||||
@@ -22,6 +22,11 @@
|
||||
var/current_skin //Has the item been reskinned?
|
||||
var/list/unique_reskin //List of options to reskin.
|
||||
|
||||
// Access levels, used in modules\jobs\access.dm
|
||||
var/list/req_access
|
||||
var/req_access_txt = "0"
|
||||
var/list/req_one_access
|
||||
var/req_one_access_txt = "0"
|
||||
|
||||
|
||||
/obj/vv_edit_var(vname, vval)
|
||||
|
||||
Reference in New Issue
Block a user