mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
59 lines
2.2 KiB
Plaintext
59 lines
2.2 KiB
Plaintext
// /data/ files store data in string format.
|
|
// They don't contain other logic for now.
|
|
/datum/computer_file/data
|
|
filetype = "DAT"
|
|
|
|
var/stored_data = "" // Stored data in string format.
|
|
var/block_size = 250
|
|
var/do_not_edit = FALSE // Whether the user will be reminded that the file probably shouldn't be edited.
|
|
|
|
/datum/computer_file/data/clone()
|
|
var/datum/computer_file/data/temp = ..()
|
|
temp.stored_data = stored_data
|
|
return temp
|
|
|
|
// Calculates file size from amount of characters in saved string
|
|
/datum/computer_file/data/proc/calculate_size()
|
|
size = max(1, round(length(stored_data) / block_size))
|
|
|
|
/datum/computer_file/data/proc/generate_file_data(mob/user)
|
|
return digitalPencode2html(stored_data)
|
|
|
|
/datum/computer_file/data/logfile
|
|
filetype = "LOG"
|
|
|
|
/datum/computer_file/data/text
|
|
filetype = "TXT"
|
|
|
|
/// Mapping tool - creates a named modular computer file in a computer's storage on late initialize.
|
|
/// Use this to do things like automatic records and blackboxes. Alternative for paper records.
|
|
/// Values can be in the editor for each map or as a subtype.
|
|
/// This is an obj because raw atoms can't be placed in DM or third-party mapping tools.
|
|
///obj/effect/computer_file_creator
|
|
// name = "computer file creator"
|
|
// desc = "This is a mapping tool used for installing text files onto a modular device when it's mapped on top of them. If you see it, it's bugged."
|
|
// icon = 'icons/effects/landmarks.dmi'
|
|
// icon_state = "x3"
|
|
// anchored = TRUE
|
|
// unacidable = TRUE
|
|
// simulated = FALSE
|
|
// invisibility = 101
|
|
// /// The name that the file will have once it's created.
|
|
// var/file_name = "helloworld"
|
|
// /// The contents of this file. Uses paper formatting.
|
|
// var/file_info = "Hello World!"
|
|
|
|
///obj/effect/computer_file_creator/Initialize(mapload)
|
|
// . = ..()
|
|
// return INITIALIZE_HINT_LATELOAD
|
|
|
|
///obj/effect/computer_file_creator/LateInitialize()
|
|
// var/turf/T = get_turf(src)
|
|
// for (var/obj/O in T)
|
|
// if (!istype(O, /obj/machinery/computer/modular) && !istype(O, /obj/item/modular_computer))
|
|
// continue
|
|
// var/datum/extension/interactive/ntos/os = get_extension(O, /datum/extension/interactive/ntos)
|
|
// if (os)
|
|
// os.create_data_file(file_name, file_info, /datum/computer_file/data/text)
|
|
// qdel(src)
|