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

QOL Eggsac Carrier Changes - Sprites, Messages and Sounds #3868

Merged
merged 15 commits into from
Jul 24, 2023
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
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.