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

The peeper - Looking into the distance #2253

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
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
26 changes: 22 additions & 4 deletions code/modules/mob/living/living_fov.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
if(fov_view)
if(rel_x >= -1 && rel_x <= 1 && rel_y >= -1 && rel_y <= 1) //Cheap way to check inside that 3x3 box around you
return TRUE //Also checks if both are 0 to stop division by zero

// Get the vector length so we can create a good directional vector
var/vector_len = sqrt(abs(rel_x) ** 2 + abs(rel_y) ** 2)

/// Getting a direction vector
var/dir_x
var/dir_y
Expand All @@ -33,10 +33,10 @@
if(WEST)
dir_x = -vector_len
dir_y = 0

///Calculate angle
var/angle = arccos((dir_x * rel_x + dir_y * rel_y) / (sqrt(dir_x**2 + dir_y**2) * sqrt(rel_x**2 + rel_y**2)))

/// Calculate vision angle and compare
var/vision_angle = (360 - fov_view) / 2
if(angle < vision_angle)
Expand All @@ -56,18 +56,36 @@
if((rel_x >= NEARSIGHTNESS_FOV_BLINDNESS || rel_x <= -NEARSIGHTNESS_FOV_BLINDNESS) || (rel_y >= NEARSIGHTNESS_FOV_BLINDNESS || rel_y <= -NEARSIGHTNESS_FOV_BLINDNESS))
return FALSE

// MOJAVE SUN EDIT BEGIN

/// Updates the applied FOV value and applies the handler to client if able
/mob/living/proc/update_fov()
var/highest_fov
if(CONFIG_GET(flag/native_fov))
highest_fov = native_fov
for(var/trait_type in fov_traits)
var/fov_type = fov_traits[trait_type]
if(fov_type == "no_fov")
highest_fov = 0
break
if(fov_type > highest_fov)
highest_fov = fov_type
fov_view = highest_fov
update_fov_client()

/*/// Updates the applied FOV value and applies the handler to client if able // ORIGINAL TG PROC
/mob/living/proc/update_fov()
var/highest_fov
if(CONFIG_GET(flag/native_fov))
highest_fov = native_fov
for(var/trait_type in fov_traits)
var/fov_type = fov_traits[trait_type]
if(fov_type > highest_fov)
highest_fov = fov_type
fov_view = highest_fov
update_fov_client()*/

// MOJAVE SUN EDIT END
/// Updates the FOV for the client.
/mob/living/proc/update_fov_client()
if(!client)
Expand Down
Binary file modified icons/effects/fov/field_of_view.dmi
Binary file not shown.
12 changes: 12 additions & 0 deletions mojave/code/_onclick/click.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/mob/alt_click_on_secondary(var/atom/A)
A.alt_click_on_secondary(src)
/*
/atom/proc/alt_click_on_secondary(var/mob/user)
return
*/
/atom/alt_click_on_secondary(var/mob/living/user)
if(!istype(user))
return
user.face_atom(src)//Face what we're zoomed in on.
user.do_zoom(src)
return
38 changes: 38 additions & 0 deletions mojave/code/modules/mob/human/human.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/mob/living/proc/do_zoom()
var/do_normal_zoom = TRUE
if(!zoomed)
if(src.body_position == LYING_DOWN)
return
if(do_normal_zoom)
var/_x = 0
var/_y = 0
switch(dir)
if (NORTH)
_y = 7
if (EAST)
_x = 7
if (SOUTH)
_y = -7
if (WEST)
_x = -7
add_fov_trait(src, "no_fov")
zoomed = TRUE
animate(client, pixel_x = world.icon_size*_x, pixel_y = world.icon_size*_y, time = 5, easing = SINE_EASING)
visible_message(span_notice("[src] peers into the distance"), vision_distance = 2)
overlay_fullscreen("peeper", /atom/movable/screen/fullscreen/impaired)
add_movespeed_modifier(/datum/movespeed_modifier/ms13/peeper) //Too busy peeping the horror to walk the chungus

else
remove_fov_trait(src, "no_fov")
reset_zoom()
update_fov_client()

/mob/living/proc/reset_zoom()
animate(client, pixel_x = 0, pixel_y = 0, time = 2, easing = SINE_EASING)
remove_movespeed_modifier(/datum/movespeed_modifier/ms13/peeper) //Too busy peeping the horror to walk the chungus
clear_fullscreen("peeper")
visible_message(span_notice("[src] focuses near themselves again."), vision_distance = 2)
zoomed = FALSE

/datum/movespeed_modifier/ms13/peeper
multiplicative_slowdown = 1
3 changes: 3 additions & 0 deletions mojave/code/modules/mob/mob_defines.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/mob
///Image that is used to mask out the vapour on a persons screen.
var/image/vapour_alpha_mask

/mob/living
var/zoomed = FALSE
2 changes: 2 additions & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -4366,6 +4366,7 @@
#include "mojave\code\_HELPERS\cmp.dm"
#include "mojave\code\_HELPERS\interactive.dm"
#include "mojave\code\_HELPERS\preferences.dm"
#include "mojave\code\_onclick\click.dm"
#include "mojave\code\_HELPERS\text.dm"
#include "mojave\code\_onclick\hud\_defines.dm"
#include "mojave\code\_onclick\hud\alert.dm"
Expand Down Expand Up @@ -4497,6 +4498,7 @@
#include "mojave\code\modules\mob\mob_projectiles.dm"
#include "mojave\code\modules\mob\ms13mobs.dm"
#include "mojave\code\modules\mob\creatures\ms13animals.dm"
#include "mojave\code\modules\mob\human\human.dm"
#include "mojave\code\modules\mob\human\sprite_accessories.dm"
#include "mojave\code\modules\mob\living\emote.dm"
#include "mojave\code\modules\mob\living\examine.dm"
Expand Down
Loading