forked from Aurorastation/Aurora.3
/
map_capture.dm
82 lines (71 loc) · 3.21 KB
/
map_capture.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/datum/admins/proc/capture_map_part(tx as null|num, ty as null|num, tz as null|num, range as null|num)
set category = "Server"
set name = "Capture Map Part"
set desc = "Usage: Capture-Map-Part target_x_cord target_y_cord target_z_cord range (captures part of a map originating from bottom left corner)"
if(!check_rights(R_ADMIN|R_DEBUG|R_SERVER))
to_chat(usr, "You are not allowed to use this command")
return
if(isnull(tx) || isnull(ty) || isnull(tz) || isnull(range))
to_chat(usr, "Capture Map Part, captures part of a map using camara like rendering.")
to_chat(usr, "Usage: Capture-Map-Part target_x_cord target_y_cord target_z_cord range")
to_chat(usr, "Target coordinates specify bottom left corner of the capture, range defines render distance to opposite corner.")
return
if(range > 32 || range <= 0)
to_chat(usr, "Capturing range is incorrect, it must be within 1-32.")
return
if(locate(tx,ty,tz))
var/ligths = 0
if(alert("Do you want lighting to be included in capture?", "Map Capture", "No", "Yes") == "Yes")
ligths = 1
var/cap = generate_image(tx ,ty ,tz ,range, CAPTURE_MODE_PARTIAL, null, ligths, 1)
var/file_name = "map_capture_x[tx]_y[ty]_z[tz]_r[range].png"
to_chat(usr, "Saved capture in cache as [file_name].")
to_chat(usr, browse_rsc(cap, file_name))
else
to_chat(usr, "Target coordinates are incorrect.")
/datum/admins/proc/capture_map_capture_next(currentz, currentx, currenty, ligths)
if(locate(currentx, currenty, currentz))
var/cap = generate_image(currentx ,currenty ,currentz ,16, CAPTURE_MODE_PARTIAL, null, ligths, 1)
var/file_name = "map_capture_x[currentx]_y[currenty]_z[currentz]_r16.png"
to_chat(usr, "Saved capture in cache as [file_name].")
to_chat(usr, browse_rsc(cap, file_name))
currentx = currentx + 16
spawn (6)
del(cap)
.(currentz, currentx, currenty, ligths)
else
currenty = currenty + 16
currentx = 1
if(locate(currentx, currenty, currentz))
var/cap = generate_image(currentx ,currenty ,currentz ,16, CAPTURE_MODE_PARTIAL, null, ligths, 1)
var/file_name = "map_capture_x[currentx]_y[currenty]_z[currentz]_r16.png"
to_chat(usr, "Saved capture in cache as [file_name].")
to_chat(usr, browse_rsc(cap, file_name))
currentx = currentx + 16
spawn (6)
del(cap)
.(currentz, currentx, currenty, ligths)
else
to_chat(usr, "End of map, capture is done.")
sound_to(usr, 'sound/AI/done.ogg')
/datum/admins/proc/capture_map(tz as null|num)
set category = "Server"
set name = "Capture Map"
set desc = "Usage: Capture-Map target_z_cord (captures map)"
if(!check_rights(R_ADMIN|R_DEBUG|R_SERVER))
to_chat(usr, "You are not allowed to use this command")
return
if(isnull(tz))
to_chat(usr, "Map Part, map using camara like rendering.")
to_chat(usr, "Usage: Capture-Map target_z_cord")
to_chat(usr, "Target Z coordinates define z level to capture.")
return
if(!locate(1, 1, tz))
to_chat(usr, "Target z-level is incorrect.")
return
var/ligths = 0
if(alert("Do you want lighting to be included in capture?", "Map Capture", "No", "Yes") == "Yes")
ligths = 1
switch(alert("Are you sure? (This will cause masive lag!!!)", "Map Capture", "No", "Yes"))
if("Yes")
usr.client.holder.capture_map_capture_next(tz, 1, 1, ligths)