[MIRROR] Fixes lingering moodlet on ethereal stomach removal. (#6897)

* Fixes lingering moodlet on ethereal stomach removal. (#60130)

* Fixes lingering moodlet on ethereal stomach removal.

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
SkyratBot
2021-07-13 23:57:26 +01:00
committed by GitHub
co-authored by Ghom
parent f75d6de9b9
commit eed6aafb06
2 changed files with 9 additions and 19 deletions
-19
View File
@@ -394,8 +394,6 @@
/datum/component/mood/proc/HandleNutrition()
var/mob/living/L = parent
if(istype(L.getorganslot(ORGAN_SLOT_STOMACH), /obj/item/organ/stomach/ethereal))
HandleCharge(L)
if(HAS_TRAIT(L, TRAIT_NOHUNGER))
return FALSE //no mood events for nutrition
switch(L.nutrition)
@@ -415,23 +413,6 @@
if(0 to NUTRITION_LEVEL_STARVING)
add_event(null, "nutrition", /datum/mood_event/starving)
/datum/component/mood/proc/HandleCharge(mob/living/carbon/human/H)
var/obj/item/organ/stomach/ethereal/stomach = H.getorganslot(ORGAN_SLOT_STOMACH)
switch(stomach.crystal_charge)
if(ETHEREAL_CHARGE_NONE to ETHEREAL_CHARGE_LOWPOWER)
add_event(null, "charge", /datum/mood_event/decharged)
if(ETHEREAL_CHARGE_LOWPOWER to ETHEREAL_CHARGE_NORMAL)
add_event(null, "charge", /datum/mood_event/lowpower)
if(ETHEREAL_CHARGE_NORMAL to ETHEREAL_CHARGE_ALMOSTFULL)
clear_event(null, "charge")
if(ETHEREAL_CHARGE_ALMOSTFULL to ETHEREAL_CHARGE_FULL)
add_event(null, "charge", /datum/mood_event/charged)
if(ETHEREAL_CHARGE_FULL to ETHEREAL_CHARGE_OVERLOAD)
add_event(null, "charge", /datum/mood_event/overcharged)
if(ETHEREAL_CHARGE_OVERLOAD to ETHEREAL_CHARGE_DANGEROUS)
add_event(null, "charge", /datum/mood_event/supercharged)
/datum/component/mood/proc/check_area_mood(datum/source, area/A)
SIGNAL_HANDLER
@@ -23,6 +23,7 @@
UnregisterSignal(owner, COMSIG_LIVING_ELECTROCUTE_ACT)
REMOVE_TRAIT(owner, TRAIT_NOHUNGER, src)
SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "charge")
carbon.clear_alert("ethereal_charge")
carbon.clear_alert("ethereal_overcharge")
@@ -48,24 +49,32 @@
/obj/item/organ/stomach/ethereal/proc/handle_charge(mob/living/carbon/carbon, delta_time, times_fired)
switch(crystal_charge)
if(-INFINITY to ETHEREAL_CHARGE_NONE)
SEND_SIGNAL(carbon, COMSIG_ADD_MOOD_EVENT, "charge", /datum/mood_event/decharged)
carbon.throw_alert("ethereal_charge", /atom/movable/screen/alert/emptycell/ethereal)
if(carbon.health > 10.5)
carbon.apply_damage(0.65, TOX, null, null, carbon)
if(ETHEREAL_CHARGE_NONE to ETHEREAL_CHARGE_LOWPOWER)
SEND_SIGNAL(carbon, COMSIG_ADD_MOOD_EVENT, "charge", /datum/mood_event/decharged)
carbon.throw_alert("ethereal_charge", /atom/movable/screen/alert/lowcell/ethereal, 3)
if(carbon.health > 10.5)
carbon.apply_damage(0.325 * delta_time, TOX, null, null, carbon)
if(ETHEREAL_CHARGE_LOWPOWER to ETHEREAL_CHARGE_NORMAL)
SEND_SIGNAL(carbon, COMSIG_ADD_MOOD_EVENT, "charge", /datum/mood_event/lowpower)
carbon.throw_alert("ethereal_charge", /atom/movable/screen/alert/lowcell/ethereal, 2)
if(ETHEREAL_CHARGE_ALMOSTFULL to ETHEREAL_CHARGE_FULL)
SEND_SIGNAL(carbon, COMSIG_ADD_MOOD_EVENT, "charge", /datum/mood_event/charged)
if(ETHEREAL_CHARGE_FULL to ETHEREAL_CHARGE_OVERLOAD)
SEND_SIGNAL(carbon, COMSIG_ADD_MOOD_EVENT, "charge", /datum/mood_event/overcharged)
carbon.throw_alert("ethereal_overcharge", /atom/movable/screen/alert/ethereal_overcharge, 1)
carbon.apply_damage(0.2, TOX, null, null, carbon)
if(ETHEREAL_CHARGE_OVERLOAD to ETHEREAL_CHARGE_DANGEROUS)
SEND_SIGNAL(carbon, COMSIG_ADD_MOOD_EVENT, "charge", /datum/mood_event/supercharged)
carbon.throw_alert("ethereal_overcharge", /atom/movable/screen/alert/ethereal_overcharge, 2)
carbon.apply_damage(0.325 * delta_time, TOX, null, null, carbon)
if(DT_PROB(5, delta_time)) // 5% each seacond for ethereals to explosively release excess energy if it reaches dangerous levels
discharge_process(carbon)
else
SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "charge")
carbon.clear_alert("ethereal_charge")
carbon.clear_alert("ethereal_overcharge")