Files
Bubberstation/code/modules/hallucination/body.dm
MrMelbert 6baebf47a1 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
2022-09-21 01:30:04 -04:00

57 lines
1.7 KiB
Plaintext

/// Makes a random body appear and disappear quickly.
/datum/hallucination/body
abstract_hallucination_parent = /datum/hallucination/body
/// The file to make the body image from.
var/body_image_file
/// The icon state to make the body image form.
var/body_image_state
/// The actual image we made and showed show.
var/image/shown_body
/datum/hallucination/body/start()
// This hallucination is purely visual, so we don't need to bother for clientless mobs
if(!hallucinator.client)
return FALSE
var/list/possible_points = list()
for(var/turf/open/floor/open_floor in view(hallucinator))
possible_points += open_floor
if(!length(possible_points))
return FALSE
shown_body = make_body_image(pick(possible_points))
hallucinator.client?.images |= shown_body
QDEL_IN(src, rand(3 SECONDS, 5 SECONDS)) //Only seen for a brief moment.
return TRUE
/datum/hallucination/body/Destroy()
hallucinator.client?.images -= shown_body
shown_body = null
return ..()
/// Makes the image of the body to show at the location passed.
/datum/hallucination/body/proc/make_body_image(turf/location)
return image(body_image_file, location, body_image_state, TURF_LAYER)
/datum/hallucination/body/husk
random_hallucination_weight = 4
body_image_file = 'icons/mob/species/human/human.dmi'
body_image_state = "husk"
/datum/hallucination/body/husk/sideways
random_hallucination_weight = 2
/datum/hallucination/body/husk/sideways/make_body_image(turf/location)
var/image/body = ..()
var/matrix/turn_matrix = matrix()
turn_matrix.Turn(90)
body.transform = turn_matrix
return body
/datum/hallucination/body/alien
random_hallucination_weight = 1
body_image_file = 'icons/mob/nonhuman-player/alien.dmi'
body_image_state = "alienother"