[MIRROR] Removes network cards and printers from tablets [MDB IGNORE] (#16451)

* Removes network cards and printers from tablets

* merge tablet_presets

* printer.dm should have been deleted, missed change

* update contractor tablet

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
Co-authored-by: tastyfish <crazychris32@gmail.com>
This commit is contained in:
SkyratBot
2022-09-27 23:16:32 -04:00
committed by GitHub
co-authored by John Willard tastyfish
parent a827c3d01b
commit 0339798a42
40 changed files with 300 additions and 708 deletions
@@ -22,7 +22,9 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
var/screen_on = 1 // Whether the computer is active/opened/it's screen is on.
var/device_theme = "ntos" // Sets the theme for the main menu, hardware config, and file browser apps. Overridden by certain non-NT devices.
var/datum/computer_file/program/active_program = null // A currently active program running on the computer.
var/hardware_flag = 0 // A flag that describes this device type
///The type of device this computer is, as a flag
var/hardware_flag = NONE
// Options: PROGRAM_ALL PROGRAM_CONSOLE | | PROGRAM_LAPTOP | PROGRAM_TABLET
var/last_power_usage = 0
var/last_battery_percent = 0 // Used for deciding if battery percentage has chandged
var/last_world_time = "00:00"
@@ -80,6 +82,11 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
/// Stored pAI in the computer
var/obj/item/pai_card/inserted_pai = null
///The amount of paper currently stored in the PDA
var/stored_paper = 10
///The max amount of paper that can be held at once.
var/max_paper = 30
/obj/item/modular_computer/Initialize(mapload)
. = ..()
@@ -97,6 +104,7 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
update_appearance()
register_context()
init_network_id(NETWORK_TABLETS)
Add_Messenger()
/obj/item/modular_computer/Destroy()
@@ -229,6 +237,18 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
return ..()
/obj/item/modular_computer/proc/print_text(text_to_print, paper_title = "")
if(!stored_paper)
return FALSE
var/obj/item/paper/printed_paper = new /obj/item/paper(drop_location())
printed_paper.add_raw_text(text_to_print)
if(paper_title)
printed_paper.name = paper_title
printed_paper.update_appearance()
stored_paper--
return TRUE
/obj/item/modular_computer/InsertID(obj/item/inserting_item)
var/obj/item/computer_hardware/card_slot/card_slot = all_components[MC_CARD]
var/obj/item/computer_hardware/card_slot/card_slot2 = all_components[MC_CARD2]
@@ -295,11 +315,6 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
else if(atom_integrity < max_integrity)
. += span_warning("It is damaged.")
var/obj/item/computer_hardware/hard_drive/hdd = all_components[MC_HDD]
for(var/datum/computer_file/app_examine as anything in hdd.stored_files)
if(app_examine.on_examine(src, user))
. += app_examine.on_examine(src, user)
var/obj/item/computer_hardware/card_slot/card_slot = all_components[MC_CARD]
var/obj/item/computer_hardware/card_slot/card_slot2 = all_components[MC_CARD2]
var/multiple_slots = istype(card_slot) && istype(card_slot2)
@@ -316,12 +331,16 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
else
. += "It has [multiple_slots ? "two slots" : "a slot"] installed for identification cards."
var/obj/item/computer_hardware/printer/printer_slot = all_components[MC_PRINT]
if(printer_slot)
. += "It has a printer installed."
if(Adjacent(user))
. += "The printer's paper levels are at: [printer_slot.stored_paper]/[printer_slot.max_paper].</span>"
/obj/item/modular_computer/examine_more(mob/user)
. = ..()
var/obj/item/computer_hardware/hard_drive/hdd = all_components[MC_HDD]
if(hdd)
for(var/datum/computer_file/app_examine as anything in hdd.stored_files)
if(app_examine.on_examine(src, user))
. += app_examine.on_examine(src, user)
if(Adjacent(user))
. += span_notice("Paper level: [stored_paper] / [max_paper].")
/obj/item/modular_computer/add_context(atom/source, list/context, obj/item/held_item, mob/user)
. = ..()
@@ -492,13 +511,13 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
data["PC_showbatteryicon"] = battery_module ? 1 : 0
switch(get_ntnet_status())
if(0)
if(NTNET_NO_SIGNAL)
data["PC_ntneticon"] = "sig_none.gif"
if(1)
if(NTNET_LOW_SIGNAL)
data["PC_ntneticon"] = "sig_low.gif"
if(2)
if(NTNET_GOOD_SIGNAL)
data["PC_ntneticon"] = "sig_high.gif"
if(3)
if(NTNET_ETHERNET_SIGNAL)
data["PC_ntneticon"] = "sig_lan.gif"
if(length(idle_threads))
@@ -574,18 +593,31 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
// Returns 0 for No Signal, 1 for Low Signal and 2 for Good Signal. 3 is for wired connection (always-on)
/obj/item/modular_computer/proc/get_ntnet_status(specific_action = 0)
var/obj/item/computer_hardware/network_card/network_card = all_components[MC_NET]
if(network_card)
return network_card.get_signal(specific_action)
else
return 0
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 NTNET_NO_SIGNAL
// computers are connected through ethernet
if(hardware_flag & PROGRAM_CONSOLE)
return NTNET_ETHERNET_SIGNAL
var/turf/current_turf = get_turf(src)
if(!current_turf || !istype(current_turf))
return NTNET_NO_SIGNAL
if(is_station_level(current_turf.z))
if(hardware_flag & PROGRAM_LAPTOP) //laptops can connect to ethernet but they have to be on station for that
return NTNET_ETHERNET_SIGNAL
return NTNET_GOOD_SIGNAL
else if(is_mining_level(current_turf.z))
return NTNET_LOW_SIGNAL
return NTNET_NO_SIGNAL
/obj/item/modular_computer/proc/add_log(text)
if(!get_ntnet_status())
return FALSE
var/obj/item/computer_hardware/network_card/network_card = all_components[MC_NET]
return SSnetworks.add_log(text, network_card.network_id, network_card.hardware_id)
return SSnetworks.add_log(text, network_id)
/obj/item/modular_computer/proc/shutdown_computer(loud = 1)
kill_program(forced = TRUE)
@@ -638,7 +670,77 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
/obj/item/modular_computer/proc/UpdateDisplay()
name = "[saved_identification] ([saved_job])"
/obj/item/modular_computer/attackby(obj/item/attacking_item, mob/user, params)
// Check for ID first
if(isidcard(attacking_item) && InsertID(attacking_item))
return
// Check for cash next
var/obj/item/computer_hardware/card_slot/card_slot = all_components[MC_CARD]
if(card_slot && iscash(attacking_item))
var/obj/item/card/id/inserted_id = card_slot.GetID()
if(inserted_id)
inserted_id.attackby(attacking_item, user) // If we do, try and put that attacking object in
return
// Inserting a pAI
if(istype(attacking_item, /obj/item/pai_card) && !inserted_pai)
if(!user.transferItemToLoc(attacking_item, src))
return
inserted_pai = attacking_item
to_chat(user, span_notice("You slot \the [attacking_item] into [src]."))
return
// Check if any Applications need it
var/obj/item/computer_hardware/hard_drive/hdd = all_components[MC_HDD]
if(hdd)
for(var/datum/computer_file/item_holding_app as anything in hdd.stored_files)
if(item_holding_app.try_insert(attacking_item, user))
return
if(istype(attacking_item, /obj/item/paper))
if(stored_paper >= max_paper)
to_chat(user, span_warning("You try to add \the [attacking_item] into [src], but it can't hold any more!"))
return
if(!user.temporarilyRemoveItemFromInventory(attacking_item))
return FALSE
to_chat(user, span_notice("You insert \the [attacking_item] into [src]'s paper recycler."))
qdel(attacking_item)
stored_paper++
return
if(istype(attacking_item, /obj/item/paper_bin))
var/obj/item/paper_bin/bin = attacking_item
if(bin.total_paper <= 0)
to_chat(user, span_notice("\The [bin] is empty!"))
return
var/papers_added //just to keep track
while((bin.total_paper > 0) && (stored_paper < max_paper))
papers_added++
stored_paper++
bin.remove_paper()
if(!papers_added)
return
to_chat(user, span_notice("Added in [papers_added] new sheets. You now have [stored_paper] / [max_paper] printing paper stored."))
bin.update_appearance()
return
// Insert items into the components
for(var/h in all_components)
var/obj/item/computer_hardware/H = all_components[h]
if(H.try_insert(attacking_item, user))
return
// Insert new hardware
if(istype(attacking_item, /obj/item/computer_hardware) && upgradable)
if(install_component(attacking_item, user))
playsound(src, 'sound/machines/card_slide.ogg', 50)
return
return ..()
/obj/item/modular_computer/screwdriver_act(mob/user, obj/item/tool)
. = ..()
if(!deconstructable)
return
if(!length(all_components))
@@ -650,97 +752,49 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
component_names.Add(H.name)
var/choice = tgui_input_list(user, "Component to uninstall", "Computer maintenance", sort_list(component_names))
if(isnull(choice))
return
if(!Adjacent(user))
return
var/obj/item/computer_hardware/H = find_hardware_by_name(choice)
if(!H)
return
return TOOL_ACT_TOOLTYPE_SUCCESS
tool.play_tool_sound(src, user, 20, volume=20)
uninstall_component(H, user)
return
return TOOL_ACT_TOOLTYPE_SUCCESS
/obj/item/modular_computer/wrench_act(mob/living/user, obj/item/tool)
. = ..()
if(length(all_components))
balloon_alert(user, "remove the other components!")
return TOOL_ACT_TOOLTYPE_SUCCESS
tool.play_tool_sound(src, user, 20, volume=20)
new /obj/item/stack/sheet/iron(get_turf(loc), steel_sheet_cost)
user.balloon_alert(user, "disassembled")
relay_qdel()
qdel(src)
return TOOL_ACT_TOOLTYPE_SUCCESS
/obj/item/modular_computer/attackby(obj/item/attacking_item, mob/user, params)
// Check for ID first
if(isidcard(attacking_item) && InsertID(attacking_item))
return
/obj/item/modular_computer/welder_act(mob/living/user, obj/item/tool)
. = ..()
if(atom_integrity == max_integrity)
to_chat(user, span_warning("\The [src] does not require repairs."))
return TOOL_ACT_TOOLTYPE_SUCCESS
// Insert a PAI.
if(istype(attacking_item, /obj/item/pai_card) && !inserted_pai)
if(!user.transferItemToLoc(attacking_item, src))
return
inserted_pai = attacking_item
to_chat(user, span_notice("You slot \the [attacking_item] into [src]."))
return
if(!tool.tool_start_check(user, amount=1))
return TOOL_ACT_TOOLTYPE_SUCCESS
var/obj/item/computer_hardware/hard_drive/hdd = all_components[MC_HDD]
to_chat(user, span_notice("You begin repairing damage to \the [src]..."))
if(!tool.use_tool(src, user, 20, volume=50, amount=1))
return TOOL_ACT_TOOLTYPE_SUCCESS
atom_integrity = max_integrity
to_chat(user, span_notice("You repair \the [src]."))
update_appearance()
return TOOL_ACT_TOOLTYPE_SUCCESS
// Scan a photo.
if(istype(attacking_item, /obj/item/photo))
var/obj/item/photo/pic = attacking_item
if(hdd)
for(var/datum/computer_file/program/messenger/messenger in hdd.stored_files)
saved_image = pic.picture
messenger.ProcessPhoto()
return
// Insert items into the components
for(var/h in all_components)
var/obj/item/computer_hardware/H = all_components[h]
if(H.try_insert(attacking_item, user))
return
// Insert items into applications
for(var/datum/computer_file/item_holding_app as anything in hdd.stored_files)
if(item_holding_app.try_insert(attacking_item, user))
return
// Insert new hardware
if(istype(attacking_item, /obj/item/computer_hardware) && upgradable)
if(install_component(attacking_item, user))
playsound(src, 'sound/machines/card_slide.ogg', 50)
return
if(attacking_item.tool_behaviour == TOOL_WRENCH)
if(length(all_components))
balloon_alert(user, "remove the other components!")
return
attacking_item.play_tool_sound(src, user, 20, volume=20)
new /obj/item/stack/sheet/iron( get_turf(src.loc), steel_sheet_cost )
user.balloon_alert(user,"disassembled")
relay_qdel()
qdel(src)
return
if(attacking_item.tool_behaviour == TOOL_WELDER)
if(atom_integrity == max_integrity)
to_chat(user, span_warning("\The [src] does not require repairs."))
return
if(!attacking_item.tool_start_check(user, amount=1))
return
to_chat(user, span_notice("You begin repairing damage to \the [src]..."))
if(attacking_item.use_tool(src, user, 20, volume=50, amount=1))
atom_integrity = max_integrity
to_chat(user, span_notice("You repair \the [src]."))
update_appearance()
return
var/obj/item/computer_hardware/card_slot/card_slot = all_components[MC_CARD]
// Check to see if we have an ID inside, and a valid input for money
if(card_slot?.GetID() && iscash(attacking_item))
var/obj/item/card/id/id = card_slot.GetID()
id.attackby(attacking_item, user) // If we do, try and put that attacking object in
return
..()
// Used by processor to relay qdel() to machinery type.
/obj/item/modular_computer/proc/relay_qdel()
@@ -2,20 +2,15 @@
. = ..()
install_component(new /obj/item/computer_hardware/battery(src, /obj/item/stock_parts/cell/computer))
install_component(new /obj/item/computer_hardware/hard_drive)
install_component(new /obj/item/computer_hardware/network_card)
install_programs()
/obj/item/modular_computer/laptop/preset/proc/install_programs()
return
/obj/item/modular_computer/laptop/preset/civilian
desc = "A low-end laptop often used for personal recreation."
/obj/item/modular_computer/laptop/preset/civilian/install_programs()
var/obj/item/computer_hardware/hard_drive/hard_drive = all_components[MC_HDD]
hard_drive.store_file(new/datum/computer_file/program/chatclient())
@@ -17,7 +17,7 @@
machinery_computer.cpu = null
machinery_computer.UnregisterSignal(src, COMSIG_ATOM_UPDATED_ICON)
machinery_computer = null
. = ..()
return ..()
/obj/item/modular_computer/processor/New(comp)
..()
@@ -102,16 +102,12 @@
/datum/computer_file/program/phys_scanner/chemistry,
/datum/computer_file/program/signal_commander,
)
/obj/item/modular_computer/tablet/pda/heads/quartermaster/Initialize(mapload)
. = ..()
install_component(new /obj/item/computer_hardware/printer/mini)
/obj/item/modular_computer/tablet/pda/heads/quartermaster
name = "quartermaster PDA"
greyscale_config = /datum/greyscale_config/tablet/stripe_thick
greyscale_colors = "#D6B328#6506CA#927444"
inserted_item = /obj/item/pen/survival
stored_paper = 20
default_applications = list(
/datum/computer_file/program/crew_manifest,
/datum/computer_file/program/status,
@@ -122,10 +118,6 @@
/datum/computer_file/program/robocontrol,
)
/obj/item/modular_computer/tablet/pda/heads/quartermaster/Initialize(mapload)
. = ..()
install_component(new /obj/item/computer_hardware/printer/mini)
/**
* Security
*/
@@ -257,6 +249,7 @@
/obj/item/modular_computer/tablet/pda/cargo
name = "cargo technician PDA"
greyscale_colors = "#D6B328#6506CA"
stored_paper = 20
default_applications = list(
/datum/computer_file/program/shipping,
/datum/computer_file/program/budgetorders,
@@ -174,8 +174,8 @@
has_light = FALSE //tablet light button actually enables/disables the borg lamp
comp_light_luminosity = 0
has_variants = FALSE
///Ref to the silicon we're installed in. Set by the borg during our creation.
var/mob/living/silicon/borgo
///Ref to the silicon we're installed in. Set by the silicon itself during its creation.
var/mob/living/silicon/silicon_owner
///Ref to the RoboTact app. Important enough to borgs to deserve a ref.
var/datum/computer_file/program/robotact/robotact
///IC log that borgs can view in their personal management app
@@ -184,21 +184,38 @@
/obj/item/modular_computer/tablet/integrated/Initialize(mapload)
. = ..()
vis_flags |= VIS_INHERIT_ID
borgo = loc
if(!istype(borgo))
borgo = null
silicon_owner = loc
if(!istype(silicon_owner))
silicon_owner = null
stack_trace("[type] initialized outside of a borg, deleting.")
return INITIALIZE_HINT_QDEL
/obj/item/modular_computer/tablet/integrated/Destroy()
borgo = null
silicon_owner = null
return ..()
/obj/item/modular_computer/tablet/integrated/turn_on(mob/user, open_ui = FALSE)
if(borgo?.stat != DEAD)
if(silicon_owner?.stat != DEAD)
return ..()
return FALSE
/obj/item/modular_computer/tablet/integrated/get_ntnet_status(specific_action = 0)
//No borg found
if(!silicon_owner)
return FALSE
// no AIs/pAIs
var/mob/living/silicon/robot/cyborg_check = silicon_owner
if(!istype(cyborg_check))
return ..()
//lockdown restricts borg networking
if(cyborg_check.lockcharge)
return FALSE
//borg cell dying restricts borg networking
if(!cyborg_check.cell || cyborg_check.cell.charge == 0)
return FALSE
return ..()
/**
* Returns a ref to the RoboTact app, creating the app if need be.
*
@@ -210,44 +227,44 @@
* RoboTact is supposed to be undeletable, so these will create runtime messages.
*/
/obj/item/modular_computer/tablet/integrated/proc/get_robotact()
if(!borgo)
if(!silicon_owner)
return null
if(!robotact)
var/obj/item/computer_hardware/hard_drive/hard_drive = all_components[MC_HDD]
robotact = hard_drive.find_file_by_name("robotact")
if(!robotact)
stack_trace("Cyborg [borgo] ( [borgo.type] ) was somehow missing their self-manage app in their tablet. A new copy has been created.")
stack_trace("Cyborg [silicon_owner] ( [silicon_owner.type] ) was somehow missing their self-manage app in their tablet. A new copy has been created.")
robotact = new(hard_drive)
if(!hard_drive.store_file(robotact))
qdel(robotact)
robotact = null
CRASH("Cyborg [borgo]'s tablet hard drive rejected recieving a new copy of the self-manage app. To fix, check the hard drive's space remaining. Please make a bug report about this.")
CRASH("Cyborg [silicon_owner]'s tablet hard drive rejected recieving a new copy of the self-manage app. To fix, check the hard drive's space remaining. Please make a bug report about this.")
return robotact
//Makes the light settings reflect the borg's headlamp settings
/obj/item/modular_computer/tablet/integrated/ui_data(mob/user)
. = ..()
.["has_light"] = TRUE
if(iscyborg(borgo))
var/mob/living/silicon/robot/robo = borgo
if(iscyborg(silicon_owner))
var/mob/living/silicon/robot/robo = silicon_owner
.["light_on"] = robo.lamp_enabled
.["comp_light_color"] = robo.lamp_color
//Makes the flashlight button affect the borg rather than the tablet
/obj/item/modular_computer/tablet/integrated/toggle_flashlight()
if(!borgo || QDELETED(borgo))
if(!silicon_owner || QDELETED(silicon_owner))
return FALSE
if(iscyborg(borgo))
var/mob/living/silicon/robot/robo = borgo
if(iscyborg(silicon_owner))
var/mob/living/silicon/robot/robo = silicon_owner
robo.toggle_headlamp()
return TRUE
//Makes the flashlight color setting affect the borg rather than the tablet
/obj/item/modular_computer/tablet/integrated/set_flashlight_color(color)
if(!borgo || QDELETED(borgo) || !color)
if(!silicon_owner || QDELETED(silicon_owner) || !color)
return FALSE
if(iscyborg(borgo))
var/mob/living/silicon/robot/robo = borgo
if(iscyborg(silicon_owner))
var/mob/living/silicon/robot/robo = silicon_owner
robo.lamp_color = color
robo.toggle_headlamp(FALSE, TRUE)
return TRUE
@@ -264,8 +281,8 @@
/obj/item/modular_computer/tablet/integrated/syndicate/Initialize(mapload)
. = ..()
if(iscyborg(borgo))
var/mob/living/silicon/robot/robo = borgo
if(iscyborg(silicon_owner))
var/mob/living/silicon/robot/robo = silicon_owner
robo.lamp_color = COLOR_RED //Syndicate likes it red
// Round start tablets
@@ -305,7 +322,6 @@
. = ..()
install_component(new /obj/item/computer_hardware/hard_drive/small)
install_component(new /obj/item/computer_hardware/battery(src, /obj/item/stock_parts/cell/computer))
install_component(new /obj/item/computer_hardware/network_card)
install_component(new /obj/item/computer_hardware/card_slot)
if(!isnull(default_applications))
@@ -3,9 +3,3 @@
. = ..()
install_component(new /obj/item/computer_hardware/battery(src, /obj/item/stock_parts/cell/computer))
install_component(new /obj/item/computer_hardware/hard_drive/small/nukeops)
install_component(new /obj/item/computer_hardware/network_card)
//Borg Built-in tablet
/obj/item/modular_computer/tablet/integrated/Initialize(mapload)
. = ..()
install_component(new /obj/item/computer_hardware/network_card/integrated)
@@ -1,7 +1,6 @@
/obj/machinery/modular_computer/console/preset
// Can be changed to give devices specific hardware
var/_has_second_id_slot = FALSE
var/_has_printer = FALSE
var/_has_battery = FALSE
/obj/machinery/modular_computer/console/preset/Initialize(mapload)
@@ -12,8 +11,6 @@
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)
cpu.install_component(new /obj/item/computer_hardware/battery(cpu, /obj/item/stock_parts/cell/computer/super))
install_programs()
@@ -55,7 +52,6 @@
name = "command console"
desc = "A stationary computer. This one comes preloaded with command programs."
_has_second_id_slot = TRUE
_has_printer = TRUE
/obj/machinery/modular_computer/console/preset/command/install_programs()
var/obj/item/computer_hardware/hard_drive/hard_drive = cpu.all_components[MC_HDD]
@@ -69,7 +65,6 @@
name = "identification console"
desc = "A stationary computer. This one comes preloaded with identification modification programs."
_has_second_id_slot = TRUE
_has_printer = TRUE
/obj/machinery/modular_computer/console/preset/id/install_programs()
var/obj/item/computer_hardware/hard_drive/hard_drive = cpu.all_components[MC_HDD]
@@ -106,7 +101,6 @@
console_department = "Civilian"
name = "curator console"
desc = "A stationary computer. This one comes preloaded with art programs."
_has_printer = TRUE
/obj/machinery/modular_computer/console/preset/curator/install_programs()
var/obj/item/computer_hardware/hard_drive/hard_drive = cpu.all_components[MC_HDD]
@@ -22,9 +22,7 @@
. = ..()
// User-built consoles start as empty frames.
var/obj/item/computer_hardware/hard_drive/hard_drive = cpu.all_components[MC_HDD]
var/obj/item/computer_hardware/hard_drive/network_card = cpu.all_components[MC_NET]
qdel(hard_drive)
qdel(network_card)
/obj/machinery/modular_computer/console/Initialize(mapload)
. = ..()
@@ -32,21 +30,8 @@
if(battery_module)
qdel(battery_module)
var/obj/item/computer_hardware/network_card/wired/network_card = new()
cpu.install_component(network_card)
cpu.install_component(new /obj/item/computer_hardware/hard_drive/super) // Consoles generally have better HDDs due to lower space limitations
var/area/A = get_area(src)
// Attempts to set this console's tag according to our area. Since some areas have stuff like "XX - YY" in their names we try to remove that too.
if(A && console_department)
network_card.identification_string = replacetext(replacetext(replacetext("[A.name] [console_department] Console", " ", "_"), "-", ""), "__", "_") // Replace spaces with "_"
else if(A)
network_card.identification_string = replacetext(replacetext(replacetext("[A.name] Console", " ", "_"), "-", ""), "__", "_")
else if(console_department)
network_card.identification_string = replacetext(replacetext(replacetext("[console_department] Console", " ", "_"), "-", ""), "__", "_")
else
network_card.identification_string = "Unknown Console"
if(cpu)
cpu.screen_on = 1
cpu.screen_on = TRUE
update_appearance()
@@ -49,7 +49,7 @@
/datum/computer_file/proc/on_examine(obj/item/modular_computer/source, mob/user)
return null
/// Called when someone tries to insert something one of your applications needs, like an Intellicard for AI restoration.
/// Called when someone tries to insert something one of your applications needs, like an Intellicard for AI restoration. Return TRUE to cancel attackby chain.
/datum/computer_file/proc/try_insert(obj/item/attacking_item, mob/living/user)
return FALSE
@@ -87,11 +87,6 @@
return FALSE
return TRUE
/datum/computer_file/program/proc/get_signal(specific_action = 0)
if(computer)
return computer.get_ntnet_status(specific_action)
return 0
// Called by Process() on device that runs us, once every tick.
/datum/computer_file/program/proc/process_tick(delta_time)
return TRUE
@@ -63,8 +63,7 @@
executed = TRUE
target.dos_sources.Add(src)
if(SSnetworks.station_network.intrusion_detection_enabled)
var/obj/item/computer_hardware/network_card/network_card = computer.all_components[MC_NET]
SSnetworks.add_log("IDS WARNING - Excess traffic flood targeting relay [target.uid] detected from device: [network_card.get_network_tag()]")
SSnetworks.add_log("IDS WARNING - Excess traffic flood targeting relay [target.uid] detected from device: [computer.name]")
SSnetworks.station_network.intrusion_detection_alarm = TRUE
return TRUE
@@ -21,8 +21,8 @@
if(computer)
if(istype(computer, /obj/item/modular_computer/tablet/integrated)) //If this is a borg's integrated tablet
var/obj/item/modular_computer/tablet/integrated/modularInterface = computer
to_chat(modularInterface.borgo,span_userdanger("SYSTEM PURGE DETECTED/"))
addtimer(CALLBACK(modularInterface.borgo, /mob/living/silicon/robot/.proc/death), 2 SECONDS, TIMER_UNIQUE)
to_chat(modularInterface.silicon_owner,span_userdanger("SYSTEM PURGE DETECTED/"))
addtimer(CALLBACK(modularInterface.silicon_owner, /mob/living/silicon/robot/.proc/death), 2 SECONDS, TIMER_UNIQUE)
return
computer.visible_message(span_notice("\The [computer]'s screen brightly flashes and loud electrical buzzing is heard."))
@@ -98,12 +98,8 @@
if(.)
return
var/obj/item/computer_hardware/printer/printer
if(computer)
printer = computer.all_components[MC_PRINT]
usr.played_game()
var/gamerSkillLevel = 0
var/gamerSkill = 0
if(usr?.mind)
@@ -153,10 +149,7 @@
enemy_check()
return TRUE
if("Dispense_Tickets")
if(!printer)
to_chat(usr, span_notice("Hardware error: A printer is required to redeem tickets."))
return
if(printer.stored_paper <= 0)
if(computer.stored_paper <= 0)
to_chat(usr, span_notice("Hardware error: Printer is out of paper."))
return
else
@@ -165,7 +158,7 @@
new /obj/item/stack/arcadeticket((get_turf(computer)), 1)
to_chat(usr, span_notice("[computer] dispenses a ticket!"))
ticket_count -= 1
printer.stored_paper -= 1
computer.stored_paper -= 1
else
to_chat(usr, span_notice("You don't have any stored tickets!"))
return TRUE
@@ -80,11 +80,9 @@
var/obj/item/computer_hardware/card_slot/card_slot
var/obj/item/computer_hardware/card_slot/card_slot2
var/obj/item/computer_hardware/printer/printer
if(computer)
card_slot = computer.all_components[MC_CARD]
card_slot2 = computer.all_components[MC_CARD2]
printer = computer.all_components[MC_PRINT]
if(!card_slot || !card_slot2)
return
@@ -109,7 +107,7 @@
return TRUE
// Print a report.
if("PRG_print")
if(!computer || !printer)
if(!computer)
return TRUE
if(!authenticated_card)
return TRUE
@@ -126,7 +124,7 @@
if(A in known_access_rights)
contents += " [SSid_access.get_access_desc(A)]"
if(!printer.print_text(contents,"access report - [target_id_card.registered_name ? target_id_card.registered_name : "Unregistered"]"))
if(!computer.print_text(contents, "access report - [target_id_card.registered_name ? target_id_card.registered_name : "Unregistered"]"))
to_chat(usr, span_notice("Hardware error: Printer was unable to print the file. It may be out of paper."))
return TRUE
else
@@ -308,18 +306,14 @@
var/obj/item/computer_hardware/card_slot/card_slot
var/obj/item/computer_hardware/card_slot/card_slot2
var/obj/item/computer_hardware/printer/printer
if(computer)
card_slot = computer.all_components[MC_CARD]
card_slot2 = computer.all_components[MC_CARD2]
printer = computer.all_components[MC_PRINT]
data["have_auth_card"] = !!(card_slot)
data["have_id_slot"] = !!(card_slot2)
data["have_printer"] = !!(printer)
else
data["have_id_slot"] = FALSE
data["have_printer"] = FALSE
if(!card_slot2)
return data //We're just gonna error out on the js side at this point anyway
@@ -20,11 +20,9 @@
var/list/data = get_header_data()
var/obj/item/computer_hardware/card_slot/card_slot = computer.all_components[MC_CARD]
var/obj/item/computer_hardware/printer/printer = computer.all_components[MC_PRINT]
var/obj/item/card/id/id_card = card_slot ? card_slot.stored_card : null
data["has_id_slot"] = !!card_slot
data["has_printer"] = !!printer
data["paperamt"] = printer ? "[printer.stored_paper] / [printer.max_paper]" : null
data["paperamt"] = "[computer.stored_paper] / [computer.max_paper]"
data["card_owner"] = card_slot?.stored_card ? id_card.registered_name : "No Card Inserted."
data["current_user"] = payments_acc ? payments_acc.account_holder : null
data["barcode_split"] = cut_multiplier * 100
@@ -39,9 +37,8 @@
// Get components
var/obj/item/computer_hardware/card_slot/card_slot = computer.all_components[MC_CARD]
var/obj/item/computer_hardware/printer/printer = computer.all_components[MC_PRINT]
var/obj/item/card/id/id_card = card_slot ? card_slot.stored_card : null
if(!card_slot || !printer) //We need both to successfully use this app.
if(!card_slot) //We need both to successfully use this app.
return
switch(action)
@@ -62,10 +59,7 @@
var/potential_cut = input("How much would you like to pay out to the registered card?","Percentage Profit ([round(cut_min*100)]% - [round(cut_max*100)]%)") as num|null
cut_multiplier = potential_cut ? clamp(round(potential_cut/100, cut_min), cut_min, cut_max) : initial(cut_multiplier)
if("print")
if(!printer)
to_chat(usr, span_notice("Hardware error: A printer is required to print barcodes."))
return
if(printer.stored_paper <= 0)
if(computer.stored_paper <= 0)
to_chat(usr, span_notice("Hardware error: Printer is out of paper."))
return
if(!payments_acc)
@@ -74,5 +68,5 @@
var/obj/item/barcode/barcode = new /obj/item/barcode(get_turf(ui_host()))
barcode.payments_acc = payments_acc
barcode.cut_multiplier = cut_multiplier
printer.stored_paper--
computer.stored_paper--
to_chat(usr, span_notice("The computer prints out a barcode."))
@@ -12,21 +12,8 @@
detomatix_resistance = DETOMATIX_RESIST_MAJOR
/datum/computer_file/program/crew_manifest/ui_static_data(mob/user)
var/list/data = list()
data["manifest"] = GLOB.data_core.get_manifest()
return data
/datum/computer_file/program/crew_manifest/ui_data(mob/user)
var/list/data = get_header_data()
var/obj/item/computer_hardware/printer/printer
if(computer)
printer = computer.all_components[MC_PRINT]
if(computer)
data["have_printer"] = !!printer
else
data["have_printer"] = FALSE
data["manifest"] = GLOB.data_core.get_manifest()
return data
/datum/computer_file/program/crew_manifest/ui_act(action, params, datum/tgui/ui)
@@ -34,18 +21,14 @@
if(.)
return
var/obj/item/computer_hardware/printer/printer
if(computer)
printer = computer.all_components[MC_PRINT]
switch(action)
if("PRG_print")
if(computer && printer) //This option should never be called if there is no printer
if(computer) //This option should never be called if there is no printer
var/contents = {"<h4>Crew Manifest</h4>
<br>
[GLOB.data_core ? GLOB.data_core.get_manifest_html(0) : ""]
"}
if(!printer.print_text(contents,text("crew manifest ([])", station_time_timestamp())))
if(!computer.print_text(contents,text("crew manifest ([])", station_time_timestamp())))
to_chat(usr, span_notice("Hardware error: Printer was unable to print the file. It may be out of paper."))
return
else
@@ -49,6 +49,14 @@
/// Whether this app can send messages to all.
var/spam_mode = FALSE
/datum/computer_file/program/messenger/try_insert(obj/item/attacking_item, mob/living/user)
if(!istype(attacking_item, /obj/item/photo))
return FALSE
var/obj/item/photo/pic = attacking_item
computer.saved_image = pic.picture
ProcessPhoto()
return TRUE
/datum/computer_file/program/messenger/proc/ScrubMessengerList()
var/list/dictionary = list()
@@ -67,17 +67,10 @@
matching_paintings = SSpersistent_paintings.painting_ui_data(filter = search_mode, search_text = search_string)
/datum/computer_file/program/portrait_printer/proc/print_painting(selected_painting)
//printer check!
var/obj/item/computer_hardware/printer/printer
if(computer)
printer = computer.all_components[MC_PRINT]
if(!printer)
to_chat(usr, span_notice("Hardware error: A printer is required to print a canvas."))
return
if(printer.stored_paper < CANVAS_PAPER_COST)
if(computer.stored_paper < CANVAS_PAPER_COST)
to_chat(usr, span_notice("Printing error: Your printer needs at least [CANVAS_PAPER_COST] paper to print a canvas."))
return
printer.stored_paper -= CANVAS_PAPER_COST
computer.stored_paper -= CANVAS_PAPER_COST
//canvas printing!
var/datum/painting/chosen_portrait = locate(selected_painting) in SSpersistent_paintings.paintings
@@ -34,41 +34,41 @@
//Implied, since we can't run on non tablets
var/obj/item/modular_computer/tablet/integrated/tablet = computer
var/mob/living/silicon/robot/borgo = tablet.borgo
var/mob/living/silicon/robot/cyborg = tablet.silicon_owner
data["name"] = borgo.name
data["designation"] = borgo.model //Borgo model type
data["masterAI"] = borgo.connected_ai //Master AI
data["name"] = cyborg.name
data["designation"] = cyborg.model
data["masterAI"] = cyborg.connected_ai //Master AI
var/charge = 0
var/maxcharge = 1
if(borgo.cell)
charge = borgo.cell.charge
maxcharge = borgo.cell.maxcharge
if(cyborg.cell)
charge = cyborg.cell.charge
maxcharge = cyborg.cell.maxcharge
data["charge"] = charge //Current cell charge
data["maxcharge"] = maxcharge //Cell max charge
data["integrity"] = ((borgo.health + 100) / 2) //Borgo health, as percentage
data["lampIntensity"] = borgo.lamp_intensity //Borgo lamp power setting
data["sensors"] = "[borgo.sensors_on?"ACTIVE":"DISABLED"]"
data["printerPictures"] = borgo.connected_ai? borgo.connected_ai.aicamera.stored.len : borgo.aicamera.stored.len //Number of pictures taken, synced to AI if available
data["printerToner"] = borgo.toner //amount of toner
data["printerTonerMax"] = borgo.tonermax //It's a variable, might as well use it
data["thrustersInstalled"] = borgo.ionpulse //If we have a thruster uprade
data["thrustersStatus"] = "[borgo.ionpulse_on?"ACTIVE":"DISABLED"]" //Feedback for thruster status
data["selfDestructAble"] = (borgo.emagged || istype(borgo, /mob/living/silicon/robot/model/syndicate/))
data["integrity"] = ((cyborg.health + 100) / 2) //health, as percentage
data["lampIntensity"] = cyborg.lamp_intensity //lamp power setting
data["sensors"] = "[cyborg.sensors_on?"ACTIVE":"DISABLED"]"
data["printerPictures"] = cyborg.connected_ai? cyborg.connected_ai.aicamera.stored.len : cyborg.aicamera.stored.len //Number of pictures taken, synced to AI if available
data["printerToner"] = cyborg.toner //amount of toner
data["printerTonerMax"] = cyborg.tonermax //It's a variable, might as well use it
data["thrustersInstalled"] = cyborg.ionpulse //If we have a thruster uprade
data["thrustersStatus"] = "[cyborg.ionpulse_on?"ACTIVE":"DISABLED"]" //Feedback for thruster status
data["selfDestructAble"] = (cyborg.emagged || istype(cyborg, /mob/living/silicon/robot/model/syndicate))
//Cover, TRUE for locked
data["cover"] = "[borgo.locked? "LOCKED":"UNLOCKED"]"
data["cover"] = "[cyborg.locked? "LOCKED":"UNLOCKED"]"
//Ability to move. FAULT if lockdown wire is cut, DISABLED if borg locked, ENABLED otherwise
data["locomotion"] = "[borgo.wires.is_cut(WIRE_LOCKDOWN)?"FAULT":"[borgo.lockcharge?"DISABLED":"ENABLED"]"]"
data["locomotion"] = "[cyborg.wires.is_cut(WIRE_LOCKDOWN)?"FAULT":"[cyborg.lockcharge?"DISABLED":"ENABLED"]"]"
//Model wire. FAULT if cut, NOMINAL otherwise
data["wireModule"] = "[borgo.wires.is_cut(WIRE_RESET_MODEL)?"FAULT":"NOMINAL"]"
data["wireModule"] = "[cyborg.wires.is_cut(WIRE_RESET_MODEL)?"FAULT":"NOMINAL"]"
//DEBUG -- Camera(net) wire. FAULT if cut (or no cameranet camera), DISABLED if pulse-disabled, NOMINAL otherwise
data["wireCamera"] = "[!borgo.builtInCamera || borgo.wires.is_cut(WIRE_CAMERA)?"FAULT":"[borgo.builtInCamera.can_use()?"NOMINAL":"DISABLED"]"]"
data["wireCamera"] = "[!cyborg.builtInCamera || cyborg.wires.is_cut(WIRE_CAMERA)?"FAULT":"[cyborg.builtInCamera.can_use()?"NOMINAL":"DISABLED"]"]"
//AI wire. FAULT if wire is cut, CONNECTED if connected to AI, READY otherwise
data["wireAI"] = "[borgo.wires.is_cut(WIRE_AI)?"FAULT":"[borgo.connected_ai?"CONNECTED":"READY"]"]"
data["wireAI"] = "[cyborg.wires.is_cut(WIRE_AI)?"FAULT":"[cyborg.connected_ai?"CONNECTED":"READY"]"]"
//Law sync wire. FAULT if cut, NOMINAL otherwise
data["wireLaw"] = "[borgo.wires.is_cut(WIRE_LAWSYNC)?"FAULT":"NOMINAL"]"
data["wireLaw"] = "[cyborg.wires.is_cut(WIRE_LAWSYNC)?"FAULT":"NOMINAL"]"
return data
@@ -76,13 +76,13 @@
var/list/data = list()
if(!iscyborg(user))
return data
var/mob/living/silicon/robot/borgo = user
var/mob/living/silicon/robot/cyborg = user
//Implied
var/obj/item/modular_computer/tablet/integrated/tablet = computer
data["Laws"] = borgo.laws.get_law_list(TRUE, TRUE, FALSE)
data["Laws"] = cyborg.laws.get_law_list(TRUE, TRUE, FALSE)
data["borgLog"] = tablet.borglog
data["borgUpgrades"] = borgo.upgrades
data["borgUpgrades"] = cyborg.upgrades
return data
/datum/computer_file/program/robotact/ui_act(action, params)
@@ -91,56 +91,56 @@
return
//Implied type, memes
var/obj/item/modular_computer/tablet/integrated/tablet = computer
var/mob/living/silicon/robot/borgo = tablet.borgo
var/mob/living/silicon/robot/cyborg = tablet.silicon_owner
switch(action)
if("coverunlock")
if(borgo.locked)
borgo.locked = FALSE
borgo.update_icons()
if(borgo.emagged)
borgo.logevent("ChÃ¥vÃis cover lock has been [borgo.locked ? "engaged" : "released"]") //"The cover interface glitches out for a split second"
if(cyborg.locked)
cyborg.locked = FALSE
cyborg.update_icons()
if(cyborg.emagged)
cyborg.logevent("ChÃ¥vÃis cover lock has been [cyborg.locked ? "engaged" : "released"]") //"The cover interface glitches out for a split second"
else
borgo.logevent("Chassis cover lock has been [borgo.locked ? "engaged" : "released"]")
cyborg.logevent("Chassis cover lock has been [cyborg.locked ? "engaged" : "released"]")
if("lawchannel")
borgo.set_autosay()
cyborg.set_autosay()
if("lawstate")
borgo.checklaws()
cyborg.checklaws()
if("alertPower")
if(borgo.stat == CONSCIOUS)
if(!borgo.cell || !borgo.cell.charge)
borgo.visible_message(span_notice("The power warning light on [span_name("[borgo]")] flashes urgently."), \
if(cyborg.stat == CONSCIOUS)
if(!cyborg.cell || !cyborg.cell.charge)
cyborg.visible_message(span_notice("The power warning light on [span_name("[cyborg]")] flashes urgently."), \
"You announce you are operating in low power mode.")
playsound(borgo, 'sound/machines/buzz-two.ogg', 50, FALSE)
playsound(cyborg, 'sound/machines/buzz-two.ogg', 50, FALSE)
if("toggleSensors")
borgo.toggle_sensors()
cyborg.toggle_sensors()
if("viewImage")
if(borgo.connected_ai)
borgo.connected_ai.aicamera?.viewpictures(usr)
if(cyborg.connected_ai)
cyborg.connected_ai.aicamera?.viewpictures(usr)
else
borgo.aicamera?.viewpictures(usr)
cyborg.aicamera?.viewpictures(usr)
if("printImage")
var/obj/item/camera/siliconcam/robot_camera/borgcam = borgo.aicamera
var/obj/item/camera/siliconcam/robot_camera/borgcam = cyborg.aicamera
borgcam?.borgprint(usr)
if("toggleThrusters")
borgo.toggle_ionpulse()
cyborg.toggle_ionpulse()
if("lampIntensity")
borgo.lamp_intensity = params["ref"]
borgo.toggle_headlamp(FALSE, TRUE)
cyborg.lamp_intensity = params["ref"]
cyborg.toggle_headlamp(FALSE, TRUE)
if("selfDestruct")
if(borgo.stat || borgo.lockcharge) //No detonation while stunned or locked down
if(cyborg.stat || cyborg.lockcharge) //No detonation while stunned or locked down
return
if(borgo.emagged || istype(borgo, /mob/living/silicon/robot/model/syndicate/)) //This option shouldn't even be showing otherwise
borgo.self_destruct(borgo)
if(cyborg.emagged || istype(cyborg, /mob/living/silicon/robot/model/syndicate)) //This option shouldn't even be showing otherwise
cyborg.self_destruct(cyborg)
/**
* Forces a full update of the UI, if currently open.
@@ -152,6 +152,6 @@
if(!istype(computer, /obj/item/modular_computer/tablet/integrated))
return
var/obj/item/modular_computer/tablet/integrated/tablet = computer
var/datum/tgui/active_ui = SStgui.get_open_ui(tablet.borgo, src)
var/datum/tgui/active_ui = SStgui.get_open_ui(tablet.silicon_owner, src)
if(active_ui)
active_ui.send_full_update()
@@ -1,101 +0,0 @@
/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/hardware_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
/obj/item/computer_hardware/network_card/Initialize(mapload)
. = ..()
init_network_id(NETWORK_CARDS)
/obj/item/computer_hardware/network_card/diagnostics(mob/user)
..()
to_chat(user, "NIX Unique ID: [hardware_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")
// Returns a string identifier of this network card
/obj/item/computer_hardware/network_card/proc/get_network_tag()
return "[identification_string] (NID [hardware_id])"
// 0 - No signal, 1 - Low signal, 2 - High signal. 3 - Wired Connection
/obj/item/computer_hardware/network_card/proc/get_signal(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/items/devices_lefthand.dmi'
righthand_file = 'icons/mob/inhands/items/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
/obj/item/computer_hardware/network_card/integrated //Borg tablet version, only works while the borg has power and is not locked
name = "cyborg data link"
/obj/item/computer_hardware/network_card/integrated/get_signal(specific_action = 0)
var/obj/item/modular_computer/tablet/integrated/modularInterface = holder
if(!modularInterface || !istype(modularInterface))
return FALSE //wrong type of tablet
if(!modularInterface.borgo)
return FALSE //No borg found
var/mob/living/silicon/robot/robo = modularInterface.borgo
if(istype(robo))
if(robo.lockcharge)
return FALSE //lockdown restricts borg networking
if(!robo.cell || robo.cell.charge == 0)
return FALSE //borg cell dying restricts borg networking
return ..()
@@ -1,100 +0,0 @@
/obj/item/computer_hardware/printer
name = "printer"
desc = "Computer-integrated printer with paper recycling module."
power_usage = 100
icon_state = "printer"
w_class = WEIGHT_CLASS_NORMAL
device_type = MC_PRINT
expansion_hw = TRUE
var/stored_paper = 20
var/max_paper = 30
/obj/item/computer_hardware/printer/diagnostics(mob/living/user)
..()
to_chat(user, span_notice("Paper level: [stored_paper]/[max_paper]."))
/obj/item/computer_hardware/printer/examine(mob/user)
. = ..()
. += span_notice("Paper level: [stored_paper]/[max_paper].")
/obj/item/computer_hardware/printer/proc/print_text(text_to_print, paper_title = "")
if(!stored_paper)
return FALSE
if(!check_functionality())
return FALSE
var/obj/item/paper/printed_paper = new/obj/item/paper(holder.drop_location())
// Damaged printer causes the resulting paper to be somewhat harder to read.
if(damage > damage_malfunction)
printed_paper.add_raw_text(stars(text_to_print, 100-malfunction_probability))
else
printed_paper.add_raw_text(text_to_print)
if(paper_title)
printed_paper.name = paper_title
printed_paper.update_appearance()
stored_paper--
return TRUE
/obj/item/computer_hardware/printer/try_insert(obj/item/I, mob/living/user = null)
if(istype(I, /obj/item/paper))
if(stored_paper >= max_paper)
to_chat(user, span_warning("You try to add \the [I] into [src], but its paper bin is full!"))
return FALSE
if(user && !user.temporarilyRemoveItemFromInventory(I))
return FALSE
to_chat(user, span_notice("You insert \the [I] into [src]'s paper recycler."))
qdel(I)
stored_paper++
return TRUE
if(istype(I, /obj/item/paper_bin))
var/obj/item/paper_bin/bin = I
if(bin.total_paper > 0)
if(stored_paper >= max_paper)
balloon_alert(user, "it's full!")
return FALSE
/// Number of sheets we're adding
var/num_to_add = 0
for(var/obj/item/paper/paper_in_stack as anything in bin.paper_stack) // Search for the first blank sheet of paper, then toss it in
if(paper_in_stack.get_total_length()) // Uh oh, paper has words!
continue
if(istype(paper_in_stack, /obj/item/paper/carbon)) // Add both the carbon, and the copy
var/obj/item/paper/carbon/carbon_paper = paper_in_stack
if(!carbon_paper.copied && ((max_paper - stored_paper) >= 2)) // See if there's room for both
num_to_add = 2
else
num_to_add = 1
bin.paper_stack -= paper_in_stack
bin.total_paper -= 1
qdel(paper_in_stack)
stored_paper += num_to_add
break // All full!
if (num_to_add == 0 && bin.total_paper > 0)
bin.total_paper -= 1
num_to_add = 1
stored_paper += 1
bin.update_appearance()
if(!num_to_add)
balloon_alert(user, "everything is written on!")
else
balloon_alert(user, "pulled in [num_to_add] sheets\s of paper")
return TRUE
else
balloon_alert(user, "the bin is empty!")
return FALSE
return FALSE
/obj/item/computer_hardware/printer/mini
name = "miniprinter"
desc = "A small printer with paper recycling module."
power_usage = 50
icon_state = "printer_mini"
w_class = WEIGHT_CLASS_TINY
stored_paper = 5
max_paper = 15
@@ -21,8 +21,6 @@
// Device loadout
var/dev_battery = 1 // 1: Default, 2: Upgraded, 3: Advanced
var/dev_disk = 1 // 1: Default, 2: Upgraded, 3: Advanced
var/dev_netcard = 0 // 0: None, 1: Basic, 2: Long-Range
var/dev_printer = 0 // 0: None, 1: Standard
var/dev_card = 0 // 0: None, 1: Standard
// Removes all traces of old order and allows you to begin configuration from scratch.
@@ -37,8 +35,6 @@
fabricated_tablet = null
dev_battery = 1
dev_disk = 1
dev_netcard = 0
dev_printer = 0
dev_card = 0
// Recalculates the price and optionally even fabricates the device.
@@ -76,19 +72,6 @@
if(fabricate)
fabricated_laptop.install_component(new /obj/item/computer_hardware/hard_drive/super)
total_price += 299
switch(dev_netcard)
if(1) // Basic(Short-Range)
if(fabricate)
fabricated_laptop.install_component(new /obj/item/computer_hardware/network_card)
total_price += 99
if(2) // Advanced (Long Range)
if(fabricate)
fabricated_laptop.install_component(new /obj/item/computer_hardware/network_card/advanced)
total_price += 299
if(dev_printer)
total_price += 99
if(fabricate)
fabricated_laptop.install_component(new /obj/item/computer_hardware/printer/mini)
if(dev_card)
total_price += 199
if(fabricate)
@@ -127,19 +110,6 @@
if(fabricate)
fabricated_tablet.install_component(new /obj/item/computer_hardware/hard_drive)
total_price += 299
switch(dev_netcard)
if(1) // Basic(Short-Range)
if(fabricate)
fabricated_tablet.install_component(new/obj/item/computer_hardware/network_card)
total_price += 99
if(2) // Advanced (Long Range)
if(fabricate)
fabricated_tablet.install_component(new/obj/item/computer_hardware/network_card/advanced)
total_price += 299
if(dev_printer)
total_price += 99
if(fabricate)
fabricated_tablet.install_component(new/obj/item/computer_hardware/printer/mini)
if(dev_card)
total_price += 199
if(fabricate)
@@ -185,14 +155,6 @@
dev_disk = text2num(params["disk"])
fabricate_and_recalc_price(FALSE)
return TRUE
if("hw_netcard")
dev_netcard = text2num(params["netcard"])
fabricate_and_recalc_price(FALSE)
return TRUE
if("hw_nanoprint")
dev_printer = text2num(params["print"])
fabricate_and_recalc_price(FALSE)
return TRUE
if("hw_card")
dev_card = text2num(params["card"])
fabricate_and_recalc_price(FALSE)
@@ -255,8 +217,6 @@
data["devtype"] = devtype
data["hw_battery"] = dev_battery
data["hw_disk"] = dev_disk
data["hw_netcard"] = dev_netcard
data["hw_nanoprint"] = dev_printer
data["hw_card"] = dev_card
if(state == 1 || state == 2)
data["totalprice"] = total_price