Adds the ability for an AI to remotely charge an APC with an upgrade disk (#86470)

## About The Pull Request

Adds an upgrade disk that gives the ability to remotely charge an APC
with the AIs backup power (the one that runs down when there is no power
in an APC). This tech disk is under advanced AI tech

Also added the ability to make new disks with the new object type
/obj/item/aiupgrade, and made it so not every AI module is malf, now
only subtypes of /datum/ai_module/malf show up on malf upgrade screens

## Why It's Good For The Game
Adds the ability for an AI to assist crewmembers who do not have power,
which is a pretty interesting interaction. Does chem not have power and
is trying to make some healing chems? you can provide power for them for
a bit, but they better hurry!


## Changelog
🆑
add: Added the remote power AI disk
code: made it possible to easily add new AI upgrade disks
/🆑

---------

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
vect0r
2024-09-19 09:24:43 +00:00
committed by GitHub
co-authored by Ghom
parent 984c3891c8
commit ab365f9fb4
10 changed files with 149 additions and 58 deletions
+53 -19
View File
@@ -1,4 +1,45 @@
///AI Upgrades
/obj/item/aiupgrade
name = "ai upgrade disk"
desc = "You really shouldn't be seeing this"
icon = 'icons/obj/devices/circuitry_n_data.dmi'
icon_state = "datadisk3"
///The upgrade that will be applied to the AI when installed
var/datum/ai_module/to_gift = /datum/ai_module
/obj/item/aiupgrade/pre_attack(atom/target, mob/living/user, proximity)
if(!proximity)
return ..()
if(!isAI(target))
return ..()
var/mob/living/silicon/ai/AI = target
var/datum/action/innate/ai/action = locate(to_gift.power_type) in AI.actions
var/datum/ai_module/gifted_ability = new to_gift
if(!to_gift.upgrade)
if(!action)
var/ability = to_gift.power_type
var/datum/action/gifted_action = new ability
gifted_action.Grant(AI)
else if(gifted_ability.one_purchase)
to_chat(user, "[AI] already has an [src] installed!")
return
else
action.uses += initial(action.uses)
action.desc = "[initial(action.desc)] It has [action.uses] use\s remaining."
action.build_all_button_icons()
else
if(!action)
gifted_ability.upgrade(AI)
if(gifted_ability.unlock_text)
to_chat(AI, gifted_ability.unlock_text)
if(gifted_ability.unlock_sound)
AI.playsound_local(AI, gifted_ability.unlock_sound, 50, 0)
update_static_data(AI)
to_chat(user, span_notice("You install [src], upgrading [AI]."))
to_chat(AI, span_userdanger("[user] has upgraded you with [src]!"))
user.log_message("has upgraded [key_name(AI)] with a [src].", LOG_GAME)
qdel(src)
return TRUE
//Malf Picker
@@ -34,28 +75,21 @@
//Lipreading
/obj/item/surveillance_upgrade
/obj/item/aiupgrade/surveillance_upgrade
name = "surveillance software upgrade"
desc = "An illegal software package that will allow an artificial intelligence to 'hear' from its cameras via lip reading and hidden microphones."
icon = 'icons/obj/devices/circuitry_n_data.dmi'
icon_state = "datadisk3"
to_gift = /datum/ai_module/malf/upgrade/eavesdrop
/obj/item/surveillance_upgrade/Initialize(mapload)
/obj/item/aiupgrade/surveillance_upgrade/Initialize(mapload)
. = ..()
ADD_TRAIT(src, TRAIT_CONTRABAND, INNATE_TRAIT)
/obj/item/surveillance_upgrade/pre_attack(atom/A, mob/living/user, proximity)
if(!proximity)
return ..()
if(!isAI(A))
return ..()
var/mob/living/silicon/ai/AI = A
if(AI.eyeobj)
AI.eyeobj.relay_speech = TRUE
to_chat(AI, span_userdanger("[user] has upgraded you with surveillance software!"))
to_chat(AI, "Via a combination of hidden microphones and lip reading software, you are able to use your cameras to listen in on conversations.")
to_chat(user, span_notice("You upgrade [AI]. [src] is consumed in the process."))
user.log_message("has upgraded [key_name(AI)] with a [src].", LOG_GAME)
message_admins("[ADMIN_LOOKUPFLW(user)] has upgraded [ADMIN_LOOKUPFLW(AI)] with a [src].")
qdel(src)
return TRUE
/obj/item/aiupgrade/power_transfer
name = "power transfer upgrade"
desc = "A legal upgrade that allows an artificial intelligence to directly provide power to APCs from a distance"
to_gift = /datum/ai_module/power_apc