Skip to content

Commit

Permalink
Merge pull request #1447 from MistakeNot4892/braaaains
Browse files Browse the repository at this point in the history
Wide-scale MMI and brainmob refactor. [MDB IGNORE]
  • Loading branch information
out-of-phaze authored Jan 25, 2024
2 parents 204bdc8 + 4f96b4c commit 8bd10f7
Show file tree
Hide file tree
Showing 70 changed files with 887 additions and 1,233 deletions.
1 change: 0 additions & 1 deletion code/__defines/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@
#define BP_ACETONE "acetone reactor"

// Robo Organs.
#define BP_POSIBRAIN "posibrain"
#define BP_VOICE "vocal synthesiser"
#define BP_STACK "stack"
#define BP_OPTICS "optics"
Expand Down
12 changes: 12 additions & 0 deletions code/_helpers/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -311,3 +311,15 @@ var/global/list/bodypart_coverage_cache = list()
/proc/get_sorted_mob_list()
. = sortTim(SSmobs.mob_list.Copy(), /proc/cmp_name_asc)
. = sortTim(., /proc/cmp_mob_sortvalue_asc)

/proc/transfer_key_from_mob_to_mob(var/mob/from_mob, var/mob/to_mob)
if(!from_mob || !from_mob.key || !to_mob)
return FALSE
var/initial_key = from_mob.key
if(to_mob.key)
to_mob.ghostize()
if(from_mob.mind)
from_mob.mind.transfer_to(to_mob)
if(initial_key && to_mob.key != initial_key)
to_mob.key = initial_key
return to_mob.key == initial_key
2 changes: 1 addition & 1 deletion code/_macros.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#define isatom(A) isloc(A)

#define isbrain(A) istype(A, /mob/living/carbon/brain)
#define isbrain(A) istype(A, /mob/living/brain)

#define iscarbon(A) istype(A, /mob/living/carbon)

Expand Down
3 changes: 0 additions & 3 deletions code/_onclick/rig.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
/mob/living/carbon/human/can_use_rig()
return 1

/mob/living/carbon/brain/can_use_rig()
return istype(loc, /obj/item/mmi)

/mob/living/silicon/ai/can_use_rig()
return carded

Expand Down
19 changes: 8 additions & 11 deletions code/controllers/subsystems/initialization/robots.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,15 @@ SUBSYSTEM_DEF(robots)
var/list/robot_alt_titles = list()

var/list/mob_types_by_title = list(
"robot, flying" = /mob/living/silicon/robot/flying,
"drone, flying" = /mob/living/silicon/robot/flying,
"cyborg, flying" = /mob/living/silicon/robot/flying
"cyborg, flying" = /mob/living/silicon/robot/flying,
"robot, flying" = /mob/living/silicon/robot/flying
)

var/list/mmi_types_by_title = list(
"cyborg" = /obj/item/mmi,
"robot" = /obj/item/organ/internal/posibrain,
"drone" = /obj/item/mmi/digital/robot,
"cyborg, flying" = /obj/item/mmi,
"robot, flying" = /obj/item/organ/internal/posibrain,
"drone, flying" = /obj/item/mmi/digital/robot
"cyborg" = /obj/item/organ/internal/brain_interface,
"robot" = /obj/item/organ/internal/brain/robotic,
"cyborg, flying" = /obj/item/organ/internal/brain_interface,
"robot, flying" = /obj/item/organ/internal/brain/robotic
)

/datum/controller/subsystem/robots/Initialize()
Expand Down Expand Up @@ -60,8 +57,8 @@ SUBSYSTEM_DEF(robots)
if(modules[include_override])
.[include_override] = modules[include_override]

/datum/controller/subsystem/robots/proc/get_mmi_type_by_title(var/check_title)
. = mmi_types_by_title[lowertext(trim(check_title))] || /obj/item/mmi
/datum/controller/subsystem/robots/proc/get_brain_type_by_title(var/check_title)
. = mmi_types_by_title[lowertext(trim(check_title))] || /obj/item/organ/internal/brain/robotic

/datum/controller/subsystem/robots/proc/get_mob_type_by_title(var/check_title)
. = mob_types_by_title[lowertext(trim(check_title))] || /mob/living/silicon/robot
2 changes: 1 addition & 1 deletion code/datums/repositories/follow.dm
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ var/global/repository/follow/follow_repository = new()

/datum/follow_holder/brain
sort_order = 3
followed_type = /mob/living/carbon/brain
followed_type = /mob/living/brain
suffix = "Brain"

/datum/follow_holder/alien
Expand Down
74 changes: 37 additions & 37 deletions code/datums/trading/traders/goods.dm
Original file line number Diff line number Diff line change
Expand Up @@ -218,43 +218,43 @@ Sells devices, odds and ends, and medical stuff
"McGillicuddy's"
)
possible_trading_items = list(
/obj/item/flashlight = TRADER_ALL,
/obj/item/kit/paint = TRADER_SUBTYPES_ONLY,
/obj/item/aicard = TRADER_THIS_TYPE,
/obj/item/binoculars = TRADER_THIS_TYPE,
/obj/item/cable_painter = TRADER_THIS_TYPE,
/obj/item/flash = TRADER_THIS_TYPE,
/obj/item/paint_sprayer = TRADER_THIS_TYPE,
/obj/item/multitool = TRADER_THIS_TYPE,
/obj/item/lightreplacer = TRADER_THIS_TYPE,
/obj/item/megaphone = TRADER_THIS_TYPE,
/obj/item/paicard = TRADER_THIS_TYPE,
/obj/item/scanner/health = TRADER_THIS_TYPE,
/obj/item/scanner/breath = TRADER_THIS_TYPE,
/obj/item/scanner/gas = TRADER_ALL,
/obj/item/scanner/spectrometer = TRADER_ALL,
/obj/item/scanner/reagent = TRADER_ALL,
/obj/item/scanner/xenobio = TRADER_THIS_TYPE,
/obj/item/suit_cooling_unit = TRADER_THIS_TYPE,
/obj/item/t_scanner = TRADER_THIS_TYPE,
/obj/item/taperecorder = TRADER_THIS_TYPE,
/obj/item/batterer = TRADER_THIS_TYPE,
/obj/item/synthesized_instrument/violin = TRADER_THIS_TYPE,
/obj/item/hailer = TRADER_THIS_TYPE,
/obj/item/uv_light = TRADER_THIS_TYPE,
/obj/item/mmi = TRADER_ALL,
/obj/item/robotanalyzer = TRADER_THIS_TYPE,
/obj/item/chems/toner_cartridge = TRADER_THIS_TYPE,
/obj/item/camera_film = TRADER_THIS_TYPE,
/obj/item/camera = TRADER_THIS_TYPE,
/obj/item/destTagger = TRADER_THIS_TYPE,
/obj/item/gps = TRADER_THIS_TYPE,
/obj/item/measuring_tape = TRADER_THIS_TYPE,
/obj/item/ano_scanner = TRADER_THIS_TYPE,
/obj/item/core_sampler = TRADER_THIS_TYPE,
/obj/item/depth_scanner = TRADER_THIS_TYPE,
/obj/item/pinpointer/radio = TRADER_THIS_TYPE,
/obj/item/stack/medical/advanced = TRADER_BLACKLIST
/obj/item/flashlight = TRADER_ALL,
/obj/item/kit/paint = TRADER_SUBTYPES_ONLY,
/obj/item/aicard = TRADER_THIS_TYPE,
/obj/item/binoculars = TRADER_THIS_TYPE,
/obj/item/cable_painter = TRADER_THIS_TYPE,
/obj/item/flash = TRADER_THIS_TYPE,
/obj/item/paint_sprayer = TRADER_THIS_TYPE,
/obj/item/multitool = TRADER_THIS_TYPE,
/obj/item/lightreplacer = TRADER_THIS_TYPE,
/obj/item/megaphone = TRADER_THIS_TYPE,
/obj/item/paicard = TRADER_THIS_TYPE,
/obj/item/scanner/health = TRADER_THIS_TYPE,
/obj/item/scanner/breath = TRADER_THIS_TYPE,
/obj/item/scanner/gas = TRADER_ALL,
/obj/item/scanner/spectrometer = TRADER_ALL,
/obj/item/scanner/reagent = TRADER_ALL,
/obj/item/scanner/xenobio = TRADER_THIS_TYPE,
/obj/item/suit_cooling_unit = TRADER_THIS_TYPE,
/obj/item/t_scanner = TRADER_THIS_TYPE,
/obj/item/taperecorder = TRADER_THIS_TYPE,
/obj/item/batterer = TRADER_THIS_TYPE,
/obj/item/synthesized_instrument/violin = TRADER_THIS_TYPE,
/obj/item/hailer = TRADER_THIS_TYPE,
/obj/item/uv_light = TRADER_THIS_TYPE,
/obj/item/organ/internal/brain_interface = TRADER_SUBTYPES_ONLY,
/obj/item/robotanalyzer = TRADER_THIS_TYPE,
/obj/item/chems/toner_cartridge = TRADER_THIS_TYPE,
/obj/item/camera_film = TRADER_THIS_TYPE,
/obj/item/camera = TRADER_THIS_TYPE,
/obj/item/destTagger = TRADER_THIS_TYPE,
/obj/item/gps = TRADER_THIS_TYPE,
/obj/item/measuring_tape = TRADER_THIS_TYPE,
/obj/item/ano_scanner = TRADER_THIS_TYPE,
/obj/item/core_sampler = TRADER_THIS_TYPE,
/obj/item/depth_scanner = TRADER_THIS_TYPE,
/obj/item/pinpointer/radio = TRADER_THIS_TYPE,
/obj/item/stack/medical/advanced = TRADER_BLACKLIST
)
speech = list(
TRADER_HAIL_GENERIC = "Hello, hello! Bits and bobs and everything in between, I hope you find what you're looking for!",
Expand Down
3 changes: 1 addition & 2 deletions code/game/gamemodes/cult/cult_structures.dm
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@

if(isrobot(M))
var/mob/living/silicon/robot/Robot = M
if(Robot.mmi)
qdel(Robot.mmi)
QDEL_NULL(Robot.central_processor)
else
for(var/obj/item/W in M)
M.drop_from_inventory(W)
Expand Down
32 changes: 13 additions & 19 deletions code/game/machinery/computer/ai_core.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var/global/list/empty_playable_ai_cores = list()

var/datum/ai_laws/laws
var/obj/item/stock_parts/circuitboard/circuit
var/obj/item/mmi/brain
var/obj/item/organ/internal/brain
var/authorized

var/circuit_secured = FALSE
Expand Down Expand Up @@ -139,30 +139,24 @@ var/global/list/empty_playable_ai_cores = list()

if(circuit && circuit_secured)

if((istype(P, /obj/item/mmi) || istype(P, /obj/item/organ/internal/posibrain)) && wired && circuit && circuit_secured)
var/mob/living/carbon/brain/B
if(istype(P, /obj/item/mmi))
var/obj/item/mmi/M = P
B = M.brainmob
else
var/obj/item/organ/internal/posibrain/PB = P
B = PB.brainmob
if(!B)
to_chat(user, SPAN_WARNING("Sticking an empty [P] into the frame would sort of defeat the purpose."))
if(istype(P, /obj/item/organ/internal) && wired && circuit && circuit_secured)
var/obj/item/organ/internal/M = P
var/mob/living/brainmob = M.get_brainmob()
if(!brainmob)
to_chat(user, SPAN_WARNING("Sticking a mindless [P] into the frame would be pointless."))
return
if(B.stat == DEAD)
if(brainmob.stat == DEAD)
to_chat(user, SPAN_WARNING("Sticking a dead [P] into the frame would sort of defeat the purpose."))
return
if(jobban_isbanned(B, "AI"))
if(jobban_isbanned(brainmob, "AI"))
to_chat(user, SPAN_WARNING("This [P] does not seem to fit."))
return
if(!user.try_unequip(P, src))
return
if(B.mind)
clear_antag_roles(B.mind, 1)
brain = P
to_chat(usr, "Added [P].")
update_icon()
if(brainmob.mind)
clear_antag_roles(brainmob.mind, 1)
brain = P
to_chat(usr, "You connect \the [P] to the frame and slide it into the casing.")
update_icon()
return TRUE

if(istype(P, /obj/item/stack/material))
Expand Down
16 changes: 8 additions & 8 deletions code/game/machinery/cryopod.dm
Original file line number Diff line number Diff line change
Expand Up @@ -314,14 +314,14 @@
// Also make sure there is a valid control computer
/obj/machinery/cryopod/robot/despawn_occupant()
var/mob/living/silicon/robot/R = occupant
if(!istype(R)) return ..()

qdel(R.mmi)
for(var/obj/item/I in R.module) // the tools the borg has; metal, glass, guns etc
for(var/obj/item/O in I.get_contained_external_atoms()) // the things inside the tools, if anything; mainly for janiborg trash bags
O.forceMove(R)
qdel(I)
qdel(R.module)
if(istype(R))
R.clear_brain()
if(R.module)
for(var/obj/item/I in R.module) // the tools the borg has; metal, glass, guns etc
for(var/obj/item/O in I.get_contained_external_atoms()) // the things inside the tools, if anything; mainly for janiborg trash bags
O.forceMove(R)
qdel(I)
qdel(R.module)

. = ..()

Expand Down
31 changes: 13 additions & 18 deletions code/game/objects/items/robot/robot_frame.dm
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
parts[part.bp_tag] = part
update_icon()

// Install an MMI/brain.
else if(istype(W, /obj/item/mmi) || istype(W, /obj/item/organ/internal/posibrain))
// Install a brain.
else if(istype(W, /obj/item/organ/internal/brain_interface))

if(!isturf(loc))
to_chat(user, SPAN_WARNING("You can't put \the [W] in without the frame being on the ground."))
Expand All @@ -71,31 +71,25 @@
to_chat(user, SPAN_WARNING("The frame is not ready for the central processor to be installed."))
return

var/mob/living/carbon/brain/B
if(istype(W, /obj/item/mmi))
var/obj/item/mmi/M = W
B = M.brainmob
else
var/obj/item/organ/internal/posibrain/P = W
B = P.brainmob

if(!B)
var/obj/item/organ/internal/brain_interface/M = W
var/mob/living/brainmob = M?.get_brainmob()
if(!brainmob)
to_chat(user, SPAN_WARNING("Sticking an empty [W.name] into the frame would sort of defeat the purpose."))
return

if(jobban_isbanned(B, ASSIGNMENT_ROBOT))
if(jobban_isbanned(brainmob, ASSIGNMENT_ROBOT))
to_chat(user, SPAN_WARNING("\The [W] does not seem to fit."))
return

if(B.stat == DEAD)
if(brainmob.stat == DEAD)
to_chat(user, SPAN_WARNING("Sticking a dead [W.name] into the frame would sort of defeat the purpose."))
return

var/ghost_can_reenter = 0
if(B.mind)
if(!B.key)
if(brainmob.mind)
if(!brainmob.key)
for(var/mob/observer/ghost/G in global.player_list)
if(G.can_reenter_corpse && G.mind == B.mind)
if(G.can_reenter_corpse && G.mind == brainmob.mind)
ghost_can_reenter = 1
break
else
Expand All @@ -112,11 +106,12 @@
if(!O)
return

O.mmi = W
O.central_processor = W
O.set_invisibility(INVISIBILITY_NONE)
O.custom_name = created_name
O.updatename("Default")
B.mind.transfer_to(O)

brainmob.mind.transfer_to(O)
if(O.mind && O.mind.assigned_role)
O.job = O.mind.assigned_role
else
Expand Down
Loading

0 comments on commit 8bd10f7

Please sign in to comment.