Skip to content

Commit

Permalink
Slime core removal surgery changes (tgstation#84241)
Browse files Browse the repository at this point in the history
## About The Pull Request

Fixed an issue with incorrect slime dead icon after core removal
surgery. Made the surgery yield all cores in case if the slime had a
steroid potion applied.

## Why It's Good For The Game

The icon was broken. Less clicks for surgery.

## Changelog

:cl:
fix: Fixed dead slime icon not showing when cores are extracted
qol: Slime core removal surgery extracts all cores on completion
/:cl:
  • Loading branch information
MTandi authored Jul 12, 2024
1 parent 0eef564 commit c8dcee1
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 21 deletions.
4 changes: 3 additions & 1 deletion code/modules/food_and_drinks/machinery/processor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,10 @@
processed_slime.forceMove(drop_location())
processed_slime.balloon_alert_to_viewers("crawls free")
return

var/core_count = processed_slime.cores
for(var/i in 1 to (core_count+rating_amount-1))
var/extra_cores = rating_amount - 1 // 0-3 bonus cores above what slime already has with upgraded parts
for(var/i in 1 to (core_count + extra_cores))
var/atom/movable/item = new processed_slime.slime_type.core_type(drop_location())
adjust_item_drop_location(item)
SSblackbox.record_feedback("tally", "slime_core_harvested", 1, processed_slime.slime_type.colour)
Expand Down
25 changes: 21 additions & 4 deletions code/modules/mob/living/basic/slime/slime.dm
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,17 @@
cut_overlays()
if(slime_type.transparent)
alpha = SLIME_TRANSPARENCY_ALPHA
var/icon_text = "[slime_type.colour]-[life_stage]"
icon_dead = "[icon_text]-dead"

icon_dead = !cores ? "[slime_type.colour]-cut" : "[slime_type.colour]-[life_stage]-dead"

if(stat != DEAD)
icon_state = icon_text
icon_state = "[slime_type.colour]-[life_stage]"
if(current_mood && current_mood != SLIME_MOOD_NONE && !stat)
add_overlay("aslime-[current_mood]")
else
icon_state = icon_dead
..()

return ..()

/mob/living/basic/slime/get_status_tab_items()
. = ..()
Expand Down Expand Up @@ -364,6 +366,21 @@
visible_message(span_warning("The mutated core shudders, and collapses into a puddle, unable to maintain its form."))
qdel(src)

///Proc for slime core removal surgery, tries to remove cores from a dead slime.
/mob/living/basic/slime/proc/try_extract_cores(count = 1)
if(stat != DEAD)
return FALSE
if(count <= 0 || cores < count)
return FALSE

var/core_count = min(count, cores)
for(var/i in 1 to core_count)
new slime_type.core_type(loc)
cores--

regenerate_icons()

return TRUE

///Makes the slime peaceful and content
/mob/living/basic/slime/proc/set_pacified_behaviour()
Expand Down
24 changes: 8 additions & 16 deletions code/modules/surgery/core_removal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,15 @@

/datum/surgery_step/extract_core/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery, default_display_results = FALSE)
var/mob/living/basic/slime/target_slime = target
if(target_slime.cores > 0)
target_slime.cores--
var/core_count = target_slime.cores
if(core_count && target_slime.try_extract_cores(count = core_count))
display_results(
user,
target,
span_notice("You successfully extract a core from [target]. [target_slime.cores] core\s remaining."),
span_notice("[user] successfully extracts a core from [target]!"),
span_notice("[user] successfully extracts a core from [target]!"),
span_notice("You successfully extract [core_count] core\s from [target]."),
span_notice("[user] successfully extracts [core_count] core\s from [target]!"),
span_notice("[user] successfully extracts [core_count] core\s from [target]!"),
)

new target_slime.slime_type.core_type(target_slime.loc)

if(target_slime.cores <= 0)
target_slime.icon_state = "[target_slime.slime_type.colour] baby slime dead-nocore"
return ..()
else
return FALSE
else
to_chat(user, span_warning("There aren't any cores left in [target]!"))
return ..()
return TRUE
to_chat(user, span_warning("There aren't any cores left in [target]!"))
return ..()

0 comments on commit c8dcee1

Please sign in to comment.