Adds header icons

Does some fixes and cleanup
Some consoles added to the map and tablets added to job loadouts for testmerging.
This commit is contained in:
Shadowlight213
2016-08-06 23:05:05 -07:00
parent 3628d1b9df
commit 4ebeec67d6
51 changed files with 282 additions and 157 deletions
@@ -45,7 +45,6 @@
var/obj/item/weapon/computer_hardware/hard_drive/portable/portable_drive // Portable data storage
var/list/idle_threads = list() // Idle programs on background. They still receive process calls but can't be interacted with.
var/activetemplate = "computer_main"
var/obj/physical = null
@@ -97,7 +96,8 @@
if(active_program)
active_program.event_idremoved(0)
for(var/datum/computer_file/program/P in idle_threads)
for(var/I in idle_threads)
var/datum/computer_file/program/P = I
P.event_idremoved(1)
card_slot.stored_card.forceMove(get_turf(src))
@@ -152,7 +152,8 @@
kill_program(1)
machines.Remove(src)
STOP_PROCESSING(SSmachine, src)
for(var/obj/item/weapon/computer_hardware/CH in src.get_all_components())
for(var/H in src.get_all_components())
var/obj/item/weapon/computer_hardware/CH = H
uninstall_component(null, CH)
qdel(CH)
return ..()
@@ -162,9 +163,7 @@
overlays.Cut()
if(!enabled)
//set_light(0)
return
//set_light(light_strength)
if(active_program)
overlays.Add(active_program.program_icon_state ? active_program.program_icon_state : icon_state_menu)
else
@@ -182,10 +181,10 @@
if(ui)
ui.close()
return 0
// if((!battery_module || !battery_module.battery.charge) && !check_power_override())
// if(ui)
// ui.close()
// return 0
if((!battery_module || !battery_module.battery.charge) && !check_power_override())
if(ui)
ui.close()
return 0
// If we have an active program switch to it now.
if(active_program)
@@ -202,9 +201,11 @@
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if (!ui)
// ui = new(user, src, ui_key, "laptop_mainscreen", "NTOS Main Menu", 400, 500)
ui = new(user, src, ui_key, activetemplate, "Main menu", 400, 500, master_ui, state)
// ui.set_initial_data(data)
var/datum/asset/assets = get_asset_datum(/datum/asset/simple/headers)
assets.send(user)
ui = new(user, src, ui_key, "computer_main", "NTOS Main menu", 400, 500, master_ui, state)
ui.open()
ui.set_autoupdate(state = 1)
@@ -246,7 +247,8 @@
physical.visible_message("\The [src] breaks apart!")
var/turf/newloc = get_turf(src)
new /obj/item/stack/sheet/metal(newloc, round(steel_sheet_cost/2))
for(var/obj/item/weapon/computer_hardware/H in get_all_components())
for(var/C in get_all_components())
var/obj/item/weapon/computer_hardware/H = C
uninstall_component(null, H)
H.forceMove(newloc)
if(prob(25))
@@ -289,7 +291,8 @@
if(active_program && active_program.requires_ntnet && !get_ntnet_status(active_program.requires_ntnet_feature)) // Active program requires NTNet to run but we've just lost connection. Crash.
active_program.event_networkfailure(0)
for(var/datum/computer_file/program/P in idle_threads)
for(var/I in idle_threads)
var/datum/computer_file/program/P = I
if(P.requires_ntnet && !get_ntnet_status(P.requires_ntnet_feature))
P.event_networkfailure(1)
@@ -301,7 +304,8 @@
else
active_program = null
for(var/datum/computer_file/program/P in idle_threads)
for(var/I in idle_threads)
var/datum/computer_file/program/P = I
if(P.program_state != PROGRAM_STATE_KILLED)
P.process_tick()
P.ntnet_status = get_ntnet_status()
@@ -349,7 +353,8 @@
if(idle_threads.len)
var/list/program_headers = list()
for(var/datum/computer_file/program/P in idle_threads)
for(var/I in idle_threads)
var/datum/computer_file/program/P = I
if(!P.ui_header)
continue
program_headers.Add(list(list(
@@ -364,7 +369,7 @@
return data
// Relays kill program request to currently active program. Use this to quit current program.
/obj/item/modular_computer/proc/kill_program(var/forced = 0)
/obj/item/modular_computer/proc/kill_program(forced = 0)
if(active_program)
active_program.kill_program(forced)
active_program = null
@@ -374,18 +379,18 @@
update_icon()
// Returns 0 for No Signal, 1 for Low Signal and 2 for Good Signal. 3 is for wired connection (always-on)
/obj/item/modular_computer/proc/get_ntnet_status(var/specific_action = 0)
/obj/item/modular_computer/proc/get_ntnet_status(specific_action = 0)
if(network_card)
return network_card.get_signal(specific_action)
else
return 0
/obj/item/modular_computer/proc/add_log(var/text)
/obj/item/modular_computer/proc/add_log(text)
if(!get_ntnet_status())
return 0
return ntnet_global.add_log(text, network_card)
/obj/item/modular_computer/proc/shutdown_computer(var/loud = 1)
/obj/item/modular_computer/proc/shutdown_computer(loud = 1)
kill_program(1)
for(var/datum/computer_file/program/P in idle_threads)
P.kill_program(1)
@@ -473,12 +478,13 @@
return
// Used in following function to reduce copypaste
/obj/item/modular_computer/proc/power_failure(var/malfunction = 0)
/obj/item/modular_computer/proc/power_failure(malfunction = 0)
if(enabled) // Shut down the computer
physical.visible_message("<span class='danger'>\The [src]'s screen flickers \"BATTERY [malfunction ? "MALFUNCTION" : "CRITICAL"]\" warning as it shuts down unexpectedly.</span>")
if(active_program)
active_program.event_powerfailure(0)
for(var/datum/computer_file/program/PRG in idle_threads)
for(var/I in idle_threads)
var/datum/computer_file/program/PRG = I
PRG.event_powerfailure(1)
shutdown_computer(0)
@@ -502,7 +508,7 @@
last_power_usage = power_usage
/obj/item/modular_computer/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
/obj/item/modular_computer/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/card/id)) // ID Card, try to insert it.
var/obj/item/weapon/card/id/I = W
if(!card_slot)
@@ -588,7 +594,7 @@
return
// Attempts to install the hardware into apropriate slot.
/obj/item/modular_computer/proc/try_install_component(var/mob/living/user, var/obj/item/weapon/computer_hardware/H, var/found = 0)
/obj/item/modular_computer/proc/try_install_component(mob/living/user, obj/item/weapon/computer_hardware/H, found = 0)
// "USB" flash drive.
if(istype(H, /obj/item/weapon/computer_hardware/hard_drive/portable))
if(portable_drive)
@@ -640,7 +646,7 @@
H.forceMove(src)
// Uninstalls component. Found and Critical vars may be passed by parent types, if they have additional hardware.
/obj/item/modular_computer/proc/uninstall_component(var/mob/living/user, var/obj/item/weapon/computer_hardware/H, var/found = 0, var/critical = 0)
/obj/item/modular_computer/proc/uninstall_component(mob/living/user, obj/item/weapon/computer_hardware/H, found = 0, critical = 0)
if(portable_drive == H)
portable_drive = null
found = 1
@@ -677,7 +683,7 @@
// Checks all hardware pieces to determine if name matches, if yes, returns the hardware piece, otherwise returns null
/obj/item/modular_computer/proc/find_hardware_by_name(var/name)
/obj/item/modular_computer/proc/find_hardware_by_name(name)
if(portable_drive && (portable_drive.name == name))
return portable_drive
if(hard_drive && (hard_drive.name == name))
@@ -760,17 +766,19 @@
*/
/obj/item/modular_computer/proc/take_damage(var/amount, var/component_probability, var/damage_casing = 1, var/randomize = 1)
/obj/item/modular_computer/proc/take_damage(amount, component_probability, damage_casing = 1, randomize = 1)
if(randomize)
// 75%-125%, rand() works with integers, apparently.
amount *= (rand(75, 125) / 100.0)
amount = round(amount)
if(damage_casing)
damage += amount
damage = max(0,min(max_damage,damage))
// damage = between(0, damage, max_damage)
if(component_probability)
for(var/obj/item/weapon/computer_hardware/H in get_all_components())
for(var/I in get_all_components())
var/obj/item/weapon/computer_hardware/H = I
if(prob(component_probability))
H.take_damage(round(amount / 2))
@@ -779,17 +787,17 @@
// Stronger explosions cause serious damage to internal components
// Minor explosions are mostly mitigitated by casing.
/obj/item/modular_computer/ex_act(var/severity)
/obj/item/modular_computer/ex_act(severity)
take_damage(rand(100,200) / severity, 30 / severity)
// EMPs are similar to explosions, but don't cause physical damage to the casing. Instead they screw up the components
/obj/item/modular_computer/emp_act(var/severity)
/obj/item/modular_computer/emp_act(severity)
take_damage(rand(100,200) / severity, 50 / severity, 0)
// "Stun" weapons can cause minor damage to components (short-circuits?)
// "Burn" damage is equally strong against internal components and exterior casing
// "Brute" damage mostly damages the casing.
/obj/item/modular_computer/bullet_act(var/obj/item/projectile/Proj)
/obj/item/modular_computer/bullet_act(obj/item/projectile/Proj)
switch(Proj.damage_type)
if(BRUTE)
take_damage(Proj.damage, Proj.damage / 2)
@@ -16,13 +16,10 @@
machinery_computer.cpu = null
machinery_computer = null
//obj/item/modular_computer/processor/nano_host()
// return machinery_computer.nano_host()
// Due to how processes work, we'd receive two process calls - one from machinery type and one from our own type.
// Since we want this to be in-sync with machinery (as it's hidden type for machinery-based computers) we'll ignore
// non-relayed process calls.
/obj/item/modular_computer/processor/process(var/relayed = 0)
/obj/item/modular_computer/processor/process(relayed = 0)
if(relayed)
..()
else
@@ -39,7 +36,7 @@
if(machinery_computer)
machinery_computer.handle_power()
/obj/item/modular_computer/processor/New(var/comp)
/obj/item/modular_computer/processor/New(comp)
if(!comp || !istype(comp, /obj/machinery/modular_computer))
CRASH("Inapropriate type passed to obj/item/modular_computer/processor/New()! Aborting.")
return
@@ -55,7 +52,7 @@
/obj/item/modular_computer/processor/relay_qdel()
qdel(machinery_computer)
/obj/item/modular_computer/processor/find_hardware_by_name(var/N)
/obj/item/modular_computer/processor/find_hardware_by_name(N)
var/obj/item/weapon/computer_hardware/H = machinery_computer.find_hardware_by_name(N)
if(H)
return H
@@ -96,7 +93,7 @@
return
// Tesla links only work on machinery types, so we'll override the default try_install_component() proc
/obj/item/modular_computer/processor/try_install_component(var/mob/living/user, var/obj/item/weapon/computer_hardware/H, var/found = 0)
/obj/item/modular_computer/processor/try_install_component(mob/living/user, obj/item/weapon/computer_hardware/H, found = 0)
if(istype(H, /obj/item/weapon/computer_hardware/tesla_link))
if(machinery_computer.tesla_link)
user << "This computer's tesla link slot is already occupied by \the [machinery_computer.tesla_link]."
@@ -107,7 +104,7 @@
found = 1
..(user, H, found)
/obj/item/modular_computer/processor/uninstall_component(var/mob/living/user, var/obj/item/weapon/computer_hardware/H, var/found = 0, var/critical = 0)
/obj/item/modular_computer/processor/uninstall_component(mob/living/user, obj/item/weapon/computer_hardware/H, found = 0, critical = 0)
if(machinery_computer.tesla_link == H)
machinery_computer.tesla_link = null
var/obj/item/weapon/computer_hardware/tesla_link/L = H
@@ -122,12 +119,12 @@
return all_components
// Perform adjacency checks on our machinery counterpart, rather than on ourselves.
/obj/item/modular_computer/processor/Adjacent(var/atom/neighbor)
/obj/item/modular_computer/processor/Adjacent(atom/neighbor)
if(!machinery_computer)
return 0
return machinery_computer.Adjacent(neighbor)
/obj/item/modular_computer/processor/turn_on(var/mob/user)
/obj/item/modular_computer/processor/turn_on(mob/user)
// If we have a tesla link on our machinery counterpart, enable it automatically. Lets computer without a battery work.
if(machinery_computer && machinery_computer.tesla_link)
machinery_computer.tesla_link.enabled = 1
@@ -1,6 +1,6 @@
// Available as custom loadout item, this is literally the worst possible cheap tablet
/obj/item/modular_computer/tablet/preset/custom_loadout/cheap/New()
/obj/item/modular_computer/tablet/preset/cheap/New()
. = ..()
desc = "A low-end tablet often seen among low ranked station personnel."
processor_unit = new/obj/item/weapon/computer_hardware/processor_unit/small(src)
@@ -10,7 +10,7 @@
network_card = new/obj/item/weapon/computer_hardware/network_card(src)
// Alternative version, an average one, for higher ranked positions mostly
/obj/item/modular_computer/tablet/preset/custom_loadout/advanced/New()
/obj/item/modular_computer/tablet/preset/advanced/New()
. = ..()
processor_unit = new/obj/item/weapon/computer_hardware/processor_unit/small(src)
battery_module = new/obj/item/weapon/computer_hardware/battery_module(src)
@@ -91,7 +91,7 @@ var/list/global_modular_computers = list()
if(cpu)
cpu.attack_self(user) // CPU is an item, that's why we route attack_hand to attack_self
/obj/machinery/modular_computer/examine(var/mob/user)
/obj/machinery/modular_computer/examine(mob/user)
. = ..()
if(cpu)
cpu.examine(user)
@@ -104,13 +104,13 @@ var/list/global_modular_computers = list()
cpu.process(1)
// Checks all hardware pieces to determine if name matches, if yes, returns the hardware piece, otherwise returns null
/obj/machinery/modular_computer/proc/find_hardware_by_name(var/N)
/obj/machinery/modular_computer/proc/find_hardware_by_name(N)
if(tesla_link && (tesla_link.name == N))
return tesla_link
return null
// Used in following function to reduce copypaste
/obj/machinery/modular_computer/proc/power_failure(var/malfunction = 0)
/obj/machinery/modular_computer/proc/power_failure(malfunction = 0)
if(cpu && cpu.enabled) // Shut down the computer
visible_message("<span class='danger'>\The [src]'s screen flickers [cpu.battery_module ? "\"BATTERY [malfunction ? "MALFUNCTION" : "CRITICAL"]\"" : "\"EXTERNAL POWER LOSS\""] warning as it shuts down unexpectedly.</span>")
if(cpu)
@@ -136,7 +136,8 @@ var/list/global_modular_computers = list()
battery_powered = 0
var/power_usage = cpu.screen_on ? base_active_power_usage : base_idle_power_usage
for(var/obj/item/weapon/computer_hardware/CH in src.cpu.get_all_components())
for(var/C in src.cpu.get_all_components())
var/obj/item/weapon/computer_hardware/CH = C
if(CH.enabled)
power_usage += CH.power_usage
@@ -169,7 +170,7 @@ var/list/global_modular_computers = list()
return
..()
/obj/machinery/modular_computer/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
/obj/machinery/modular_computer/attackby(var/obj/item/weapon/W as obj, mob/user)
if(cpu)
return cpu.attackby(W, user)
return ..()
@@ -177,19 +178,19 @@ var/list/global_modular_computers = list()
// Stronger explosions cause serious damage to internal components
// Minor explosions are mostly mitigitated by casing.
/obj/machinery/modular_computer/ex_act(var/severity)
/obj/machinery/modular_computer/ex_act(severity)
if(cpu)
cpu.ex_act(severity)
// EMPs are similar to explosions, but don't cause physical damage to the casing. Instead they screw up the components
/obj/machinery/modular_computer/emp_act(var/severity)
/obj/machinery/modular_computer/emp_act(severity)
if(cpu)
cpu.emp_act(severity)
// "Stun" weapons can cause minor damage to components (short-circuits?)
// "Burn" damage is equally strong against internal components and exterior casing
// "Brute" damage mostly damages the casing.
/obj/machinery/modular_computer/bullet_act(var/obj/item/projectile/Proj)
/obj/machinery/modular_computer/bullet_act(obj/item/projectile/Proj)
if(cpu)
cpu.bullet_act(Proj)