Skip to content

Commit d962901

Browse files
Allows station blueprints to show an archive of how somewhere looked (#37106)
* fun new use for this item * visual update * this thing too * fixes proc * better image * scope * gets rid of this * sanity check for spam of this * comments explaining it
1 parent 3a2ecfe commit d962901

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

code/game/objects/items/blueprints.dm

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# define ROOM_ERR_SPACE -1
1616
# define ROOM_ERR_TOOLARGE -2
1717

18+
var/global/list/blueprint_archives = list()
1819

1920
/obj/item/blueprints
2021
name = "station blueprints"
@@ -26,6 +27,8 @@
2627
flammable = TRUE
2728

2829
var/header = "<small>property of Nanotrasen. For heads of staff only. Store in high-secure storage.</small>"
30+
var/shows_archives = TRUE
31+
var/last_shown_archive
2932

3033
var/can_create_areas_in = list(AREA_SPACE,AREA_CONSTRUCT)
3134
var/can_rename_areas = list(AREA_STATION, AREA_BLUEPRINTS)
@@ -43,6 +46,30 @@
4346

4447
var/mob/editor
4548

49+
// below is non functional, uncomment if you want to have a go at this being available from a roundstart snapshot
50+
/*/obj/item/blueprints/initialize()
51+
. = ..()
52+
if(shows_archives && !blueprint_archives.len)
53+
for(var/area/A in areas)
54+
if(get_area_type(A) == AREA_STATION)
55+
for(var/turf/T in A.area_turfs)
56+
update_turf_image(T)*/
57+
58+
/obj/item/blueprints/proc/update_turf_image(var/turf/T)
59+
var/image/overlay = image(T.icon,T,T.icon_state,T.layer,T.dir,T.pixel_x,T.pixel_y)
60+
overlay.plane = NARSIE_PLANE
61+
overlay.alpha = 128
62+
overlay.color = "#06f"
63+
blueprint_archives["[T.x],[T.y],[T.z]"] = list(overlay)
64+
for(var/atom/AM in T.contents)
65+
if(AM.type == /atom/movable/lighting_overlay)
66+
continue
67+
overlay = image(AM.icon,T,AM.icon_state,AM.layer,AM.dir,AM.pixel_x,AM.pixel_y)
68+
overlay.plane = NARSIE_PLANE
69+
overlay.alpha = 128
70+
overlay.color = "#0af"
71+
blueprint_archives["[T.x],[T.y],[T.z]"] += overlay
72+
4673
//MoMMI blueprints
4774
/obj/item/blueprints/mommiprints
4875
name = "MoMMI station blueprints"
@@ -62,6 +89,7 @@ these cannot rename rooms that are in by default BUT can rename rooms that are c
6289
icon_state = "permit"
6390

6491
w_class = W_CLASS_TINY
92+
shows_archives = FALSE
6593

6694
can_rename_areas = list(AREA_BLUEPRINTS)
6795
can_delete_areas = list(AREA_BLUEPRINTS)
@@ -109,6 +137,12 @@ these cannot rename rooms that are in by default BUT can rename rooms that are c
109137
return
110138

111139
switch(href_list["action"])
140+
if("show_room")
141+
show_room(usr)
142+
143+
if("update_room")
144+
update_room(usr)
145+
112146
if("create_room")
113147
create_room(usr)
114148

@@ -149,6 +183,9 @@ these cannot rename rooms that are in by default BUT can rename rooms that are c
149183

150184
text += "<br>"
151185

186+
if(shows_archives)
187+
text += "<p><a href='?src=\ref[src];action=show_room'>Show archive of surroundings</a></p>"
188+
text += "<p><a href='?src=\ref[src];action=update_room'>Update archive of surroundings</a></p>"
152189
if(area_type in can_create_areas_in)
153190
text += "<p><a href='?src=\ref[src];action=create_room'>Create a new room</a></p>"
154191
text += "<p><a href='?src=\ref[src];action=create_area'>Start a new drawing</a></p>"
@@ -262,6 +299,30 @@ these cannot rename rooms that are in by default BUT can rename rooms that are c
262299

263300
#undef error_flash_dur
264301

302+
//Shows an archive of surrounding tiles
303+
/obj/item/blueprints/proc/show_room(mob/user)
304+
if(shows_archives && user.client)
305+
var/list/shown_images = list()
306+
var/tstring = ""
307+
for(var/turf/T in spiral_block(get_turf(user),user.client.view))
308+
tstring = "[T.x],[T.y],[T.z]"
309+
if(tstring in blueprint_archives)
310+
for(var/I in blueprint_archives[tstring])
311+
shown_images += I
312+
user.client.images += I
313+
last_shown_archive = world.time
314+
spawn(10 SECONDS)
315+
if(world.time - last_shown_archive >= 99) // sanity for mass clicking of this
316+
user.client.images -= shown_images
317+
318+
/obj/item/blueprints/proc/update_room(mob/user)
319+
if(shows_archives)
320+
if(blueprint_archives.len)
321+
if(alert(usr,"This will overwrite any archives, continue?","Overwriting","Yes","No") == "No")
322+
return
323+
for(var/turf/T in view(user.client.view))
324+
update_turf_image(T)
325+
265326
//Creates a new area and spreads it to cover the current room
266327
/obj/item/blueprints/proc/create_room(mob/user)
267328
if(!(get_area_type() in can_create_areas_in))

0 commit comments

Comments
 (0)