mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
* Photography Update * Pictures logged in their own /data/picture_logs folder rather than normal logs * Pictures logged in their own /data/picture_logs folder rather than normal logs * Photos broke, retrying * Persistence stuff * I'm almost done I promise! * Persistence mostly working, compile, etc etc * Persistence mostly working, compile, etc etc * Remove something really not needed from the PR * Prevents duplication * default to off * removes check tick * increase slots in albums to 21 * Allows for singular loading * Update camera_image_capturing.dm * Addresses review * Anturk * Update camera.dm * Update misc.dm * Update datum.dm * Update camera.dm
75 lines
1.9 KiB
Plaintext
75 lines
1.9 KiB
Plaintext
|
|
//Yes, they can only be rectangular.
|
|
//Yes, I'm sorry.
|
|
/datum/turf_reservation
|
|
var/list/reserved_turfs = list()
|
|
var/width = 0
|
|
var/height = 0
|
|
var/bottom_left_coords[3]
|
|
var/top_right_coords[3]
|
|
var/wipe_reservation_on_release = TRUE
|
|
var/turf_type = /turf/open/space
|
|
|
|
/datum/turf_reservation/transit
|
|
turf_type = /turf/open/space/transit
|
|
|
|
/datum/turf_reservation/proc/Release()
|
|
var/v = reserved_turfs.Copy()
|
|
for(var/i in reserved_turfs)
|
|
reserved_turfs -= i
|
|
SSmapping.used_turfs -= i
|
|
SSmapping.reserve_turfs(v)
|
|
|
|
/datum/turf_reservation/proc/Reserve(width, height, zlevel)
|
|
if(width > world.maxx || height > world.maxy || width < 1 || height < 1)
|
|
return FALSE
|
|
var/list/avail = SSmapping.unused_turfs["[zlevel]"]
|
|
var/turf/BL
|
|
var/turf/TR
|
|
var/list/turf/final = list()
|
|
var/passing = FALSE
|
|
for(var/i in avail)
|
|
CHECK_TICK
|
|
BL = i
|
|
if(!(BL.flags_1 & UNUSED_RESERVATION_TURF_1))
|
|
continue
|
|
if(BL.x + width > world.maxx || BL.y + height > world.maxy)
|
|
continue
|
|
TR = locate(BL.x + width - 1, BL.y + height - 1, BL.z)
|
|
if(!(TR.flags_1 & UNUSED_RESERVATION_TURF_1))
|
|
continue
|
|
final = block(BL, TR)
|
|
if(!final)
|
|
continue
|
|
passing = TRUE
|
|
for(var/I in final)
|
|
var/turf/checking = I
|
|
if(!(checking.flags_1 & UNUSED_RESERVATION_TURF_1))
|
|
passing = FALSE
|
|
break
|
|
if(!passing)
|
|
continue
|
|
break
|
|
if(!passing || !istype(BL) || !istype(TR))
|
|
return FALSE
|
|
bottom_left_coords = list(BL.x, BL.y, BL.z)
|
|
top_right_coords = list(TR.x, TR.y, TR.z)
|
|
for(var/i in final)
|
|
var/turf/T = i
|
|
reserved_turfs |= T
|
|
T.flags_1 &= ~UNUSED_RESERVATION_TURF_1
|
|
SSmapping.unused_turfs["[T.z]"] -= T
|
|
SSmapping.used_turfs[T] = src
|
|
T.ChangeTurf(turf_type, turf_type)
|
|
src.width = width
|
|
src.height = height
|
|
return TRUE
|
|
|
|
/datum/turf_reservation/New()
|
|
LAZYADD(SSmapping.turf_reservations, src)
|
|
|
|
/datum/turf_reservation/Destroy()
|
|
Release()
|
|
LAZYREMOVE(SSmapping.turf_reservations, src)
|
|
return ..()
|