mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 13:10:02 +01:00
Support for expansion-class modPC hardware (#52644)
* Support for expansion-class modPC hardware * end of the line * As requested Did anyone know that the tablet vendor was attaching the wrong ModPC printer? I bet no one knew that. * update
This commit is contained in:
@@ -44,18 +44,20 @@
|
||||
. += "It has a slot installed for an intelliCard."
|
||||
|
||||
var/obj/item/computer_hardware/card_slot/card_slot = get_modular_computer_part(MC_CARD)
|
||||
var/obj/item/computer_hardware/card_slot/card_slot2 = get_modular_computer_part(MC_CARD2)
|
||||
var/multiple_slots = istype(card_slot) && istype(card_slot2)
|
||||
if(card_slot)
|
||||
if(card_slot.stored_card || card_slot.stored_card2)
|
||||
if(card_slot.stored_card || card_slot2.stored_card)
|
||||
var/obj/item/card/id/first_ID = card_slot.stored_card
|
||||
var/obj/item/card/id/second_ID = card_slot.stored_card2
|
||||
var/obj/item/card/id/second_ID = card_slot2.stored_card
|
||||
var/multiple_cards = istype(first_ID) && istype(second_ID)
|
||||
if(user_is_adjacent)
|
||||
. += "It has two slots for identification cards installed[multiple_cards ? " which contain [first_ID] and [second_ID]" : ", one of which contains [first_ID ? first_ID : second_ID]"]."
|
||||
. += "It has [multiple_slots ? "two slots" : "a slot"] for identification cards installed[multiple_cards ? " which contain [first_ID] and [second_ID]" : ", one of which contains [first_ID ? first_ID : second_ID]"]."
|
||||
else
|
||||
. += "It has two slots for identification cards installed, [multiple_cards ? "both of which appear" : "and one of them appears"] to be occupied."
|
||||
. += "It has [multiple_slots ? "two slots" : "a slot"] for identification cards installed, [multiple_cards ? "both of which appear" : "and one of them appears"] to be occupied."
|
||||
. += "<span class='info'>Alt-click [src] to eject the identification card[multiple_cards ? "s":""].</span>"
|
||||
else
|
||||
. += "It has two slots installed for identification cards."
|
||||
. += "It has [multiple_slots ? "two slots" : "a slot"] installed for identification cards."
|
||||
|
||||
var/obj/item/computer_hardware/printer/printer_slot = get_modular_computer_part(MC_PRINT)
|
||||
if(printer_slot)
|
||||
|
||||
@@ -35,11 +35,12 @@
|
||||
var/max_hardware_size = 0 // Maximal hardware w_class. Tablets/PDAs have 1, laptops 2, consoles 4.
|
||||
var/steel_sheet_cost = 5 // Amount of steel sheets refunded when disassembling an empty frame of this computer.
|
||||
|
||||
// Important hardware (must be installed for computer to work)
|
||||
|
||||
// Optional hardware (improves functionality, but is not critical for computer to work)
|
||||
|
||||
var/list/all_components = list() // List of "connection ports" in this computer and the components with which they are plugged
|
||||
/// List of "connection ports" in this computer and the components with which they are plugged
|
||||
var/list/all_components = list()
|
||||
/// Lazy List of extra hardware slots that can be used modularly.
|
||||
var/list/expansion_bays
|
||||
/// Number of total expansion bays this computer has available.
|
||||
var/max_bays = 0
|
||||
|
||||
var/list/idle_threads // Idle programs on background. They still receive process calls but can't be interacted with.
|
||||
var/obj/physical = null // Object that represents our computer. It's used for Adjacent() and UI visibility checks.
|
||||
@@ -76,9 +77,9 @@
|
||||
return
|
||||
|
||||
if(user.canUseTopic(src, BE_CLOSE))
|
||||
var/obj/item/computer_hardware/card_slot/card_slot2 = all_components[MC_CARD2]
|
||||
var/obj/item/computer_hardware/card_slot/card_slot = all_components[MC_CARD]
|
||||
if(card_slot)
|
||||
card_slot.try_eject(null, user)
|
||||
return (card_slot2?.try_eject(user) || card_slot?.try_eject(user)) //Try the secondary one first.
|
||||
|
||||
// Gets IDs/access levels from card slot. Would be useful when/if PDAs would become modular PCs.
|
||||
/obj/item/modular_computer/GetAccess()
|
||||
@@ -94,19 +95,25 @@
|
||||
return ..()
|
||||
|
||||
/obj/item/modular_computer/RemoveID()
|
||||
var/obj/item/computer_hardware/card_slot/card_slot2 = all_components[MC_CARD2]
|
||||
var/obj/item/computer_hardware/card_slot/card_slot = all_components[MC_CARD]
|
||||
if(!card_slot)
|
||||
return
|
||||
return card_slot.RemoveID()
|
||||
return (card_slot2?.try_eject() || card_slot?.try_eject()) //Try the secondary one first.
|
||||
|
||||
/obj/item/modular_computer/InsertID(obj/item/inserting_item)
|
||||
var/obj/item/computer_hardware/card_slot/card_slot = all_components[MC_CARD]
|
||||
if(!card_slot)
|
||||
var/obj/item/computer_hardware/card_slot/card_slot2 = all_components[MC_CARD2]
|
||||
if(!(card_slot || card_slot2))
|
||||
//to_chat(user, "<span class='warning'>There isn't anywhere you can fit a card into on this computer.</span>")
|
||||
return FALSE
|
||||
|
||||
var/obj/item/card/inserting_id = inserting_item.RemoveID()
|
||||
if(!inserting_id)
|
||||
return FALSE
|
||||
return card_slot.try_insert(inserting_id)
|
||||
|
||||
if((card_slot?.try_insert(inserting_id)) || (card_slot2?.try_insert(inserting_id)))
|
||||
return TRUE
|
||||
//to_chat(user, "<span class='warning'>This computer doesn't have an open card slot.</span>")
|
||||
return FALSE
|
||||
|
||||
/obj/item/modular_computer/MouseDrop(obj/over_object, src_location, over_location)
|
||||
var/mob/M = usr
|
||||
|
||||
@@ -6,6 +6,14 @@
|
||||
to_chat(user, "<span class='warning'>This component is too large for \the [src]!</span>")
|
||||
return FALSE
|
||||
|
||||
if(H.expansion_hw)
|
||||
if(LAZYLEN(expansion_bays) >= max_bays)
|
||||
to_chat(user, "<span class='warning'>All of the computer's expansion bays are filled.</span>")
|
||||
return FALSE
|
||||
if(LAZYACCESS(expansion_bays, H.device_type))
|
||||
to_chat(user, "<span class='warning'>The computer immediately ejects /the [H] and flashes an error: \"Hardware Address Conflict\".</span>")
|
||||
return FALSE
|
||||
|
||||
if(all_components[H.device_type])
|
||||
to_chat(user, "<span class='warning'>This computer's hardware slot is already occupied by \the [all_components[H.device_type]].</span>")
|
||||
return FALSE
|
||||
@@ -20,6 +28,8 @@
|
||||
if(user && !user.transferItemToLoc(H, src))
|
||||
return FALSE
|
||||
|
||||
if(H.expansion_hw)
|
||||
LAZYSET(expansion_bays, H.device_type, H)
|
||||
all_components[H.device_type] = H
|
||||
|
||||
to_chat(user, "<span class='notice'>You install \the [H] into \the [src].</span>")
|
||||
@@ -32,7 +42,9 @@
|
||||
/obj/item/modular_computer/proc/uninstall_component(obj/item/computer_hardware/H, mob/living/user = null)
|
||||
if(H.holder != src) // Not our component at all.
|
||||
return FALSE
|
||||
if(H.expansion_hw)
|
||||
|
||||
LAZYREMOVE(expansion_bays, H.device_type)
|
||||
all_components.Remove(H.device_type)
|
||||
|
||||
to_chat(user, "<span class='notice'>You remove \the [H] from \the [src].</span>")
|
||||
|
||||
@@ -67,6 +67,9 @@
|
||||
var/obj/item/computer_hardware/ai_slot/intelliholder = all_components[MC_AI]
|
||||
if(intelliholder?.stored_card)
|
||||
data["removable_media"] += "intelliCard"
|
||||
var/obj/item/computer_hardware/card_slot/secondarycardholder = all_components[MC_CARD2]
|
||||
if(secondarycardholder?.stored_card)
|
||||
data["removable_media"] += "secondary RFID card"
|
||||
|
||||
data["programs"] = list()
|
||||
var/obj/item/computer_hardware/hard_drive/hard_drive = all_components[MC_HDD]
|
||||
@@ -197,13 +200,19 @@
|
||||
var/obj/item/computer_hardware/ai_slot/intelliholder = all_components[MC_AI]
|
||||
if(!intelliholder)
|
||||
return
|
||||
if(intelliholder.try_eject(0,user))
|
||||
if(intelliholder.try_eject(user))
|
||||
playsound(src, 'sound/machines/card_slide.ogg', 50)
|
||||
if("ID")
|
||||
var/obj/item/computer_hardware/card_slot/cardholder = all_components[MC_CARD]
|
||||
if(!cardholder)
|
||||
return
|
||||
cardholder.try_eject(0, user)
|
||||
cardholder.try_eject(user)
|
||||
if("secondary RFID card")
|
||||
var/obj/item/computer_hardware/card_slot/cardholder = all_components[MC_CARD2]
|
||||
if(!cardholder)
|
||||
return
|
||||
cardholder.try_eject(user)
|
||||
|
||||
|
||||
else
|
||||
return
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
hardware_flag = PROGRAM_LAPTOP
|
||||
max_hardware_size = 2
|
||||
w_class = WEIGHT_CLASS_NORMAL
|
||||
max_bays = 4
|
||||
|
||||
// No running around with open laptops in hands.
|
||||
item_flags = SLOWS_WHILE_IN_HAND
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
icon_state_unpowered = null
|
||||
icon_state_menu = null
|
||||
hardware_flag = 0
|
||||
max_bays = 4
|
||||
|
||||
var/obj/machinery/modular_computer/machinery_computer = null
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
hardware_flag = PROGRAM_TABLET
|
||||
max_hardware_size = 1
|
||||
w_class = WEIGHT_CLASS_SMALL
|
||||
max_bays = 3
|
||||
steel_sheet_cost = 1
|
||||
slot_flags = ITEM_SLOT_ID | ITEM_SLOT_BELT
|
||||
has_light = TRUE //LED flashlight!
|
||||
|
||||
@@ -26,11 +26,21 @@
|
||||
install_component(new /obj/item/computer_hardware/processor_unit/small)
|
||||
install_component(new /obj/item/computer_hardware/battery(src, /obj/item/stock_parts/cell/computer))
|
||||
install_component(hard_drive)
|
||||
install_component(new /obj/item/computer_hardware/card_slot)
|
||||
install_component(new /obj/item/computer_hardware/network_card)
|
||||
install_component(new /obj/item/computer_hardware/printer/mini)
|
||||
hard_drive.store_file(new /datum/computer_file/program/bounty)
|
||||
hard_drive.store_file(new /datum/computer_file/program/shipping)
|
||||
|
||||
/obj/item/modular_computer/tablet/preset/advanced/atmos/Initialize() //This will be defunct and will be replaced when NtOS PDAs are done
|
||||
. = ..()
|
||||
install_component(new /obj/item/computer_hardware/sensorpackage)
|
||||
|
||||
/obj/item/modular_computer/tablet/preset/advanced/command/Initialize()
|
||||
. = ..()
|
||||
install_component(new /obj/item/computer_hardware/sensorpackage)
|
||||
install_component(new /obj/item/computer_hardware/card_slot/secondary)
|
||||
|
||||
/// Given by the syndicate as part of the contract uplink bundle - loads in the Contractor Uplink.
|
||||
/obj/item/modular_computer/tablet/syndicate_contract_uplink/preset/uplink/Initialize()
|
||||
. = ..()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/obj/machinery/modular_computer/console/preset
|
||||
// Can be changed to give devices specific hardware
|
||||
var/_has_id_slot = FALSE
|
||||
var/_has_second_id_slot = FALSE
|
||||
var/_has_printer = FALSE
|
||||
var/_has_battery = FALSE
|
||||
var/_has_ai = FALSE
|
||||
@@ -11,8 +11,9 @@
|
||||
return
|
||||
cpu.install_component(new /obj/item/computer_hardware/processor_unit)
|
||||
|
||||
if(_has_id_slot)
|
||||
cpu.install_component(new /obj/item/computer_hardware/card_slot)
|
||||
cpu.install_component(new /obj/item/computer_hardware/card_slot)
|
||||
if(_has_second_id_slot)
|
||||
cpu.install_component(new /obj/item/computer_hardware/card_slot/secondary)
|
||||
if(_has_printer)
|
||||
cpu.install_component(new /obj/item/computer_hardware/printer)
|
||||
if(_has_battery)
|
||||
@@ -59,7 +60,7 @@
|
||||
console_department = "Command"
|
||||
name = "command console"
|
||||
desc = "A stationary computer. This one comes preloaded with command programs."
|
||||
_has_id_slot = TRUE
|
||||
_has_second_id_slot = TRUE
|
||||
_has_printer = TRUE
|
||||
|
||||
/obj/machinery/modular_computer/console/preset/command/install_programs()
|
||||
@@ -73,7 +74,7 @@
|
||||
console_department = "Identification"
|
||||
name = "identification console"
|
||||
desc = "A stationary computer. This one comes preloaded with identification modification programs."
|
||||
_has_id_slot = TRUE
|
||||
_has_second_id_slot = TRUE
|
||||
_has_printer = TRUE
|
||||
|
||||
/obj/machinery/modular_computer/console/preset/id/install_programs()
|
||||
|
||||
Reference in New Issue
Block a user