Skip to content

Commit

Permalink
Fix fruit counting and refactor out delete_fruit (cmss13-devs#5686)
Browse files Browse the repository at this point in the history
This PR is a follow up to cmss13-devs#5514 where we set picked true to have more
accurate messages sent, however this was also checked to skip updating
the fruit count in the bound_xeno's action. This PR also refactors out
delete_fruit since it just effectively was Destroy anyways.

Fixes cmss13-devs#5666

<details>
<summary>Screenshots & Videos</summary>

https://github.com/cmss13-devs/cmss13/assets/76988376/4020e86d-df91-4d44-aaf5-0a338584cbc2

</details>

:cl: Drathek
fix: Fix gardener fruit count not always updating
/:cl:

---------

Co-authored-by: Birdtalon <[email protected]>
  • Loading branch information
2 people authored and Guidesu committed Feb 10, 2024
1 parent d1bd768 commit c2e1447
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions code/modules/cm_aliens/structures/fruit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,19 @@
return FALSE

/obj/effect/alien/resin/fruit/Destroy()
delete_fruit()
//Notify and update the xeno count
if(!QDELETED(bound_xeno))
if(!picked)
to_chat(bound_xeno, SPAN_XENOHIGHDANGER("We sense one of our fruit has been destroyed."))
bound_xeno.current_fruits.Remove(src)

var/number_of_fruit = length(bound_xeno.current_fruits)
var/datum/action/xeno_action/onclick/plant_resin_fruit/plant_action = get_xeno_action_by_type(bound_xeno, /datum/action/xeno_action/onclick/plant_resin_fruit)
plant_action.button.set_maptext(SMALL_FONTS_COLOR(7, number_of_fruit, "#e69d00"), 19, 2)
plant_action.update_button_icon()

bound_xeno = null

return ..()

//Greater
Expand Down Expand Up @@ -278,9 +290,9 @@
..()
START_PROCESSING(SSobj, src)

/obj/effect/alien/resin/fruit/spore/delete_fruit()
/obj/effect/alien/resin/fruit/spore/Destroy()
STOP_PROCESSING(SSobj, src)
..()
return ..()

/obj/effect/alien/resin/fruit/spore/process()
if(mature)
Expand Down

0 comments on commit c2e1447

Please sign in to comment.