mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-22 12:29:46 +01:00
Fix wallhack cameras (#2093)
changes: Fixed cameras' visibility calculations. Possibly made cameras slightly faster.
This commit is contained in:
@@ -886,10 +886,16 @@ proc/generate_image(var/tx as num, var/ty as num, var/tz as num, var/range as nu
|
||||
//Capture includes non-existan turfs
|
||||
if(!suppress_errors)
|
||||
return
|
||||
|
||||
return generate_image_from_turfs(turfstocapture, range, cap_mode, user, lighting)
|
||||
|
||||
/proc/generate_image_from_turfs(turf/topleft, list/turf/turfstocapture, range as num, cap_mode = CAPTURE_MODE_PARTIAL, mob/living/user, lighting = TRUE)
|
||||
var/tx = topleft.x
|
||||
var/ty = topleft.y
|
||||
//Lines below determine what objects will be rendered
|
||||
var/list/atoms = list()
|
||||
for(var/turf/T in turfstocapture)
|
||||
atoms.Add(T)
|
||||
atoms += T
|
||||
for(var/atom/A in T)
|
||||
if(istype(A, /atom/movable/lighting_overlay)) //Special case for lighting
|
||||
continue
|
||||
@@ -899,7 +905,7 @@ proc/generate_image(var/tx as num, var/ty as num, var/tz as num, var/range as nu
|
||||
|
||||
atoms += A
|
||||
|
||||
//Lines below actually render all colected data
|
||||
//Lines below actually render all collected data
|
||||
atoms = sort_atoms_by_layer(atoms)
|
||||
var/icon/cap = icon('icons/effects/96x96.dmi', "")
|
||||
cap.Scale(range*32, range*32)
|
||||
|
||||
@@ -204,22 +204,29 @@ var/global/photo_count = 0
|
||||
return TRUE // DVIEW will do sanity checks, we've got no special checks.
|
||||
|
||||
/obj/item/device/camera/proc/captureimage(atom/target, mob/living/user, flag)
|
||||
var/obj/item/weapon/photo/p = createpicture(target, user, flag)
|
||||
printpicture(user, p)
|
||||
|
||||
/obj/item/device/camera/proc/createpicture(atom/target, mob/living/user, flag)
|
||||
var/mobs = ""
|
||||
var/list/turfs = list()
|
||||
|
||||
FOR_DVIEW(var/turf/T, size, target, INVISIBILITY_LIGHTING)
|
||||
if (user.can_capture_turf(T))
|
||||
mobs += get_mobs(T)
|
||||
turfs += T
|
||||
|
||||
END_FOR_DVIEW
|
||||
|
||||
var/obj/item/weapon/photo/p = createpicture(target, user, mobs, flag)
|
||||
printpicture(user, p)
|
||||
|
||||
/obj/item/device/camera/proc/createpicture(atom/target, mob/user, mobs, flag)
|
||||
var/x_c = target.x - (size-1)/2
|
||||
var/y_c = target.y - (size-1)/2
|
||||
var/z_c = target.z
|
||||
var/icon/photoimage = generate_image(x_c, y_c, z_c, size, CAPTURE_MODE_REGULAR, user)
|
||||
|
||||
var/turf/topleft = locate(x_c, y_c, z_c)
|
||||
if (!topleft)
|
||||
return null
|
||||
|
||||
var/icon/photoimage = generate_image_from_turfs(topleft, turfs, size, CAPTURE_MODE_REGULAR, user)
|
||||
|
||||
var/icon/small_img = icon(photoimage)
|
||||
var/icon/tiny_img = icon(photoimage)
|
||||
|
||||
Reference in New Issue
Block a user