Completely refactors hallucinations, and also adds a few (#69706)

* Refactors hallucinations slightly, organizes them

* Refactors hallucination into a status effect

* Further hallucination proper refactoring

* Refactors battle hallucinations

* Refactors "fake item other" hallucination

* Gets it a bit closer to working state

* Refactors screwydoll and fake alerts

* Refactors fake inhand items

* Refactors a few more.
- Fake death
- Fake messages
- Fake sounds
- Projectiles

* Refactoring delusions, hallucination effects

* Furthering the hallucination status effect
- removes copypaste of hallucination pulses

* Almost finalizes the changeover to status effect

* Last staus effect stuff

* Delusion business

* Airlocks, fire, and more delusion stuff

* Finishes screwyhud. It compiles now!

* Swaps screwyhud over to a grouped status effect

* Removes hal_screwyhud

* Comment

* Bugfixing

* image cleaning

* Get rid of this it came back

* What if I finished this branch?

* Oops

* Messing with the randomness

* Mass hallucination tweaks

* +

* Some more mass tweaks

* Review

* Updates

* Unit tests hallucination icons

* More tweaks

* Move folder

* Another re-name

* Minor tweaks

* Anomaly unity

* Mass hallucination buffs

* t

* Sig

* Merge

* Lints

* Unit test already coming in clutch

* Another failure

* Use named args for cause_hallucination via some define trickery

* Some cleanup

* This is better

* adds some hallucinations

* Oops

* More sounds

* Tweaks

* Some additional documentation

* Flash

* Fixes mass hallucination

* Json changes

* Updates documentation

* Json conflicts

* Makes it work

* Missed that one too

* Helpers

* More signalization (WIP)

* Fixes bump

* Missed a helper use

* Dumb
This commit is contained in:
MrMelbert
2022-09-21 00:30:04 -05:00
committed by GitHub
parent 1ce23e0b57
commit 6baebf47a1
124 changed files with 4040 additions and 2418 deletions
+1
View File
@@ -96,6 +96,7 @@
#include "gas_transfer.dm"
#include "get_turf_pixel.dm"
#include "greyscale_config.dm"
#include "hallucination_icons.dm"
#include "heretic_knowledge.dm"
#include "heretic_rituals.dm"
#include "holidays.dm"
@@ -43,8 +43,11 @@
ignore += typesof(/obj/item/poster/wanted)
//This expects a seed, we can't pass it
ignore += typesof(/obj/item/food/grown)
//Nothing to hallucinate if there's nothing to hallicinate
ignore += typesof(/obj/effect/hallucination)
//Needs clients / mobs to observe it to exist. Also includes hallucinations.
ignore += typesof(/obj/effect/client_image_holder)
//Same to above. Needs a client / mob / hallucination to observe it to exist.
ignore += typesof(/obj/projectile/hallucination)
ignore += typesof(/obj/item/hallucinated)
//These want fried food to take on the shape of, we can't pass that in
ignore += typesof(/obj/item/food/deepfryholder)
//Can't pass in a thing to glow
@@ -0,0 +1,70 @@
/**
* Unit tests various image related hallucinations
* that their icon_states and icons still exist,
* as often hallucinations are copy and pasted
* implementations of existing image setups
* that may be changed and not updated.
*/
/datum/unit_test/hallucination_icons
/datum/unit_test/hallucination_icons/Run()
// Test nearby_fake_item hallucinations for invalid image setups
for(var/datum/hallucination/nearby_fake_item/hallucination as anything in subtypesof(/datum/hallucination/nearby_fake_item))
var/left_icon = initial(hallucination.left_hand_file)
var/right_icon = initial(hallucination.right_hand_file)
var/icon_state = initial(hallucination.image_icon_state)
check_hallucination_icon(hallucination, left_icon, icon_state)
check_hallucination_icon(hallucination, right_icon, icon_state)
// Test preset delusion hallucinations for invalid image setups
for(var/datum/hallucination/delusion/preset/hallucination as anything in subtypesof(/datum/hallucination/delusion/preset))
var/icon = initial(hallucination.delusion_icon_file)
var/icon_state = initial(hallucination.delusion_icon_state)
check_hallucination_icon(hallucination, icon, icon_state)
// Test fake body hallucinations
for(var/datum/hallucination/body/husk/hallucination as anything in subtypesof(/datum/hallucination/body/husk))
var/icon = initial(hallucination.body_image_file)
var/icon_state = initial(hallucination.body_image_state)
check_hallucination_icon(hallucination, icon, icon_state)
// Test on_fire hallucination for if the fire icon state exists
var/datum/hallucination/fire/fire_hallucination = /datum/hallucination/fire
var/fire_hallucination_icon = initial(fire_hallucination.fire_icon)
var/fire_hallucination_icon_state = initial(fire_hallucination.fire_icon_state)
check_hallucination_icon(fire_hallucination, fire_hallucination_icon, fire_hallucination_icon_state)
// Test shock hallucination for if the shock icon state exists
var/datum/hallucination/shock/shock_hallucination = /datum/hallucination/shock
var/shock_hallucination_icon = initial(shock_hallucination.electrocution_icon)
var/shock_hallucination_icon_state = initial(shock_hallucination.electrocution_icon_state)
check_hallucination_icon(shock_hallucination, shock_hallucination_icon, shock_hallucination_icon_state)
// Test fake_flood hallucination for if its fake plasmaflood icon exists
var/datum/hallucination/fake_flood/flood_hallucination = /datum/hallucination/fake_flood
var/flood_hallucination_icon = initial(flood_hallucination.image_icon)
var/flood_hallucination_icon_state = initial(flood_hallucination.image_state)
check_hallucination_icon(flood_hallucination, flood_hallucination_icon, flood_hallucination_icon_state)
// Test hallucination client_image_holders that are used for various hallucinations (bubblegum, xeno attack)
for(var/obj/effect/client_image_holder/hallucination/image_holder as anything in subtypesof(/obj/effect/client_image_holder/hallucination))
var/icon = initial(image_holder.image_icon)
var/icon_state = initial(image_holder.image_state)
if(!icon_state || !icon)
// Not having an icon_state or icon set by default is okay, for these.
continue
if(icon_exists(icon, icon_state))
continue
Fail("Hallucination image holder [image_holder] had an invalid / missing icon state for the icon [icon].")
/datum/unit_test/hallucination_icons/proc/check_hallucination_icon(hallucination, icon, icon_state)
if(!icon)
Fail("Hallucination [hallucination] forgot to set its icon file.")
if(!icon_state)
Fail("Hallucination [hallucination] forgot to set an icon state.")
if(!icon || !icon_state || icon_exists(icon, icon_state))
return
Fail("Hallucination [hallucination] has an invalid icon_state ([icon_state]) for its icon ([icon]).")