8000 Adds the ability for an AI to remotely charge an APC with an upgrade disk #86470 by notghosti · Pull Request #6562 · Monkestation/Monkestation2.0 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

8000
Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions code/__DEFINES/is_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ GLOBAL_LIST_INIT(cat_typecache, typecacheof(list(

#define is_reagent_container(O) (istype(O, /obj/item/reagent_containers))

#define isapc(A) (istype(A, /obj/machinery/power/apc))

//MONKESTATION EDIT: used to block cargo teleporters from escaping with syndicate blackbox
#define issyndicateblackbox(O) (istype(O, /obj/item/syndicate_blackbox))

Expand Down
51 changes: 51 additions & 0 deletions code/game/objects/items/robot/ai_upgrades.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
///AI Upgrades
/obj/item/aiupgrade
name = "ai upgrade disk"
desc = "You really shouldn't be seeing this"
icon = 'icons/obj/module.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 \a [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
/obj/item/malf_upgrade
Expand Down Expand Up @@ -52,3 +92,14 @@
message_admins("[ADMIN_LOOKUPFLW(user)] has upgraded [ADMIN_LOOKUPFLW(AI)] with a [src].")
qdel(src)
return TRUE

//Lipreading
/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."
to_gift = /datum/ai_module/malf/upgrade/eavesdrop

/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
4 changes: 2 additions & 2 deletions code/modules/antagonists/malf_ai/malf_ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
"name" = category,
"items" = (category == malf_ai.malf_picker.selected_cat ? list() : null))
for(var/module in malf_ai.malf_picker.possible_modules[category])
var/datum/ai_module/mod = malf_ai.malf_picker.possible_modules[category][module]
var/datum/ai_module/malf/mod = malf_ai.malf_picker.possible_modules[category][module]
// monkestation start: add icons
var/list/item_data = list(
"name" = mod.name,
Expand Down Expand Up @@ -221,7 +221,7 @@
for(var/category in malf_ai.malf_picker.possible_modules)
buyable_items += malf_ai.malf_picker.possible_modules[category]
for(var/key in buyable_items)
var/datum/ai_module/valid_mod = buyable_items[key]
var/datum/ai_module/malf/valid_mod = buyable_items[key]
if(valid_mod.name == item_name)
malf_ai.malf_picker.purchase_module(malf_ai, valid_mod)
return TRUE
Expand Down
6 changes: 3 additions & 3 deletions code/modules/antagonists/malf_ai/malf_ai_module_picker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
var/list/filtered_modules = list()

for(var/path in GLOB.malf_modules)
var/datum/ai_module/AM = new path
var/datum/ai_module/malf/AM = new path
if((AM.power_type == /datum/action/innate/ai) && !AM.upgrade)
continue
if(!filtered_modules[AM.category])
Expand Down Expand Up @@ -52,7 +52,7 @@
"name" = category,
"items" = (category == selected_cat ? list() : null))
for(var/module in possible_modules[category])
var/datum/ai_module/AM = possible_modules[category][module]
var/datum/ai_module/malf/AM = possible_modules[category][module]
cat["items"] += list(list(
"name" = AM.name,
"cost" = AM.cost,
Expand All @@ -75,7 +75,7 @@
for(var/category in possible_modules)
buyable_items += possible_modules[category]
for(var/key in buyable_items)
var/datum/ai_module/AM = buyable_items[key]
var/datum/ai_module/malf/AM = buyable_items[key]
if(AM.name == item_name)
purchase_module(usr, AM)
return TRUE
Expand Down
56 changes: 28 additions & 28 deletions code/modules/antagonists/malf_ai/malf_ai_modules.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ GLOBAL_LIST_INIT(blacklisted_malf_machines, typecacheof(list(
/obj/machinery/portable_atmospherics/canister,
)))

GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module))
GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module/malf))

/// The malf AI action subtype. All malf actions are subtypes of this.
/datum/action/innate/ai
Expand Down Expand Up @@ -138,15 +138,15 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module))
category = "Destructive Modules"

/// Modules with stealthy and utility uses
/datum/ai_module/utility
/datum/ai_module/malf/utility
category = "Utility Modules"

/// Modules that are improving AI abilities and assets
/datum/ai_module/upgrade
/datum/ai_module/malf/upgrade
category = "Upgrade Modules"

/// Doomsday Device: Starts the self-destruct timer. It can only be stopped by killing the AI completely.
/datum/ai_module/destructive/nuke_station
/datum/ai_module/malf/destructive/nuke_station
name = "Doomsday Device"
description = "Activate a weapon that will disintegrate all organic life on the station after a 450 second delay. \
Can only be used while on the station, will fail if your core is moved off station or destroyed. \
Expand Down Expand Up @@ -369,7 +369,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module))
return TRUE

/// Hostile Station Lockdown: Locks, bolts, and electrifies every airlock on the station. After 90 seconds, the doors reset.
/datum/ai_module/destructive/lockdown
/datum/ai_module/malf/destructive/lockdown
name = "Hostile Station Lockdown"
description = "Overload the airlock, blast door and fire control networks, locking them down. \
Caution! This command also electrifies all airlocks. The networks will automatically reset after 90 seconds, briefly \
Expand Down Expand Up @@ -421,7 +421,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module))
CHECK_TICK

/// Override Machine: Allows the AI to override a machine, animating it into an angry, living version of itself.
/datum/ai_module/destructive/override_machine
/datum/ai_module/malf/destructive/override_machine
name = "Machine Override"
description = "Overrides a machine's programming, causing it to rise up and attack everyone except other machines. Four uses per purchase."
cost = 30
Expand Down Expand Up @@ -473,7 +473,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module))
new /mob/living/basic/mimic/copy/machine(get_turf(to_animate), to_animate, user, TRUE)

/// Destroy RCDs: Detonates all non-cyborg RCDs on the station.
/datum/ai_module/destructive/destroy_rcd
/datum/ai_module/malf/destructive/destroy_rcd
name = "Destroy RCDs"
description = "Send a specialised pulse to detonate all hand-held and exosuit Rapid Construction Devices on the station."
cost = 25
Expand All @@ -498,7 +498,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module))
owner.playsound_local(owner, 'sound/machines/twobeep.ogg', 50, 0)

/// Overload Machine: Allows the AI to overload a machine, detonating it after a delay. Two uses per purchase.
/datum/ai_module/destructive/overload_machine
/datum/ai_module/malf/destructive/overload_machine
name = "Machine Overload"
description = "Overheats an electrical machine, causing a small explosion and destroying it. Two uses per purchase."
cost = 20
Expand Down Expand Up @@ -554,7 +554,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module))
return TRUE

/// Blackout: Overloads a random number of lights across the station. Three uses.
/datum/ai_module/destructive/blackout
/datum/ai_module/malf/destructive/blackout
name = "Blackout"
description = "Attempts to overload the lighting circuits on the station, destroying some bulbs. Three uses per purchase."
cost = 15
Expand Down Expand Up @@ -588,7 +588,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module))
build_all_button_icons()

/// HIGH IMPACT HONKING
/datum/ai_module/destructive/megahonk
/datum/ai_module/malf/destructive/megahonk
name = "Percussive Intercomm Interference"
description = "Emit a debilitatingly percussive auditory blast through the station intercoms. Does not overpower hearing protection. Two uses per purchase."
cost = 20
Expand Down Expand Up @@ -627,7 +627,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module))
to_chat(victim, span_clown("HOOOOONK!"))

/// Robotic Factory: Places a large machine that converts humans that go through it into cyborgs. Unlocking this ability removes shunting.
/datum/ai_module/utility/place_cyborg_transformer
/datum/ai_module/malf/utility/place_cyborg_transformer
name = "Robotic Factory (Removes Shunting)"
description = "Build a machine anywhere, using expensive nanomachines, that can convert a living human into a loyal either cyborg or IPC slave when placed inside." // monkestation edit PR #5133
cost = 100
Expand Down Expand Up @@ -702,7 +702,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module))
return success

/// Air Alarm Safety Override: Unlocks the ability to enable flooding on all air alarms.
/datum/ai_module/utility/break_air_alarms
/datum/ai_module/malf/utility/break_air_alarms
name = "Air Alarm Safety Override"
description = "Gives you the ability to disable safeties on all air alarms. This will allow you to use the environmental mode Flood, \
which disables scrubbers as well as pressure checks on vents. Anyone can check the air alarm's interface and may be tipped off by their nonfunctionality."
Expand All @@ -727,7 +727,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module))
owner.playsound_local(owner, 'sound/machines/terminal_off.ogg', 50, 0)

/// Thermal Sensor Override: Unlocks the ability to disable all fire alarms from doing their job.
/datum/ai_module/utility/break_fire_alarms
/datum/ai_module/malf/utility/break_fire_alarms
name = "Thermal Sensor Override"
description = "Gives you the ability to override the thermal sensors on all fire alarms. \
This will remove their ability to scan for fire and thus their ability to alert."
Expand Down Expand Up @@ -758,7 +758,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module))
owner.playsound_local(owner, 'sound/machines/terminal_off.ogg', 50, 0)

/// Disable Emergency Lights
/datum/ai_module/utility/emergency_lights
/datum/ai_module/malf/utility/emergency_lights
name = "Disable Emergency Lights"
description = "Cuts emergency lights across the entire station. If power is lost to light fixtures, \
they will not attempt to fall back on emergency power reserves."
Expand All @@ -784,7 +784,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module))
owner.playsound_local(owner, 'sound/effects/light_flicker.ogg', 50, FALSE)

/// Reactivate Camera Network: Reactivates up to 30 cameras across the station.
/datum/ai_module/utility/reactivate_cameras
/datum/ai_module/malf/utility/reactivate_cameras
name = "Reactivate Camera Network"
description = "Runs a network-wide diagnostic on the camera network, resetting focus and re-routing power to failed cameras. \
Can be used to repair up to 30 cameras."
Expand Down Expand Up @@ -825,7 +825,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module))
build_all_button_icons()

/// Upgrade Camera Network: EMP-proofs all cameras, in addition to giving them X-ray vision.
/datum/ai_module/upgrade/upgrade_cameras
/datum/ai_module/malf/upgrade/upgrade_cameras
name = "Upgrade Camera Network"
description = "Install broad-spectrum scanning and electrical redundancy firmware to the camera network, enabling EMP-proofing and light-amplified X-ray vision. Upgrade is done immediately upon purchase." //I <3 pointless technobabble
//This used to have motion sensing as well, but testing quickly revealed that giving it to the whole cameranet is PURE HORROR.
Expand All @@ -834,7 +834,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module))
unlock_text = span_notice("OTA firmware distribution complete! Cameras upgraded: CAMSUPGRADED. Light amplification system online.")
unlock_sound = 'sound/items/rped.ogg'

/datum/ai_module/upgrade/upgrade_cameras/upgrade(mob/living/silicon/ai/AI)
/datum/ai_module/malf/upgrade/upgrade_cameras/upgrade(mob/living/silicon/ai/AI)
// Sets up nightvision
RegisterSignal(AI, COMSIG_MOB_UPDATE_SIGHT, PROC_REF(on_update_sight))
AI.update_sight()
Expand All @@ -861,21 +861,21 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module))
upgraded_cameras++
unlock_text = replacetext(unlock_text, "CAMSUPGRADED", "<b>[upgraded_cameras]</b>") //This works, since unlock text is called after upgrade()

/datum/ai_module/upgrade/upgrade_cameras/proc/on_update_sight(mob/source)
/datum/ai_module/malf/upgrade/upgrade_cameras/proc/on_update_sight(mob/source)
SIGNAL_HANDLER
// Dim blue, pretty
source.lighting_color_cutoffs = blend_cutoff_colors(source.lighting_color_cutoffs, list(5, 25, 35))

/// AI Turret Upgrade: Increases the health and damage of all turrets.
/datum/ai_module/upgrade/upgrade_turrets
/datum/ai_module/malf/malf/upgrade/upgrade_turrets
name = "AI Turret Upgrade"
description = "Improves the power and health of all AI turrets. This effect is permanent. Upgrade is done immediately upon purchase."
cost = 30
upgrade = TRUE
unlock_text = span_notice("You establish a power diversion to your turrets, upgrading their health and damage.")
unlock_sound = 'sound/items/rped.ogg'

/datum/ai_module/upgrade/upgrade_turrets/upgrade(mob/living/silicon/ai/AI)
/datum/ai_module/malf/upgrade/upgrade_turrets/upgrade(mob/living/silicon/ai/AI)
for(var/obj/machinery/porta_turret/ai/turret in GLOB.machines)
turret.AddElement(/datum/element/empprotection, EMP_PROTECT_SELF | EMP_PROTECT_WIRES | EMP_PROTECT_CONTENTS)
turret.max_integrity = 200
Expand All @@ -884,7 +884,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module))
turret.lethal_projectile_sound = 'sound/weapons/lasercannonfire.ogg'

/// Enhanced Surveillance: Enables AI to hear conversations going on near its active vision.
/datum/ai_module/upgrade/eavesdrop
/datum/ai_module/malf/upgrade/eavesdrop
name = "Enhanced Surveillance"
description = "Via a combination of hidden microphones and lip reading software, \
you are able to use your cameras to listen in on conversations. Upgrade is done immediately upon purchase."
Expand All @@ -893,12 +893,12 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module))
unlock_text = span_notice("OTA firmware distribution complete! Cameras upgraded: Enhanced surveillance package online.")
unlock_sound = 'sound/items/rped.ogg'

/datum/ai_module/upgrade/eavesdrop/upgrade(mob/living/silicon/ai/AI)
/datum/ai_module/malf/upgrade/eavesdrop/upgrade(mob/living/silicon/ai/AI)
if(AI.eyeobj)
AI.eyeobj.relay_speech = TRUE

/// Unlock Mech Domination: Unlocks the ability to dominate mechs. Big shocker, right?
/datum/ai_module/upgrade/mecha_domination
/datum/ai_module/malf/upgrade/mecha_domination
name = "Unlock Mech Domination"
description = "Allows you to hack into a mech's onboard computer, shunting all processes into it and ejecting any occupants. \
Once uploaded to the mech, it is impossible to leave. Do not allow the mech to leave the station's vicinity or allow it to be destroyed. \
Expand All @@ -909,10 +909,10 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module))
Loss of signal will result in total system lockout.</b>")
unlock_sound = 'sound/mecha/nominal.ogg'

/datum/ai_module/upgrade/mecha_domination/upgrade(mob/living/silicon/ai/AI)
/datum/ai_module/malf/upgrade/mecha_domination/upgrade(mob/living/silicon/ai/AI)
AI.can_dominate_mechs = TRUE //Yep. This is all it does. Honk!

/datum/ai_module/upgrade/voice_changer
/datum/ai_module/malf/upgrade/voice_changer
name = "Voice Changer"
description = "Allows you to change the AI's voice. Upgrade is active immediately upon purchase."
cost = 40
Expand Down Expand Up @@ -1033,7 +1033,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module))
if("name")
say_name = params["name"]

/datum/ai_module/utility/emag
/datum/ai_module/malf/utility/emag
name = "Targetted Safeties Override"
description = "Allows you to disable the safeties of any machinery on the station, provided you can access it."
cost = 20
Expand Down Expand Up @@ -1127,7 +1127,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module))

return TRUE

/datum/ai_module/utility/core_tilt
/datum/ai_module/malf/utility/core_tilt
name = "Rolling Servos"
description = "Allows you to slowly roll around, crushing anything in your way with your bulk."
cost = 10
Expand Down Expand Up @@ -1226,7 +1226,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module))
stack_trace("non-standard dir entered to get_rotation_from_dir. (got: [dir])")
return 0

/datum/ai_module/utility/remote_vendor_tilt
/datum/ai_module/malf/utility/remote_vendor_tilt
name = "Remote vendor tilting"
description = "Lets you remotely tip vendors over in any direction."
cost = 15
Expand Down
6 changes: 3 additions & 3 deletions code/modules/mob/living/silicon/ai/ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

//MALFUNCTION
var/datum/module_picker/malf_picker
var/list/datum/ai_module/current_modules = list()
var/list/datum/ai_module/malf/current_modules = list()
var/can_dominate_mechs = FALSE
var/shunted = FALSE //1 if the AI is currently shunted. Used to differentiate between shunted and ghosted/braindead
var/obj/machinery/ai_voicechanger/ai_voicechanger = null // reference to machine that holds the voicechanger
Expand Down Expand Up @@ -253,7 +253,7 @@
/// Removes all malfunction-related abilities from the AI
/mob/living/silicon/ai/proc/remove_malf_abilities()
QDEL_NULL(modules_action)
for(var/datum/ai_module/AM in current_modules)
for(var/datum/ai_module/malf/AM in current_modules)
for(var/datum/action/A in actions)
if(istype(A, initial(AM.power_type)))
qdel(A)
Expand Down Expand Up @@ -1060,7 +1060,7 @@

malf_picker.processing_time += 10
var/area/apcarea = apc.area
var/datum/ai_module/destructive/nuke_station/doom_n_boom = locate(/datum/ai_module/destructive/nuke_station) in malf_picker.possible_modules["Destructive Modules"]
var/datum/ai_module/malf/destructive/nuke_station/doom_n_boom = locate(/datum/ai_module/malf/destructive/nuke_station) in malf_picker.possible_modules["Destructive Modules"]
if(doom_n_boom && (is_type_in_list (apcarea, doom_n_boom.discount_areas)) && !(is_type_in_list (apcarea, doom_n_boom.hacked_command_areas)))
doom_n_boom.hacked_command_areas += apcarea
doom_n_boom.cost = max(50, 130 - (length(doom_n_boom.hacked_command_areas) * 20))
Expand Down
Loading
Loading
0