@@ -0,0 +1,122 @@
|
||||
/obj/item/computer_hardware/card_slot
|
||||
name = "identification card authentication module" // \improper breaks the find_hardware_by_name proc
|
||||
desc = "A module allowing this computer to read or write data on ID cards. Necessary for some programs to run properly."
|
||||
power_usage = 10 //W
|
||||
icon_state = "card_mini"
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
device_type = MC_CARD
|
||||
|
||||
var/obj/item/card/id/stored_card = null
|
||||
var/obj/item/card/id/stored_card2 = null
|
||||
|
||||
/obj/item/computer_hardware/card_slot/Destroy()
|
||||
try_eject()
|
||||
return ..()
|
||||
|
||||
/obj/item/computer_hardware/card_slot/GetAccess()
|
||||
if(stored_card && stored_card2) // Best of both worlds
|
||||
return (stored_card.GetAccess() | stored_card2.GetAccess())
|
||||
else if(stored_card)
|
||||
return stored_card.GetAccess()
|
||||
else if(stored_card2)
|
||||
return stored_card2.GetAccess()
|
||||
return ..()
|
||||
|
||||
/obj/item/computer_hardware/card_slot/GetID()
|
||||
if(stored_card)
|
||||
return stored_card
|
||||
else if(stored_card2)
|
||||
return stored_card2
|
||||
return ..()
|
||||
|
||||
/obj/item/computer_hardware/card_slot/RemoveID()
|
||||
if(stored_card)
|
||||
. = stored_card
|
||||
if(!try_eject(1))
|
||||
return null
|
||||
return
|
||||
if(stored_card2)
|
||||
. = stored_card2
|
||||
if(!try_eject(2))
|
||||
return null
|
||||
|
||||
/obj/item/computer_hardware/card_slot/on_install(obj/item/modular_computer/M, mob/living/user = null)
|
||||
M.add_verb(device_type)
|
||||
|
||||
/obj/item/computer_hardware/card_slot/on_remove(obj/item/modular_computer/M, mob/living/user = null)
|
||||
M.remove_verb(device_type)
|
||||
|
||||
/obj/item/computer_hardware/card_slot/try_insert(obj/item/I, mob/living/user = null)
|
||||
if(!holder)
|
||||
return FALSE
|
||||
|
||||
if(!istype(I, /obj/item/card/id))
|
||||
return FALSE
|
||||
|
||||
if(stored_card && stored_card2)
|
||||
to_chat(user, "<span class='warning'>You try to insert \the [I] into \the [src], but its slots are occupied.</span>")
|
||||
return FALSE
|
||||
if(user)
|
||||
if(!user.transferItemToLoc(I, src))
|
||||
return FALSE
|
||||
else
|
||||
I.forceMove(src)
|
||||
|
||||
if(!stored_card)
|
||||
stored_card = I
|
||||
else
|
||||
stored_card2 = I
|
||||
to_chat(user, "<span class='notice'>You insert \the [I] into \the [src].</span>")
|
||||
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
|
||||
|
||||
return TRUE
|
||||
|
||||
|
||||
/obj/item/computer_hardware/card_slot/try_eject(slot=0, mob/living/user = null, forced = 0)
|
||||
if(!stored_card && !stored_card2)
|
||||
to_chat(user, "<span class='warning'>There are no cards in \the [src].</span>")
|
||||
return FALSE
|
||||
|
||||
var/ejected = 0
|
||||
if(stored_card && (!slot || slot == 1))
|
||||
if(user)
|
||||
user.put_in_hands(stored_card)
|
||||
else
|
||||
stored_card.forceMove(get_turf(src))
|
||||
stored_card = null
|
||||
ejected++
|
||||
|
||||
if(stored_card2 && (!slot || slot == 2))
|
||||
if(user)
|
||||
user.put_in_hands(stored_card2)
|
||||
else
|
||||
stored_card2.forceMove(get_turf(src))
|
||||
stored_card2 = null
|
||||
ejected++
|
||||
|
||||
if(ejected)
|
||||
if(holder)
|
||||
if(holder.active_program)
|
||||
holder.active_program.event_idremoved(0, slot)
|
||||
|
||||
for(var/I in holder.idle_threads)
|
||||
var/datum/computer_file/program/P = I
|
||||
P.event_idremoved(1, slot)
|
||||
|
||||
to_chat(user, "<span class='notice'>You remove the card[ejected>1 ? "s" : ""] from \the [src].</span>")
|
||||
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/item/computer_hardware/card_slot/attackby(obj/item/I, mob/living/user)
|
||||
if(..())
|
||||
return
|
||||
if(istype(I, /obj/item/screwdriver))
|
||||
to_chat(user, "<span class='notice'>You press down on the manual eject button with \the [I].</span>")
|
||||
try_eject(0,user)
|
||||
return
|
||||
|
||||
/obj/item/computer_hardware/card_slot/examine(mob/user)
|
||||
..()
|
||||
if(stored_card || stored_card2)
|
||||
to_chat(user, "There appears to be something loaded in the card slots.")
|
||||
@@ -0,0 +1,79 @@
|
||||
/obj/item/computer_hardware/network_card
|
||||
name = "network card"
|
||||
desc = "A basic wireless network card for usage with standard NTNet frequencies."
|
||||
power_usage = 50
|
||||
icon_state = "radio_mini"
|
||||
var/identification_id = null // Identification ID. Technically MAC address of this device. Can't be changed by user.
|
||||
var/identification_string = "" // Identification string, technically nickname seen in the network. Can be set by user.
|
||||
var/long_range = 0
|
||||
var/ethernet = 0 // Hard-wired, therefore always on, ignores NTNet wireless checks.
|
||||
malfunction_probability = 1
|
||||
device_type = MC_NET
|
||||
var/static/ntnet_card_uid = 1
|
||||
|
||||
/obj/item/computer_hardware/network_card/diagnostics(var/mob/user)
|
||||
..()
|
||||
to_chat(user, "NIX Unique ID: [identification_id]")
|
||||
to_chat(user, "NIX User Tag: [identification_string]")
|
||||
to_chat(user, "Supported protocols:")
|
||||
to_chat(user, "511.m SFS (Subspace) - Standard Frequency Spread")
|
||||
if(long_range)
|
||||
to_chat(user, "511.n WFS/HB (Subspace) - Wide Frequency Spread/High Bandiwdth")
|
||||
if(ethernet)
|
||||
to_chat(user, "OpenEth (Physical Connection) - Physical network connection port")
|
||||
|
||||
/obj/item/computer_hardware/network_card/New(var/l)
|
||||
..()
|
||||
identification_id = ntnet_card_uid++
|
||||
|
||||
// Returns a string identifier of this network card
|
||||
/obj/item/computer_hardware/network_card/proc/get_network_tag()
|
||||
return "[identification_string] (NID [identification_id])"
|
||||
|
||||
// 0 - No signal, 1 - Low signal, 2 - High signal. 3 - Wired Connection
|
||||
/obj/item/computer_hardware/network_card/proc/get_signal(var/specific_action = 0)
|
||||
if(!holder) // Hardware is not installed in anything. No signal. How did this even get called?
|
||||
return 0
|
||||
|
||||
if(!check_functionality())
|
||||
return 0
|
||||
|
||||
if(ethernet) // Computer is connected via wired connection.
|
||||
return 3
|
||||
|
||||
if(!SSnetworks.station_network || !SSnetworks.station_network.check_function(specific_action)) // NTNet is down and we are not connected via wired connection. No signal.
|
||||
return 0
|
||||
|
||||
if(holder)
|
||||
|
||||
var/turf/T = get_turf(holder)
|
||||
if((T && istype(T)) && (is_station_level(T.z) || is_mining_level(T.z)))
|
||||
// Computer is on station. Low/High signal depending on what type of network card you have
|
||||
if(long_range)
|
||||
return 2
|
||||
else
|
||||
return 1
|
||||
|
||||
if(long_range) // Computer is not on station, but it has upgraded network card. Low signal.
|
||||
return 1
|
||||
|
||||
return 0 // Computer is not on station and does not have upgraded network card. No signal.
|
||||
|
||||
|
||||
/obj/item/computer_hardware/network_card/advanced
|
||||
name = "advanced network card"
|
||||
desc = "An advanced network card for usage with standard NTNet frequencies. Its transmitter is strong enough to connect even off-station."
|
||||
long_range = 1
|
||||
power_usage = 100 // Better range but higher power usage.
|
||||
icon_state = "radio"
|
||||
lefthand_file = 'icons/mob/inhands/misc/devices_lefthand.dmi'
|
||||
righthand_file = 'icons/mob/inhands/misc/devices_righthand.dmi'
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
|
||||
/obj/item/computer_hardware/network_card/wired
|
||||
name = "wired network card"
|
||||
desc = "An advanced network card for usage with standard NTNet frequencies. This one also supports wired connection."
|
||||
ethernet = 1
|
||||
power_usage = 100 // Better range but higher power usage.
|
||||
icon_state = "net_wired"
|
||||
w_class = WEIGHT_CLASS_NORMAL
|
||||
Reference in New Issue
Block a user