mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-24 12:37:26 +01:00
Gives ghosts the ability to spook mirrors (#30817)
* adds behavior * transparency test * transparency * mask and logic * comments * removed the chance for mirrors to break * linting * autodoc
This commit is contained in:
@@ -10,7 +10,13 @@
|
||||
var/list/ui_users = list()
|
||||
var/broken_icon_state = "mirror_broke"
|
||||
|
||||
/// what to show when a ghost Boo!'s this mirror
|
||||
var/icon/spooked_icon
|
||||
/// Whether a mirror can be Boo!'d or not. Magic mirrors are animated, so this is used to stop them from looking weird
|
||||
var/can_be_spooked = TRUE
|
||||
|
||||
/obj/structure/mirror/organ
|
||||
can_be_spooked = FALSE
|
||||
|
||||
/obj/structure/mirror/Initialize(mapload, newdir = SOUTH, building = FALSE)
|
||||
. = ..()
|
||||
@@ -25,6 +31,7 @@
|
||||
if(WEST)
|
||||
pixel_x = 32
|
||||
GLOB.mirrors += src
|
||||
spooked_icon = update_spooked_icon(icon("icons/mob/human.dmi", "husk_s"), SOUTH, 8, 0)
|
||||
|
||||
/obj/structure/mirror/Destroy()
|
||||
QDEL_LIST_ASSOC_VAL(ui_users)
|
||||
@@ -86,6 +93,32 @@
|
||||
if(BURN)
|
||||
playsound(src, 'sound/effects/hit_on_shattered_glass.ogg', 70, TRUE)
|
||||
|
||||
/obj/structure/mirror/get_spooked()
|
||||
if(!can_be_spooked || broken)
|
||||
return
|
||||
flicker_ghost(spooked_icon)
|
||||
return TRUE
|
||||
|
||||
/// This proc sets the icon that will show up in the mirror when spooked
|
||||
/// * icon_to_show - which icon
|
||||
/// * offset_dir - you might want to move the icon so it appears in the mirror
|
||||
/// * offset_pixels - how many pixels you need to move the icon
|
||||
/// * wrap - if the icon should wrap around
|
||||
/obj/structure/mirror/proc/update_spooked_icon(icon/icon_to_show, offset_dir, offset_pixels, wrap)
|
||||
var/icon/our_icon = icon_to_show
|
||||
our_icon.Shift(offset_dir,offset_pixels,wrap)
|
||||
var/icon/alpha_mask = new("icons/obj/watercloset.dmi", "mirror_mask")
|
||||
our_icon.AddAlphaMask(alpha_mask)
|
||||
var/icon/added_icons = new("icons/obj/watercloset.dmi", "mirror")
|
||||
added_icons.Blend(our_icon, ICON_OVERLAY)
|
||||
return added_icons
|
||||
|
||||
/// Shows the icon in the mirror with its mask
|
||||
/obj/structure/mirror/proc/flicker_ghost(icon/icon_to_show)
|
||||
icon = icon_to_show
|
||||
sleep(rand(5,10))
|
||||
icon = initial(icon)
|
||||
return
|
||||
|
||||
/obj/item/mounted/mirror
|
||||
name = "mirror"
|
||||
@@ -105,6 +138,7 @@
|
||||
var/options = list("Name", "Body", "Voice")
|
||||
var/organ_warn = FALSE
|
||||
var/actually_magical = TRUE
|
||||
can_be_spooked = FALSE
|
||||
|
||||
/obj/structure/mirror/magic/Initialize(mapload, newdir, building)
|
||||
. = ..()
|
||||
@@ -187,4 +221,3 @@
|
||||
options = list("Body")
|
||||
organ_warn = TRUE
|
||||
actually_magical = FALSE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user