|
32 | 32 | SSstatistics.add_field("cyborg_frames_built",1) |
33 | 33 | return TRUE |
34 | 34 |
|
| 35 | +/obj/item/robot_parts/robot_suit/proc/is_valid_processor(obj/item/used_item) |
| 36 | + return istype(used_item, /obj/item/organ/internal/brain/robotic) |
| 37 | + |
35 | 38 | /obj/item/robot_parts/robot_suit/attackby(obj/item/used_item, mob/user) |
36 | 39 |
|
37 | 40 | // Uninstall a robotic part. |
|
61 | 64 | return TRUE |
62 | 65 |
|
63 | 66 | // Install a brain. |
64 | | - else if(istype(used_item, /obj/item/organ/internal/brain_interface)) |
| 67 | + else if(istype(used_item, /obj/item/organ/internal) && is_valid_processor(used_item)) |
| 68 | + var/obj/item/organ/internal/processor = used_item |
65 | 69 |
|
66 | 70 | if(!isturf(loc)) |
67 | | - to_chat(user, SPAN_WARNING("You can't put \the [used_item] in without the frame being on the ground.")) |
| 71 | + to_chat(user, SPAN_WARNING("You can't put \the [processor] in without the frame being on the ground.")) |
68 | 72 | return TRUE |
69 | 73 |
|
70 | 74 | if(!check_completion()) |
71 | 75 | to_chat(user, SPAN_WARNING("The frame is not ready for the central processor to be installed.")) |
72 | 76 | return TRUE |
73 | 77 |
|
74 | | - var/obj/item/organ/internal/brain_interface/M = used_item |
75 | | - var/mob/living/brainmob = M?.get_brainmob() |
| 78 | + var/mob/living/brainmob = processor.get_brainmob() |
76 | 79 | if(!brainmob) |
77 | | - to_chat(user, SPAN_WARNING("Sticking an empty [used_item.name] into the frame would sort of defeat the purpose.")) |
| 80 | + to_chat(user, SPAN_WARNING("Sticking an empty [processor.name] into the frame would sort of defeat the purpose.")) |
78 | 81 | return TRUE |
79 | 82 |
|
80 | 83 | if(jobban_isbanned(brainmob, ASSIGNMENT_ROBOT)) |
81 | | - to_chat(user, SPAN_WARNING("\The [used_item] does not seem to fit.")) |
| 84 | + to_chat(user, SPAN_WARNING("\The [processor] does not seem to fit.")) |
82 | 85 | return TRUE |
83 | 86 |
|
84 | 87 | if(brainmob.stat == DEAD) |
85 | | - to_chat(user, SPAN_WARNING("Sticking a dead [used_item.name] into the frame would sort of defeat the purpose.")) |
| 88 | + to_chat(user, SPAN_WARNING("Sticking a dead [processor.name] into the frame would sort of defeat the purpose.")) |
86 | 89 | return TRUE |
87 | 90 |
|
88 | 91 | var/ghost_can_reenter = 0 |
|
95 | 98 | else |
96 | 99 | ghost_can_reenter = 1 |
97 | 100 | if(!ghost_can_reenter) |
98 | | - to_chat(user, SPAN_WARNING("\The [used_item] is completely unresponsive; there's no point.")) |
| 101 | + to_chat(user, SPAN_WARNING("\The [processor] is completely unresponsive; there's no point.")) |
99 | 102 | return TRUE |
100 | 103 |
|
101 | | - if(!user.try_unequip(used_item)) |
| 104 | + if(!user.try_unequip(processor)) |
102 | 105 | return TRUE |
103 | 106 |
|
104 | 107 | SSstatistics.add_field("cyborg_frames_built",1) |
105 | 108 | var/mob/living/silicon/robot/O = new product(get_turf(loc)) |
106 | 109 | if(!O) |
107 | 110 | return TRUE |
108 | 111 |
|
109 | | - O.central_processor = used_item |
| 112 | + O.central_processor = processor |
110 | 113 | O.set_invisibility(INVISIBILITY_NONE) |
111 | 114 | O.custom_name = created_name |
112 | 115 | O.updatename("Default") |
|
120 | 123 |
|
121 | 124 | var/obj/item/robot_parts/chest/chest = parts[BP_CHEST] |
122 | 125 | chest.cell.forceMove(O) |
123 | | - used_item.forceMove(O) //Should fix cybros run time erroring when blown up. It got deleted before, along with the frame. |
| 126 | + processor.forceMove(O) //Should fix cybros run time erroring when blown up. It got deleted before, along with the frame. |
124 | 127 |
|
125 | 128 | // Since we "magically" installed a cell, we also have to update the correct component. |
126 | 129 | if(O.cell) |
|
0 commit comments