[MIRROR] Tablet apps are now deleted when necessary & removes console preset. [MDB IGNORE] (#21942)

* Tablet apps are now deleted when necessary & removes console preset. (#75863)

## About The Pull Request

Apps now properly delete themselves when removed, so they don't exist in
nullspace anymore.
Chat client now actually updates the uid, because its New() didn't call
parent.
Deletes the 'console' subtype of modular computer
Updates how downloading and transferring files are handled
Fixes being able to infinitely upload apps to a disk

## Why It's Good For The Game

Fixes some more bugs I found with apps and prevents spamming apps in a
disk.

## Changelog

🆑
fix: Maintenance data disks now properly transfer from PC to disk
fix: Disks can no longer be flooded with the same app repeatedly.
/🆑

* Tablet apps are now deleted when necessary & removes console preset.

* updatepaths

* feex

---------

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
Co-authored-by: Jolly-66 <70232195+Jolly-66@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-06-20 14:36:09 +00:00
committed by GitHub
co-authored by John Willard Jolly-66
parent 31ccdbc025
commit 3079143be5
52 changed files with 28959 additions and 28994 deletions
@@ -143,7 +143,7 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
/obj/item/modular_computer/proc/install_default_programs()
SHOULD_CALL_PARENT(FALSE)
for(var/programs in default_programs + starting_programs)
var/datum/computer_file/program/program_type = new programs
var/datum/computer_file/program_type = new programs
store_file(program_type)
/obj/item/modular_computer/Destroy()
@@ -14,11 +14,9 @@
if(file_storing in stored_files)
return FALSE
SEND_SIGNAL(file_storing, COMSIG_MODULAR_COMPUTER_FILE_ADDING)
file_storing.computer = src
stored_files.Add(file_storing)
used_capacity += file_storing.size
SEND_SIGNAL(file_storing, COMSIG_MODULAR_COMPUTER_FILE_ADDED)
SEND_SIGNAL(file_storing, COMSIG_MODULAR_COMPUTER_FILE_STORE, src)
return TRUE
/**
@@ -35,15 +33,12 @@
return FALSE
if(istype(file_removing, /datum/computer_file/program))
var/datum/computer_file/program/program_file = file_removing
if(program_file == active_program)
active_program.kill_program()
for(var/datum/computer_file/program/programs as anything in idle_threads)
programs.kill_program()
program_file.kill_program()
SEND_SIGNAL(file_removing, COMSIG_MODULAR_COMPUTER_FILE_DELETING)
stored_files.Remove(file_removing)
used_capacity -= file_removing.size
SEND_SIGNAL(file_removing, COMSIG_MODULAR_COMPUTER_FILE_DELETED)
qdel(file_removing)
return TRUE
/**
@@ -17,7 +17,7 @@
/obj/item/computer_disk/Initialize(mapload)
. = ..()
for(var/programs in starting_programs)
var/datum/computer_file/program/program_type = new programs
var/datum/computer_file/program_type = new programs
add_file(program_type)
/obj/item/computer_disk/Destroy(force)
@@ -47,6 +47,7 @@
return FALSE
stored_files.Remove(file)
used_capacity -= file.size
qdel(file)
return TRUE
/obj/item/computer_disk/advanced
@@ -1,19 +1,18 @@
/obj/machinery/modular_computer/console/preset
/obj/machinery/modular_computer/preset
///List of programs the computer starts with, given on Initialize.
var/list/datum/computer_file/starting_programs = list()
/obj/machinery/modular_computer/console/preset/Initialize(mapload)
/obj/machinery/modular_computer/preset/Initialize(mapload)
. = ..()
if(!cpu)
return
for(var/programs in starting_programs)
var/datum/computer_file/program/program_type = new programs
var/datum/computer_file/program_type = new programs
cpu.store_file(program_type)
// ===== ENGINEERING CONSOLE =====
/obj/machinery/modular_computer/console/preset/engineering
console_department = "Engineering"
/obj/machinery/modular_computer/preset/engineering
name = "engineering console"
desc = "A stationary computer. This one comes preloaded with engineering programs."
starting_programs = list(
@@ -23,8 +22,7 @@
)
// ===== RESEARCH CONSOLE =====
/obj/machinery/modular_computer/console/preset/research
console_department = "Research"
/obj/machinery/modular_computer/preset/research
name = "research director's console"
desc = "A stationary computer. This one comes preloaded with research programs."
starting_programs = list(
@@ -36,8 +34,7 @@
)
// ===== COMMAND CONSOLE =====
/obj/machinery/modular_computer/console/preset/command
console_department = "Command"
/obj/machinery/modular_computer/preset/command
name = "command console"
desc = "A stationary computer. This one comes preloaded with command programs."
starting_programs = list(
@@ -46,8 +43,7 @@
)
// ===== IDENTIFICATION CONSOLE =====
/obj/machinery/modular_computer/console/preset/id
console_department = "Identification"
/obj/machinery/modular_computer/preset/id
name = "identification console"
desc = "A stationary computer. This one comes preloaded with identification modification programs."
starting_programs = list(
@@ -57,17 +53,16 @@
/datum/computer_file/program/crew_manifest,
)
/obj/machinery/modular_computer/console/preset/id/centcom
/obj/machinery/modular_computer/preset/id/centcom
desc = "A stationary computer. This one comes preloaded with CentCom identification modification programs."
/obj/machinery/modular_computer/console/preset/id/centcom/Initialize(mapload)
/obj/machinery/modular_computer/preset/id/centcom/Initialize(mapload)
. = ..()
var/datum/computer_file/program/card_mod/card_mod_centcom = cpu.find_file_by_name("plexagonidwriter")
card_mod_centcom.is_centcom = TRUE
// ===== CIVILIAN CONSOLE =====
/obj/machinery/modular_computer/console/preset/civilian
console_department = "Civilian"
/obj/machinery/modular_computer/preset/civilian
name = "civilian console"
desc = "A stationary computer. This one comes preloaded with generic programs."
starting_programs = list(
@@ -76,8 +71,7 @@
)
// curator
/obj/machinery/modular_computer/console/preset/curator
console_department = "Civilian"
/obj/machinery/modular_computer/preset/curator
name = "curator console"
desc = "A stationary computer. This one comes preloaded with art programs."
starting_programs = list(
@@ -85,48 +79,51 @@
)
// ===== CARGO CHAT CONSOLES =====
/obj/machinery/modular_computer/console/preset/cargochat
/obj/machinery/modular_computer/preset/cargochat
name = "cargo chatroom console"
desc = "A stationary computer. This one comes preloaded with a chatroom for your cargo requests."
starting_programs = list(
/datum/computer_file/program/chatclient,
)
/obj/machinery/modular_computer/console/preset/cargochat/Initialize(mapload)
///Used in Initialize to set the chat client name.
var/console_department
/obj/machinery/modular_computer/preset/cargochat/Initialize(mapload)
. = ..()
var/datum/computer_file/program/chatclient/chatprogram = cpu.find_file_by_name("ntnrc_client")
chatprogram.username = "[lowertext(console_department)]_department"
cpu.active_program = chatprogram
/obj/machinery/modular_computer/console/preset/cargochat/service
/obj/machinery/modular_computer/preset/cargochat/service
console_department = "Service"
/obj/machinery/modular_computer/console/preset/cargochat/engineering
/obj/machinery/modular_computer/preset/cargochat/engineering
console_department = "Engineering"
/obj/machinery/modular_computer/console/preset/cargochat/science
/obj/machinery/modular_computer/preset/cargochat/science
console_department = "Science"
/obj/machinery/modular_computer/console/preset/cargochat/security
/obj/machinery/modular_computer/preset/cargochat/security
console_department = "Security"
/obj/machinery/modular_computer/console/preset/cargochat/medical
/obj/machinery/modular_computer/preset/cargochat/medical
console_department = "Medical"
//ONE PER MAP PLEASE, IT MAKES A CARGOBUS FOR EACH ONE OF THESE
/obj/machinery/modular_computer/console/preset/cargochat/cargo
/obj/machinery/modular_computer/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/LateInitialize()
/obj/machinery/modular_computer/preset/cargochat/cargo/LateInitialize()
. = ..()
var/datum/computer_file/program/chatclient/chatprogram = cpu.find_file_by_name("ntnrc_client")
chatprogram.username = "cargo_requests_operator"
var/datum/ntnet_conversation/cargochat = chatprogram.create_new_channel("#cargobus", strong = TRUE)
for(var/obj/machinery/modular_computer/console/preset/cargochat/cargochat_console in GLOB.machines)
for(var/obj/machinery/modular_computer/preset/cargochat/cargochat_console in GLOB.machines)
if(cargochat_console == src)
continue
var/datum/computer_file/program/chatclient/other_chatprograms = cargochat_console.cpu.find_file_by_name("ntnrc_client")
@@ -1,20 +1,18 @@
// Modular Computer - device that runs various programs and operates with hardware
// DO NOT SPAWN THIS TYPE. Use /laptop/ or /console/ instead.
// Modular Computer - A machinery that is mostly just a host to the Modular Computer item.
/obj/machinery/modular_computer
name = "modular computer"
desc = "You shouldn't see this. If you do, report it." //they should be examining the processor instead
// 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 = 'icons/obj/modular_console.dmi'
icon_state = null
icon_state = "console"
idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.05
density = TRUE
max_integrity = 300
integrity_failure = 0.5
///The power cell, null by default as we use the APC we're in
var/internal_cell = null
///A flag that describes this device type
var/hardware_flag = NONE
var/hardware_flag = PROGRAM_CONSOLE
///Power usage during last tick
var/last_power_usage = 0
/// Amount of programs that can be ran at once
@@ -22,9 +20,9 @@
///Icon state when the computer is turned off.
var/icon_state_unpowered = null
var/icon_state_unpowered = "console-off"
///Icon state when the computer is turned on.
var/icon_state_powered = null
var/icon_state_powered = "console"
///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'.
@@ -32,11 +30,11 @@
///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
var/light_strength = 2
///Power usage when the computer is open (screen is active) and can be interacted with.
var/base_active_power_usage = 100
var/base_active_power_usage = 500
///Power usage when the computer is idle and screen is off (currently only applies to laptops)
var/base_idle_power_usage = 10
var/base_idle_power_usage = 100
///CPU that handles most logic while this type only handles power and other specific things.
var/obj/item/modular_computer/processor/cpu
@@ -44,7 +42,8 @@
/obj/machinery/modular_computer/Initialize(mapload)
. = ..()
cpu = new(src)
cpu.physical = src
cpu.screen_on = TRUE
update_appearance()
/obj/machinery/modular_computer/Destroy()
QDEL_NULL(cpu)
@@ -1,24 +0,0 @@
/obj/machinery/modular_computer/console
name = "console"
desc = "A stationary computer."
icon = 'icons/obj/modular_console.dmi'
icon_state = "console"
icon_state_powered = "console"
icon_state_unpowered = "console-off"
hardware_flag = PROGRAM_CONSOLE
density = TRUE
base_idle_power_usage = 100
base_active_power_usage = 500
steel_sheet_cost = 10
light_strength = 2
max_integrity = 300
integrity_failure = 0.5
///Used in New() to set network tag according to our area.
var/console_department = ""
/obj/machinery/modular_computer/console/Initialize(mapload)
. = ..()
if(cpu)
cpu.screen_on = TRUE
update_appearance()