Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working with p(r)ogs [Probably needs public testing] #36

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6a9736e
Update .gitattributes
MrCastmer Feb 29, 2024
9072537
Revert "Update .gitattributes"
MrCastmer Feb 29, 2024
6328efd
budgetordering
MrCastmer Mar 19, 2024
131d7d1
Merge branch 'master' into working-with-progs
MrCastmer Mar 19, 2024
5d2dfe6
fix
MrCastmer Mar 20, 2024
70a9c82
pda cartridge prototype
Blundir Mar 20, 2024
4baeb98
hard restart ui ma
MrCastmer Mar 21, 2024
ff264e9
fix
MrCastmer Mar 21, 2024
1dce01a
pda fixes
Blundir Mar 22, 2024
80161a1
Merge branch 'master' into working-with-progs
MrCastmer Mar 27, 2024
3090040
Merge branch 'master' into working-with-progs
MrCastmer Mar 27, 2024
05cd6ff
work?
MrCastmer Apr 5, 2024
7f6b711
Merge branch 'master' into working-with-progs
MrCastmer Apr 6, 2024
c14bec6
Merge branch 'master' into working-with-progs
MrCastmer Apr 9, 2024
0594129
Merge branch 'master' into working-with-progs
MrCastmer Apr 9, 2024
22c68a4
Update includes.dm
MrCastmer Apr 9, 2024
aaf87ec
Update includes.dm
MrCastmer Apr 10, 2024
3a38127
Merge branch 'master' into working-with-progs
MrCastmer Apr 12, 2024
6c6dadd
Merge branch 'master' into working-with-progs
MrCastmer Apr 12, 2024
b3cf044
Merge branch 'master' into working-with-progs
MrCastmer Apr 19, 2024
a2efeab
Merge branch 'master' into working-with-progs
MrCastmer Apr 26, 2024
08a9930
Merge branch 'master' into working-with-progs
MrCastmer Apr 26, 2024
c6eb561
Merge branch 'master' into working-with-progs
MrCastmer Jul 18, 2024
934ef54
Merge branch 'master' into working-with-progs
MrCastmer Jul 18, 2024
b49671f
Merge branch 'master' into working-with-progs
MrCastmer Aug 8, 2024
798e76c
Merge branch 'master' into working-with-progs
MrCastmer Aug 15, 2024
e16140b
Merge branch 'master' into working-with-progs
MrCastmer Aug 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions code/__DEFINES/{dripstation_defines}/devices.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Role disk defines

#define DISK_POWER (1<<0)
#define DISK_ATMOS (1<<1)
#define DISK_MED (1<<2)
#define DISK_CHEM (1<<3)
#define DISK_MANIFEST (1<<4)
#define DISK_NEWSCASTER (1<<5)
#define DISK_SIGNAL (1<<6)
#define DISK_STATUS (1<<7)
#define DISK_CARGO (1<<8)
#define DISK_ROBOS (1<<9)
#define DISK_JANI (1<<10)
#define DISK_SEC (1<<11)
#define DISK_BUDGET (1<<12)
#define DISK_REMOTE_AIRLOCK (1<<13)
#define DISK_SILO_LOG (1<<14)
#define DISK_HOP (1<<15)
4 changes: 4 additions & 0 deletions code/__DEFINES/{dripstation_defines}/machines.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//Modular computer/NTNet defines

//Modular computer part defines
#define MC_HDD_JOB "HDD_JOB"
31 changes: 31 additions & 0 deletions code/modules/modular_computers/computers/item/computer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@
light_color = "#FFFFFF"
light_on = FALSE

//DRIPSTATION EDIT START
/// The currently imprinted ID.
var/saved_identification = null
/// The currently imprinted job.
var/saved_job = null
/// If the saved info should auto-update
var/saved_auto_imprint = TRUE
/// Can we toggle imprints or not
var/show_us_imprint = TRUE
//DRIPSTATION EDIT END
/// List of "connection ports" in this computer and the components with which they are plugged
var/list/all_components = list()
/// Lazy List of extra hardware slots that can be used modularly.
Expand Down Expand Up @@ -101,6 +111,24 @@
install_starting_files()
update_appearance()

//DRIPSTATION EDIT START

/obj/item/modular_computer/proc/update_identification()
var/obj/item/computer_hardware/card_slot/cardholder = all_components[MC_CARD]
if(!saved_auto_imprint || !cardholder || istype(active_program, /datum/computer_file/program/card_mod))
return
var/obj/item/card/id/stored_card = cardholder.GetID()
if(!stored_card.registered_name || !stored_card.assignment)
return
if(stored_card.registered_name == saved_identification && stored_card.assignment == saved_job)
return
saved_identification = stored_card.registered_name
saved_job = stored_card.assignment
update_appearance()
playsound(src, 'sound/machines/terminal_prompt.ogg', 15, TRUE)
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(playsound), src, 'sound/machines/terminal_prompt_confirm.ogg', 15, TRUE), 1.3 SECONDS)
//DRIPSTATION EDIT END

/obj/item/modular_computer/Destroy()
kill_program(forced = TRUE)
STOP_PROCESSING(SSobj, src)
Expand Down Expand Up @@ -195,6 +223,7 @@
return FALSE

if((card_slot?.try_insert(inserting_id)) || (card_slot2?.try_insert(inserting_id)))
update_identification()
update_appearance(UPDATE_ICON)
return TRUE
//to_chat(user, "<span class='warning'>This computer doesn't have an open card slot.</span>")
Expand All @@ -206,6 +235,7 @@
return card_slot.GetID()
return ..()

/* Yog moment
/obj/item/modular_computer/RemoveID()
var/obj/item/computer_hardware/card_slot/card_slot = all_components[MC_CARD]
if(!card_slot)
Expand All @@ -220,6 +250,7 @@
if(!inserting_id)
return FALSE
return card_slot.try_insert(inserting_id)
*/

/obj/item/modular_computer/MouseDrop(obj/over_object, src_location, over_location)
var/mob/M = usr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,20 @@
to_chat(user, "<span class='warning'>The computer immediately ejects /the [try_install] and flashes an error: \"Hardware Address Conflict\".</span>")
return FALSE

/* //Dripstation edit
if(all_components[try_install.device_type])
to_chat(user, span_warning("This computer's hardware slot is already occupied by \the [all_components[try_install.device_type]]."))
return FALSE
return TRUE
*/

//DRIPSTATION EDIT START
var/obj/item/computer_hardware/existing = all_components[try_install.device_type]
if(existing && (!istype(existing) || !existing.hotswap))
to_chat(user, "<span class='warning'>This computer's hardware slot is already occupied by \the [existing].</span>")
return FALSE
return TRUE
//DRIPSTATION EDIT END

/// Installs component.
/obj/item/modular_computer/proc/install_component(obj/item/computer_hardware/install, mob/living/user = null)
Expand All @@ -28,6 +37,16 @@
if(user && !user.transferItemToLoc(install, src))
return FALSE

//DRIPSTATION EDIT START
var/obj/item/computer_hardware/existing = all_components[install.device_type]
if(istype(existing) && existing.hotswap)
if(!uninstall_component(existing, user, TRUE))
// ABORT!!
install.forceMove(get_turf(user))
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50)
return FALSE
//DRIPSTATION EDIT END

if(install.expansion_hw)
LAZYSET(expansion_bays, install.device_type, install)
all_components[install.device_type] = install
Expand Down
79 changes: 79 additions & 0 deletions code/modules/modular_computers/computers/item/computer_ui.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
headername = "Syndix Main Menu"
else
headername = "NtOS Main Menu"
/*
ui = new(user, src, "NtosMain", headername, 400, 500)
*/
ui = new(user, src, "NtosMain", headername, 500, 600)
if(ui.open())
ui.send_asset(get_asset_datum(/datum/asset/simple/headers))

Expand All @@ -51,9 +54,12 @@
data["device_theme"] = device_theme
data["login"] = list()
var/obj/item/computer_hardware/card_slot/cardholder = all_components[MC_CARD]
var/obj/item/computer_hardware/hard_drive/role/ssd = all_components[MC_HDD_JOB] //Dripstation edit
data["cardholder"] = FALSE

if(cardholder)
data["cardholder"] = TRUE
data["auto_imprint"] = saved_auto_imprint //dripstation edit
var/obj/item/card/id/stored_card = cardholder.GetID()
if(stored_card)
var/stored_name = stored_card.registered_name
Expand All @@ -62,10 +68,33 @@
stored_name = "Unknown"
if(!stored_title)
stored_title = "Unknown"
//DRIPSTATION EDIT START
/*
data["login"] = list(
*/
data["proposed_login"] = list(
IDName = stored_name,
IDJob = stored_title,
)
//DRIPSTATION EDIT START
data["login"] = list(
IDName = saved_identification,
IDJob = saved_job,
)
//DRIPSTATION EDIT END

//DRIPSTATION EDIT START
if(ssd)
data["disk"] = ssd
data["disk_name"] = ssd.name

for(var/datum/computer_file/program/prog in ssd.stored_files)
var/background_running = FALSE
if(prog in idle_threads)
background_running = TRUE

data["disk_programs"] += list(list("name" = prog.filename, "desc" = prog.filedesc, "running" = background_running, "icon" = prog.program_icon, "alert" = prog.alert_pending))
//DRIPSTATION EDIT END

data["removable_media"] = list()
if(all_components[MC_SDD])
Expand All @@ -92,8 +121,18 @@
return data


//DRIPSTATION EDIT START
/obj/item/modular_computer/ui_static_data(mob/user)
var/list/data = ..()
data["show_imprint"] = show_us_imprint
return data
//DRIPSTATION EDIT END

// Handles user's GUI input
/*
/obj/item/modular_computer/ui_act(action, params)
*/
/obj/item/modular_computer/ui_act(action, params, datum/tgui/ui) //dripstation edit
if(..())
return
var/obj/item/computer_hardware/hard_drive/hard_drive = all_components[MC_HDD]
Expand Down Expand Up @@ -137,9 +176,16 @@
if("PC_runprogram")
var/prog = params["name"]
var/datum/computer_file/program/P = null
var/is_disk = params["is_disk"] //Dripstation edit
var/obj/item/computer_hardware/hard_drive/role/ssd = all_components[MC_HDD_JOB] //Dripstation edit
var/mob/user = usr
/*
if(hard_drive)
*/
if(hard_drive && !is_disk) //Dripstation edit
P = hard_drive.find_file_by_name(prog)
if(ssd && is_disk) //Dripstation edit
P = ssd.find_file_by_name(prog) //Dripstation edit
play_interact_sound()
if(!P || !istype(P)) // Program not found or it's not executable program.
to_chat(user, span_danger("\The [src]'s screen shows \"I/O ERROR - Unable to run program\" warning."))
Expand Down Expand Up @@ -203,6 +249,16 @@
if(uninstall_component(portable_drive, usr))
user.put_in_hands(portable_drive)
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50)
//DRIPSTATION EDIT START
if("job disk")
var/obj/item/computer_hardware/hard_drive/role/ssd = all_components[MC_HDD_JOB]
if(!ssd)
return
if(uninstall_component(ssd, usr, TRUE))
user.put_in_hands(ssd)
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50)
return TRUE
//DRIPSTATION EDIT END
if("intelliCard")
var/obj/item/computer_hardware/ai_slot/intelliholder = all_components[MC_AI]
if(!intelliholder)
Expand All @@ -222,6 +278,29 @@
cardholder.try_eject(user)
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50)

//DRIPSTATION EDIT START
if(user && istype(user) && ui)
ui.close()
ui_interact(user)
update_appearance(UPDATE_ICON)
if("PC_Imprint_ID")
var/obj/item/computer_hardware/card_slot/cardholder = all_components[MC_CARD]
if(!cardholder)
return
var/obj/item/card/id/stored_card = cardholder.GetID()
saved_identification = stored_card.registered_name
saved_job = stored_card.assignment

update_appearance(UPDATE_ICON)

playsound(src, 'sound/machines/terminal_prompt.ogg', 15, TRUE)
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(playsound), src, 'sound/machines/terminal_prompt_confirm.ogg', 15, TRUE), 1.3 SECONDS)

if("PC_Toggle_Auto_Imprint")
saved_auto_imprint = !saved_auto_imprint
if(saved_auto_imprint)
update_identification()
//DRIPSTATION EDIT END

else
return
Expand Down
20 changes: 20 additions & 0 deletions code/modules/modular_computers/computers/item/tablet/tablet.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,26 @@
else
return ..()

///MOVE TO MODULE///MOVE TO MODULE///MOVE TO MODULE///MOVE TO MODULE///MOVE TO MODULE///MOVE TO MODULE///MOVE TO MODULE
/obj/item/modular_computer/tablet/pre_attack(atom/target, mob/living/user, params)
var/obj/item/computer_hardware/hard_drive/role/job_disk = all_components[MC_HDD_JOB]
if(istype(job_disk) && !job_disk.process_pre_attack(target, user, params))
return FALSE
return ..()

// Eject Job Disk
/obj/item/modular_computer/tablet/CtrlShiftClick(mob/user)
..()
// We want to allow the user to drag the tablet still
if(isturf(loc) || issilicon(user) || !user.canUseTopic(src, BE_CLOSE))
return
var/obj/item/computer_hardware/hard_drive/role/disk = all_components[MC_HDD_JOB]
if(istype(disk))
uninstall_component(disk, user, TRUE)
user.put_in_hands(disk)
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50)
///MOVE TO MODULE///MOVE TO MODULE///MOVE TO MODULE///MOVE TO MODULE///MOVE TO MODULE///MOVE TO MODULE///MOVE TO MODULE

/obj/item/modular_computer/tablet/update_icon_state()
. = ..()
if (!isnull(variants))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"Head of Security",
"Chief Engineer",
"Research Director",
"Quartermaster",
"Chief Medical Officer")

//The scaling factor of max total positions in relation to the total amount of people on board the station in %
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
///Is it being bought from a departmental budget?
var/budget_order = FALSE
///If this is true, unlock the ability to order through budgets
/* dripstation edit
var/unlock_budget = TRUE
*/
var/unlock_budget = FALSE

/datum/computer_file/program/budgetorders/proc/get_export_categories()
. = EXPORT_CARGO
Expand Down Expand Up @@ -75,15 +78,31 @@
var/obj/item/computer_hardware/card_slot/card_slot = computer.all_components[MC_CARD]
var/obj/item/card/id/id_card = card_slot?.GetID()
if(id_card?.registered_account)
/* //dripstation edit
unlock_budget = TRUE
*/
if(ACCESS_HEADS in id_card.access) //you are head, you can purchase with dep budget, dripstation edit
unlock_budget = TRUE //dripstation edit
if(id_card?.registered_account?.account_job?.paycheck_department == ACCOUNT_CAR)
unlock_budget = FALSE //cargo tech is already using the same budget.
if(id_card?.registered_account?.account_job?.paycheck_department && budget_order)
buyer = SSeconomy.get_dep_account(id_card.registered_account.account_job.paycheck_department)
if(id_card?.registered_account && self_paid) //dripstation edit
buyer = id_card.registered_account //dripstation edit
if(ACCESS_QM in id_card.access) //dripstation edit
requestonly = FALSE //dripstation edit
can_approve_requests = TRUE //dripstation edit
can_send = TRUE //dripstation edit
else if(ACCESS_CARGO in id_card.access) //dripstation edit
requestonly = FALSE //dripstation edit
can_approve_requests = FALSE //dripstation edit
can_send = FALSE //dripstation edit
/* dripstation edit
if((ACCESS_HEADS in id_card.access) || (ACCESS_QM in id_card.access) || (ACCESS_CARGO in id_card.access))
requestonly = FALSE
can_approve_requests = TRUE
can_send = TRUE
*/
else
requestonly = TRUE
can_approve_requests = FALSE
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/obj/item/computer_hardware
/// If the hardware can be "hotswapped" (ejected when another is installed)
var/hotswap = FALSE

/obj/item/computer_hardware/hard_drive/proc/process_pre_attack(atom/target, mob/living/user, params)
return TRUE
Loading
Loading