Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 3 additions & 6 deletions code/controllers/subsystems/initialization/robots.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,19 @@ SUBSYSTEM_DEF(robots)
var/list/robot_alt_titles = list()

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

var/list/mmi_types_by_title = list(
"cyborg" = /obj/item/organ/internal/brain_interface,
var/list/processor_types_by_title = list(
"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()
. = ..()

// This is done via loop instead of just assignment in order to trim associations.
for(var/title in (mob_types_by_title|mmi_types_by_title))
for(var/title in (mob_types_by_title|processor_types_by_title))
robot_alt_titles |= capitalize(title)
sortTim(robot_alt_titles, /proc/cmp_text_asc)

Expand Down Expand Up @@ -58,7 +55,7 @@ SUBSYSTEM_DEF(robots)
.[include_override] = modules[include_override]

/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
. = processor_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
1 change: 0 additions & 1 deletion code/datums/trading/traders/goods.dm
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ Sells devices, odds and ends, and medical stuff
/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,
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/ai_core.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ var/global/list/empty_playable_ai_cores = list()
if(open_for_latejoin)
empty_playable_ai_cores += D
else
var/mob/living/silicon/ai/A = new /mob/living/silicon/ai ( loc, laws, brain )
var/mob/living/silicon/ai/A = new /mob/living/silicon/ai ( loc, laws, brain.get_brainmob() )
if(A) //if there's no brain, the mob is deleted and a structure/AIcore is created
A.on_mob_init()
A.rename_self("ai", 1)
Expand Down
25 changes: 14 additions & 11 deletions code/game/objects/items/robot/robot_frame.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
SSstatistics.add_field("cyborg_frames_built",1)
return TRUE

/obj/item/robot_parts/robot_suit/proc/is_valid_processor(obj/item/used_item)
return istype(used_item, /obj/item/organ/internal/brain/robotic)

/obj/item/robot_parts/robot_suit/attackby(obj/item/used_item, mob/user)

// Uninstall a robotic part.
Expand Down Expand Up @@ -61,28 +64,28 @@
return TRUE

// Install a brain.
else if(istype(used_item, /obj/item/organ/internal/brain_interface))
else if(istype(used_item, /obj/item/organ/internal) && is_valid_processor(used_item))
var/obj/item/organ/internal/processor = used_item

if(!isturf(loc))
to_chat(user, SPAN_WARNING("You can't put \the [used_item] in without the frame being on the ground."))
to_chat(user, SPAN_WARNING("You can't put \the [processor] in without the frame being on the ground."))
return TRUE

if(!check_completion())
to_chat(user, SPAN_WARNING("The frame is not ready for the central processor to be installed."))
return TRUE

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

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

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

var/ghost_can_reenter = 0
Expand All @@ -95,18 +98,18 @@
else
ghost_can_reenter = 1
if(!ghost_can_reenter)
to_chat(user, SPAN_WARNING("\The [used_item] is completely unresponsive; there's no point."))
to_chat(user, SPAN_WARNING("\The [processor] is completely unresponsive; there's no point."))
return TRUE

if(!user.try_unequip(used_item))
if(!user.try_unequip(processor))
return TRUE

SSstatistics.add_field("cyborg_frames_built",1)
var/mob/living/silicon/robot/O = new product(get_turf(loc))
if(!O)
return TRUE

O.central_processor = used_item
O.central_processor = processor
O.set_invisibility(INVISIBILITY_NONE)
O.custom_name = created_name
O.updatename("Default")
Expand All @@ -120,7 +123,7 @@

var/obj/item/robot_parts/chest/chest = parts[BP_CHEST]
chest.cell.forceMove(O)
used_item.forceMove(O) //Should fix cybros run time erroring when blown up. It got deleted before, along with the frame.
processor.forceMove(O) //Should fix cybros run time erroring when blown up. It got deleted before, along with the frame.

// Since we "magically" installed a cell, we also have to update the correct component.
if(O.cell)
Expand Down
1 change: 0 additions & 1 deletion code/modules/bodytype/bodytype_prosthetic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
'sound/foley/metal1.ogg'
)
has_organ = list(
BP_BRAIN = /obj/item/organ/internal/brain_interface,
BP_EYES = /obj/item/organ/internal/eyes,
BP_CELL = /obj/item/organ/internal/cell
)
Expand Down
3 changes: 2 additions & 1 deletion code/modules/clothing/spacesuits/rig/modules/computer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
var/mob/living/integrated_ai // Direct reference to the actual mob held in the suit.
var/obj/item/ai_card // Reference to the object previously holding the AI.
var/obj/item/ai_verbs/verb_holder
var/list/simple_insert_types = list(/obj/item/paicard)

/mob/living
var/get_rig_stats = 0
Expand Down Expand Up @@ -136,7 +137,7 @@
return 1

// Okay, it wasn't a terminal being touched, check for all the simple insertions.
if(input_device.type in list(/obj/item/paicard, /obj/item/organ/internal/brain_interface))
if(is_type_in_list(input_device, simple_insert_types))
if(integrated_ai)
integrated_ai.attackby(input_device,user)
// If the transfer was successful, we can clear out our vars.
Expand Down
4 changes: 2 additions & 2 deletions code/modules/emotes/emote_mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
/mob/living/check_mob_can_emote(var/emote_type)
return ..() && !(HAS_STATUS(src, STAT_SILENCE) && emote_type == AUDIBLE_MESSAGE)

/mob/living/brain/check_mob_can_emote(var/emote_type)
return ..() && istype(get_container(), /obj/item/organ/internal/brain_interface)
/mob/living/brain/check_mob_can_emote(var/emote_type, allow_brain_emote = FALSE)
return ..() && allow_brain_emote

#define EMOTE_REFRESH_SPAM_COOLDOWN (5 SECONDS)
/mob/proc/emote(var/act, var/m_type, var/message)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
/datum/fabricator_recipe/protolathe/brains
category = "Machine Intelligence"
path = /obj/item/organ/internal/brain_interface/empty
path = /obj/item/organ/internal/brain/robotic

/datum/fabricator_recipe/protolathe/brains/get_product_name()
. = "intelligence storage ([..()])"

/datum/fabricator_recipe/protolathe/brains/robotic
path = /obj/item/organ/internal/brain/robotic

/datum/fabricator_recipe/protolathe/brains/mmi_radio
path = /obj/item/organ/internal/brain_interface/radio_enabled/empty

/datum/fabricator_recipe/protolathe/brains/paicard
path = /obj/item/paicard

Expand Down
5 changes: 5 additions & 0 deletions code/modules/mob/inventory.dm
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,11 @@
for(var/thing in get_held_items())
try_unequip(thing, drop_loc)

/mob/proc/drop_equipped_items(drop_loc = loc, include_carried = FALSE)
SHOULD_CALL_PARENT(TRUE)
for(var/thing in get_equipped_items(include_carried))
try_unequip(thing, drop_loc)

//Returns the item equipped to the specified slot, if any.
/mob/proc/get_equipped_item(var/slot)
SHOULD_CALL_PARENT(TRUE)
Expand Down
10 changes: 5 additions & 5 deletions code/modules/mob/living/brain/brain.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@
/mob/living/brain/proc/get_container()
return get_recursive_loc_of_type(/obj/item/organ/internal)

/mob/living/brain/proc/on_container_login(obj/item/organ/internal/container)
container.update_icon()

/mob/living/brain/Login()
. = ..()
var/obj/item/organ/internal/container = get_container()
if(istype(container))
var/obj/item/organ/internal/brain_interface/interface = container
if(istype(interface))
interface.locked = TRUE
container.update_icon()
on_container_login(container)

/mob/living/brain/proc/is_in_interface()
var/container = get_container()
return istype(container, /obj/item/organ/internal/brain_interface) || istype(container, /obj/item/organ/internal/brain/robotic)
return istype(container, /obj/item/organ/internal/brain/robotic)

/mob/living/brain/can_emote(emote_type, show_message)
return is_in_interface() && ..()
Expand Down
17 changes: 2 additions & 15 deletions code/modules/mob/living/brain/death.dm
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
/mob/living/brain/get_death_message(gibbed)
var/obj/item/organ/internal/brain_interface/container = get_container()
if(!gibbed && istype(container))
return "beeps shrilly as \the [container] flatlines!"
return ..()

/mob/living/brain/death(gibbed)
var/obj/item/organ/holder = loc
var/obj/item/organ/internal/brain_interface/container = get_container()
. = ..()
if(.)
if(stat == DEAD && istype(holder))
holder.die()
if(istype(container) && !QDELETED(container))
container.update_icon()

/mob/living/brain/gib(do_gibs = TRUE)
var/obj/item/organ/internal/brain_interface/container = get_container()
var/obj/item/organ/internal/brain/sponge = loc
. = ..()
if(.)
if(istype(container) && !QDELETED(container))
qdel(container)
if(istype(sponge) && !QDELETED(sponge))
qdel(sponge)
if(. && istype(sponge) && !QDELETED(sponge))
qdel(sponge)
4 changes: 0 additions & 4 deletions code/modules/mob/living/brain/say.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,3 @@
if(radio)
radio.hear_talk(src, sanitize(message), verb, speaking)

/mob/living/brain/get_radio()
var/obj/item/organ/internal/brain_interface/container = get_container()
if(istype(container))
return container.get_radio()
3 changes: 1 addition & 2 deletions code/modules/mob/living/silicon/ai/ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ var/global/list/ai_verbs_default = list(
src.verbs -= ai_verbs_default
src.verbs += /mob/living/verb/ghost

/mob/living/silicon/ai/Initialize(mapload, var/datum/ai_laws/L, var/obj/item/organ/internal/brain_interface/B, var/safety = 0)
/mob/living/silicon/ai/Initialize(mapload, var/datum/ai_laws/L, var/mob/living/brain/brainmob, var/safety = 0)
announcement = new()
announcement.title = "A.I. Announcement"
announcement.announcement_type = "A.I. Announcement"
Expand Down Expand Up @@ -143,7 +143,6 @@ var/global/list/ai_verbs_default = list(
add_language(/decl/language/sign, 0)

if(!safety)//Only used by AIize() to successfully spawn an AI.
var/mob/living/brainmob = B?.get_brainmob()
if(!brainmob) // If there is no player/brain inside.
empty_playable_ai_cores += new/obj/structure/aicore/deactivated(loc)//New empty terminal.
. = INITIALIZE_HINT_QDEL
Expand Down
1 change: 0 additions & 1 deletion code/modules/mob/living/silicon/robot/drone/drone_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
can_hold = list(
/obj/item/cell,
/obj/item/stock_parts,
/obj/item/organ/internal/brain_interface,
/obj/item/robot_parts,
/obj/item/borg/upgrade,
/obj/item/flash,
Expand Down
30 changes: 13 additions & 17 deletions code/modules/mob/transform_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
/mob/living/AIize(move = TRUE)
if (HAS_TRANSFORMATION_MOVEMENT_HANDLER(src))
return
for(var/t in get_external_organs())
qdel(t)
delete_organs()
drop_equipped_items()
for(var/obj/item/thing in src)
drop_from_inventory(thing)
ADD_TRANSFORMATION_MOVEMENT_HANDLER(src)
Expand All @@ -65,7 +65,7 @@
sound_to(src, sound(null, repeat = 0, wait = 0, volume = 85, channel = sound_channels.lobby_channel))// stop the jams for AIs


var/mob/living/silicon/ai/O = new (loc, global.using_map.default_law_type,,1)//No brain but safety is in effect.
var/mob/living/silicon/ai/O = new (loc, global.using_map.default_law_type,null,1)//No brain but safety is in effect.
O.set_invisibility(INVISIBILITY_NONE)
O.aiRestorePowerRoutine = 0
if(mind)
Expand Down Expand Up @@ -101,28 +101,23 @@
qdel(src)
return O

//human -> robot
/mob/living/human/proc/Robotize(var/supplied_robot_type = /mob/living/silicon/robot)
//living mob -> robot
/mob/living/proc/Robotize(var/supplied_robot_type = ASSIGNMENT_ROBOT, skip_qdel = FALSE)
if (HAS_TRANSFORMATION_MOVEMENT_HANDLER(src))
return
QDEL_NULL_LIST(worn_underwear)
for(var/obj/item/thing in src)
drop_from_inventory(thing)
try_refresh_visible_overlays()
ADD_TRANSFORMATION_MOVEMENT_HANDLER(src)
icon = null
set_invisibility(INVISIBILITY_ABSTRACT)
for(var/t in get_external_organs())
qdel(t)

var/mob/living/silicon/robot/O = new supplied_robot_type( loc )
drop_equipped_items()
var/robot_type_path = SSrobots.get_mob_type_by_title(supplied_robot_type)
var/mob/living/silicon/robot/O = new robot_type_path(loc)

O.set_gender(gender)
O.set_gender(get_gender())
O.set_invisibility(INVISIBILITY_NONE)

if(!mind)
mind_initialize()
mind.assigned_role = ASSIGNMENT_ROBOT
if(supplied_robot_type != ASSIGNMENT_ROBOT)
mind.role_alt_title = supplied_robot_type
mind.active = TRUE
mind.transfer_to(O)
if(O.mind && O.mind.assigned_role == ASSIGNMENT_ROBOT)
Expand All @@ -135,7 +130,8 @@
RAISE_EVENT(/decl/observ/cyborg_created, O)
O.Namepick()

qdel(src)
if(!skip_qdel)
qdel(src)
return O

/mob/living/human/proc/corgize()
Expand Down
Loading