This commit is contained in:
LetterN
2021-10-28 17:34:52 +08:00
parent 49940c373e
commit f7b898a2a9
346 changed files with 13714 additions and 8493 deletions
@@ -26,8 +26,6 @@
/obj/machinery/modular_computer/console/preset/proc/install_programs()
return
// ===== ENGINEERING CONSOLE =====
/obj/machinery/modular_computer/console/preset/engineering
console_department = "Engineering"
@@ -45,6 +43,7 @@
console_department = "Research"
name = "research director's console"
desc = "A stationary computer. This one comes preloaded with research programs."
_has_second_id_slot = TRUE
_has_ai = TRUE
/obj/machinery/modular_computer/console/preset/research/install_programs()
@@ -84,6 +83,18 @@
hard_drive.store_file(new/datum/computer_file/program/job_management())
hard_drive.store_file(new/datum/computer_file/program/crew_manifest())
/obj/machinery/modular_computer/console/preset/id/centcom
desc = "A stationary computer. This one comes preloaded with CentCom identification modification programs."
/obj/machinery/modular_computer/console/preset/id/centcom/install_programs()
var/obj/item/computer_hardware/hard_drive/hard_drive = cpu.all_components[MC_HDD]
var/datum/computer_file/program/card_mod/card_mod_centcom = new /datum/computer_file/program/card_mod()
card_mod_centcom.is_centcom = TRUE
hard_drive.store_file(new /datum/computer_file/program/chatclient())
hard_drive.store_file(card_mod_centcom)
hard_drive.store_file(new /datum/computer_file/program/job_management())
hard_drive.store_file(new /datum/computer_file/program/crew_manifest())
// ===== CIVILIAN CONSOLE =====
/obj/machinery/modular_computer/console/preset/civilian
console_department = "Civilian"
@@ -94,3 +105,79 @@
var/obj/item/computer_hardware/hard_drive/hard_drive = cpu.all_components[MC_HDD]
hard_drive.store_file(new/datum/computer_file/program/chatclient())
hard_drive.store_file(new/datum/computer_file/program/arcade())
// curator
/obj/machinery/modular_computer/console/preset/curator
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]
hard_drive.store_file(new/datum/computer_file/program/portrait_printer())
// ===== CARGO CHAT CONSOLES =====
/obj/machinery/modular_computer/console/preset/cargochat
name = "cargo chatroom console"
desc = "A stationary computer. This one comes preloaded with a chatroom for your cargo requests."
///chat client installed on this computer, just helpful for linking all the computers
var/datum/computer_file/program/chatclient/chatprogram
/obj/machinery/modular_computer/console/preset/cargochat/install_programs()
var/obj/item/computer_hardware/hard_drive/hard_drive = cpu.all_components[MC_HDD]
chatprogram = new
chatprogram.computer = cpu
hard_drive.store_file(chatprogram)
chatprogram.username = "[lowertext(console_department)]_department"
chatprogram.program_state = PROGRAM_STATE_ACTIVE
cpu.active_program = chatprogram
//ONE PER MAP PLEASE, IT MAKES A CARGOBUS FOR EACH ONE OF THESE
/obj/machinery/modular_computer/console/preset/cargochat/cargo
console_department = "Cargo"
name = "department chatroom console"
desc = "A stationary computer. This one comes preloaded with a chatroom for incoming cargo requests. You may moderate it from this computer."
/obj/machinery/modular_computer/console/preset/cargochat/cargo/install_programs()
var/obj/item/computer_hardware/hard_drive/hard_drive = cpu.all_components[MC_HDD]
//adding chat, setting it as the active window immediately
chatprogram = new
chatprogram.computer = cpu
hard_drive.store_file(chatprogram)
chatprogram.program_state = PROGRAM_STATE_ACTIVE
cpu.active_program = chatprogram
//setting up chat
chatprogram.username = "cargo_requests_operator"
var/datum/ntnet_conversation/cargochat = new
cargochat.operator = chatprogram //adding operator before joining the chat prevents an unnecessary message about switching op from showing
cargochat.add_client(chatprogram)
cargochat.title = "#cargobus"
cargochat.strong = TRUE
chatprogram.active_channel = cargochat.id
/obj/machinery/modular_computer/console/preset/cargochat/cargo/LateInitialize()
. = ..()
var/datum/ntnet_conversation/cargochat = SSnetworks.station_network.get_chat_channel_by_id(chatprogram.active_channel)
for(var/obj/machinery/modular_computer/console/preset/cargochat/cargochat_console in GLOB.machines)
if(cargochat_console == src)
continue
cargochat_console.chatprogram.active_channel = chatprogram.active_channel
cargochat.add_client(cargochat_console.chatprogram, silent = TRUE)
/obj/machinery/modular_computer/console/preset/cargochat/service
console_department = "Service"
/obj/machinery/modular_computer/console/preset/cargochat/engineering
console_department = "Engineering"
/obj/machinery/modular_computer/console/preset/cargochat/science
console_department = "Science"
/obj/machinery/modular_computer/console/preset/cargochat/security
console_department = "Security"
/obj/machinery/modular_computer/console/preset/cargochat/medical
console_department = "Medical"
@@ -4,28 +4,41 @@
name = "modular computer"
desc = "An advanced computer."
use_power = IDLE_POWER_USE
idle_power_usage = 5
var/hardware_flag = 0 // A flag that describes this device type
var/last_power_usage = 0 // Power usage during last tick
// Modular computers can run on various devices. Each DEVICE (Laptop, Console, Tablet,..)
// must have it's own DMI file. Icon states must be called exactly the same in all files, but may look differently
// If you create a program which is limited to Laptops and Consoles you don't have to add it's icon_state overlay for Tablets too, for example.
icon = null
icon_state = null
var/icon_state_unpowered = null // Icon state when the computer is turned off.
var/icon_state_powered = null // Icon state when the computer is turned on.
var/screen_icon_state_menu = "menu" // Icon state overlay when the computer is turned on, but no program is loaded that would override the screen.
var/screen_icon_screensaver = "standby" // Icon state overlay when the computer is powered, but not 'switched on'.
var/max_hardware_size = 0 // Maximal hardware size. Currently, tablets have 1, laptops 2 and consoles 3. Limits what hardware types can be installed.
var/steel_sheet_cost = 10 // Amount of steel sheets refunded when disassembling an empty frame of this computer.
var/light_strength = 0 // Light luminosity when turned on
var/base_active_power_usage = 100 // Power usage when the computer is open (screen is active) and can be interacted with. Remember hardware can use power too.
var/base_idle_power_usage = 10 // Power usage when the computer is idle and screen is off (currently only applies to laptops)
var/obj/item/modular_computer/processor/cpu = null // CPU that handles most logic while this type only handles power and other specific things.
use_power = IDLE_POWER_USE
idle_power_usage = 5
///A flag that describes this device type
var/hardware_flag = 0
///Power usage during last tick
var/last_power_usage = 0
///Icon state when the computer is turned off.
var/icon_state_unpowered = null
///Icon state when the computer is turned on.
var/icon_state_powered = null
///Icon state overlay when the computer is turned on, but no program is loaded that would override the screen.
var/screen_icon_state_menu = "menu"
///Icon state overlay when the computer is powered, but not 'switched on'.
var/screen_icon_screensaver = "standby"
///Maximal hardware size. Currently, tablets have 1, laptops 2 and consoles 3. Limits what hardware types can be installed.
var/max_hardware_size = 0
///Amount of steel sheets refunded when disassembling an empty frame of this computer.
var/steel_sheet_cost = 10
///Light luminosity when turned on
var/light_strength = 0
///Power usage when the computer is open (screen is active) and can be interacted with. Remember hardware can use power too.
var/base_active_power_usage = 100
///Power usage when the computer is idle and screen is off (currently only applies to laptops)
var/base_idle_power_usage = 10
///CPU that handles most logic while this type only handles power and other specific things.
var/obj/item/modular_computer/processor/cpu = null
/obj/machinery/modular_computer/Initialize()
. = ..()
@@ -48,32 +61,35 @@
cpu.attack_ghost(user)
/obj/machinery/modular_computer/emag_act(mob/user)
. = ..()
if(!cpu)
to_chat(user, "<span class='warning'>You'd need to turn the [src] on first.</span>")
to_chat(user, span_warning("You'd need to turn the [src] on first."))
return FALSE
return (cpu.emag_act(user))
/obj/machinery/modular_computer/update_icon()
cut_overlays()
icon_state = icon_state_powered
/obj/machinery/modular_computer/update_appearance(updates)
. = ..()
set_light(cpu?.enabled ? light_strength : 0)
if(!cpu || !cpu.enabled)
/obj/machinery/modular_computer/update_icon_state()
icon_state = (cpu?.enabled || (!(stat & NOPOWER) && cpu?.use_power())) ? icon_state_powered : icon_state_unpowered
return ..()
/obj/machinery/modular_computer/update_overlays()
. = ..()
if(!cpu?.enabled)
if (!(stat & NOPOWER) && (cpu?.use_power()))
add_overlay(screen_icon_screensaver)
else
icon_state = icon_state_unpowered
set_light(0)
. += screen_icon_screensaver
else
set_light(light_strength)
if(cpu.active_program)
add_overlay(cpu.active_program.program_icon_state ? cpu.active_program.program_icon_state : screen_icon_state_menu)
else
add_overlay(screen_icon_state_menu)
. += cpu.active_program?.program_icon_state || screen_icon_state_menu
if(cpu && cpu.obj_integrity <= cpu.integrity_failure * cpu.max_integrity)
add_overlay("bsod")
add_overlay("broken")
. += "bsod"
. += "broken"
/// Eats the "source" arg because update_icon actually expects args now.
/obj/machinery/modular_computer/proc/relay_icon_update(datum/source, updates, updated)
SIGNAL_HANDLER
return update_icon(updates)
/obj/machinery/modular_computer/AltClick(mob/user)
if(cpu)
@@ -98,17 +114,17 @@
/obj/machinery/modular_computer/proc/power_failure(malfunction = 0)
var/obj/item/computer_hardware/battery/battery_module = cpu.all_components[MC_CELL]
if(cpu?.enabled) // Shut down the computer
visible_message("<span class='danger'>\The [src]'s screen flickers [battery_module ? "\"BATTERY [malfunction ? "MALFUNCTION" : "CRITICAL"]\"" : "\"EXTERNAL POWER LOSS\""] warning as it shuts down unexpectedly.</span>")
visible_message(span_danger("\The [src]'s screen flickers [battery_module ? "\"BATTERY [malfunction ? "MALFUNCTION" : "CRITICAL"]\"" : "\"EXTERNAL POWER LOSS\""] warning as it shuts down unexpectedly."))
if(cpu)
cpu.shutdown_computer(0)
stat |= NOPOWER
update_icon()
set_machine_stat(stat | NOPOWER)
update_appearance()
// Modular computers can have battery in them, we handle power in previous proc, so prevent this from messing it up for us.
/obj/machinery/modular_computer/power_change()
if(cpu?.use_power()) // If MC_CPU still has a power source, PC wouldn't go offline.
stat &= ~NOPOWER
update_icon()
set_machine_stat(stat & ~NOPOWER)
update_appearance()
return
. = ..()
@@ -116,7 +132,7 @@
if(cpu)
return cpu.screwdriver_act(user, tool)
/obj/machinery/modular_computer/attackby(obj/item/W as obj, mob/user)
/obj/machinery/modular_computer/attackby(obj/item/W as obj, mob/living/user)
if (user.a_intent == INTENT_HELP && cpu && !(flags_1 & NODECONSTRUCT_1))
return cpu.attackby(W, user)
return ..()
@@ -126,15 +142,16 @@
// Minor explosions are mostly mitigitated by casing.
/obj/machinery/modular_computer/ex_act(severity)
if(cpu)
cpu.ex_act(severity)
// switch(severity)
// if(EXPLODE_DEVASTATE)
// SSexplosions.high_mov_atom += cpu
// if(EXPLODE_HEAVY)
// SSexplosions.med_mov_atom += cpu
// if(EXPLODE_LIGHT)
// SSexplosions.low_mov_atom += cpu
..()
return cpu.ex_act(severity)
// switch(severity)
// if(EXPLODE_DEVASTATE)
// SSexplosions.high_mov_atom += cpu
// if(EXPLODE_HEAVY)
// SSexplosions.med_mov_atom += cpu
// if(EXPLODE_LIGHT)
// SSexplosions.low_mov_atom += cpu
return ..()
// EMPs are similar to explosions, but don't cause physical damage to the casing. Instead they screw up the components
/obj/machinery/modular_computer/emp_act(severity)
@@ -16,7 +16,8 @@
light_strength = 2
max_integrity = 300
integrity_failure = 0.5
var/console_department = "" // Used in New() to set network tag according to our area.
///Used in New() to set network tag according to our area.
var/console_department = ""
/obj/machinery/modular_computer/console/buildable/Initialize()
. = ..()
@@ -52,4 +53,4 @@
network_card.identification_string = "Unknown Console"
if(cpu)
cpu.screen_on = 1
update_icon()
update_appearance()