Files
BatrachophrenoandGitHub 4ecb0bc21c Repath obj/machinery to obj/structure/machinery [MDB Ignore] (#22500)
Repaths obj/machinery to obj/structure/machinery. **Note for
reviewers:** the only meaningful changed code exists within
**code/game/objects/structures.dm** and
**code/game/objects/structures/_machinery.dm**, largely concerning
damage procs. With the exception of moving airlock defines to their own
file, ALL OTHER CHANGES ARE STRICTLY PATH CHANGES.

Objects, _categorically_, are largely divided between those you can hold
in your hand/inventory and those you can't. Machinery objects are
already subtypes of Structures behaviorally, this PR just makes their
pathing reflect that, and allows for future work (tool actions, more
health/destruction functionality) to be developed without unnecessary
code duplication.

I have tested this PR by loading up the Horizon and dismantling various
machines and structures with tools, shooting guns of various types
throughout the ship, and detonating a bunch of explosions throughout the
ship.
2026-05-26 19:35:48 +00:00

112 lines
3.4 KiB
Plaintext

/datum/ai_emotion
var/overlay
var/ckey
/datum/ai_emotion/New(var/over, var/key)
overlay = over
ckey = key
GLOBAL_LIST_INIT(ai_status_emotions, list(
"Very Happy" = new /datum/ai_emotion("ai_veryhappy"),
"Happy" = new /datum/ai_emotion("ai_happy"),
"Neutral" = new /datum/ai_emotion("ai_neutral"),
"Unsure" = new /datum/ai_emotion("ai_unsure"),
"Confused" = new /datum/ai_emotion("ai_confused"),
"Sad" = new /datum/ai_emotion("ai_sad"),
"Surprised" = new /datum/ai_emotion("ai_surprised"),
"Upset" = new /datum/ai_emotion("ai_upset"),
"Angry" = new /datum/ai_emotion("ai_angry"),
"BSOD" = new /datum/ai_emotion("ai_bsod"),
"Blank" = new /datum/ai_emotion("ai_off"),
"Problems?" = new /datum/ai_emotion("ai_trollface"),
"Awesome" = new /datum/ai_emotion("ai_awesome"),
"Dorfy" = new /datum/ai_emotion("ai_urist"),
"Facepalm" = new /datum/ai_emotion("ai_facepalm"),
"Friend Computer" = new /datum/ai_emotion("ai_friend"),
"Diagnostics" = new /datum/ai_emotion("ai_diagnostics"),
"Tribunal" = new /datum/ai_emotion("ai_tribunal", "serithi"),
"Tribunal Malfunctioning" = new /datum/ai_emotion("ai_tribunal_malf", "serithi")
))
/proc/get_ai_emotions(var/ckey)
var/list/emotions = new
for(var/emotion_name in GLOB.ai_status_emotions)
var/datum/ai_emotion/emotion = GLOB.ai_status_emotions[emotion_name]
if(!emotion.ckey || emotion.ckey == ckey)
emotions += emotion_name
return emotions
/proc/set_ai_status_displays(mob/user as mob)
var/emote = get_ai_emotion(user)
for (var/obj/structure/machinery/M in SSmachinery.all_status_displays) //change status
if(istype(M, /obj/structure/machinery/ai_status_display))
var/obj/structure/machinery/ai_status_display/AISD = M
AISD.emotion = emote
AISD.update()
//if Friend Computer, change ALL displays
else if(istype(M, /obj/structure/machinery/status_display))
var/obj/structure/machinery/status_display/SD = M
if(emote=="Friend Computer")
SD.friendc = 1
else
SD.friendc = 0
/obj/structure/machinery/ai_status_display
icon = 'icons/obj/status_display.dmi'
icon_state = "frame"
name = "AI display"
anchored = 1
density = 0
var/mode = 0 // 0 = Blank
// 1 = AI emoticon
// 2 = Blue screen of death
var/picture_state // icon_state of ai picture
var/emotion = "Neutral"
/obj/structure/machinery/ai_status_display/Initialize()
. = ..()
SSmachinery.all_status_displays += src
/obj/structure/machinery/ai_status_display/Destroy()
SSmachinery.all_status_displays -= src
return ..()
/obj/structure/machinery/ai_status_display/attack_ai(mob/user as mob)
if(!ai_can_interact(user))
return
var/emote = get_ai_emotion(user)
src.emotion = emote
src.update()
/proc/get_ai_emotion(mob/user as mob)
return input(user, "Please, select a status!", "AI Status", null) in get_ai_emotions(user.ckey)
/obj/structure/machinery/ai_status_display/proc/update()
switch (mode)
if (0) // Blank
ClearOverlays()
if (1) // AI emoticon
var/datum/ai_emotion/ai_emotion = GLOB.ai_status_emotions[emotion]
set_picture(ai_emotion.overlay)
if (2) // BSOD
set_picture("ai_bsod")
/obj/structure/machinery/ai_status_display/proc/set_picture(var/state)
picture_state = state
ClearOverlays()
AddOverlays(picture_state)
/obj/structure/machinery/ai_status_display/power_change()
..()
if(stat & NOPOWER)
ClearOverlays()
else
update()