Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing issues with robot brainmobs. #4791

Merged
merged 1 commit into from
Jan 24, 2025
Merged
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
2 changes: 1 addition & 1 deletion code/modules/mob/living/brain/brain.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
container.queue_icon_update()

/mob/living/brain/proc/get_container()
. = loc?.loc
return get_recursive_loc_of_type(/obj/item/organ/internal)

/mob/living/brain/Login()
. = ..()
Expand Down
6 changes: 6 additions & 0 deletions code/modules/mob/living/death.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@
stop_aiming(no_message=1)
if(istype(ai))
ai.handle_death(gibbed)

var/decl/species/my_species = get_species()
if(my_species)
if(!gibbed && my_species.death_sound)
playsound(loc, my_species.death_sound, 80, 1, 1)
my_species.handle_death(src)
3 changes: 0 additions & 3 deletions code/modules/mob/living/human/death.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,8 @@
if(!gibbed)
set_tail_animation_state(null, TRUE)
handle_organs()
if(species.death_sound)
playsound(loc, species.death_sound, 80, 1, 1)
if(SSticker.mode)
SSticker.mode.check_win()
species.handle_death(src)

/mob/living/human/physically_destroyed(var/skip_qdel, var/droplimb_type = DISMEMBER_METHOD_BLUNT)
for(var/obj/item/organ/external/limb in get_external_organs())
Expand Down
40 changes: 26 additions & 14 deletions code/modules/mob/living/silicon/robot/robot.dm
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,7 @@
return 0

/mob/living/silicon/robot/Destroy()
if(central_processor)
central_processor.dropInto(loc)
var/mob/living/brainmob = central_processor.get_brainmob()
if(mind && brainmob)
mind.transfer_to(brainmob)
else
ghostize()
central_processor = null
QDEL_NULL(central_processor)
if(connected_ai)
connected_ai.connected_robots -= src
connected_ai = null
Expand Down Expand Up @@ -518,8 +511,8 @@
SPAN_NOTICE("\The [user] begins ripping \the [central_processor] out of \the [src]."),
SPAN_NOTICE("You jam the crowbar into the robot and begin levering out \the [central_processor]."))

if(do_after(user, 50, src))
dismantle(user)
if(do_after(user, 5 SECONDS, src))
dismantle_robot(user)
else
// Okay we're not removing the cell or a CPU, but maybe something else?
var/list/removable_components = list()
Expand Down Expand Up @@ -1042,10 +1035,29 @@
return 1
return ..()

/mob/living/silicon/robot/proc/dismantle(var/mob/user)
to_chat(user, SPAN_NOTICE("You damage some parts of the chassis, but eventually manage to rip out the central processor."))
var/obj/item/robot_parts/robot_suit/C = new dismantle_type(loc)
C.dismantled_from(src)
/mob/living/silicon/robot/gib(do_gibs)
SHOULD_CALL_PARENT(FALSE)
var/lastloc = loc
dismantle_robot()
if(lastloc && do_gibs)
spawn_gibber(lastloc)

/mob/living/silicon/robot/proc/dismantle_robot(var/mob/user)

if(central_processor)
if(user)
to_chat(user, SPAN_NOTICE("You damage some parts of the chassis, but eventually manage to rip out \the [central_processor]."))
central_processor.dropInto(loc)
var/mob/living/brainmob = central_processor.get_brainmob(create_if_missing = TRUE)
if(mind && brainmob)
mind.transfer_to(brainmob)
else
ghostize()
central_processor.update_icon()
central_processor = null

var/obj/item/robot_parts/robot_suit/chassis = new dismantle_type(loc)
chassis.dismantled_from(src)
qdel(src)

/mob/living/silicon/robot/try_stock_parts_install(obj/item/stock_parts/W, mob/user)
Expand Down