Modular Tablets: Converting PDAs to the NtOS System (#65755)

Converts PDA functions and applications over to modular tablets and devices, namely the messaging function. HREF data code is quite honestly clunky and difficult to work with, as I've definitely experienced whilst working on this. By moving from this system over the easier to read (and frankly, easier to add to) TGUI system, you get cleaner looking and more user friendly UIs and a greater degree of standardization amongst other UIs.

Co-authored-by: Seth Scherer <supernovaa41@gmx.com>
Co-authored-by: GoldenAlpharex <58045821+GoldenAlpharex@users.noreply.github.com>
Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
This commit is contained in:
magatsuchi
2022-04-20 03:08:41 +03:00
committed by GitHub
co-authored by Seth Scherer GoldenAlpharex Aleksej Komarov
parent ee7f0d0a60
commit cd1b891d79
146 changed files with 2733 additions and 3321 deletions
@@ -7,6 +7,8 @@
device_type = MC_CARD
var/obj/item/card/id/stored_card
var/current_identification = null
var/current_job = null
///What happens when the ID card is removed (or deleted) from the module, through try_eject() or not.
/obj/item/computer_hardware/card_slot/Exited(atom/movable/gone, direction)
@@ -76,6 +78,10 @@
stored_card = I
to_chat(user, span_notice("You insert \the [I] into \the [expansion_hw ? "secondary":"primary"] [src]."))
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, FALSE)
holder.update_appearance()
current_identification = stored_card.registered_name
current_job = stored_card.assignment
var/holder_loc = holder.loc
if(ishuman(holder_loc))
@@ -99,6 +105,11 @@
to_chat(user, span_notice("You remove the card from \the [src]."))
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, FALSE)
holder.update_appearance()
stored_card = null
current_identification = null
current_job = null
return TRUE
@@ -9,6 +9,7 @@
var/max_capacity = 128
var/used_capacity = 0
var/list/stored_files = list() // List of stored files on this drive. DO NOT MODIFY DIRECTLY!
var/default_installs = TRUE // install the default progs
/obj/item/computer_hardware/hard_drive/on_remove(obj/item/modular_computer/remove_from, mob/user)
remove_from.shutdown_computer()
@@ -130,7 +131,9 @@
/obj/item/computer_hardware/hard_drive/Initialize(mapload)
. = ..()
install_default_programs()
if(default_installs)
install_default_programs()
/obj/item/computer_hardware/hard_drive/advanced
@@ -167,12 +170,25 @@
w_class = WEIGHT_CLASS_TINY
custom_price = PAYCHECK_MEDIUM * 2
/obj/item/computer_hardware/hard_drive/small/install_default_programs()
. = ..()
store_file(new /datum/computer_file/program/messenger(src))
store_file(new /datum/computer_file/program/notepad(src))
// For borg integrated tablets. No downloader.
/obj/item/computer_hardware/hard_drive/small/integrated/install_default_programs()
var/datum/computer_file/program/messenger/messenger = new(src)
messenger.is_silicon = TRUE
store_file(messenger)
/obj/item/computer_hardware/hard_drive/small/integrated/borg/install_default_programs()
store_file(new /datum/computer_file/program/computerconfig(src)) // Computer configuration utility, allows hardware control and displays more info than status bar
store_file(new /datum/computer_file/program/filemanager(src)) // File manager, allows text editor functions and basic file manipulation.
store_file(new /datum/computer_file/program/robotact(src))
var/datum/computer_file/program/messenger/messenger = new(src)
messenger.is_silicon = TRUE
store_file(messenger)
// Syndicate variant - very slight better
/obj/item/computer_hardware/hard_drive/small/syndicate
@@ -0,0 +1,13 @@
/obj/item/computer_hardware/identifier
name = "identifier"
desc = "Used to automatically update the names of modular devices."
power_usage = 0
w_class = WEIGHT_CLASS_TINY
device_type = MC_IDENTIFY
expansion_hw = FALSE
/obj/item/computer_hardware/identifier/proc/UpdateDisplay()
var/name = holder.saved_identification
var/job = holder.saved_job
holder.name = "[name] ([job])"
@@ -0,0 +1,253 @@
/obj/item/computer_hardware/hard_drive/role
name = "job data disk"
desc = "A disk meant to give a worker the needed programs to work."
power_usage = 0
icon_state = "datadisk6"
w_class = WEIGHT_CLASS_TINY
critical = FALSE
max_capacity = 500
device_type = MC_HDD_JOB
default_installs = FALSE
var/disk_flags = 0 // bit flag for the programs
var/can_spam = FALSE
var/list/bot_access = list()
/obj/item/computer_hardware/hard_drive/role/on_remove(obj/item/modular_computer/remove_from, mob/user)
return
/obj/item/computer_hardware/hard_drive/role/Initialize(mapload)
. = ..()
var/list/progs_to_store = list()
if(disk_flags & DISK_POWER)
progs_to_store += new /datum/computer_file/program/power_monitor(src)
progs_to_store += new /datum/computer_file/program/supermatter_monitor(src)
if(disk_flags & DISK_ATMOS)
progs_to_store += new /datum/computer_file/program/atmosscan(src)
if(disk_flags & DISK_MANIFEST)
progs_to_store += new /datum/computer_file/program/crew_manifest(src)
if(disk_flags & DISK_SEC)
progs_to_store += new /datum/computer_file/program/records/security(src)
if(disk_flags & DISK_JANI)
progs_to_store += new /datum/computer_file/program/radar/custodial_locator(src)
if((disk_flags & DISK_CHEM) || (disk_flags & DISK_MED))
var/datum/computer_file/program/phys_scanner/scanner = new(src)
if(disk_flags & DISK_CHEM)
scanner.available_modes += DISK_CHEM
if(disk_flags & DISK_MED)
progs_to_store += new /datum/computer_file/program/records/medical(src)
scanner.available_modes += DISK_MED
progs_to_store += scanner
if(disk_flags & DISK_ROBOS)
var/datum/computer_file/program/robocontrol/robo = new(src)
robo.cart_mode = TRUE
progs_to_store += robo
if(disk_flags & DISK_CARGO)
progs_to_store += new /datum/computer_file/program/shipping(src)
if(disk_flags & DISK_SIGNAL)
progs_to_store += new /datum/computer_file/program/signaler(src)
if(disk_flags & DISK_NEWS)
progs_to_store += new /datum/computer_file/program/newscaster(src)
if(disk_flags & DISK_BUDGET)
progs_to_store += new /datum/computer_file/program/budgetorders(src)
if(disk_flags & DISK_STATUS)
progs_to_store += new /datum/computer_file/program/status(src)
for (var/datum/computer_file/program/prog in progs_to_store)
prog.usage_flags = PROGRAM_ALL
prog.required_access = list()
prog.transfer_access = list()
store_file(prog)
/obj/item/computer_hardware/hard_drive/role/proc/CanSpam()
return can_spam
// Disk Definitions
/obj/item/computer_hardware/hard_drive/role/engineering
name = "Power-ON disk"
desc = "Engineers ignoring station power-draw since 2400."
icon_state = "datadisk2"
disk_flags = DISK_POWER
/obj/item/computer_hardware/hard_drive/role/atmos
name = "\improper BreatheDeep disk"
icon_state = "datadisk2"
disk_flags = DISK_ATMOS | DISK_ROBOS
bot_access = list(
FLOOR_BOT,
FIRE_BOT,
)
/obj/item/computer_hardware/hard_drive/role/medical
name = "\improper Med-U disk"
icon_state = "datadisk7"
disk_flags = DISK_MED | DISK_ROBOS
bot_access = list(
MED_BOT,
)
/obj/item/computer_hardware/hard_drive/role/chemistry
name = "\improper ChemWhiz disk"
icon_state = "datadisk7"
disk_flags = DISK_CHEM
/obj/item/computer_hardware/hard_drive/role/security
name = "\improper R.O.B.U.S.T. disk"
icon_state = "datadisk9"
disk_flags = DISK_SEC | DISK_MANIFEST | DISK_ROBOS
bot_access = list(
SEC_BOT,
ADVANCED_SEC_BOT,
)
/obj/item/computer_hardware/hard_drive/role/detective
name = "\improper D.E.T.E.C.T. disk"
icon_state = "datadisk9"
disk_flags = DISK_MED | DISK_SEC | DISK_MANIFEST | DISK_ROBOS
bot_access = list(
SEC_BOT,
ADVANCED_SEC_BOT,
)
/obj/item/computer_hardware/hard_drive/role/janitor
name = "\improper CustodiPRO disk"
icon_state = "datadisk5"
desc = "The ultimate in clean-room design."
disk_flags = DISK_JANI | DISK_ROBOS
bot_access = list(
CLEAN_BOT,
)
/obj/item/computer_hardware/hard_drive/role/lawyer
name = "\improper P.R.O.V.E. disk"
icon_state = "datadisk9"
disk_flags = DISK_SEC
can_spam = TRUE
/obj/item/computer_hardware/hard_drive/role/curator
name = "\improper Lib-Tweet disk"
icon_state = "datadisk2"
disk_flags = DISK_NEWS
/obj/item/computer_hardware/hard_drive/role/roboticist
name = "\improper B.O.O.P. Remote Control disk"
icon_state = "datadisk5"
desc = "Packed with heavy duty quad-bot interlink!"
disk_flags = DISK_ROBOS
bot_access = list(
FLOOR_BOT,
CLEAN_BOT,
MED_BOT,
FIRE_BOT,
VIBE_BOT,
)
/obj/item/computer_hardware/hard_drive/role/signal
name = "generic signaler disk"
icon_state = "datadisk5"
desc = "A data disk with an integrated radio signaler module."
disk_flags = DISK_SIGNAL
/obj/item/computer_hardware/hard_drive/role/signal/ordnance
name = "\improper Signal Ace 2 disk"
icon_state = "datadisk5"
desc = "Complete with integrated radio signaler!"
disk_flags = DISK_ATMOS | DISK_SIGNAL | DISK_CHEM
/obj/item/computer_hardware/hard_drive/role/quartermaster
name = "space parts & space vendors disk"
icon_state = "datadisk0"
desc = "Perfect for the Quartermaster on the go!"
disk_flags = DISK_CARGO | DISK_ROBOS | DISK_BUDGET
bot_access = list(
MULE_BOT,
)
/obj/item/computer_hardware/hard_drive/role/head
name = "\improper Easy-Record DELUXE disk"
icon_state = "datadisk7"
disk_flags = DISK_MANIFEST | DISK_STATUS | DISK_BUDGET
/obj/item/computer_hardware/hard_drive/role/hop
name = "\improper HumanResources9001 disk"
icon_state = "datadisk7"
disk_flags = DISK_MANIFEST | DISK_STATUS | DISK_JANI | DISK_SEC | DISK_NEWS | DISK_CARGO | DISK_ROBOS | DISK_BUDGET
bot_access = list(
MULE_BOT,
CLEAN_BOT,
VIBE_BOT,
)
/obj/item/computer_hardware/hard_drive/role/hos
name = "\improper R.O.B.U.S.T. DELUXE disk"
icon_state = "datadisk7"
disk_flags = DISK_MANIFEST | DISK_STATUS | DISK_SEC | DISK_ROBOS | DISK_BUDGET
bot_access = list(
SEC_BOT,
ADVANCED_SEC_BOT,
)
/obj/item/computer_hardware/hard_drive/role/ce
name = "\improper Power-On DELUXE disk"
icon_state = "datadisk7"
disk_flags = DISK_POWER | DISK_ATMOS | DISK_MANIFEST | DISK_STATUS | DISK_ROBOS | DISK_BUDGET
bot_access = list(
FLOOR_BOT,
FIRE_BOT,
)
/obj/item/computer_hardware/hard_drive/role/cmo
name = "\improper Med-U DELUXE disk"
icon_state = "datadisk7"
disk_flags = DISK_MANIFEST | DISK_STATUS | DISK_CHEM | DISK_ROBOS | DISK_BUDGET
bot_access = list(
MED_BOT,
)
/obj/item/computer_hardware/hard_drive/role/rd
name = "\improper Signal Ace DELUXE disk"
icon_state = "rndmajordisk"
disk_flags = DISK_ATMOS | DISK_MANIFEST | DISK_STATUS | DISK_CHEM | DISK_ROBOS | DISK_BUDGET | DISK_SIGNAL
bot_access = list(
FLOOR_BOT,
CLEAN_BOT,
MED_BOT,
FIRE_BOT,
VIBE_BOT,
)
/obj/item/computer_hardware/hard_drive/role/captain
name = "\improper Value-PAK disk"
icon_state = "datadisk8"
desc = "Now with 350% more value!" //Give the Captain...EVERYTHING! (Except Mime, Clown, and Syndie)
disk_flags = ~0
can_spam = TRUE
bot_access = list(
SEC_BOT,
ADVANCED_SEC_BOT,
MULE_BOT,
FLOOR_BOT,
CLEAN_BOT,
MED_BOT,
FIRE_BOT,
VIBE_BOT,
)
@@ -88,10 +88,12 @@
if(!modularInterface.borgo)
return FALSE //No borg found
if(modularInterface.borgo.lockcharge)
return FALSE //lockdown restricts borg networking
var/mob/living/silicon/robot/robo = modularInterface.borgo
if(istype(robo))
if(robo.lockcharge)
return FALSE //lockdown restricts borg networking
if(!modularInterface.borgo.cell || modularInterface.borgo.cell.charge == 0)
return FALSE //borg cell dying restricts borg networking
if(!robo.cell || robo.cell.charge == 0)
return FALSE //borg cell dying restricts borg networking
return ..()
@@ -0,0 +1,140 @@
/obj/item/computer_hardware/hard_drive/role/virus
name = "\improper generic virus disk"
icon_state = "virusdisk"
var/charges = 5
/obj/item/computer_hardware/hard_drive/role/virus/proc/send_virus(obj/item/modular_computer/tablet/target, mob/living/user)
return
/obj/item/computer_hardware/hard_drive/role/virus/clown
name = "\improper H.O.N.K. disk"
/obj/item/computer_hardware/hard_drive/role/virus/clown/send_virus(obj/item/modular_computer/tablet/target, mob/living/user)
if(charges <= 0)
to_chat(user, span_notice("ERROR: Out of charges."))
return
if(target)
user.show_message(span_notice("Success!"))
charges--
target.honkamnt = rand(15, 25)
else
to_chat(user, span_notice("ERROR: Could not find device."))
/obj/item/computer_hardware/hard_drive/role/virus/mime
name = "\improper sound of silence disk"
/obj/item/computer_hardware/hard_drive/role/virus/mime/send_virus(obj/item/modular_computer/tablet/target, mob/living/user)
if(charges <= 0)
to_chat(user, span_notice("ERROR: Out of charges."))
return
if(target)
user.show_message(span_notice("Success!"))
charges--
var/obj/item/computer_hardware/hard_drive/drive = target.all_components[MC_HDD]
for(var/datum/computer_file/program/messenger/app in drive.stored_files)
app.ringer_status = FALSE
app.ringtone = ""
else
to_chat(user, span_notice("ERROR: Could not find device."))
/obj/item/computer_hardware/hard_drive/role/virus/deto
name = "\improper D.E.T.O.M.A.T.I.X. disk"
charges = 6
/obj/item/computer_hardware/hard_drive/role/virus/deto/send_virus(obj/item/modular_computer/tablet/target, mob/living/user)
if(charges <= 0)
to_chat(user, span_notice("ERROR: Out of charges."))
return
var/difficulty = 0
var/obj/item/computer_hardware/hard_drive/role/disk = target.all_components[MC_HDD_JOB]
if(disk)
difficulty += bit_count(disk.disk_flags & (DISK_MED | DISK_SEC | DISK_POWER | DISK_MANIFEST))
if(disk.disk_flags & DISK_MANIFEST)
difficulty++ //if cartridge has manifest access it has extra snowflake difficulty
if(SEND_SIGNAL(target, COMSIG_TABLET_CHECK_DETONATE) & COMPONENT_TABLET_NO_DETONATE || prob(difficulty * 15))
user.show_message(span_danger("ERROR: Target could not be bombed."), MSG_VISUAL)
charges--
return
var/original_host = holder
var/fakename = sanitize_name(tgui_input_text(user, "Enter a name for the rigged message.", "Forge Message", max_length = MAX_NAME_LEN), allow_numbers = TRUE)
if(!fakename || holder != original_host || !user.canUseTopic(holder, BE_CLOSE))
return
var/fakejob = sanitize_name(tgui_input_text(user, "Enter a job for the rigged message.", "Forge Message", max_length = MAX_NAME_LEN), allow_numbers = TRUE)
if(!fakejob || holder != original_host || !user.canUseTopic(holder, BE_CLOSE))
return
var/obj/item/computer_hardware/hard_drive/drive = holder.all_components[MC_HDD]
for(var/datum/computer_file/program/messenger/app in drive.stored_files)
if(charges > 0 && app.send_message(user, list(target), rigged = REF(user), fake_name = fakename, fake_job = fakejob))
charges--
user.show_message(span_notice("Success!"))
var/reference = REF(src)
ADD_TRAIT(target, TRAIT_PDA_CAN_EXPLODE, reference)
ADD_TRAIT(target, TRAIT_PDA_MESSAGE_MENU_RIGGED, reference)
addtimer(TRAIT_CALLBACK_REMOVE(target, TRAIT_PDA_MESSAGE_MENU_RIGGED, reference), 10 SECONDS)
/obj/item/computer_hardware/hard_drive/role/virus/frame
name = "\improper F.R.A.M.E. disk"
var/telecrystals = 0
var/current_progression = 0
/obj/item/computer_hardware/hard_drive/role/virus/frame/send_virus(obj/item/modular_computer/tablet/target, mob/living/user)
if(charges <= 0)
to_chat(user, span_notice("ERROR: Out of charges."))
return
if(target)
charges--
var/lock_code = "[rand(100,999)] [pick(GLOB.phonetic_alphabet)]"
to_chat(user, span_notice("Success! The unlock code to the target is: [lock_code]"))
var/datum/component/uplink/hidden_uplink = target.GetComponent(/datum/component/uplink)
if(!hidden_uplink)
var/datum/mind/target_mind
var/list/backup_players = list()
for(var/datum/mind/player as anything in get_crewmember_minds())
if(player.assigned_role?.title == target.saved_job)
backup_players += player
if(player.name == target.saved_identification)
target_mind = player
break
if(!target_mind)
if(!length(backup_players))
target_mind = user.mind
else
target_mind = pick(backup_players)
hidden_uplink = target.AddComponent(/datum/component/uplink, target_mind, enabled = TRUE, starting_tc = telecrystals, has_progression = TRUE)
hidden_uplink.uplink_handler.has_objectives = TRUE
hidden_uplink.uplink_handler.owner = target_mind
hidden_uplink.uplink_handler.can_take_objectives = FALSE
hidden_uplink.uplink_handler.progression_points = min(SStraitor.current_global_progression, current_progression)
hidden_uplink.uplink_handler.generate_objectives()
SStraitor.register_uplink_handler(hidden_uplink.uplink_handler)
else
hidden_uplink.add_telecrystals(telecrystals)
telecrystals = 0
hidden_uplink.locked = FALSE
hidden_uplink.active = TRUE
else
to_chat(user, span_notice("ERROR: Could not find device."))
/obj/item/computer_hardware/hard_drive/role/virus/frame/attackby(obj/item/I, mob/user, params)
. = ..()
if(istype(I, /obj/item/stack/telecrystal))
if(!charges)
to_chat(user, span_notice("[src] is out of charges, it's refusing to accept [I]."))
return
var/obj/item/stack/telecrystal/telecrystalStack = I
telecrystals += telecrystalStack.amount
to_chat(user, span_notice("You slot [telecrystalStack] into [src]. The next time it's used, it will also give telecrystals."))
telecrystalStack.use(telecrystalStack.amount)