From c8d5d89d79426d438da199b570b9dbc08db45e92 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 15 Jul 2019 11:39:06 -0700 Subject: [PATCH] Fixing Diona limbs (#6724) Diona now regenerates full limbs arm + hand, leg + foot. Because it is a single nymph. Fixes #6716 --- code/modules/mob/living/carbon/diona_base.dm | 39 ++++++++++------- .../mob/living/carbon/human/diona_gestalt.dm | 13 +++--- html/changelogs/Sindorman-dionafix.yml | 42 +++++++++++++++++++ 3 files changed, 73 insertions(+), 21 deletions(-) create mode 100644 html/changelogs/Sindorman-dionafix.yml diff --git a/code/modules/mob/living/carbon/diona_base.dm b/code/modules/mob/living/carbon/diona_base.dm index cd0aaf4310e..9789677aeca 100644 --- a/code/modules/mob/living/carbon/diona_base.dm +++ b/code/modules/mob/living/carbon/diona_base.dm @@ -244,7 +244,7 @@ var/list/diona_banned_languages = list( // We cancel with regening organ, as it's meant to stop all other regenerative // processes. Just pray to shit the timers don't implode. - if ((!total_radiation && !DS.healing_factor && !DS.stored_energy) || DS.regening_organ) + if (((!total_radiation && !DS.healing_factor && !DS.stored_energy) || DS.regening_organ) && !bypass) return FALSE //Next up, healing any damage to internal organs. @@ -300,23 +300,30 @@ var/list/diona_banned_languages = list( if (path) - if (DS.stored_energy < REGROW_ENERGY_REQ) + if ((DS.stored_energy < REGROW_ENERGY_REQ) && !bypass) to_chat(src, "You try to regrow a lost limb, but you lack the energy. Find more light!") return - if (nutrition < REGROW_FOOD_REQ) + if ((nutrition < REGROW_FOOD_REQ) && !bypass) to_chat(src, "You try to regrow a lost limb, but you lack the biomass. Find some food!") return - DS.stored_energy -= REGROW_ENERGY_REQ + DS.stored_energy -= !bypass ? REGROW_ENERGY_REQ : 0 adjustNutritionLoss(REGROW_FOOD_REQ) visible_message("[src] begins to shift and quiver.", "You begin to shift and quiver, feeling a stirring within your trunk") DS.regening_organ = TRUE to_chat(src, "You are trying to regrow a lost limb, this is a long and complicated process that will take 10 minutes!") - if(!bypass) - DS.regen_limb = addtimer(CALLBACK(src, .proc/diona_regen_callback, path), 10 MINUTES, TIMER_STOPPABLE) - else - diona_regen_callback(path, DS) + var/list/special_case = list( + /obj/item/organ/external/arm/diona = /obj/item/organ/external/hand/diona, + /obj/item/organ/external/arm/right/diona = /obj/item/organ/external/hand/right/diona, + /obj/item/organ/external/leg/diona = /obj/item/organ/external/foot/diona, + /obj/item/organ/external/leg/right/diona = /obj/item/organ/external/foot/right/diona + ) + DS.regen_limb = addtimer(CALLBACK(src, .proc/diona_regen_callback, path, DS), 10 MINUTES, TIMER_STOPPABLE) + sleep(5) + if(path in special_case) + DS.regen_extra = addtimer(CALLBACK(src, .proc/diona_regen_callback, special_case[path], DS), 10 MINUTES, TIMER_STOPPABLE) + return @@ -543,12 +550,15 @@ var/list/diona_banned_languages = list( continue var/mob/living/carbon/human/diona/C = H if(C == gestalt) - C.nutrition += REGROW_FOOD_REQ - C.DS.stored_energy += REGROW_ENERGY_REQ - total_radiation += 5 + C.nutrition += REGROW_FOOD_REQ * 0.75 + C.DS.stored_energy += REGROW_ENERGY_REQ * 0.75 C.key = src.key - if(DS.regen_limb) - execute_and_deltimer(DS.regen_limb) + if(C.DS.regen_limb) + execute_and_deltimer(C.DS.regen_limb) + C.DS.regen_limb = null + if(C.DS.regen_extra) + execute_and_deltimer(C.DS.regen_extra) + C.DS.regen_extra = null else C.diona_handle_regeneration(C.DS, TRUE) to_chat(C, span("notice", "Your lost nymph merged back.")) @@ -587,6 +597,7 @@ var/list/diona_banned_languages = list( var/dionatype //1 = nymph, 2 = worker gestalt var/datum/weakref/nym var/regen_limb + var/regen_extra /datum/dionastats/Destroy() light_organ = null //Nulling out these references to prevent GC errors @@ -601,8 +612,6 @@ var/list/diona_banned_languages = list( #undef TEMP_REGEN_NORMAL #undef TEMP_INCREASE_REGEN_DOUBLE #undef LIFETICK_INTERVAL_LESS -#undef REGROW_FOOD_REQ -#undef REGROW_ENERGY_REQ #undef diona_max_pressure #undef diona_nutrition_factor #undef DIONA_LIGHT_COEFICIENT diff --git a/code/modules/mob/living/carbon/human/diona_gestalt.dm b/code/modules/mob/living/carbon/human/diona_gestalt.dm index aaadea41bdf..24a203271d2 100644 --- a/code/modules/mob/living/carbon/human/diona_gestalt.dm +++ b/code/modules/mob/living/carbon/human/diona_gestalt.dm @@ -48,7 +48,8 @@ if(thing in exclude) continue - add_nymph() + if(!add_nymph()) + return added added += 1 return added @@ -58,13 +59,13 @@ for(var/mob/living/carbon/alien/nymph in contents) count += 1 if(count >= 6) - return + return FALSE var/mob/living/carbon/alien/diona/M = new /mob/living/carbon/alien/diona(src) M.gestalt = src M.stat = CONSCIOUS M.update_verbs() M.sync_languages(src) - return + return TRUE //Environmental Functions //================================ @@ -264,9 +265,9 @@ verbs += /mob/living/carbon/human/proc/switch_to_nymph update_dionastats() //Re-find the organs in case they were lost or regained - nutrition -= 150 - DS.stored_energy -= 60 - diona_handle_regeneration(DS) + nutrition -= REGROW_FOOD_REQ + DS.stored_energy -= REGROW_ENERGY_REQ + diona_handle_regeneration(DS, TRUE) playsound(src, 'sound/species/diona/gestalt_grow.ogg', 30, 1) /mob/living/carbon/human/proc/switch_to_nymph() diff --git a/html/changelogs/Sindorman-dionafix.yml b/html/changelogs/Sindorman-dionafix.yml new file mode 100644 index 00000000000..d8e098555a6 --- /dev/null +++ b/html/changelogs/Sindorman-dionafix.yml @@ -0,0 +1,42 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: PoZe + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Diona no longer keeps growing nymphs inside past the defined limit." + - tweak: "Diona now regenerates full limb like arm + hand, leg + foot. Since they are of one nymph."