diff --git a/code/modules/modular_computers/computers/item/computer_files.dm b/code/modules/modular_computers/computers/item/computer_files.dm index 6b6fbd179f2..b0ae073bdd6 100644 --- a/code/modules/modular_computers/computers/item/computer_files.dm +++ b/code/modules/modular_computers/computers/item/computer_files.dm @@ -39,7 +39,7 @@ stored_files.Remove(file_removing) used_capacity -= file_removing.size SEND_SIGNAL(src, COMSIG_MODULAR_COMPUTER_FILE_DELETE, file_removing) - SEND_SIGNAL(file_removing, COMSIG_COMPUTER_FILE_DELETE) + SEND_SIGNAL(file_removing, COMSIG_COMPUTER_FILE_DELETE, src) qdel(file_removing) return TRUE diff --git a/code/modules/modular_computers/computers/item/disks/maintenance_disks.dm b/code/modules/modular_computers/computers/item/disks/maintenance_disks.dm index 430c101668d..0fb2ccc2eef 100644 --- a/code/modules/modular_computers/computers/item/disks/maintenance_disks.dm +++ b/code/modules/modular_computers/computers/item/disks/maintenance_disks.dm @@ -25,3 +25,6 @@ /obj/item/computer_disk/maintenance/theme/Initialize(mapload) starting_programs = list(pick(subtypesof(/datum/computer_file/program/maintenance/theme))) return ..() + +/obj/item/computer_disk/maintenance/cool_sword + starting_programs = list(/datum/computer_file/program/maintenance/cool_sword) diff --git a/code/modules/modular_computers/file_system/programs/maintenance/cool_sword.dm b/code/modules/modular_computers/file_system/programs/maintenance/cool_sword.dm new file mode 100644 index 00000000000..1a05bf2ceba --- /dev/null +++ b/code/modules/modular_computers/file_system/programs/maintenance/cool_sword.dm @@ -0,0 +1,71 @@ +/datum/computer_file/program/maintenance/cool_sword + filename = "cool_sword" + filedesc = "NtOS Cursor Replacer" + power_cell_use = 0 + downloader_category = PROGRAM_CATEGORY_DEVICE + extended_desc = "This program allows you to customize your computer's mouse cursor, \ + but there's only one option, let's be honest. \ + Wear your PDA in your ID slot for it to take effect." + can_run_on_flags = PROGRAM_PDA + tgui_id = "NtosCursor" + program_open_overlay = "generic" + + /// What icon to use for the mouse pointer? + var/sword_icon = 'icons/effects/mouse_pointers/cool_sword.dmi' + +/datum/computer_file/program/maintenance/cool_sword/New() + . = ..() + RegisterSignal(src, COMSIG_COMPUTER_FILE_DELETE, PROC_REF(on_delete)) + +/datum/computer_file/program/maintenance/cool_sword/on_install(datum/computer_file/source, obj/item/modular_computer/computer_installing) + . = ..() + RegisterSignal(computer_installing, COMSIG_ITEM_EQUIPPED, PROC_REF(host_equipped)) + RegisterSignal(computer_installing, COMSIG_ITEM_DROPPED, PROC_REF(host_dropped)) + + if(ismob(computer_installing.loc)) + var/mob/living/computer_guy = computer_installing.loc + var/current_slot = computer_guy.get_slot_by_item(computer_installing) + host_equipped(computer_installing, computer_guy, current_slot) + +/datum/computer_file/program/maintenance/cool_sword/proc/on_delete(datum/source, obj/item/modular_computer/computer_uninstalling) + SIGNAL_HANDLER + + if(ismob(computer_uninstalling.loc)) + host_dropped(computer_uninstalling, computer_uninstalling.loc) + +/datum/computer_file/program/maintenance/cool_sword/proc/host_equipped(datum/source, mob/user, slot) + SIGNAL_HANDLER + + if(slot & ITEM_SLOT_ID) + user.client?.mouse_override_icon = sword_icon + RegisterSignal(user, COMSIG_MOB_LOGIN, PROC_REF(update_mouse), override = TRUE) + RegisterSignal(user, COMSIG_MOB_LOGOUT, PROC_REF(stop_mouse), override = TRUE) + else + // Shouldn't be necessary w/ dropped but just to be safe + user.client?.mouse_override_icon = null + UnregisterSignal(user, list(COMSIG_MOB_LOGIN, COMSIG_MOB_LOGOUT)) + user.update_mouse_pointer() + +/datum/computer_file/program/maintenance/cool_sword/proc/host_dropped(datum/source, mob/user) + SIGNAL_HANDLER + + user.client?.mouse_override_icon = null + UnregisterSignal(user, list(COMSIG_MOB_LOGIN, COMSIG_MOB_LOGOUT)) + user.update_mouse_pointer() + +/datum/computer_file/program/maintenance/cool_sword/proc/update_mouse(mob/source) + SIGNAL_HANDLER + + source.client?.mouse_override_icon = sword_icon + source.update_mouse_pointer() + +/datum/computer_file/program/maintenance/cool_sword/proc/stop_mouse(mob/source) + SIGNAL_HANDLER + + source.canon_client?.mouse_override_icon = null + source.canon_client?.mob?.update_mouse_pointer() + +/datum/computer_file/program/maintenance/cool_sword/ui_static_data(mob/user) + var/list/data = list() + data["dmi"] = list("icon" = sword_icon, "icon_state" = "") + return data diff --git a/icons/effects/mouse_pointers/cool_sword.dmi b/icons/effects/mouse_pointers/cool_sword.dmi new file mode 100644 index 00000000000..a34fa56d87d Binary files /dev/null and b/icons/effects/mouse_pointers/cool_sword.dmi differ diff --git a/tgstation.dme b/tgstation.dme index 0ea8dd2e156..0661a0c0e57 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -5257,6 +5257,7 @@ #include "code\modules\modular_computers\file_system\programs\chatroom\ntnrc_client.dm" #include "code\modules\modular_computers\file_system\programs\maintenance\_maintenance_program.dm" #include "code\modules\modular_computers\file_system\programs\maintenance\camera.dm" +#include "code\modules\modular_computers\file_system\programs\maintenance\cool_sword.dm" #include "code\modules\modular_computers\file_system\programs\maintenance\modsuit.dm" #include "code\modules\modular_computers\file_system\programs\maintenance\phys_scanner.dm" #include "code\modules\modular_computers\file_system\programs\maintenance\spectre_meter.dm" diff --git a/tgui/packages/tgui/interfaces/NtosCursor.tsx b/tgui/packages/tgui/interfaces/NtosCursor.tsx new file mode 100644 index 00000000000..6c62df26a17 --- /dev/null +++ b/tgui/packages/tgui/interfaces/NtosCursor.tsx @@ -0,0 +1,63 @@ +import { useState } from 'react'; + +import { useBackend } from '../backend'; +import { Button, DmIcon, NoticeBox, Section, Stack } from '../components'; +import { NtosWindow } from '../layouts'; + +type Data = { + dmi: { + icon: string; + icon_state: string; + }; +}; + +export const NtosCursor = () => { + const { data } = useBackend(); + + const { dmi } = data; + + const [numClicked, incrementClicked] = useState(0); + + const NoticeBoxText = () => { + if (numClicked <= 2) { + return `There's only one option... It's the sword.`; + } else if (numClicked === 3) { + return `You clicked the sword. It's still the sword.`; + } else if (numClicked === 4) { + return `You clicked the sword again. It's still the sword.`; + } else if (numClicked === 5) { + return `Trying to click the sword again? It's still the sword.`; + } + return `You clicked the sword ${numClicked} times... It's still the sword.`; + }; + + return ( + + +
+ + + + + + {NoticeBoxText()} + + +
+
+
+ ); +};