Removes AI and Charge parts from tablets, adds support for more later. (#70012)

* Removes recharger tablet parts

Removes 'advanced' tablet subtypes that we used before PDAs were added, in some jobs.
Replaces Roboticist's advanced tablet mail with a laptop
Moves the notepad's note var from the tablet, to the note app
Moves modular computer's defines into their own file

Machine computers now directly use power from the machine they're in, while the rest uses power cells.
Silicon tablets don't use power at all.

Co-authored-by: san7890 <the@san7890.com>
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
This commit is contained in:
John Willard
2022-09-22 23:58:20 -04:00
committed by GitHub
parent c7f5bc49da
commit ca229574f6
46 changed files with 307 additions and 718 deletions
@@ -1,127 +1,139 @@
/datum/computer_file/program/aidiag
filename = "aidiag"
filedesc = "NT FRK"
/datum/computer_file/program/ai_restorer
filename = "ai_restore"
filedesc = "AI Manager & Restorer"
category = PROGRAM_CATEGORY_SCI
program_icon_state = "generic"
extended_desc = "Firmware Restoration Kit, capable of reconstructing damaged AI systems. Requires direct AI connection via intellicard slot."
size = 12
requires_ntnet = FALSE
usage_flags = PROGRAM_CONSOLE | PROGRAM_LAPTOP
transfer_access = list(ACCESS_COMMAND)
transfer_access = list(ACCESS_RD)
available_on_ntnet = TRUE
tgui_id = "NtosAiRestorer"
program_icon = "laptop-code"
/// The AI stored in the program
var/obj/item/aicard/stored_card
/// Variable dictating if we are in the process of restoring the AI in the inserted intellicard
var/restoring = FALSE
/datum/computer_file/program/aidiag/proc/get_ai(cardcheck)
/datum/computer_file/program/ai_restorer/on_examine(obj/item/modular_computer/source, mob/user)
var/list/examine_text = list()
if(!stored_card)
examine_text += "It has a slot installed for an intelliCard."
return examine_text
var/obj/item/computer_hardware/ai_slot/ai_slot
if(computer.Adjacent(user))
examine_text += "It has a slot installed for an intelliCard which contains: [stored_card.name]"
else
examine_text += "It has a slot installed for an intelliCard, which appears to be occupied."
examine_text += span_info("Alt-click to eject the intelliCard.")
return examine_text
if(computer)
ai_slot = computer.all_components[MC_AI]
/datum/computer_file/program/ai_restorer/kill_program(forced)
try_eject(forced = TRUE)
return ..()
if(computer && ai_slot?.check_functionality())
if(cardcheck == 1)
return ai_slot
if(ai_slot.enabled && ai_slot.stored_card)
if(cardcheck == 2)
return ai_slot.stored_card
if(ai_slot.stored_card.AI)
return ai_slot.stored_card.AI
return
/datum/computer_file/program/aidiag/ui_act(action, params)
. = ..()
if(.)
return
var/mob/living/silicon/ai/A = get_ai()
if(!A)
restoring = FALSE
switch(action)
if("PRG_beginReconstruction")
if(A && A.health < 100)
restoring = TRUE
A.notify_ghost_cloning("Your core files are being restored!", source = computer)
return TRUE
if("PRG_eject")
if(computer.all_components[MC_AI])
var/obj/item/computer_hardware/ai_slot/ai_slot = computer.all_components[MC_AI]
if(ai_slot?.stored_card)
ai_slot.try_eject(usr)
return TRUE
/datum/computer_file/program/aidiag/process_tick()
/datum/computer_file/program/ai_restorer/process_tick(delta_time)
. = ..()
if(!restoring) //Put the check here so we don't check for an ai all the time
return
var/obj/item/aicard/cardhold = get_ai(2)
var/obj/item/computer_hardware/ai_slot/ai_slot = get_ai(1)
var/mob/living/silicon/ai/A = get_ai()
if(!A || !cardhold)
restoring = FALSE // If the AI was removed, stop the restoration sequence.
if(ai_slot)
ai_slot.locked = FALSE
return
if(cardhold.flush)
ai_slot.locked = FALSE
var/mob/living/silicon/ai/A = stored_card.AI
if(stored_card.flush)
restoring = FALSE
return
ai_slot.locked = TRUE
A.adjustOxyLoss(-5, FALSE)
A.adjustFireLoss(-5, FALSE)
A.adjustBruteLoss(-5, FALSE)
// Please don't forget to update health, otherwise the below if statements will probably always fail.
A.updatehealth()
if(A.health >= 0 && A.stat == DEAD)
A.revive(full_heal = FALSE, admin_revive = FALSE)
cardhold.update_appearance()
stored_card.update_appearance()
// Finished restoring
if(A.health >= 100)
ai_slot.locked = FALSE
restoring = FALSE
return TRUE
/datum/computer_file/program/ai_restorer/try_insert(obj/item/attacking_item, mob/living/user)
if(!computer)
return FALSE
if(!istype(attacking_item, /obj/item/aicard))
return FALSE
/datum/computer_file/program/aidiag/ui_data(mob/user)
if(stored_card)
to_chat(user, span_warning("You try to insert \the [attacking_item] into \the [computer.name], but the slot is occupied."))
return FALSE
if(user && !user.transferItemToLoc(attacking_item, computer))
return FALSE
stored_card = attacking_item
to_chat(user, span_notice("You insert \the [attacking_item] into \the [computer.name]."))
return TRUE
/datum/computer_file/program/ai_restorer/try_eject(mob/living/user, forced = FALSE)
if(!stored_card)
if(user)
to_chat(user, span_warning("There is no card in \the [computer.name]."))
return FALSE
if(restoring && !forced)
if(user)
to_chat(user, span_warning("Safeties prevent you from removing the card until reconstruction is complete..."))
return FALSE
if(user && computer.Adjacent(user))
to_chat(user, span_notice("You remove [stored_card] from [computer.name]."))
user.put_in_hands(stored_card)
else
stored_card.forceMove(computer.drop_location())
stored_card = null
restoring = FALSE
return TRUE
/datum/computer_file/program/ai_restorer/ui_act(action, params)
. = ..()
if(.)
return
switch(action)
if("PRG_beginReconstruction")
if(!stored_card || !stored_card.AI)
return FALSE
var/mob/living/silicon/ai/A = stored_card.AI
if(A && A.health < 100)
restoring = TRUE
A.notify_ghost_cloning("Your core files are being restored!", source = computer)
return TRUE
if("PRG_eject")
if(stored_card)
try_eject(usr)
return TRUE
/datum/computer_file/program/ai_restorer/ui_data(mob/user)
var/list/data = get_header_data()
var/mob/living/silicon/ai/AI = get_ai()
var/obj/item/aicard/aicard = get_ai(2)
data["ejectable"] = TRUE
data["AI_present"] = FALSE
data["AI_present"] = !!stored_card?.AI
data["error"] = null
if(!aicard)
if(!stored_card)
data["error"] = "Please insert an intelliCard."
else if(!stored_card.AI)
data["error"] = "No AI located..."
else if(stored_card.flush)
data["error"] = "Flush in progress!"
else
if(!AI)
data["error"] = "No AI located"
else
var/obj/item/aicard/cardhold = AI.loc
if(cardhold.flush)
data["error"] = "Flush in progress"
else
data["AI_present"] = TRUE
data["name"] = AI.name
data["restoring"] = restoring
data["health"] = (AI.health + 100) / 2
data["isDead"] = AI.stat == DEAD
data["laws"] = AI.laws.get_law_list(include_zeroth = TRUE, render_html = FALSE)
data["name"] = stored_card.AI.name
data["restoring"] = restoring
data["health"] = (stored_card.AI.health + 100) / 2
data["isDead"] = stored_card.AI.stat == DEAD
data["laws"] = stored_card.AI.laws.get_law_list(include_zeroth = TRUE, render_html = FALSE)
return data
/datum/computer_file/program/aidiag/kill_program(forced)
restoring = FALSE
return ..()
@@ -26,7 +26,7 @@
QDEL_NULL(alert_control)
return ..()
/datum/computer_file/program/alarm_monitor/process_tick()
/datum/computer_file/program/alarm_monitor/process_tick(delta_time)
..()
if(has_alert)
@@ -16,7 +16,7 @@
var/error = ""
var/executed = 0
/datum/computer_file/program/ntnet_dos/process_tick()
/datum/computer_file/program/ntnet_dos/process_tick(delta_time)
dos_speed = 0
switch(ntnet_status)
if(1)
@@ -30,7 +30,6 @@
computer.update_appearance()
var/obj/item/computer_hardware/hard_drive/hard_drive = computer.all_components[MC_HDD]
var/obj/item/computer_hardware/battery/battery_module = computer.all_components[MC_CELL]
var/obj/item/computer_hardware/recharger/recharger = computer.all_components[MC_CHARGE]
qdel(hard_drive)
computer.take_damage(25, BRUTE, 0, 0)
if(battery_module && prob(25))
@@ -39,12 +38,6 @@
var/datum/effect_system/spark_spread/spark_system = new /datum/effect_system/spark_spread
spark_system.start()
if(recharger && prob(50))
qdel(recharger)
computer.visible_message(span_notice("\The [computer]'s recharger explodes in rain of sparks."))
var/datum/effect_system/spark_spread/spark_system = new /datum/effect_system/spark_spread
spark_system.start()
/datum/computer_file/program/revelation/ui_act(action, params)
. = ..()
@@ -47,7 +47,7 @@
borgo.logevent("File request by [username]: /var/logs/syslog")
return TRUE
/datum/computer_file/program/borg_monitor/process_tick()
/datum/computer_file/program/borg_monitor/process_tick(delta_time)
if(!DL_source)
DL_progress = -1
return
@@ -9,6 +9,9 @@
program_icon = "book"
usage_flags = PROGRAM_TABLET
var/written_note = "Congratulations on your station upgrading to the new NtOS and Thinktronic based collaboration effort, \
bringing you the best in electronics and software since 2467!"
/datum/computer_file/program/notepad/ui_act(action, list/params, datum/tgui/ui)
. = ..()
if(.)
@@ -16,14 +19,12 @@
switch(action)
if("UpdateNote")
var/obj/item/modular_computer/tablet/comp = computer
comp.note = params["newnote"]
written_note = params["newnote"]
return UI_UPDATE
/datum/computer_file/program/notepad/ui_data(mob/user)
var/list/data = get_header_data()
var/obj/item/modular_computer/tablet/comp = computer
data["note"] = comp.note
data["note"] = written_note
return data
@@ -93,7 +93,7 @@
download_completion = FALSE
ui_header = "downloader_finished.gif"
/datum/computer_file/program/ntnetdownload/process_tick()
/datum/computer_file/program/ntnetdownload/process_tick(delta_time)
if(!downloaded_file)
return
if(download_completion >= downloaded_file.size)
@@ -171,7 +171,7 @@
channel.ping_user(src, pinged)
return TRUE
/datum/computer_file/program/chatclient/process_tick()
/datum/computer_file/program/chatclient/process_tick(delta_time)
. = ..()
var/datum/ntnet_conversation/channel = SSnetworks.station_network.get_chat_channel_by_id(active_channel)
if(program_state != PROGRAM_STATE_KILLED)
@@ -31,7 +31,7 @@
history["demand"] = list()
/datum/computer_file/program/power_monitor/process_tick()
/datum/computer_file/program/power_monitor/process_tick(delta_time)
if(!get_powernet())
search()
else
@@ -197,7 +197,7 @@
computer.setDir(get_dir(here_turf, target_turf))
//We can use process_tick to restart fast processing, since the computer will be running this constantly either way.
/datum/computer_file/program/radar/process_tick()
/datum/computer_file/program/radar/process_tick(delta_time)
if(computer.active_program == src)
START_PROCESSING(SSfastprocess, src)
@@ -316,19 +316,13 @@
return
RegisterSignal(SSdcs, COMSIG_GLOB_NUKE_DEVICE_ARMED, .proc/on_nuke_armed)
if(computer)
RegisterSignal(computer, COMSIG_PARENT_EXAMINE, .proc/on_examine)
/datum/computer_file/program/radar/fission360/kill_program(forced)
UnregisterSignal(SSdcs, COMSIG_GLOB_NUKE_DEVICE_ARMED)
if(computer)
UnregisterSignal(computer, COMSIG_PARENT_EXAMINE)
return ..()
/datum/computer_file/program/radar/fission360/Destroy()
UnregisterSignal(SSdcs, COMSIG_GLOB_NUKE_DEVICE_ARMED)
if(computer)
UnregisterSignal(computer, COMSIG_PARENT_EXAMINE)
return ..()
/datum/computer_file/program/radar/fission360/find_atom()
@@ -364,16 +358,14 @@
)
objects += list(ship_info)
/*
* Signal proc for [COMSIG_PARENT_EXAMINE], registered on the computer.
* Shows how long any armed nukes are to detonating.
*/
/datum/computer_file/program/radar/fission360/proc/on_examine(datum/source, mob/user, list/examine_list)
SIGNAL_HANDLER
///Shows how long until the nuke detonates, if one is active.
/datum/computer_file/program/radar/fission360/on_examine(obj/item/modular_computer/source, mob/user)
var/list/examine_list = list()
for(var/obj/machinery/nuclearbomb/bomb as anything in GLOB.nuke_list)
if(bomb.timing)
examine_list += span_danger("Extreme danger. Arming signal detected. Time remaining: [bomb.get_time_left()].")
return examine_list
/*
* Signal proc for [COMSIG_GLOB_NUKE_DEVICE_ARMED].
@@ -392,4 +384,4 @@
computer.audible_message(
span_danger("[computer] vibrates and lets out an ominous alarm. Uh oh."),
span_notice("[computer] begins to vibrate rapidly. Wonder what that means..."),
)
)
@@ -20,7 +20,7 @@
active = null
return ..()
/datum/computer_file/program/supermatter_monitor/process_tick()
/datum/computer_file/program/supermatter_monitor/process_tick(delta_time)
..()
var/new_status = get_status()
if(last_status != new_status)