Hallucination Refactor (#17661)

* begone accursed beast

* cleanup and notes

* screen object fix

* varset clear

* don't raw send sounds, spark on door sound, pain hallucination

* lengthen this a bit

* more pain messages, become jittery

* note

* lets clean that up to

* Revert "lets clean that up to"

This reverts commit 2409e41870.

* cleanup and define

* use accessors

* death isn't working so have toxins instead, it's scarier

* don't actually clean these up, because of how xenochi works

* additional protection

* hunger joke

* Use get_component instead of a cache

* empty scope removed

* Updated xenochi code to use hallu component

---------

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
Will
2025-05-15 00:17:39 -07:00
committed by GitHub
co-authored by Kashargul
parent 8eb403bf73
commit 709e9d130c
12 changed files with 689 additions and 610 deletions
+12 -10
View File
@@ -773,6 +773,11 @@
spawn(0) emote(pick("giggle", "laugh"))
breath.adjust_gas(GAS_N2O, -breath.gas[GAS_N2O]/6, update = 0) //update after
if(get_hallucination_component()?.get_hud_state() == HUD_HALLUCINATION_OXY)
throw_alert("oxy", /obj/screen/alert/not_enough_atmos)
else if(get_hallucination_component()?.get_hud_state() == HUD_HALLUCINATION_TOXIN)
throw_alert("tox_in_air", /obj/screen/alert/tox_in_air)
// Were we able to breathe?
if (failed_inhale || failed_exhale)
failed_last_breath = 1
@@ -1300,20 +1305,15 @@
Paralyse(3)
if(hallucination)
if(hallucination >= 20 && !(species.flags & (NO_POISON|IS_PLANT|NO_HALLUCINATION)) )
if(!handling_hal)
spawn handle_hallucinations() //The not boring kind!
if(hallucination >= HALLUCINATION_THRESHOLD && !(species.flags & (NO_POISON|IS_PLANT|NO_HALLUCINATION)) )
handle_hallucinations()
/* Stop spinning the view, it breaks too much.
if(client && prob(5))
client.dir = pick(2,4,8)
spawn(rand(20,50))
client.dir = 1
*/
hallucination = max(0, hallucination - 2)
else
for(var/atom/a in hallucinations)
qdel(a)
//Brain damage from Oxyloss
if(should_have_organ(O_BRAIN))
@@ -1377,7 +1377,7 @@
//Are they SSD? If so we'll keep them asleep but work off some of that sleep var in case of stoxin or similar.
if(client || sleeping > 3)
handle_sleeping()
if( prob(2) && health && !hal_crit && client )
if( prob(2) && health && !get_hallucination_component()?.get_fakecrit() && client )
spawn(0)
emote("snore")
//CONSCIOUS
@@ -1583,7 +1583,7 @@
clear_fullscreen("fear")
if(healths)
if (chem_effects[CE_PAINKILLER] > 100)
if(chem_effects[CE_PAINKILLER] > 100)
healths.icon_state = "health_numb"
else
// Generate a by-limb health display.
@@ -1605,10 +1605,12 @@
health_images += E.get_damage_hud_image(limb_trauma_val)
// Apply a fire overlay if we're burning.
if(on_fire)
if(on_fire || get_hallucination_component()?.get_hud_state() == HUD_HALLUCINATION_ONFIRE)
health_images += image('icons/mob/OnFire.dmi',"[get_fire_icon_state()]")
// Show a general pain/crit indicator if needed.
if(get_hallucination_component()?.get_hud_state() == HUD_HALLUCINATION_CRIT)
trauma_val = 2
if(trauma_val)
if(!(species.flags & NO_PAIN))
if(trauma_val > 0.7)
@@ -22,7 +22,6 @@
var/max_nutrition = MAX_NUTRITION
var/hallucination = 0 //Directly affects how long a mob will hallucinate for
var/list/atom/hallucinations = list() //A list of hallucinated people that try to attack the mob. See /obj/effect/fake_attacker in hallucinations.dm
var/last_special = 0 //Used by the resist verb, likely used to prevent players from bypassing next_move by logging in/out.
var/base_attack_cooldown = DEFAULT_ATTACK_COOLDOWN