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

Throws check tick all over the photo code #4584

Closed
wants to merge 2 commits into from
Closed
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
8 changes: 7 additions & 1 deletion code/modules/paperwork/photography.dm
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@
for(var/atom/A in the_turf)
if(A.invisibility) continue
atoms.Add(A)
CHECK_TICK
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking tick on just loops filtering out contents I'm skeptical is helpful.


// Sort the atoms into their layers
var/list/sorted = sort_atoms_by_layer(atoms)
Expand All @@ -209,6 +210,7 @@
xoff+=A:step_x
yoff+=A:step_y
res.Blend(IM, blendMode2iconMode(A.blend_mode), A.pixel_x + xoff, A.pixel_y + yoff)
CHECK_TICK
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Harry when he sees single letter vars in the code context 👀


// Lastly, render any contained effects on top.
for(var/turf/the_turf as anything in turfs)
Expand All @@ -218,6 +220,7 @@
var/image/IM = getFlatIcon(the_turf.loc)
if(IM)
res.Blend(IM, blendMode2iconMode(the_turf.blend_mode),xoff,yoff)
Copy link
Contributor

@Drulikar Drulikar Oct 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
res.Blend(IM, blendMode2iconMode(the_turf.blend_mode),xoff,yoff)
CHECK_TICK
res.Blend(IM, blendMode2iconMode(the_turf.blend_mode),xoff,yoff)

The get flat icon just before this did a bunch of blends so worth checking tick before this blend.

Also try testing this by merging with master to get the getflaticon fixes pr in and you can better evaluate if this resolves any issues with large pictures (you may need to opt in to the more expensive get flat icon only for testing - not something the cameras should generally opt into unless we find cases where the extra work is needed for photos)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also whitespace may be funky on mobile - not sure why this suggestion diff is red lining the existing code - just want a new line with check tick.

CHECK_TICK
return res


Expand All @@ -243,13 +246,15 @@
/obj/item/device/camera/afterattack(atom/target as mob|obj|turf|area, mob/user as mob, flag)
if(!on || !pictures_left || ismob(target.loc) || isstorage(target.loc)) return
if(user.contains(target) || istype(target, /atom/movable/screen)) return
captureimage(target, user, flag)

playsound(loc, pick('sound/items/polaroid1.ogg', 'sound/items/polaroid2.ogg'), 15, 1)

pictures_left--
desc = "A polaroid camera. It has [pictures_left] photos left."
to_chat(user, SPAN_NOTICE("[pictures_left] photos left."))

captureimage(target, user, flag)

icon_state = icon_off
on = 0
spawn(64)
Expand All @@ -262,6 +267,7 @@
var/list/turf/turfs = RANGE_TURFS(radius, target) & view(world_view_size + radius, user.client)
for(var/turf/T as anything in turfs)
mobs += get_mobs(T)
CHECK_TICK
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking tick on just loops filtering out contents I'm skeptical is helpful.

var/datum/picture/P = createpicture(target, user, turfs, mobs, flag)
printpicture(user, P)

Expand Down