Skip to content
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

AI Programs: More than a Door #27988

Draft
wants to merge 46 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
c08d4bc
AI Powers initial commit - Base datums for picker and program
PollardTheDragon Jan 5, 2025
b8fcaa4
Small fixes in base datums
PollardTheDragon Jan 5, 2025
c6d6ba0
RGB Lighting Power
PollardTheDragon Jan 7, 2025
4685f48
Nearest camera detection, beam effect for RGB_Lighting
PollardTheDragon Jan 7, 2025
f7b404b
Fixed learning AI Porgrams, Power Shunt Program
PollardTheDragon Jan 8, 2025
00e5ab0
Program install fixes, WebUI Program Install Menu Fixes
PollardTheDragon Jan 9, 2025
47e9802
Repair nanites
PollardTheDragon Jan 9, 2025
a92c73e
Universal Adapter
PollardTheDragon Jan 9, 2025
8473668
Door Override
PollardTheDragon Jan 10, 2025
5537d52
Nanofrost, Program Icons, Door Override Bug Fixes
PollardTheDragon Jan 11, 2025
3be17de
Sprites for AI machines
PollardTheDragon Jan 12, 2025
9edc57b
Bluespace Miner, Multimarket Analyzer, Light Replacer
PollardTheDragon Jan 12, 2025
4cffe1b
Fixes economy thing with bluespace miner
PollardTheDragon Jan 12, 2025
729fa86
Enhanced Door Controls, Nanosurgeons
PollardTheDragon Jan 14, 2025
1e0965e
Experimental Research Subsystem
PollardTheDragon Jan 16, 2025
fefa974
Removed excess from RND subsystem
PollardTheDragon Jan 16, 2025
e958a77
Adds Processing Node
XFirebirdX Jan 16, 2025
4ad2a76
Processing node changes and fixes
PollardTheDragon Jan 16, 2025
ae57da3
Processing nodes power states
PollardTheDragon Jan 16, 2025
61b6db9
Minor cleanup
PollardTheDragon Jan 16, 2025
acdd0ef
I've got a network node! And it makes heat!
PollardTheDragon Jan 17, 2025
64f7dab
Adds proc to nodes to change the assigned AI
PollardTheDragon Jan 17, 2025
c7c5359
Removed extra vars
PollardTheDragon Jan 17, 2025
cbde356
Icon fixes
PollardTheDragon Jan 17, 2025
baf6bcf
Adds overheat counter to delay overheat to prevent random atmos hotsp…
PollardTheDragon Jan 17, 2025
a307fb9
Merge branch 'master' into ai-more-than-a-door
PollardTheDragon Jan 17, 2025
deb0dfa
They changed my isAI check. Woe.
PollardTheDragon Jan 17, 2025
83d7348
Sealant, Holosigns, HONK, bugfixes, and stock part multipliers
PollardTheDragon Jan 18, 2025
3fde6dc
Enhanced Tracking Software
PollardTheDragon Jan 18, 2025
48de55e
Refunds for active programs
PollardTheDragon Jan 20, 2025
6e2320a
Remaining uninstall functionality
PollardTheDragon Jan 22, 2025
e76b818
AI RMC
PollardTheDragon Jan 22, 2025
d330c6a
Forgot a circuitboard
PollardTheDragon Jan 22, 2025
9e2aa5b
Fixes a small path issue
PollardTheDragon Jan 22, 2025
f1505cb
Global nodes list + node data for AI RMC TGUI
PollardTheDragon Jan 22, 2025
529b05f
TGUI Foundations
PollardTheDragon Jan 26, 2025
6722c57
Better check
PollardTheDragon Jan 29, 2025
fa05ffd
Better null check
PollardTheDragon Jan 29, 2025
7f1d5e1
Spacing
PollardTheDragon Jan 29, 2025
9a9ebe9
Better chat notification
PollardTheDragon Jan 29, 2025
2e420d8
A shitload of fixes
PollardTheDragon Jan 30, 2025
28c64fc
Camera beam helper proc
PollardTheDragon Jan 30, 2025
9fc596d
AI remote sound helper
PollardTheDragon Jan 30, 2025
d003b4a
Timer on nanofrost
PollardTheDragon Jan 30, 2025
6f266f3
ui.user
PollardTheDragon Jan 30, 2025
3309f8b
Merge remote-tracking branch 'upstream/master' into ai-more-than-a-door
PollardTheDragon Feb 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Sealant, Holosigns, HONK, bugfixes, and stock part multipliers
  • Loading branch information
PollardTheDragon committed Jan 18, 2025
commit 83d734880d95ac70e4a2db7e61f4cc0585ba0ef3
22 changes: 20 additions & 2 deletions code/game/machinery/ai_resource.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
/// How much resources does this machine provide
var/resource_amount = 1
/// How much heat does this put out?
var/heat_amount = 40000
var/heat_amount = 25000
/// Are we overheating?
var/overheating = FALSE
/// Used to ensure it takes a few seconds of being hot before overheating
var/overheat_counter = 0
/// How efficient is this machine?
var/efficiency = 1

/obj/machinery/ai_node/process()
..()
Expand Down Expand Up @@ -52,6 +54,22 @@
/obj/machinery/ai_node/attack_ai(mob/user)
return

/obj/machinery/ai_node/RefreshParts()
. = ..()
var/E
for(var/obj/item/stock_parts/capacitor/M in component_parts)
E += M.rating
efficiency = E / 2
// Adjust values according to the new stock parts.
heat_amount = initial(heat_amount) * efficiency
update_idle_power_consumption(power_channel, initial(idle_power_consumption) * efficiency)
update_active_power_consumption(power_channel, initial(active_power_consumption) * efficiency)
var/old_resource_amount = resource_amount
resource_amount = round_down(initial(resource_amount) * efficiency)
// Adjust the resources of the connected AI if the machine is on
if(assigned_ai)
assigned_ai.program_picker.modify_resource(resource_key, (resource_amount - old_resource_amount))

/obj/machinery/ai_node/attack_hand(user as mob)
if(overheating)
to_chat(user, "<span class = 'notice'>You turn the overheating [src] off.</span>")
Expand Down Expand Up @@ -104,7 +122,7 @@
if(!istype(new_ai))
return
assigned_ai.program_picker.modify_resource(resource_key, -resource_amount)
assigned_ai = new_attack_chain
assigned_ai = new_ai
assigned_ai.program_picker.modify_resource(resource_key, resource_amount)

/datum/milla_safe/ai_node_process
Expand Down
141 changes: 140 additions & 1 deletion code/modules/mob/living/silicon/ai/ai_programs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@
upgrade_level++
installed = TRUE

// RGB Lighting - Recolors Lights
// Light Synthesizer - Fixes lights
/datum/ai_program/light_repair
program_name = "Light Synthesizer"
program_id = "light_repair"
Expand Down Expand Up @@ -664,4 +664,143 @@
to_chat(user, "<span class='notice'>Discovered innovations has led to an increase in the [current] field!</span>")
upgraded = TRUE

/datum/spell/ai_spell/research_subsystem/on_purchase_upgrade()
cooldown_handler.recharge_duration = max(min(base_cooldown, base_cooldown - (spell_level * 30)), 600 SECONDS)

// Emergency Sealant - Patches holes with metal foam
/datum/ai_program/research_semergency_sealantubsystem
program_name = "Emergency Sealant"
program_id = "emergency_sealant"
description = "Deploy an area of metal foam to rapidly repair and seal hull breaches."
cost = 2
nanite_cost = 50
power_type = /datum/spell/ai_spell/ranged/emergency_sealant
unlock_text = "Metal foam synthesizer online."

/datum/spell/ai_spell/ranged/emergency_sealant
name = "Emergency Sealant"
desc = "Deploy an area of metal foam to rapidly repair and seal hull breaches."
action_icon = 'icons/obj/structures.dmi'
action_icon_state = "reinforced"
ranged_mousepointer = 'icons/mecha/mecha_mouse.dmi'
auto_use_uses = FALSE
base_cooldown = 180 SECONDS
cooldown_min = 30 SECONDS
level_max = 5
selection_activated_message = "<span class='notice'>You fill a canister with metal foam...</span>"
selection_deactivated_message = "<span class='notice'>You dissolve the unused canister.</span>"

/datum/spell/ai_spell/ranged/emergency_sealant/cast(list/targets, mob/user)
var/target = targets[1]
var/mob/living/silicon/ai/AI = user
AI.program_picker.nanites -= 50
user.playsound_local(user, 'sound/items/deconstruct.ogg', 50, FALSE, use_reverb = FALSE)
playsound(target, 'sound/effects/bubbles2.ogg', 50, FALSE, use_reverb = FALSE)
var/obj/machinery/camera/C = find_nearest_camera(target)
if(!istype(C))
return
var/obj/effect/particle_effect/foam/metal/F = new /obj/effect/particle_effect/foam/metal(get_turf(target), TRUE)
C.Beam(target, icon_state = "rped_upgrade", icon = 'icons/effects/effects.dmi', time = 15)
F.spread_amount = 2

/datum/spell/ai_spell/ranged/door_override/on_purchase_upgrade()
cooldown_handler.recharge_duration = max(min(base_cooldown, base_cooldown - (spell_level * 30)), 30 SECONDS)

// Holosign Deployment - Deploys a holosign on the selected turf
/datum/ai_program/holosign_displayer
program_name = "Holosign Displayer"
program_id = "holosign_displayer"
description = "Deploy a holographic sign to alert crewmembers to potential hazards."
cost = 1
nanite_cost = 10
power_type = /datum/spell/ai_spell/ranged/holosign_displayer
unlock_text = "Metal foam synthesizer online."

/datum/spell/ai_spell/ranged/holosign_displayer
name = "Holosign Displayer"
desc = "Deploy a holographic sign to alert crewmembers to potential hazards."
action_icon = 'icons/obj/device.dmi'
action_icon_state = "signmaker"
ranged_mousepointer = 'icons/mecha/mecha_mouse.dmi'
auto_use_uses = FALSE
base_cooldown = 30 SECONDS
cooldown_min = 30 SECONDS
level_max = 8
selection_activated_message = "<span class='notice'>You spool up your projector...</span>"
selection_deactivated_message = "<span class='notice'>You stop spooling the projector.</span>"
/// Types of holosigns the AI can deploy
var/sign_choices = list(
"Engineering",
"Security",
"Wet Floor"
)
/// List of currently active signs
var/signs = list()

/datum/spell/ai_spell/ranged/holosign_displayer/cast(list/targets, mob/user)
var/sign_id = tgui_input_list(usr, "Select an holosgn!", "AI", sign_choices)
if(!sign_id)
return
var/sign_type = null
switch(sign_id)
if("Engineering")
sign_type = /obj/structure/holosign/barrier/engineering
if("Wet Floor")
sign_type = /obj/structure/holosign/wetsign
if("Security")
sign_type = /obj/structure/holosign/barrier
else
return
var/target = targets[1]
var/mob/living/silicon/ai/AI = user
AI.program_picker.nanites -= 10
var/H = new sign_type(get_turf(target), src)
addtimer(CALLBACK(src, PROC_REF(sign_timer_complete), H), (60 + 30 * spell_level) SECONDS, TIMER_UNIQUE)
user.playsound_local(user, 'sound/machines/click.ogg', 20, FALSE, use_reverb = FALSE)
playsound(target, 'sound/machines/click.ogg', 20, FALSE, use_reverb = FALSE)
var/obj/machinery/camera/C = find_nearest_camera(target)
if(!istype(C))
return
C.Beam(target, icon_state = "rped_upgrade", icon = 'icons/effects/effects.dmi', time = 5)

/datum/spell/ai_spell/ranged/holosign_displayer/proc/sign_timer_complete(obj/structure/holosign/H)
playsound(H.loc, 'sound/machines/chime.ogg', 20, 1)
qdel(H)

// HONK Subsystem - HONK
/datum/ai_program/honk_subsystem
program_name = "Honk Subsystem"
program_id = "honk_subsystem"
description = "Download a program from Clowns.NT to be able to play bike horn sounds on demand."
nanite_cost = 5
power_type = /datum/spell/ai_spell/ranged/honk_subsystem
unlock_text = "Honker.exe installed."

/datum/spell/ai_spell/ranged/honk_subsystem
name = "Honk Subsystem"
desc = "Download a program from Clowns.NT to be able to play bike horn sounds on demand."
action_icon = 'icons/obj/items.dmi'
action_icon_state = "bike_horn"
ranged_mousepointer = 'icons/mecha/mecha_mouse.dmi'
auto_use_uses = FALSE
base_cooldown = 30 SECONDS
cooldown_min = 5 SECONDS
level_max = 10
selection_activated_message = "<span class='notice'>You prepare to honk...</span>"
selection_deactivated_message = "<span class='notice'>You reduce the amount of humor in your subsystems.</span>"

/datum/spell/ai_spell/ranged/honk_subsystem/cast(list/targets, mob/user)
var/target = targets[1]
if(!target)
return
var/mob/living/silicon/ai/AI = user
AI.program_picker.nanites -= 5
if(spell_level >= 10)
playsound(target, 'sound/items/airhorn.ogg', 100, 1)
user.playsound_local(user, 'sound/items/airhorn.ogg', 50, FALSE, use_reverb = FALSE)
else
playsound(target, 'sound/items/bikehorn.ogg', 50, FALSE, use_reverb = FALSE)
user.playsound_local(user, 'sound/items/bikehorn.ogg', 50, FALSE, use_reverb = FALSE)

/datum/spell/ai_spell/ranged/rgb_lighting/on_purchase_upgrade()
cooldown_handler.recharge_duration = max(base_cooldown - (spell_level * 15) SECONDS, 15 SECONDS)
Loading