This commit is contained in:
Shadowlight213
2016-07-31 00:13:27 -07:00
parent 6a5c7d7068
commit 2eb1ece075
17 changed files with 134 additions and 28 deletions

View File

@@ -97,12 +97,14 @@ var/global/datum/ntnet/ntnet_global = new()
// Builds lists that contain downloadable software. // Builds lists that contain downloadable software.
/datum/ntnet/proc/build_news_list() /datum/ntnet/proc/build_news_list()
/*
available_news = list() available_news = list()
for(var/F in typesof(/datum/computer_file/data/news_article/)) for(var/F in typesof(/datum/computer_file/data/news_article/))
var/datum/computer_file/data/news_article/news = new F(1) var/datum/computer_file/data/news_article/news = new F(1)
if(news.stored_data) if(news.stored_data)
available_news.Add(news) available_news.Add(news)
*/
return 1
// Attempts to find a downloadable file according to filename var // Attempts to find a downloadable file according to filename var
/datum/ntnet/proc/find_ntnet_file_by_name(var/filename) /datum/ntnet/proc/find_ntnet_file_by_name(var/filename)

View File

@@ -178,14 +178,14 @@
if(ui) if(ui)
ui.close() ui.close()
return 0 return 0
/*
// If we have an active program switch to it now. // If we have an active program switch to it now.
if(active_program) if(active_program)
if(ui) // This is the main laptop screen. Since we are switching to program's UI close it for now. if(ui) // This is the main laptop screen. Since we are switching to program's UI close it for now.
ui.close() ui.close()
active_program.ui_interact(user) active_program.ui_interact(user)
return return
*/
// We are still here, that means there is no program loaded. Load the BIOS/ROM/OS/whatever you want to call it. // We are still here, that means there is no program loaded. Load the BIOS/ROM/OS/whatever you want to call it.
// This screen simply lists available programs and user may select them. // This screen simply lists available programs and user may select them.
if(!hard_drive || !hard_drive.stored_files || !hard_drive.stored_files.len) if(!hard_drive || !hard_drive.stored_files || !hard_drive.stored_files.len)
@@ -207,11 +207,11 @@
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if (!ui) if (!ui)
// ui = new(user, src, ui_key, "laptop_mainscreen", "NTOS Main Menu", 400, 500) // ui = new(user, src, ui_key, "laptop_mainscreen", "NTOS Main Menu", 400, 500)
ui = new(user, src, ui_key, "vr_sleeper", "VR Sleeper", 475, 340, master_ui, state) ui = new(user, src, ui_key, "computer_main", "Main menu", 475, 340, master_ui, state)
ui.auto_update_layout = 1 ui.auto_update_layout = 1
ui.set_initial_data(data) // ui.set_initial_data(data)
ui.open() ui.open()
ui.set_auto_update(1) // ui.set_auto_update(1)
// On-click handling. Turns on the computer if it's off and opens the GUI. // On-click handling. Turns on the computer if it's off and opens the GUI.
/obj/item/modular_computer/attack_self(mob/user) /obj/item/modular_computer/attack_self(mob/user)
@@ -521,7 +521,7 @@
if(components.len) if(components.len)
user << "Remove all components from \the [src] before disassembling it." user << "Remove all components from \the [src] before disassembling it."
return return
new /obj/item/stack/material/steel( get_turf(src.loc), steel_sheet_cost ) new /obj/item/stack/sheet/metal( get_turf(src.loc), steel_sheet_cost )
src.visible_message("\The [src] has been disassembled by [user].") src.visible_message("\The [src] has been disassembled by [user].")
relay_qdel() relay_qdel()
qdel(src) qdel(src)
@@ -622,7 +622,7 @@
if(found) if(found)
user << "You install \the [H] into \the [src]" user << "You install \the [H] into \the [src]"
H.holder2 = src H.holder2 = src
user.drop_from_inventory(H) // user.drop_from_inventory(H)
H.forceMove(src) H.forceMove(src)
// Uninstalls component. Found and Critical vars may be passed by parent types, if they have additional hardware. // Uninstalls component. Found and Critical vars may be passed by parent types, if they have additional hardware.
@@ -748,7 +748,7 @@
amount = round(amount) amount = round(amount)
if(damage_casing) if(damage_casing)
damage += amount damage += amount
damage = between(0, damage, max_damage) // damage = between(0, damage, max_damage)
if(component_probability) if(component_probability)
for(var/obj/item/weapon/computer_hardware/H in get_all_components()) for(var/obj/item/weapon/computer_hardware/H in get_all_components())

View File

@@ -19,7 +19,7 @@
var/available_on_syndinet = 0 // Whether the program can be downloaded from SyndiNet (accessible via emagging the computer). Set to 1 to enable. var/available_on_syndinet = 0 // Whether the program can be downloaded from SyndiNet (accessible via emagging the computer). Set to 1 to enable.
var/computer_emagged = 0 // Set to 1 if computer that's running us was emagged. Computer updates this every Process() tick var/computer_emagged = 0 // Set to 1 if computer that's running us was emagged. Computer updates this every Process() tick
var/ui_header = null // Example: "something.gif" - a header image that will be rendered in computer's UI when this program is running at background. Images are taken from /nano/images/status_icons. Be careful not to use too large images! var/ui_header = null // Example: "something.gif" - a header image that will be rendered in computer's UI when this program is running at background. Images are taken from /nano/images/status_icons. Be careful not to use too large images!
var/datum/computer_file/program/program = null
/datum/computer_file/program/New(var/obj/item/modular_computer/comp = null) /datum/computer_file/program/New(var/obj/item/modular_computer/comp = null)
..() ..()
if(comp && istype(comp)) if(comp && istype(comp))
@@ -122,7 +122,7 @@
// This is called every tick when the program is enabled. Ensure you do parent call if you override it. If parent returns 1 continue with UI initialisation. // This is called every tick when the program is enabled. Ensure you do parent call if you override it. If parent returns 1 continue with UI initialisation.
// It returns 0 if it can't run or if NanoModule was used instead. I suggest using NanoModules where applicable. // It returns 0 if it can't run or if NanoModule was used instead. I suggest using NanoModules where applicable.
/datum/computer_file/program/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) /datum/computer_file/program/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 1, datum/tgui/master_ui = null, datum/ui_state/state = default_state)
if(program_state != PROGRAM_STATE_ACTIVE) // Our program was closed. Close the ui if it exists. if(program_state != PROGRAM_STATE_ACTIVE) // Our program was closed. Close the ui if it exists.
if(ui) if(ui)
ui.close() ui.close()

View File

@@ -2,15 +2,15 @@
// Always include a parent call when overriding an event. // Always include a parent call when overriding an event.
// Called when the ID card is removed from computer. ID is removed AFTER this proc. // Called when the ID card is removed from computer. ID is removed AFTER this proc.
/datum/computer_file/program/proc/event_idremoved(var/background) /datum/computer_file/program/proc/event_idremoved(background)
return return
// Called when the computer fails due to power loss. Override when program wants to specifically react to power loss. // Called when the computer fails due to power loss. Override when program wants to specifically react to power loss.
/datum/computer_file/program/proc/event_powerfailure(var/background) /datum/computer_file/program/proc/event_powerfailure(background)
kill_program(1) kill_program(1)
// Called when the network connectivity fails. Computer does necessary checks and only calls this when requires_ntnet_feature and similar variables are not met. // Called when the network connectivity fails. Computer does necessary checks and only calls this when requires_ntnet_feature and similar variables are not met.
/datum/computer_file/program/proc/event_networkfailure(var/background) /datum/computer_file/program/proc/event_networkfailure(background)
kill_program(1) kill_program(1)
if(background) if(background)
computer.visible_message("<span class='danger'>\The [computer]'s screen displays an \"Process [filename].[filetype] (PID [rand(100,999)]) terminated - Network Error\" error</span>") computer.visible_message("<span class='danger'>\The [computer]'s screen displays an \"Process [filename].[filetype] (PID [rand(100,999)]) terminated - Network Error\" error</span>")

View File

@@ -11,17 +11,17 @@
return TRUE return TRUE
/datum/nano_module/program /datum/nano_module/program
available_to_ai = FALSE // available_to_ai = FALSE
var/datum/computer_file/program/program = null // Program-Based computer program that runs this nano module. Defaults to null. var/datum/computer_file/program/program = null // Program-Based computer program that runs this nano module. Defaults to null.
/datum/nano_module/program/New(var/host, var/topic_manager, var/program) /datum/nano_module/program/New(host, topic_manager, program)
..() ..()
src.program = program src.program = program
/datum/topic_manager/program /datum/topic_manager/program
var/datum/program var/datum/program
/datum/topic_manager/program/New(var/datum/program) /datum/topic_manager/program/New(datum/program)
..() ..()
src.program = program src.program = program

View File

@@ -12,13 +12,16 @@
size = 4 size = 4
available_on_ntnet = 0 available_on_ntnet = 0
requires_ntnet = 0 requires_ntnet = 0
nanomodule_path = /datum/nano_module/program/computer_configurator/ // nanomodule_path = /datum/nano_module/program/computer_configurator/
/datum/nano_module/program/computer_configurator //datum/nano_module/program/computer_configurator
name = "NTOS Computer Configuration Tool" // name = "NTOS Computer Configuration Tool"
var/obj/item/modular_computer/movable = null var/obj/item/modular_computer/movable = null
/datum/nano_module/program/computer_configurator/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/topic_state/state = default_state)
//obj/machinery/vr_sleeper/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = default_state)
/datum/computer_file/program/computerconfig/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = default_state)
if(program) if(program)
movable = program.computer movable = program.computer
if(!istype(movable)) if(!istype(movable))

View File

@@ -8,7 +8,7 @@
malfunction_probability = 1 malfunction_probability = 1
origin_tech = list(TECH_POWER = 1, TECH_ENGINEERING = 1) origin_tech = list(TECH_POWER = 1, TECH_ENGINEERING = 1)
var/battery_rating = 750 var/battery_rating = 750
var/obj/item/weapon/cell/battery = null var/obj/item/weapon/stock_parts/cell/battery = null
/obj/item/weapon/computer_hardware/battery_module/advanced /obj/item/weapon/computer_hardware/battery_module/advanced
name = "advanced battery" name = "advanced battery"
@@ -61,7 +61,7 @@
user << "Internal battery charge: [battery.charge]/[battery.maxcharge] CU" user << "Internal battery charge: [battery.charge]/[battery.maxcharge] CU"
/obj/item/weapon/computer_hardware/battery_module/New() /obj/item/weapon/computer_hardware/battery_module/New()
battery = new/obj/item/weapon/cell(src) battery = new/obj/item/weapon/stock_parts/cell(src)
battery.maxcharge = battery_rating battery.maxcharge = battery_rating
battery.charge = 0 battery.charge = 0
..() ..()

View File

@@ -87,8 +87,8 @@
// Use this proc to add file to the drive. Returns 1 on success and 0 on failure. Contains necessary sanity checks. // Use this proc to add file to the drive. Returns 1 on success and 0 on failure. Contains necessary sanity checks.
/obj/item/weapon/computer_hardware/hard_drive/proc/install_default_programs() /obj/item/weapon/computer_hardware/hard_drive/proc/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/computerconfig(src)) // Computer configuration utility, allows hardware control and displays more info than status bar
store_file(new/datum/computer_file/program/ntnetdownload(src)) // NTNet Downloader Utility, allows users to download more software from NTNet repository // store_file(new/datum/computer_file/program/ntnetdownload(src)) // NTNet Downloader Utility, allows users to download more software from NTNet repository
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/filemanager(src)) // File manager, allows text editor functions and basic file manipulation.
// Use this proc to remove file from the drive. Returns 1 on success and 0 on failure. Contains necessary sanity checks. // Use this proc to remove file from the drive. Returns 1 on success and 0 on failure. Contains necessary sanity checks.

View File

@@ -22,7 +22,7 @@
return 1 return 1
// Nanopaste. Repair all damage if present for a single unit. // Nanopaste. Repair all damage if present for a single unit.
var/obj/item/stack/S = W var/obj/item/stack/S = W
if(istype(S, /obj/item/stack/nanopaste)) if(istype(S, /obj/item/stack/sheet/glass))
if(!damage) if(!damage)
user << "\The [src] doesn't seem to require repairs." user << "\The [src] doesn't seem to require repairs."
return 1 return 1

View File

@@ -76,6 +76,8 @@ var/global/ntnet_card_uid = 1
return 0 return 0
if(holder2) if(holder2)
return 2
/*
var/turf/T = get_turf(holder2) var/turf/T = get_turf(holder2)
if((T && istype(T)) && T.z in using_map.station_levels) if((T && istype(T)) && T.z in using_map.station_levels)
// Computer is on station. Low/High signal depending on what type of network card you have // Computer is on station. Low/High signal depending on what type of network card you have
@@ -83,7 +85,7 @@ var/global/ntnet_card_uid = 1
return 2 return 2
else else
return 1 return 1
*/
if(long_range) // Computer is not on station, but it has upgraded network card. Low signal. if(long_range) // Computer is not on station, but it has upgraded network card. Low signal.
return 1 return 1

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -1519,7 +1519,6 @@
#include "code\modules\modular_computers\computers\item\processor.dm" #include "code\modules\modular_computers\computers\item\processor.dm"
#include "code\modules\modular_computers\computers\item\tablet.dm" #include "code\modules\modular_computers\computers\item\tablet.dm"
#include "code\modules\modular_computers\computers\item\tablet_presets.dm" #include "code\modules\modular_computers\computers\item\tablet_presets.dm"
#include "code\modules\modular_computers\computers\machinery\console_presets.dm"
#include "code\modules\modular_computers\computers\machinery\modular_computer.dm" #include "code\modules\modular_computers\computers\machinery\modular_computer.dm"
#include "code\modules\modular_computers\computers\machinery\modular_console.dm" #include "code\modules\modular_computers\computers\machinery\modular_console.dm"
#include "code\modules\modular_computers\computers\machinery\modular_laptop.dm" #include "code\modules\modular_computers\computers\machinery\modular_laptop.dm"
@@ -1527,6 +1526,8 @@
#include "code\modules\modular_computers\file_system\data.dm" #include "code\modules\modular_computers\file_system\data.dm"
#include "code\modules\modular_computers\file_system\program.dm" #include "code\modules\modular_computers\file_system\program.dm"
#include "code\modules\modular_computers\file_system\program_events.dm" #include "code\modules\modular_computers\file_system\program_events.dm"
#include "code\modules\modular_computers\file_system\programs\_program.dm"
#include "code\modules\modular_computers\file_system\programs\configurator.dm"
#include "code\modules\modular_computers\hardware\battery_module.dm" #include "code\modules\modular_computers\hardware\battery_module.dm"
#include "code\modules\modular_computers\hardware\card_slot.dm" #include "code\modules\modular_computers\hardware\card_slot.dm"
#include "code\modules\modular_computers\hardware\hard_drive.dm" #include "code\modules\modular_computers\hardware\hard_drive.dm"

View File

@@ -0,0 +1,27 @@
<link rel='ractive' href='{{data.active_program_template}}'>
<script>
component.exports = {
data: {
getActiveProgramTag(template) {
let tag = ''; //templates come in the form './airalarm/vents.ract' and from that the tag is <vents/>
if(template){
tag = template.split('/').pop().split('.')[0]; //'vents'
}
return tag
},
getTaskbarContents() {
{{!does a thing, probably reads a lot of data.X to load things like active programs, their icons, etc.}}
}
}
}
</script>
<ui-display>
<ui-section> {{! Active program}}
<{{{getActiveProgramTag(data.active_program_template)}}}/>
</ui-section>
<ui-section> {{! Taskbar}}
{{{getTaskbarContents()}}}
</ui-section>
</ui-display>

View File

@@ -0,0 +1,71 @@
<script>
component.exports = {
data: {
chargeState(charge) {
let max = this.get('data.battery.max')
if(charge > (max/2)) return 'good'
else if(charge > (max/4)) return 'average'
else return 'bad'
}
}
}
</script>
<ui-display>
<i>Welcome to computer configuration utility. Please consult your system administrator if you have any questions about your device.</i><hr>
<ui-display title='Power Supply'>
{{#if data.battery}}
<ui-section label='Battery Status'>
Active
</ui-section>
<ui-section label='Battery Rating'>
{{data.battery.max}}
</ui-section>
<ui-section label='Battery Charge'>
<ui-bar min='0' max='{{adata.battery.max}}' value='{{adata.battery.charge}}' state='{{chargeState(adata.battery.charge)}}'>{{Math.round(adata.battery.charge)}}/{{adata.battery.max}}</ui-bar>
</ui-section>
{{else}}
<ui-section label='Battery Status'>
Not Available
</ui-section>
{{/if}}
<ui-section label='Power Usage'>
{{data.power_usage}}W
</ui-section>
</ui-display>
<ui-display title='File System'>
<ui-section label='Used Capacity'>
<ui-bar min='0' max='{{adata.battery.max}}' value='{{adata.battery.charge}}' state='good'>{{Math.round(adata.disk.used)}}GQ/{{adata.disk.size}}GQ</ui-bar>
</ui-section>
</ui-display>
<ui-display title='Computer Components'>
{{#each data.hardware}}
<ui-subdisplay title='{{name}}'>
<i>{{desc}}</i><br>
<ui-section label='State'>
{{enabled ? "Enabled" : "Disabled"}}
</ui-section>
<ui-section Label='Power Usage'>
{{powerusage}}W
</ui-section>
{{#if !critical}}
<ui-section label='Toggle Component'>
<ui-button icon='{{enabled ? "power-off" : "close"}}' action='PC_toggle_component' params='{"name": "{{name}}"}">
{{enabled ? "On" : "Off"}}
</ui-button>
</ui-section>
{{/if}}
<br><br>
{{/each}}
</ui-display>
</ui-display>