Skip to content

Commit

Permalink
uuuuhhhhhhhhh
Browse files Browse the repository at this point in the history
  • Loading branch information
TobyThorne committed Aug 18, 2024
1 parent d23a066 commit cc88b88
Show file tree
Hide file tree
Showing 10 changed files with 179 additions and 124 deletions.
13 changes: 3 additions & 10 deletions code/modules/mob/living/silicon/ai/ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ var/list/ai_verbs_default = list(
anchored = 1 // -- TLE
density = 1
status_flags = CANSTUN|CANPARALYSE|CANPUSH
shouldnt_see = list(/obj/effect/rune)
maxHealth = 200
var/list/network = list("Exodus")
var/obj/machinery/camera/camera = null
Expand Down Expand Up @@ -108,10 +109,10 @@ var/list/ai_verbs_default = list(
give_ghost_proc_at_initialize = FALSE

/mob/living/silicon/ai/proc/add_ai_verbs()
grant_verb(src, ai_verbs_default)
src.verbs |= ai_verbs_default

/mob/living/silicon/ai/proc/remove_ai_verbs()
revoke_verb(src, ai_verbs_default)
src.verbs -= ai_verbs_default

/mob/living/silicon/ai/New(loc, datum/ai_laws/L, obj/item/organ/internal/cerebrum/mmi/B, safety = 0)
var/list/possibleNames = GLOB.ai_names
Expand Down Expand Up @@ -156,14 +157,6 @@ var/list/ai_verbs_default = list(
add_language(LANGUAGE_INDEPENDENT, 1)
add_language(LANGUAGE_SPACER, 1)

default_silicon_subsystems.Cut()

for(var/datum/nano_module/subsystem_type as anything in subtypesof(/datum/nano_module))
if(!subsystem_type::available_to_ai)
continue

default_silicon_subsystems += subsystem_type

if(!safety)//Only used by AIize() to successfully spawn an AI.
if (!B)//If there is no player/brain inside.
empty_playable_ai_cores += new /obj/structure/AIcore/deactivated(loc)//New empty terminal.
Expand Down
43 changes: 20 additions & 23 deletions code/modules/mob/living/silicon/ai/malf.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@
hacked_apcs = list()
recalc_cpu()

grant_verb(src, list(
/datum/game_mode/malfunction/verb/ai_select_hardware,
/datum/game_mode/malfunction/verb/ai_select_research,
/datum/game_mode/malfunction/verb/ai_help,
))
verbs += /datum/game_mode/malfunction/verb/ai_select_hardware
verbs += /datum/game_mode/malfunction/verb/ai_select_research
verbs += /datum/game_mode/malfunction/verb/ai_help

log_ability_use(src, "became malfunctioning AI")
// And greet user with some OOC info.
Expand Down Expand Up @@ -44,7 +42,7 @@
if(security_state.current_security_level == security_state.severe_security_level)
security_state.decrease_security_level(TRUE)
// Reset our verbs
revoke_verb(src, verbs)
src.verbs.Cut()
add_ai_verbs()
// Let them know.
if(loud)
Expand Down Expand Up @@ -117,31 +115,30 @@

// Shows capacitor charge and hardware integrity information to the AI in Status tab.
/mob/living/silicon/ai/show_system_integrity()
. = list()

if(!stat)
. += "Hardware integrity: [hardware_integrity()]%"
. += "Internal capacitor: [backup_capacitor()]%"
if(!src.stat)
stat("Hardware integrity", "[hardware_integrity()]%")
stat("Internal capacitor", "[backup_capacitor()]%")

if(eyeobj)
var/turf/T = get_turf(eyeobj)
stat("Current location", "([T.x]:[T.y]:[T.z])")
else
. += "Systems nonfunctional"
stat("Systems nonfunctional")

// Shows AI Malfunction related information to the AI.
/mob/living/silicon/ai/show_malf_ai()
. = ..()

if(src.is_malf())
if(src.hacked_apcs)
. += "Hacked APCs: [src.hacked_apcs.len]"
. += "System Status: [src.hacking ? "Busy" : "Stand-By"]"
stat("Hacked APCs", "[src.hacked_apcs.len]")
stat("System Status", "[src.hacking ? "Busy" : "Stand-By"]")
if(src.research)
. += "Available CPU: [src.research.stored_cpu] TFlops"
. += "Maximal CPU: [src.research.max_cpu] TFlops"
. += "CPU generation rate: [src.research.cpu_increase_per_tick * 10] TFlops/s"
. += "Current research focus: [src.research.focus ? src.research.focus.name : "None"]"
stat("Available CPU", "[src.research.stored_cpu] TFlops")
stat("Maximal CPU", "[src.research.max_cpu] TFlops")
stat("CPU generation rate", "[src.research.cpu_increase_per_tick * 10] TFlops/s")
stat("Current research focus", "[src.research.focus ? src.research.focus.name : "None"]")
if(src.research.focus)
. += "Research completed: [round(src.research.focus.invested, 0.1)]/[round(src.research.focus.price)]"
stat("Research completed", "[round(src.research.focus.invested, 0.1)]/[round(src.research.focus.price)]")
if(system_override == 1)
. += "SYSTEM OVERRIDE INITIATED"
stat("SYSTEM OVERRIDE INITIATED")
else if(system_override == 2)
. += "SYSTEM OVERRIDE COMPLETED"
stat("SYSTEM OVERRIDE COMPLETED")
28 changes: 16 additions & 12 deletions code/modules/mob/living/silicon/pai/pai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,8 @@
//As a human made device, we'll understand sol common without the need of the translator
add_language(LANGUAGE_SOL_COMMON, 1)

grant_verb(src, list(
/mob/living/silicon/pai/proc/choose_chassis,
/mob/living/silicon/pai/proc/choose_verbs,
))
verbs += /mob/living/silicon/pai/proc/choose_chassis
verbs += /mob/living/silicon/pai/proc/choose_verbs

..()

Expand All @@ -109,12 +107,18 @@
silicon_radio = null // Because this radio actually belongs to another instance we simply null
. = ..()

/mob/living/silicon/pai/get_status_tab_items()
. = ..()

if(silence_time)
// this function shows the information about being silenced as a pAI in the Status panel
/mob/living/silicon/pai/proc/show_silenced()
if(src.silence_time)
var/timeleft = round((silence_time - world.timeofday)/10 ,1)
. += "Communications system reboot in -[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]"
stat(null, "Communications system reboot in -[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]")


/mob/living/silicon/pai/Stat()
. = ..()
statpanel("Status")
if (src.client.statpanel == "Status")
show_silenced()

/mob/living/silicon/pai/check_eye(mob/user as mob)
if (!src.current)
Expand Down Expand Up @@ -297,8 +301,8 @@

chassis = possible_chassis[choice]

revoke_verb(src, /mob/living/silicon/pai/proc/choose_chassis)
grant_verb(src, /mob/living/proc/hide)
verbs -= /mob/living/silicon/pai/proc/choose_chassis
verbs += /mob/living/proc/hide

/mob/living/silicon/pai/proc/choose_verbs()
set category = "pAI Commands"
Expand All @@ -312,7 +316,7 @@
speak_exclamation = sayverbs[(sayverbs.len>1 ? 2 : sayverbs.len)]
speak_query = sayverbs[(sayverbs.len>2 ? 3 : sayverbs.len)]

revoke_verb(src, /mob/living/silicon/pai/proc/choose_verbs)
verbs -= /mob/living/silicon/pai/proc/choose_verbs

/mob/living/silicon/pai/lay_down()
set name = "Rest"
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/silicon/posi_brainmob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use_me = 0 //Can't use the me verb, it's a freaking immobile brain
icon = 'icons/mob/human_races/organs/cyber.dmi'
icon_state = "brain-prosthetic"
default_silicon_subsystems = list(
silicon_subsystems = list(
/datum/nano_module/law_manager
)

Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/silicon/robot/drone/drone.dm
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ var/list/mob_hat_cache = list()

..()

grant_verb(src, /mob/living/proc/hide)
verbs += /mob/living/proc/hide

remove_language(LANGUAGE_ROBOT)
add_language(LANGUAGE_ROBOT, FALSE)
Expand All @@ -148,7 +148,7 @@ var/list/mob_hat_cache = list()
var/datum/robot_component/C = components[V]
C.max_damage = 10

revoke_verb(src, /mob/living/silicon/robot/verb/Namepick)
verbs -= /mob/living/silicon/robot/verb/Namepick
update_icon()

/mob/living/silicon/robot/drone/init()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
/mob/living/silicon/robot/drone/proc/assume_control(mob/living/silicon/ai/user)
user.controlling_drone = src
controlling_ai = user
grant_verb(src, /mob/living/silicon/robot/drone/proc/release_ai_control_verb)
revoke_verb(src, /mob/living/proc/ghost)
verbs += /mob/living/silicon/robot/drone/proc/release_ai_control_verb
verbs -= /mob/living/proc/ghost
local_transmit = FALSE
languages = controlling_ai.languages.Copy()
add_language("Robot Talk", 1)
Expand All @@ -35,7 +35,6 @@
user.mind.transfer_to(src)
else
key = user.key
client?.init_verbs()

updatename()
qdel(silicon_radio)
Expand Down Expand Up @@ -97,14 +96,13 @@
mind.transfer_to(controlling_ai)
else
controlling_ai.key = key
controlling_ai.client?.init_verbs()

to_chat(controlling_ai, "<span class='notice'>[message]</span>")
controlling_ai.controlling_drone = null
controlling_ai = null

revoke_verb(src, /mob/living/silicon/robot/drone/proc/release_ai_control_verb)
grant_verb(src, /mob/living/proc/ghost)
verbs -= /mob/living/silicon/robot/drone/proc/release_ai_control_verb
verbs += /mob/living/proc/ghost

full_law_reset()
updatename()
Expand Down
3 changes: 0 additions & 3 deletions code/modules/mob/living/silicon/robot/preset.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
cell = /obj/item/cell/super
pitch_toggle = 0
custom_sprite = FALSE // presets robots must not have custom sprites.
default_silicon_subsystems = list(
/datum/nano_module/law_manager
)

/mob/living/silicon/robot/combat
lawupdate = 0
Expand Down
50 changes: 33 additions & 17 deletions code/modules/mob/living/silicon/robot/robot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -493,31 +493,47 @@
else
set_light(0)

// this function displays jetpack pressure in the stat panel
/mob/living/silicon/robot/proc/show_jetpack_pressure()
// if you have a jetpack, show the internal tank pressure
var/obj/item/tank/jetpack/current_jetpack = installed_jetpack()
if (current_jetpack)
stat("Internal Atmosphere Info", current_jetpack.name)
stat("Tank Pressure", current_jetpack.air_contents.return_pressure())

// this function returns the robots jetpack, if one is installed
/mob/living/silicon/robot/proc/installed_jetpack()
if(module)
return (locate(/obj/item/tank/jetpack) in module.modules)
return null

/mob/living/silicon/robot/get_status_tab_items()
. = ..()

// this function displays the cyborgs current cell charge in the stat panel
/mob/living/silicon/robot/proc/show_cell_power()
if(cell)
. += "Charge Left: [round(CELL_PERCENT(cell))]%"
. += "Cell Rating: [round(cell.maxcharge)]"
. += "Power Cell Load: [round(used_power_this_tick)]W"
stat(null, text("Charge Left: [round(CELL_PERCENT(cell))]%"))
stat(null, text("Cell Rating: [round(cell.maxcharge)]")) // Round just in case we somehow get crazy values
stat(null, text("Power Cell Load: [round(used_power_this_tick)]W"))
else
. += "No Cell Inserted!"
stat(null, text("No Cell Inserted!"))

var/obj/item/tank/jetpack/current_jetpack = installed_jetpack()
if(current_jetpack)
. += "Internal Atmosphere Info: [current_jetpack]"
. += "Tank Pressure [current_jetpack.air_contents.return_pressure()]"

. += "Lights: [lights_on ? "ON" : "OFF"]"
/mob/living/silicon/robot/proc/show_gps()
var/turf/T = get_turf(src)
if (T.z != 1 && T.z != 2)
stat(null, text("Current location: Unknown"))
else
stat(null, text("Current location:[T.x]:[T.y]:[T.z]"))

for(var/datum/matter_synth/ms in module?.synths)
. += "[ms.name]: [ms.energy]/[ms.max_energy_multiplied]"
// update the status screen display
/mob/living/silicon/robot/Stat()
. = ..()
if (statpanel("Status"))
show_gps()
show_cell_power()
show_jetpack_pressure()
stat(null, text("Lights: [lights_on ? "ON" : "OFF"]"))
if(module)
for(var/datum/matter_synth/ms in module.synths)
stat("[ms.name]: [ms.energy]/[ms.max_energy_multiplied]")

/mob/living/silicon/robot/restrained()
return 0
Expand Down Expand Up @@ -1112,10 +1128,10 @@
toggle_sensor_mode()

/mob/living/silicon/robot/proc/add_robot_verbs()
grant_verb(src, robot_verbs_default)
src.verbs |= robot_verbs_default

/mob/living/silicon/robot/proc/remove_robot_verbs()
revoke_verb(src, robot_verbs_default)
src.verbs -= robot_verbs_default

// Uses power from cyborg's cell. Returns 1 on success or 0 on failure.
// Properly converts using CELLRATE now! Amount is in Joules.
Expand Down
40 changes: 15 additions & 25 deletions code/modules/mob/living/silicon/silicon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,6 @@ GLOBAL_LIST_EMPTY(all_synthetic_mind_to_data) // data: list of name and type of
var/list/avaliable_huds
var/active_hud

/// List of subsystems to initialize when silicon is spawned.
var/list/default_silicon_subsystems = list(
/datum/nano_module/alarm_monitor/all,
/datum/nano_module/law_manager,
/datum/nano_module/records/ai
)
/// List of all created and managed subsystems.
var/list/datum/nano_module/silicon_subsystems
/// Asociative list typepath -> `datum/ui_state`, where typepath is subsystem's type.
var/list/silicon_subsystems_states

rad_resist_type = /datum/rad_resist/mob_silicon

/datum/rad_resist/mob_silicon
Expand Down Expand Up @@ -73,17 +62,13 @@ GLOBAL_LIST_EMPTY(all_synthetic_mind_to_data) // data: list of name and type of
QDEL_NULL(silicon_radio)
QDEL_NULL(silicon_camera)

for(var/datum/nano_module/subsystem in silicon_subsystems)
remove_subsystem(subsystem.type)

for(var/datum/alarm_handler/AH in SSalarm.all_handlers)
AH.unregister_alarm(src)

if(istype(idcard))
QDEL_NULL(idcard)

queued_alarms.Cut()
silicon_subsystems_states?.Cut() // Just in case...

return ..()

Expand Down Expand Up @@ -183,26 +168,31 @@ GLOBAL_LIST_EMPTY(all_synthetic_mind_to_data) // data: list of name and type of

// this function shows the health of the AI in the Status panel
/mob/living/silicon/proc/show_system_integrity()
. = list()

if(!src.stat)
. += "System integrity: [round((health/maxHealth)*100)]%"
stat(null, text("System integrity: [round((health/maxHealth)*100)]%"))
else
. += "Systems nonfunctional"
stat(null, text("Systems nonfunctional"))


// This is a pure virtual function, it should be overwritten by all subclasses
/mob/living/silicon/proc/show_malf_ai(list/stats)
return list()
/mob/living/silicon/proc/show_malf_ai()
return 0

// this function displays the shuttles ETA in the status panel if the shuttle has been called
/mob/living/silicon/proc/show_emergency_shuttle_eta()
if(evacuation_controller)
var/eta_status = evacuation_controller.get_status_panel_eta()
if(eta_status)
stat(null, eta_status)

// This adds the basic clock, shuttle recall timer, and malf_ai info to all silicon lifeforms
/mob/living/silicon/get_status_tab_items()
/mob/living/silicon/Stat()
if(statpanel("Status"))
show_emergency_shuttle_eta()
show_system_integrity()
show_malf_ai()
. = ..()

. += show_system_integrity()
. += show_malf_ai()


// this function displays the stations manifest in a separate window
/mob/living/silicon/proc/show_station_manifest()
Expand Down
Loading

0 comments on commit cc88b88

Please sign in to comment.