Skip to content

Commit

Permalink
QOL Eggsac Carrier Changes - Sprites, Messages and Sounds (#3868)
Browse files Browse the repository at this point in the history
# About the pull request

Adds new eggsac carrier sprites to the game. Includes eggsac overlay
sprites that change based on how many eggs you carry. Implements a
warning message for the hive when a carrier with eggs dies. Adds a sound
effect to when an eggsac carrier dies. Fixes the egg drop chance upon
death.

**Huge thanks to ihatethisengine for helping me with the coding.**

# Explain why it's good for the game

Eggsac Carrier currently has no sprites, there's no differentiating one
from a regular carrier.
This PR attempts to give more flavor to the strain. Also fixes
something, so that's nice.


# Testing Photographs and Procedure (Updated)
<details>
<summary>Screenshots & Videos</summary>
 
 Sprites:

![layers](https://github.com/cmss13-devs/cmss13/assets/134622054/a967c407-b98f-43a2-a4c3-aae0b3f030db)

Showcase Video:

https://github.com/cmss13-devs/cmss13/assets/134622054/e6f1f978-4ad7-41eb-8917-96440f8fd974

</details>


# Changelog

:cl: MarpleJones, ihatethisengine2
add: Added new sprites for the Eggsac Carrier. Includes an additional
death sound for the eggsac bursting.
add: Added a hive announcement for when a Carrier dies with eggs.
fix: Carrier egg drop chance upon death now works as intended.
/:cl:

---------

Co-authored-by: harryob <[email protected]>
  • Loading branch information
MPhonks and harryob authored Jul 24, 2023
1 parent e3fd925 commit b9b353b
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 12 deletions.
72 changes: 60 additions & 12 deletions code/modules/mob/living/carbon/xenomorph/castes/Carrier.dm
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,20 @@

var/list/hugger_image_index = list()
var/mutable_appearance/hugger_overlays_icon
var/mutable_appearance/eggsac_overlays_icon

/mob/living/carbon/xenomorph/carrier/update_icons()
. = ..()

update_hugger_overlays()
if (mutation_type == CARRIER_NORMAL)
update_hugger_overlays()
if (mutation_type == CARRIER_EGGSAC)
update_eggsac_overlays()

/mob/living/carbon/xenomorph/carrier/proc/update_hugger_overlays()
if(!hugger_overlays_icon)
return
if(mutation_type != CARRIER_NORMAL)
return

overlays -= hugger_overlays_icon
hugger_overlays_icon.overlays.Cut()
Expand All @@ -99,7 +104,7 @@
hugger_image_index.Cut()
return

update_icon_maths(round(( huggers_cur / huggers_max ) * 3.999) + 1)
update_clinger_maths(round(( huggers_cur / huggers_max ) * 3.999) + 1)

for(var/i in hugger_image_index)
if(stat == DEAD)
Expand All @@ -114,29 +119,65 @@

overlays += hugger_overlays_icon

/mob/living/carbon/xenomorph/carrier/proc/update_icon_maths(number)
var/funny_list = list(1,2,3,4)
/mob/living/carbon/xenomorph/carrier/proc/update_clinger_maths(number)
var/clinger_list = list(1,2,3,4)
if(length(hugger_image_index) != number)
if(length(hugger_image_index) > number)
while(length(hugger_image_index) != number)
hugger_image_index -= hugger_image_index[length(hugger_image_index)]
else
while(length(hugger_image_index) != number)
for(var/i in hugger_image_index)
if(locate(i) in funny_list)
funny_list -= i
hugger_image_index += funny_list[rand(1,length(funny_list))]
if(locate(i) in clinger_list)
clinger_list -= i
hugger_image_index += clinger_list[rand(1,length(clinger_list))]

/mob/living/carbon/xenomorph/carrier/proc/update_eggsac_overlays()
if(!eggsac_overlays_icon)
return
if(mutation_type != CARRIER_EGGSAC)
return

overlays -= eggsac_overlays_icon
eggsac_overlays_icon.overlays.Cut()

if(!eggs_cur)
return

///Simplified image index change.
var/i = 0
if(eggs_cur > 8)
i = 3
else if (eggs_cur > 4)
i = 2
else if (eggs_cur > 0)
i = 1

if(stat != DEAD)
if(lying)
if((resting || sleeping) && (!knocked_down && !knocked_out && health > 0))
eggsac_overlays_icon.overlays += icon(icon, "eggsac_[i] Sleeping")
else
eggsac_overlays_icon.overlays +=icon(icon, "eggsac_[i] Knocked Down")
else
eggsac_overlays_icon.overlays +=icon(icon, "eggsac_[i]")

overlays += eggsac_overlays_icon

/mob/living/carbon/xenomorph/carrier/Initialize(mapload, mob/living/carbon/xenomorph/oldxeno, h_number)
. = ..()
hugger_overlays_icon = mutable_appearance('icons/mob/xenos/overlay_effects64x64.dmi',"empty")
eggsac_overlays_icon = mutable_appearance('icons/mob/xenos/overlay_effects64x64.dmi',"empty")

/mob/living/carbon/xenomorph/carrier/death(cause, gibbed)
. = ..(cause, gibbed)
if(.)
var/chance = 75
var/chance = 75 //75% to drop an egg or hugger.
if(mutation_type == CARRIER_EGGSAC)
visible_message(SPAN_XENOWARNING("[src] throes as its eggsac bursts into a mess of acid!"))
playsound(src.loc, 'sound/effects/alien_egg_burst.ogg', 25, 1)

if (huggers_cur)
if(huggers_cur)
//Hugger explosion, like an egg morpher
var/obj/item/clothing/mask/facehugger/hugger
visible_message(SPAN_XENOWARNING("The chittering mass of tiny aliens is trying to escape [src]!"))
Expand All @@ -145,10 +186,15 @@
hugger = new(loc, hivenumber)
step_away(hugger, src, 1)

while (eggs_cur > 0)
var/eggs_dropped = FALSE
for(var/i in 1 to eggs_cur)
if(prob(chance))
new /obj/item/xeno_egg(loc, hivenumber)
eggs_cur--
eggs_dropped = TRUE
eggs_cur = 0

if(eggs_dropped) //Checks whether or not to announce egg drop.
xeno_message(SPAN_XENOANNOUNCE("[src] has dropped some precious eggs!"), 2, hive.hivenumber)

/mob/living/carbon/xenomorph/carrier/get_status_tab_items()
. = ..()
Expand Down Expand Up @@ -272,6 +318,7 @@
if(eggs_cur < eggs_max)
if(stat == CONSCIOUS)
eggs_cur++
update_icons()
to_chat(src, SPAN_NOTICE("You store the egg and carry it for safekeeping. Now sheltering: [eggs_cur] / [eggs_max]."))
qdel(E)
else
Expand Down Expand Up @@ -306,6 +353,7 @@
return
E = new(src, hivenumber)
eggs_cur--
update_icons()
put_in_active_hand(E)
to_chat(src, SPAN_XENONOTICE("You grab one of the eggs in your storage. Now sheltering: [eggs_cur] / [eggs_max]."))
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
playsound(carrier.loc, 'sound/voice/alien_facehugger_dies.ogg', 25, 1)
carrier.huggers_cur = 0
carrier.huggers_max = 0
carrier.update_hugger_overlays()
carrier.update_eggsac_overlays()
carrier.eggs_max = 12
carrier.extra_build_dist = 1
return TRUE
Expand Down Expand Up @@ -73,3 +75,4 @@
if(egg_generation_progress >= 15)
egg_generation_progress = 0
xeno.eggs_cur++
xeno.update_icons()
Binary file modified icons/mob/xenos/carrier.dmi
Binary file not shown.

0 comments on commit b9b353b

Please sign in to comment.