Field of Vision component. (#12075)

* Hopeless WIP for vision cones.

* Core component and hooks done

* Removing clutter.

* linter bashing me for using statements as args.

* Ok.

* continue

* bring back the macro

* Configs and openspace filter.

* Chat plane, reset perspective signal, mechs/vehicles cases, machineries.

* view, viewers and spoopy ghosts.

* Renamed component, admin fun button and snowflakes robots.

* Whoopsie.

* Yikes

* test merge tweak.

* radial yaketi sax.

* Fixed tgui UIs, some messages not displayed to the target.

* Documentation and a little bugfix.

* Pulling QoL, seventh plane made in this PR.

* Fix.

* Tweaks and improvements.

* Update randomverbs.dm
This commit is contained in:
Ghom
2020-05-16 00:25:04 +02:00
committed by GitHub
parent b21fb97bda
commit 7c7147cb3e
122 changed files with 947 additions and 347 deletions
+17 -14
View File
@@ -324,10 +324,9 @@
return
/atom/proc/ShiftClick(mob/user)
var/flags = SEND_SIGNAL(src, COMSIG_CLICK_SHIFT, user)
var/flags = SEND_SIGNAL(src, COMSIG_CLICK_SHIFT, user) | SEND_SIGNAL(user, COMSIG_MOB_CLICKED_SHIFT_ON, src)
if(!(flags & COMPONENT_DENY_EXAMINATE) && user.client && (user.client.eye == user || user.client.eye == user.loc || flags & COMPONENT_ALLOW_EXAMINATE))
user.examinate(src)
return
/*
Ctrl click
@@ -424,32 +423,36 @@
LE.fire()
// Simple helper to face what you clicked on, in case it should be needed in more than one place
/mob/proc/face_atom(atom/A)
if( buckled || stat != CONSCIOUS || !A || !x || !y || !A.x || !A.y )
/mob/proc/face_atom(atom/A, ismousemovement = FALSE)
if( buckled || stat != CONSCIOUS || !loc || !A || !A.x || !A.y )
return
var/dx = A.x - x
var/dy = A.y - y
var/atom/L = loc
if(L.flags_1 & BLOCK_FACE_ATOM_1)
return
var/turf/T = get_turf(src)
var/dx = A.x - T.x
var/dy = A.y - T.y
if(!dx && !dy) // Wall items are graphically shifted but on the floor
if(A.pixel_y > 16)
setDir(NORTH)
setDir(NORTH, ismousemovement)
else if(A.pixel_y < -16)
setDir(SOUTH)
setDir(SOUTH, ismousemovement)
else if(A.pixel_x > 16)
setDir(EAST)
setDir(EAST, ismousemovement)
else if(A.pixel_x < -16)
setDir(WEST)
setDir(WEST, ismousemovement)
return
if(abs(dx) < abs(dy))
if(dy > 0)
setDir(NORTH)
setDir(NORTH, ismousemovement)
else
setDir(SOUTH)
setDir(SOUTH, ismousemovement)
else
if(dx > 0)
setDir(EAST)
setDir(EAST, ismousemovement)
else
setDir(WEST)
setDir(WEST, ismousemovement)
//debug
/obj/screen/proc/scale_to(x1,y1)
+70 -3
View File
@@ -24,6 +24,10 @@
blend_mode = BLEND_MULTIPLY
alpha = 255
/obj/screen/plane_master/openspace/Initialize()
. = ..()
filters += filter(type="alpha", render_source=FIELD_OF_VISION_RENDER_TARGET, flags=MASK_INVERSE)
/obj/screen/plane_master/openspace/backdrop(mob/mymob)
filters = list()
filters += filter(type = "drop_shadow", color = "#04080FAA", size = -10)
@@ -46,6 +50,26 @@
appearance_flags = PLANE_MASTER
blend_mode = BLEND_OVERLAY
/obj/screen/plane_master/wall
name = "wall plane master"
plane = WALL_PLANE
appearance_flags = PLANE_MASTER
/obj/screen/plane_master/wall/backdrop(mob/mymob)
if(mymob?.client?.prefs.ambientocclusion)
add_filter("ambient_occlusion", 0, AMBIENT_OCCLUSION)
else
remove_filter("ambient_occlusion")
/obj/screen/plane_master/above_wall
name = "above wall plane master"
plane = ABOVE_WALL_PLANE
appearance_flags = PLANE_MASTER
/obj/screen/plane_master/above_wall/Initialize()
. = ..()
add_filter("vision_cone", 100, list(type="alpha", render_source=FIELD_OF_VISION_RENDER_TARGET, flags=MASK_INVERSE))
///Contains most things in the game world
/obj/screen/plane_master/game_world
name = "game world plane master"
@@ -53,12 +77,50 @@
appearance_flags = PLANE_MASTER //should use client color
blend_mode = BLEND_OVERLAY
/obj/screen/plane_master/game_world/Initialize()
. = ..()
add_filter("vision_cone", 100, list(type="alpha", render_source=FIELD_OF_VISION_RENDER_TARGET, flags=MASK_INVERSE))
/obj/screen/plane_master/game_world/backdrop(mob/mymob)
if(istype(mymob) && mymob.client && mymob.client.prefs && mymob.client.prefs.ambientocclusion)
if(mymob?.client?.prefs.ambientocclusion)
add_filter("ambient_occlusion", 0, AMBIENT_OCCLUSION)
else
remove_filter("ambient_occlusion")
update_filters()
//Reserved to chat messages, so they are still displayed above the field of vision masking.
/obj/screen/plane_master/chat_messages
name = "chat messages plane master"
plane = CHAT_PLANE
appearance_flags = PLANE_MASTER
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
///Contains all shadow cone masks, whose image overrides are displayed only to their respective owners.
/obj/screen/plane_master/field_of_vision
name = "field of vision mask plane master"
plane = FIELD_OF_VISION_PLANE
render_target = FIELD_OF_VISION_RENDER_TARGET
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
/obj/screen/plane_master/field_of_vision/Initialize()
. = ..()
filters += filter(type="alpha", render_source=FIELD_OF_VISION_BLOCKER_RENDER_TARGET, flags=MASK_INVERSE)
///Used to display the owner and its adjacent surroundings through the FoV plane mask.
/obj/screen/plane_master/field_of_vision_blocker
name = "field of vision blocker plane master"
plane = FIELD_OF_VISION_BLOCKER_PLANE
render_target = FIELD_OF_VISION_BLOCKER_RENDER_TARGET
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
///Stores the visible portion of the FoV shadow cone.
/obj/screen/plane_master/field_of_vision_visual
name = "field of vision visual plane master"
plane = FIELD_OF_VISION_VISUAL_PLANE
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
/obj/screen/plane_master/field_of_vision_visual/Initialize()
. = ..()
filters += filter(type="alpha", render_source=FIELD_OF_VISION_BLOCKER_RENDER_TARGET, flags=MASK_INVERSE)
///Contains all lighting objects
/obj/screen/plane_master/lighting
@@ -87,11 +149,12 @@
/obj/screen/plane_master/emissive/Initialize()
. = ..()
filters += filter(type="alpha", render_source=EMISSIVE_BLOCKER_RENDER_TARGET, flags=MASK_INVERSE)
filters += filter(type="alpha", render_source=FIELD_OF_VISION_RENDER_TARGET, flags=MASK_INVERSE)
/**
* Things placed on this always mask the lighting plane. Doesn't render directly.
*
* Always masks the light plane, isn't blocked by anything. Use for on mob glows,
* Always masks the light plane, isn't blocked by anything (except Field of Vision). Use for on mob glows,
* magic stuff, etc.
*/
@@ -101,6 +164,10 @@
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
render_target = EMISSIVE_UNBLOCKABLE_RENDER_TARGET
/obj/screen/plane_master/emissive_unblockable/Initialize()
. = ..()
filters += filter(type="alpha", render_source=FIELD_OF_VISION_RENDER_TARGET, flags=MASK_INVERSE)
/**
* Things placed on this layer mask the emissive layer. Doesn't render directly
*
+1
View File
@@ -238,6 +238,7 @@ GLOBAL_LIST_EMPTY(radial_menus)
var/mutable_appearance/MA = new /mutable_appearance(E)
if(MA)
MA.layer = ABOVE_HUD_LAYER
MA.plane = ABOVE_HUD_PLANE
MA.appearance_flags |= RESET_TRANSFORM
return MA