mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-27 06:00:23 +01:00
More area flag option fixes (#16740)
* some mor fixes on the block flags * . * fix aghosting * . * add privacy switch * . * ignore bellied * . * . * fix it up
This commit is contained in:
@@ -6,6 +6,27 @@
|
||||
/datum/chunk/ghost
|
||||
var/list/hidden_areas = list()
|
||||
|
||||
/datum/chunk/ghost/add(mob/observer/dead/ghost, add_images = TRUE)
|
||||
if(add_images)
|
||||
var/client/client = ghost.client
|
||||
if(client)
|
||||
client.images += obscured
|
||||
ghost.visibleChunks += src
|
||||
visible++
|
||||
seenby += ghost
|
||||
if(changed && !updating)
|
||||
update()
|
||||
|
||||
/datum/chunk/ghost/remove(mob/observer/dead/ghost, remove_images = TRUE)
|
||||
if(remove_images)
|
||||
var/client/client = ghost.client
|
||||
if(client)
|
||||
client.images -= obscured
|
||||
ghost.visibleChunks -= src
|
||||
seenby -= ghost
|
||||
if(visible > 0)
|
||||
visible--
|
||||
|
||||
/datum/chunk/ghost/acquireVisibleTurfs(var/list/invisible)
|
||||
|
||||
for(var/area/A in hidden_areas)
|
||||
@@ -85,6 +106,8 @@
|
||||
if(!m)
|
||||
seenby -= m
|
||||
continue
|
||||
if(!m.checkStatic())
|
||||
continue
|
||||
var/client/client = m.client
|
||||
if(client)
|
||||
client.images += t.obfuscations[obfuscation.type]
|
||||
|
||||
@@ -5,20 +5,65 @@
|
||||
/datum/visualnet/ghost
|
||||
chunk_type = /datum/chunk/ghost
|
||||
|
||||
// Removes a area from a chunk.
|
||||
/datum/visualnet/ghost/proc/addVisibility(list/moved_eyes, client/C)
|
||||
if(!islist(moved_eyes))
|
||||
moved_eyes = moved_eyes ? list(moved_eyes) : list()
|
||||
|
||||
var/list/chunks_pre_seen = list()
|
||||
|
||||
for(var/mob/observer/dead/ghost as anything in moved_eyes)
|
||||
if(C)
|
||||
chunks_pre_seen |= ghost.visibleChunks
|
||||
|
||||
if(C)
|
||||
for(var/datum/chunk/ghost/c as anything in chunks_pre_seen)
|
||||
for(var/mob/observer/dead/ghost as anything in moved_eyes)
|
||||
c.remove(ghost)
|
||||
|
||||
/datum/visualnet/ghost/proc/removeVisibility(list/moved_eyes, client/C)
|
||||
if(!islist(moved_eyes))
|
||||
moved_eyes = moved_eyes ? list(moved_eyes) : list()
|
||||
|
||||
var/list/chunks_post_seen = list()
|
||||
|
||||
for(var/mob/observer/dead/ghost as anything in moved_eyes)
|
||||
// 0xf = 15
|
||||
var/static_range = ghost.static_visibility_range
|
||||
var/x1 = max(0, ghost.x - static_range) & ~(CHUNK_SIZE - 1)
|
||||
var/y1 = max(0, ghost.y - static_range) & ~(CHUNK_SIZE - 1)
|
||||
var/x2 = min(world.maxx, ghost.x + static_range) & ~(CHUNK_SIZE - 1)
|
||||
var/y2 = min(world.maxy, ghost.y + static_range) & ~(CHUNK_SIZE - 1)
|
||||
|
||||
var/list/visibleChunks = list()
|
||||
|
||||
for(var/x = x1; x <= x2; x += CHUNK_SIZE)
|
||||
for(var/y = y1; y <= y2; y += CHUNK_SIZE)
|
||||
visibleChunks |= getChunk(x, y, ghost.z)
|
||||
|
||||
var/list/add = visibleChunks - ghost.visibleChunks
|
||||
|
||||
for(var/datum/chunk/ghost/c as anything in add)
|
||||
c.add(ghost, FALSE)
|
||||
|
||||
if(C)
|
||||
chunks_post_seen |= ghost.visibleChunks
|
||||
|
||||
if(C)
|
||||
|
||||
for(var/datum/chunk/c as anything in chunks_post_seen)
|
||||
C.images += c.obscured
|
||||
|
||||
// Removes a area from a chunk.
|
||||
/datum/visualnet/ghost/proc/removeArea(area/A)
|
||||
if(!A.flag_check(AREA_BLOCK_GHOST_SIGHT))
|
||||
majorChunkChange(A, 0)
|
||||
|
||||
// Add a area to a chunk.
|
||||
|
||||
/datum/visualnet/ghost/proc/addArea(area/A)
|
||||
if(A.flag_check(AREA_BLOCK_GHOST_SIGHT))
|
||||
majorChunkChange(A, 1)
|
||||
|
||||
// Used for ghost visible areas. Since portable areas can be in ANY chunk.
|
||||
|
||||
/datum/visualnet/ghost/proc/updateArea(area/A)
|
||||
if(A.flag_check(AREA_BLOCK_GHOST_SIGHT))
|
||||
majorChunkChange(A, 1)
|
||||
|
||||
@@ -14,8 +14,7 @@
|
||||
blinded = 0
|
||||
anchored = TRUE // don't get pushed around
|
||||
var/list/visibleChunks = list()
|
||||
var/datum/visualnet/visualnet
|
||||
var/use_static = TRUE
|
||||
var/datum/visualnet/ghost/visualnet
|
||||
var/static_visibility_range = 16
|
||||
|
||||
var/can_reenter_corpse
|
||||
@@ -92,13 +91,14 @@
|
||||
var/last_revive_notification = null // world.time of last notification, used to avoid spamming players from defibs or cloners.
|
||||
var/cleanup_timer // Refernece to a timer that will delete this mob if no client returns
|
||||
|
||||
/mob/observer/dead/New(mob/body)
|
||||
/mob/observer/dead/New(mob/body, aghost = FALSE)
|
||||
|
||||
appearance = body
|
||||
invisibility = INVISIBILITY_OBSERVER
|
||||
layer = BELOW_MOB_LAYER
|
||||
plane = PLANE_GHOSTS
|
||||
alpha = 127
|
||||
admin_ghosted = aghost
|
||||
|
||||
sight |= SEE_TURFS | SEE_MOBS | SEE_OBJS | SEE_SELF
|
||||
see_invisible = SEE_INVISIBLE_OBSERVER
|
||||
@@ -146,10 +146,14 @@
|
||||
..()
|
||||
visualnet = ghostnet
|
||||
|
||||
/mob/observer/dead/proc/checkStatic()
|
||||
return !(check_rights(R_ADMIN|R_FUN|R_EVENT|R_SERVER, 0, src) || (client && client.buildmode) || isbelly(loc))
|
||||
|
||||
/mob/observer/dead/Moved(atom/old_loc, direction, forced)
|
||||
. = ..()
|
||||
use_static = !(check_rights(R_ADMIN|R_FUN|R_EVENT|R_SERVER, 0, src) || (client && client.buildmode))
|
||||
if(visualnet && use_static)
|
||||
if(isbelly(loc) && !isbelly(old_loc))
|
||||
visualnet.addVisibility()
|
||||
if(visualnet && checkStatic())
|
||||
visualnet.visibility(src, client)
|
||||
|
||||
/mob/observer/dead/Topic(href, href_list)
|
||||
@@ -220,14 +224,14 @@ Works together with spawning an observer, noted above.
|
||||
forceMove(O.loc)
|
||||
//RS Port #658 End
|
||||
|
||||
/mob/proc/ghostize(var/can_reenter_corpse = 1)
|
||||
/mob/proc/ghostize(var/can_reenter_corpse = 1, var/aghost = FALSE)
|
||||
if(key)
|
||||
if(ishuman(src))
|
||||
var/mob/living/carbon/human/H = src
|
||||
if(H.vr_holder && !can_reenter_corpse)
|
||||
H.exit_vr()
|
||||
return 0
|
||||
var/mob/observer/dead/ghost = new(src) //Transfer safety to observer spawning proc.
|
||||
var/mob/observer/dead/ghost = new(src, aghost) //Transfer safety to observer spawning proc.
|
||||
ghost.can_reenter_corpse = can_reenter_corpse
|
||||
ghost.timeofdeath = src.timeofdeath //BS12 EDIT
|
||||
ghost.key = key
|
||||
@@ -463,7 +467,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
|
||||
|
||||
//RS Port #658 Start
|
||||
var/area/A = get_area(destination)
|
||||
if(A?.flag_check(AREA_BLOCK_GHOSTS) && !isbelly(destination))
|
||||
if(A?.flag_check(AREA_BLOCK_GHOSTS) && !isbelly(destination) && !admin_ghosted)
|
||||
to_chat(src,span_warning("Sorry, that area does not allow ghosts."))
|
||||
if(following)
|
||||
stop_following()
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
//
|
||||
// The datum containing all the chunks.
|
||||
|
||||
#define CHUNK_SIZE 16
|
||||
|
||||
/datum/visualnet
|
||||
// The chunks of the map, mapping the areas that an object can see.
|
||||
var/list/chunks = list()
|
||||
@@ -159,5 +157,3 @@
|
||||
var/datum/chunk/chunk = cameranet.getCameraChunk(x, y, z)
|
||||
usr.client.debug_variables(chunk)
|
||||
*/
|
||||
|
||||
#undef CHUNK_SIZE
|
||||
|
||||
Reference in New Issue
Block a user