Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blindspot Quirk (Yet Another Overlay Quirk) #22880

Merged
merged 6 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion code/_onclick/hud/fullscreen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
if (client && screen.should_show_to(src))
screen.update_for_view(client.view)
client.screen += screen

if(screen.needs_offsetting)
SET_PLANE_EXPLICIT(screen, PLANE_TO_TRUE(screen.plane), src)

Expand Down Expand Up @@ -241,3 +241,9 @@
icon_state = "blue_eye"
plane = FULLSCREEN_PLANE
layer = CURSE_LAYER

/// Blindspot quirk - has 4 directions
/atom/movable/screen/fullscreen/blindspot
icon_state = "blindspot"
plane = FULLSCREEN_PLANE
layer = BLIND_LAYER
68 changes: 65 additions & 3 deletions code/datums/traits/negative.dm
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@
gain_text = span_danger("You remember your allergic reaction to a common medicine.")
lose_text = span_notice("You no longer are allergic to medicine.")

var/allergy_chem_list = list(
var/allergy_chem_list = list(
/datum/reagent/medicine/inacusiate,
/datum/reagent/medicine/silver_sulfadiazine,
/datum/reagent/medicine/styptic_powder,
Expand Down Expand Up @@ -707,7 +707,7 @@
var/reagent_id
COOLDOWN_DECLARE(allergies)
/// how long allergies last after getting rid of the allergen
var/cooldown_duration = 10 SECONDS
var/cooldown_duration = 10 SECONDS
/// Wether the person is experiencing anaphylatic shock or not
COOLDOWN_DECLARE(anaphylaxis)
/// How long anaphylactic shock lasts
Expand Down Expand Up @@ -751,7 +751,7 @@

else if(!COOLDOWN_FINISHED(src, allergies)) //if the cooldown is going
//external indicator that it's happening
if(prob(50))
if(prob(50))
switch(rand(0, 2))
if(0)
H.emote("cough")
Expand Down Expand Up @@ -1017,3 +1017,65 @@

/datum/quirk/lactose_intolerance/proc/on_species_gain(datum/source, datum/species/new_species)
new_species.toxic_food |= DAIRY // no escape from your terrible fate

/datum/quirk/blindspot
name = "Blindspot"
desc = "You lack the sixth sense and cannot see behind yourself."
icon = "arrows-to-eye"
gain_text = span_danger("You can't see behind yourself anymore.")
lose_text = span_notice("You can see behind yourself again.")
value = -2
medical_record_text = "Patient has trouble with spatial awareness."

#define BLINDSPOT_NORTH "blindspotN"
#define BLINDSPOT_SOUTH "blindspotS"
#define BLINDSPOT_EAST "blindspotE"
#define BLINDSPOT_WEST "blindspotW"

/datum/quirk/blindspot/add()
quirk_holder.blindspot_overlay = new/list(10)
var/atom/movable/screen/fullscreen/blindspot/north_blindspot = quirk_holder.overlay_fullscreen(BLINDSPOT_NORTH, /atom/movable/screen/fullscreen/blindspot)
var/atom/movable/screen/fullscreen/blindspot/south_blindspot = quirk_holder.overlay_fullscreen(BLINDSPOT_SOUTH, /atom/movable/screen/fullscreen/blindspot)
var/atom/movable/screen/fullscreen/blindspot/east_blindspot = quirk_holder.overlay_fullscreen(BLINDSPOT_EAST, /atom/movable/screen/fullscreen/blindspot)
var/atom/movable/screen/fullscreen/blindspot/west_blindspot = quirk_holder.overlay_fullscreen(BLINDSPOT_WEST, /atom/movable/screen/fullscreen/blindspot)
quirk_holder.blindspot_overlay[NORTH] = WEAKREF(north_blindspot)
quirk_holder.blindspot_overlay[SOUTH] = WEAKREF(south_blindspot)
quirk_holder.blindspot_overlay[EAST] = WEAKREF(east_blindspot)
quirk_holder.blindspot_overlay[WEST] = WEAKREF(west_blindspot)
north_blindspot.dir = NORTH
south_blindspot.dir = SOUTH
east_blindspot.dir = EAST
west_blindspot.dir = WEST
north_blindspot.alpha = (quirk_holder.dir == NORTH) * 255
south_blindspot.alpha = (quirk_holder.dir == SOUTH) * 255
east_blindspot.alpha = (quirk_holder.dir == EAST) * 255
west_blindspot.alpha = (quirk_holder.dir == WEST) * 255
RegisterSignal(quirk_holder, COMSIG_ATOM_DIR_CHANGE, PROC_REF(change_dir))

/datum/quirk/blindspot/remove()
quirk_holder.clear_fullscreen(BLINDSPOT_NORTH)
quirk_holder.clear_fullscreen(BLINDSPOT_SOUTH)
quirk_holder.clear_fullscreen(BLINDSPOT_EAST)
quirk_holder.clear_fullscreen(BLINDSPOT_WEST)
quirk_holder.blindspot_overlay = null
UnregisterSignal(quirk_holder, COMSIG_ATOM_DIR_CHANGE)

/datum/quirk/blindspot/proc/change_dir(atom/movable/source, olddir, newdir)
SIGNAL_HANDLER
if(olddir == 0 || newdir == 0)
return
if(olddir == newdir)
return
if(!quirk_holder.blindspot_overlay)
return
var/atom/movable/screen/fullscreen/blindspot/old_spot = quirk_holder.blindspot_overlay[olddir]?.resolve()
var/atom/movable/screen/fullscreen/blindspot/new_spot = quirk_holder.blindspot_overlay[newdir]?.resolve()
if(!istype(old_spot) || !istype(new_spot))
return
animate(old_spot, 0.5 SECONDS, easing = CIRCULAR_EASING|EASE_IN, alpha = 0)
animate(new_spot, 0.5 SECONDS, easing = CIRCULAR_EASING|EASE_OUT, alpha = 255)

#undef BLINDSPOT_NORTH
#undef BLINDSPOT_SOUTH
#undef BLINDSPOT_EAST
#undef BLINDSPOT_WEST
3 changes: 3 additions & 0 deletions code/modules/mob/mob_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@
///Contains the fullscreen overlays the mob can see (from 'code/_onclick/hud/fullscreen.dm')
var/list/screens = list()

/// Contains the blindspot overlays, if they are in use
var/list/datum/weakref/blindspot_overlay

///The HUD type the mob will gain on Initialize. (from 'code/_onclick/hud/hud.dm')
var/hud_type = /datum/hud

Expand Down
Binary file modified icons/mob/screen_full.dmi
Binary file not shown.
Loading