mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-29 16:10:02 +01:00
Replaces our lighting system with CM's. (#21465)
Depends on #21458. Ports https://github.com/cmss13-devs/cmss13/pull/4229, with the original authors as: - https://github.com/tgstation/TerraGov-Marine-Corps/pull/1964 for the lighting controller (A-lexa) - https://github.com/tgstation/TerraGov-Marine-Corps/pull/4747 and https://github.com/tgstation/TerraGov-Marine-Corps/pull/7263 for the lighting (TiviPlus) - https://github.com/tgstation/tgstation/pull/54520 for the dir lighting component - https://github.com/tgstation/tgstation/pull/75018 for the out of bounds fix in lighting - https://github.com/tgstation/TerraGov-Marine-Corps/pull/6678 for the emissives (TiviPlus) The main driving reason behind this is that current lighting consumes way too much processing power, especially for things like odysseys/away sites where a billion light sources are processing/moving at once and the game slows down to a crawl. Hopefully this improves the situation by a good margin, but we will need some testmerging to confirm that. <img width="1349" height="1349" alt="image" src="https://github.com/user-attachments/assets/1059ba2b-c0c5-495a-9c76-2d75d0c42bf2" /> <img width="1349" height="1349" alt="image" src="https://github.com/user-attachments/assets/9704b0f6-4cf6-4dfd-a6cb-5702ad07d677" /> - [x] Resolve todos - [x] Look into open space fuckery (border objects) --------- Co-authored-by: Matt Atlas <liermattia@gmail.com> Co-authored-by: JohnWildkins <john.wildkins@gmail.com>
This commit is contained in:
co-authored by
Matt Atlas
JohnWildkins
parent
8ebd7c9ad5
commit
94d92803b4
@@ -22,7 +22,6 @@
|
||||
var/mob/owner = null
|
||||
var/list/visibleChunks = list()
|
||||
|
||||
var/ghostimage = null
|
||||
var/datum/visualnet/visualnet
|
||||
///Set if the eye uses special click handling. Distinct from parent mob click handling for AI eye.
|
||||
var/click_handler_type = /datum/click_handler/eye
|
||||
@@ -30,21 +29,7 @@
|
||||
///Whether or not our eye uses normal living vision handling
|
||||
var/living_eye = TRUE
|
||||
|
||||
/mob/abstract/eye/New()
|
||||
ghostimage = image(src.icon,src,src.icon_state)
|
||||
SSmobs.ghost_darkness_images |= ghostimage //so ghosts can see the eye when they disable darkness
|
||||
SSmobs.ghost_sightless_images |= ghostimage //so ghosts can see the eye when they disable ghost sight
|
||||
updateallghostimages()
|
||||
..()
|
||||
|
||||
/mob/abstract/eye/Destroy()
|
||||
if (ghostimage)
|
||||
SSmobs.ghost_darkness_images -= ghostimage
|
||||
SSmobs.ghost_sightless_images -= ghostimage
|
||||
qdel(ghostimage)
|
||||
ghostimage = null
|
||||
updateallghostimages()
|
||||
|
||||
release(owner)
|
||||
owner = null
|
||||
visualnet = null
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
/mob/abstract/ghost
|
||||
stat = DEAD
|
||||
|
||||
/// Toggle darkness.
|
||||
var/see_darkness = FALSE
|
||||
/// Is the ghost able to see things humans can't?
|
||||
var/ghostvision = FALSE
|
||||
var/ghostvision = TRUE
|
||||
/// This variable generally controls whether a ghost has restrictions on where it can go or not (ex. if the ghost can bypass holy places).
|
||||
var/has_ghost_restrictions = TRUE
|
||||
/// If the ghost has antagHUD.
|
||||
@@ -56,17 +54,22 @@
|
||||
set name = "Toggle Darkness"
|
||||
set category = "Ghost"
|
||||
|
||||
see_darkness = !see_darkness
|
||||
update_sight()
|
||||
|
||||
/mob/abstract/ghost/proc/update_sight()
|
||||
set_sight(sight|SEE_TURFS|SEE_MOBS|SEE_OBJS)
|
||||
set_see_invisible(SEE_INVISIBLE_LEVEL_TWO)
|
||||
|
||||
if (!see_darkness)
|
||||
set_see_invisible(SEE_INVISIBLE_NOLIGHTING)
|
||||
else
|
||||
set_see_invisible(ghostvision ? SEE_INVISIBLE_OBSERVER : SEE_INVISIBLE_LIVING)
|
||||
var/level_message
|
||||
switch(lighting_alpha)
|
||||
if(LIGHTING_PLANE_ALPHA_VISIBLE)
|
||||
lighting_alpha = LIGHTING_PLANE_ALPHA_SOMEWHAT_INVISIBLE
|
||||
level_message = "half night vision"
|
||||
if(LIGHTING_PLANE_ALPHA_SOMEWHAT_INVISIBLE)
|
||||
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE
|
||||
level_message = "three quarters night vision"
|
||||
if(LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE)
|
||||
lighting_alpha = LIGHTING_PLANE_ALPHA_INVISIBLE
|
||||
level_message = "full night vision"
|
||||
if(LIGHTING_PLANE_ALPHA_INVISIBLE)
|
||||
lighting_alpha = LIGHTING_PLANE_ALPHA_VISIBLE
|
||||
level_message = "no night vision"
|
||||
to_chat(src, SPAN_NOTICE("Night vision mode switched and saved to [level_message]."))
|
||||
sync_lighting_plane_alpha()
|
||||
|
||||
/mob/abstract/ghost/verb/toggle_ghostsee()
|
||||
set name = "Toggle Ghost Vision"
|
||||
@@ -152,6 +155,20 @@
|
||||
to_chat(src, SPAN_NOTICE("Now following \the <b>[target]</b>."))
|
||||
update_sight()
|
||||
|
||||
/mob/abstract/ghost/proc/update_sight()
|
||||
//if they are on a restricted level, then set the ghost vision for them.
|
||||
if(on_restricted_level())
|
||||
//On the restricted level they have the same sight as the mob
|
||||
set_sight(sight&(~SEE_TURFS)&(~SEE_MOBS)&(~SEE_OBJS))
|
||||
else
|
||||
//Outside of the restrcited level, they have enhanced vision
|
||||
set_sight(sight|SEE_TURFS|SEE_MOBS|SEE_OBJS)
|
||||
|
||||
if(ghostvision)
|
||||
set_see_invisible(SEE_INVISIBLE_OBSERVER) //overmap viewing breaks if this is lower
|
||||
else
|
||||
set_see_invisible(SEE_INVISIBLE_LIVING)
|
||||
|
||||
/mob/abstract/ghost/proc/on_restricted_level(var/check)
|
||||
if(!check)
|
||||
check = z
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
/mob/abstract/ghost/observer/LateLogin()
|
||||
..()
|
||||
if (ghostimage)
|
||||
ghostimage.icon_state = src.icon_state
|
||||
updateghostimages()
|
||||
@@ -8,6 +8,7 @@
|
||||
blinded = FALSE
|
||||
anchored = TRUE // don't get pushed around
|
||||
invisibility = INVISIBILITY_OBSERVER
|
||||
lighting_alpha = LIGHTING_PLANE_ALPHA_SOMEWHAT_INVISIBLE
|
||||
simulated = FALSE
|
||||
universal_speak = TRUE
|
||||
incorporeal_move = INCORPOREAL_GHOST
|
||||
@@ -28,8 +29,6 @@
|
||||
var/admin_ghosted = 0
|
||||
/// If this ghost has enabled chat anonymization.
|
||||
var/anonsay = 0
|
||||
/// This mob's ghost image, for deleting and stuff.
|
||||
var/image/ghostimage
|
||||
/// If the ghost can be seen through cult shenanigans.
|
||||
var/is_manifest = 0
|
||||
/// Cooldown for ghost abilities, such as move_item().
|
||||
@@ -42,10 +41,6 @@
|
||||
|
||||
set_stat(DEAD)
|
||||
|
||||
ghostimage = image(icon, src, icon_state)
|
||||
SSmobs.ghost_darkness_images |= ghostimage
|
||||
updateallghostimages()
|
||||
|
||||
var/turf/T
|
||||
if (ismob(body))
|
||||
T = get_turf(body) //Where is the body located?
|
||||
@@ -54,6 +49,7 @@
|
||||
var/originaldesc = desc
|
||||
var/o_transform = transform
|
||||
set_appearance(body)
|
||||
underlays.Cut()
|
||||
appearance_flags = KEEP_TOGETHER
|
||||
desc = originaldesc
|
||||
transform = o_transform
|
||||
@@ -88,15 +84,6 @@
|
||||
name = capitalize(pick(GLOB.first_names_male)) + " " + capitalize(pick(GLOB.last_names))
|
||||
real_name = name
|
||||
|
||||
/mob/abstract/ghost/observer/Destroy()
|
||||
if (ghostimage)
|
||||
SSmobs.ghost_darkness_images -= ghostimage
|
||||
qdel(ghostimage)
|
||||
ghostimage = null
|
||||
updateallghostimages()
|
||||
|
||||
return ..()
|
||||
|
||||
/mob/abstract/ghost/observer/proc/initialise_postkey(set_timers = TRUE)
|
||||
//This function should be run after a ghost has been created and had a ckey assigned
|
||||
if (!set_timers)
|
||||
@@ -574,47 +561,12 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
|
||||
/mob/abstract/ghost/observer/can_admin_interact()
|
||||
return check_rights(R_ADMIN, 0, src)
|
||||
|
||||
/mob/abstract/ghost/observer/update_sight()
|
||||
//if they are on a restricted level, then set the ghost vision for them.
|
||||
if(on_restricted_level())
|
||||
//On the restricted level they have the same sight as the mob
|
||||
set_sight(sight&(~SEE_TURFS)&(~SEE_MOBS)&(~SEE_OBJS))
|
||||
set_see_invisible(SEE_INVISIBLE_OBSERVER)
|
||||
else
|
||||
//Outside of the restrcited level, they have enhanced vision
|
||||
set_sight(sight|SEE_TURFS|SEE_MOBS|SEE_OBJS)
|
||||
set_see_invisible(SEE_INVISIBLE_LEVEL_TWO)
|
||||
|
||||
if (!see_darkness)
|
||||
set_see_invisible(SEE_INVISIBLE_NOLIGHTING)
|
||||
else
|
||||
set_see_invisible(ghostvision ? SEE_INVISIBLE_OBSERVER : SEE_INVISIBLE_LIVING)
|
||||
|
||||
updateghostimages()
|
||||
|
||||
/proc/updateallghostimages()
|
||||
for (var/mob/abstract/ghost/observer/O in GLOB.player_list)
|
||||
O.updateghostimages()
|
||||
|
||||
/mob/abstract/ghost/observer/proc/updateghostimages()
|
||||
if (!client)
|
||||
return
|
||||
if (see_darkness || !ghostvision)
|
||||
client.images -= SSmobs.ghost_darkness_images
|
||||
client.images |= SSmobs.ghost_sightless_images
|
||||
else
|
||||
//add images for the 60inv things ghosts can normally see when darkness is enabled so they can see them now
|
||||
client.images -= SSmobs.ghost_sightless_images
|
||||
client.images |= SSmobs.ghost_darkness_images
|
||||
if (ghostimage)
|
||||
client.images -= ghostimage //remove ourself
|
||||
|
||||
/**
|
||||
* We use this proc to set appearance because doing so resets the plane.
|
||||
* We want the plane to stay at GHOST_PLANE to avoid weird overlaying stuff.
|
||||
*/
|
||||
/mob/abstract/ghost/observer/proc/set_appearance(new_appearance)
|
||||
appearance = new_appearance
|
||||
/mob/abstract/ghost/observer/proc/set_appearance(mob/body)
|
||||
appearance = body.appearance
|
||||
plane = GHOST_PLANE
|
||||
|
||||
/mob/abstract/ghost/observer/MayRespawn(var/feedback = 0, var/respawn_type = null)
|
||||
|
||||
Reference in New Issue
Block a user