mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Swap overlay cache for appearance cache in SSskybox
This commit is contained in:
@@ -6,6 +6,7 @@ SUBSYSTEM_DEF(skybox)
|
|||||||
flags = SS_NO_FIRE
|
flags = SS_NO_FIRE
|
||||||
var/static/list/skybox_cache = list()
|
var/static/list/skybox_cache = list()
|
||||||
|
|
||||||
|
var/static/mutable_appearance/normal_space
|
||||||
var/static/list/dust_cache = list()
|
var/static/list/dust_cache = list()
|
||||||
var/static/list/speedspace_cache = list()
|
var/static/list/speedspace_cache = list()
|
||||||
var/static/list/mapedge_cache = list()
|
var/static/list/mapedge_cache = list()
|
||||||
@@ -13,52 +14,75 @@ SUBSYSTEM_DEF(skybox)
|
|||||||
var/static/list/phase_shift_by_y = list()
|
var/static/list/phase_shift_by_y = list()
|
||||||
|
|
||||||
/datum/controller/subsystem/skybox/PreInit()
|
/datum/controller/subsystem/skybox/PreInit()
|
||||||
|
//Shuffle some lists
|
||||||
|
phase_shift_by_x = get_cross_shift_list(15)
|
||||||
|
phase_shift_by_y = get_cross_shift_list(15)
|
||||||
|
|
||||||
|
//Create our 'normal' space appearance
|
||||||
|
normal_space = new()
|
||||||
|
normal_space.name = "\proper space"
|
||||||
|
normal_space.desc = "Space!"
|
||||||
|
normal_space.mouse_opacity = 2 //Always fully opaque. It's SPACE there can't be things BEHIND IT.
|
||||||
|
normal_space.appearance_flags = TILE_BOUND|PIXEL_SCALE|KEEP_TOGETHER
|
||||||
|
normal_space.plane = SPACE_PLANE
|
||||||
|
normal_space.layer = TURF_LAYER
|
||||||
|
normal_space.icon = 'icons/turf/space.dmi'
|
||||||
|
normal_space.icon_state = "white"
|
||||||
|
|
||||||
//Static
|
//Static
|
||||||
for (var/i in 0 to 25)
|
for (var/i in 0 to 25)
|
||||||
|
var/mutable_appearance/MA = new(normal_space)
|
||||||
var/image/im = image('icons/turf/space_dust.dmi', "[i]")
|
var/image/im = image('icons/turf/space_dust.dmi', "[i]")
|
||||||
im.plane = DUST_PLANE
|
im.plane = DUST_PLANE
|
||||||
im.alpha = 128 //80
|
im.alpha = 128 //80
|
||||||
im.blend_mode = BLEND_ADD
|
im.blend_mode = BLEND_ADD
|
||||||
dust_cache["[i]"] = im
|
|
||||||
|
MA.overlays = list(im)
|
||||||
|
|
||||||
|
dust_cache["[i]"] = MA
|
||||||
|
|
||||||
//Moving
|
//Moving
|
||||||
for (var/i in 0 to 14)
|
for (var/i in 0 to 14)
|
||||||
// NORTH/SOUTH
|
// NORTH/SOUTH
|
||||||
|
var/mutable_appearance/MA = new(normal_space)
|
||||||
var/image/im = image('icons/turf/space_dust_transit.dmi', "speedspace_ns_[i]")
|
var/image/im = image('icons/turf/space_dust_transit.dmi', "speedspace_ns_[i]")
|
||||||
im.plane = DUST_PLANE
|
im.plane = DUST_PLANE
|
||||||
im.blend_mode = BLEND_ADD
|
im.blend_mode = BLEND_ADD
|
||||||
speedspace_cache["NS_[i]"] = im
|
MA.overlays = list(im)
|
||||||
|
speedspace_cache["NS_[i]"] = MA
|
||||||
// EAST/WEST
|
// EAST/WEST
|
||||||
|
MA = new(normal_space)
|
||||||
im = image('icons/turf/space_dust_transit.dmi', "speedspace_ew_[i]")
|
im = image('icons/turf/space_dust_transit.dmi', "speedspace_ew_[i]")
|
||||||
im.plane = DUST_PLANE
|
im.plane = DUST_PLANE
|
||||||
im.blend_mode = BLEND_ADD
|
im.blend_mode = BLEND_ADD
|
||||||
speedspace_cache["EW_[i]"] = im
|
|
||||||
|
MA.overlays = list(im)
|
||||||
|
|
||||||
|
speedspace_cache["EW_[i]"] = MA
|
||||||
|
|
||||||
//Over-the-edge images
|
//Over-the-edge images
|
||||||
for (var/dir in alldirs)
|
for (var/dir in alldirs)
|
||||||
var/image/I = image('icons/turf/space.dmi', "white")
|
var/mutable_appearance/MA = new(normal_space)
|
||||||
var/matrix/M = matrix()
|
var/matrix/M = matrix()
|
||||||
var/horizontal = (dir & (WEST|EAST))
|
var/horizontal = (dir & (WEST|EAST))
|
||||||
var/vertical = (dir & (NORTH|SOUTH))
|
var/vertical = (dir & (NORTH|SOUTH))
|
||||||
M.Scale(horizontal ? 8 : 1, vertical ? 8 : 1)
|
M.Scale(horizontal ? 8 : 1, vertical ? 8 : 1)
|
||||||
I.transform = M
|
MA.transform = M
|
||||||
I.appearance_flags = KEEP_APART | TILE_BOUND
|
MA.appearance_flags = KEEP_APART | TILE_BOUND
|
||||||
I.plane = SPACE_PLANE
|
MA.plane = SPACE_PLANE
|
||||||
I.layer = 0
|
MA.layer = 0
|
||||||
|
|
||||||
if(dir & NORTH)
|
if(dir & NORTH)
|
||||||
I.pixel_y = 112
|
MA.pixel_y = 112
|
||||||
else if(dir & SOUTH)
|
else if(dir & SOUTH)
|
||||||
I.pixel_y = -112
|
MA.pixel_y = -112
|
||||||
|
|
||||||
if(dir & EAST)
|
if(dir & EAST)
|
||||||
I.pixel_x = 112
|
MA.pixel_x = 112
|
||||||
else if(dir & WEST)
|
else if(dir & WEST)
|
||||||
I.pixel_x = -112
|
MA.pixel_x = -112
|
||||||
|
|
||||||
mapedge_cache["[dir]"] = I
|
mapedge_cache["[dir]"] = MA
|
||||||
|
|
||||||
//Shuffle some lists
|
|
||||||
phase_shift_by_x = get_cross_shift_list(15)
|
|
||||||
phase_shift_by_y = get_cross_shift_list(15)
|
|
||||||
|
|
||||||
. = ..()
|
. = ..()
|
||||||
|
|
||||||
|
|||||||
@@ -9,46 +9,20 @@
|
|||||||
thermal_conductivity = OPEN_HEAT_TRANSFER_COEFFICIENT
|
thermal_conductivity = OPEN_HEAT_TRANSFER_COEFFICIENT
|
||||||
can_build_into_floor = TRUE
|
can_build_into_floor = TRUE
|
||||||
var/keep_sprite = FALSE
|
var/keep_sprite = FALSE
|
||||||
var/edge = 0
|
var/edge = 0 //If we're an edge
|
||||||
|
var/forced_dirs = 0 //Force this one to pretend it's an overedge turf
|
||||||
|
|
||||||
/turf/space/Initialize()
|
/turf/space/Initialize()
|
||||||
. = ..()
|
. = ..()
|
||||||
|
|
||||||
if(!keep_sprite)
|
|
||||||
icon_state = "white"
|
|
||||||
|
|
||||||
if(config.starlight)
|
if(config.starlight)
|
||||||
update_starlight()
|
update_starlight()
|
||||||
|
|
||||||
build_overedge() //Spread out over the edge of the map if we're an edge
|
//Sprite stuff only beyond here
|
||||||
toggle_transit() //Add static dust (not passing a dir)
|
if(keep_sprite)
|
||||||
|
return .
|
||||||
|
|
||||||
/turf/space/proc/toggle_transit(var/direction)
|
//We might be an edge
|
||||||
cut_overlays()
|
|
||||||
|
|
||||||
if(!direction)
|
|
||||||
add_overlay(SSskybox.dust_cache["[((x + y) ^ ~(x * y) + z) % 25]"])
|
|
||||||
return
|
|
||||||
|
|
||||||
if(direction & (NORTH|SOUTH))
|
|
||||||
var/x_shift = SSskybox.phase_shift_by_x[src.x % (SSskybox.phase_shift_by_x.len - 1) + 1]
|
|
||||||
var/transit_state = ((direction & SOUTH ? world.maxy - src.y : src.y) + x_shift)%15
|
|
||||||
add_overlay(SSskybox.speedspace_cache["NS_[transit_state]"])
|
|
||||||
else if(direction & (EAST|WEST))
|
|
||||||
var/y_shift = SSskybox.phase_shift_by_y[src.y % (SSskybox.phase_shift_by_y.len - 1) + 1]
|
|
||||||
var/transit_state = ((direction & WEST ? world.maxx - src.x : src.x) + y_shift)%15
|
|
||||||
add_overlay(SSskybox.speedspace_cache["EW_[transit_state]"])
|
|
||||||
|
|
||||||
for(var/atom/movable/AM in src)
|
|
||||||
if (!AM.simulated)
|
|
||||||
continue
|
|
||||||
|
|
||||||
if(!AM.anchored)
|
|
||||||
AM.throw_at(get_step(src,reverse_direction(direction)), 5, 1)
|
|
||||||
else if (istype(AM, /obj/effect/decal))
|
|
||||||
qdel(AM) //No more space blood coming with the shuttle
|
|
||||||
|
|
||||||
/turf/space/proc/build_overedge(var/forced_dirs)
|
|
||||||
if(y == world.maxy || forced_dirs & NORTH)
|
if(y == world.maxy || forced_dirs & NORTH)
|
||||||
edge |= NORTH
|
edge |= NORTH
|
||||||
else if(y == 1 || forced_dirs & SOUTH)
|
else if(y == 1 || forced_dirs & SOUTH)
|
||||||
@@ -59,10 +33,34 @@
|
|||||||
else if(x == world.maxx || forced_dirs & EAST)
|
else if(x == world.maxx || forced_dirs & EAST)
|
||||||
edge |= EAST
|
edge |= EAST
|
||||||
|
|
||||||
if(!edge)
|
if(edge) //Magic edges
|
||||||
return
|
appearance = SSskybox.mapedge_cache["[edge]"]
|
||||||
|
else //Dust
|
||||||
|
appearance = SSskybox.dust_cache["[((x + y) ^ ~(x * y) + z) % 25]"]
|
||||||
|
|
||||||
add_overlay(SSskybox.mapedge_cache["[edge]"], TRUE)
|
/turf/space/proc/toggle_transit(var/direction)
|
||||||
|
if(edge) //Not a great way to do this yet. Maybe we'll come up with one. We could pre-make sprites... or tile the overlay over it?
|
||||||
|
return
|
||||||
|
|
||||||
|
if(!direction) //Stopping our transit
|
||||||
|
appearance = SSskybox.dust_cache["[((x + y) ^ ~(x * y) + z) % 25]"]
|
||||||
|
else if(direction & (NORTH|SOUTH)) //Starting transit vertically
|
||||||
|
var/x_shift = SSskybox.phase_shift_by_x[src.x % (SSskybox.phase_shift_by_x.len - 1) + 1]
|
||||||
|
var/transit_state = ((direction & SOUTH ? world.maxy - src.y : src.y) + x_shift)%15
|
||||||
|
appearance = SSskybox.speedspace_cache["NS_[transit_state]"]
|
||||||
|
else if(direction & (EAST|WEST)) //Starting transit horizontally
|
||||||
|
var/y_shift = SSskybox.phase_shift_by_y[src.y % (SSskybox.phase_shift_by_y.len - 1) + 1]
|
||||||
|
var/transit_state = ((direction & WEST ? world.maxx - src.x : src.x) + y_shift)%15
|
||||||
|
appearance = SSskybox.speedspace_cache["EW_[transit_state]"]
|
||||||
|
|
||||||
|
for(var/atom/movable/AM in src)
|
||||||
|
if (!AM.simulated)
|
||||||
|
continue
|
||||||
|
|
||||||
|
if(!AM.anchored)
|
||||||
|
AM.throw_at(get_step(src,reverse_direction(direction)), 5, 1)
|
||||||
|
else if (istype(AM, /obj/effect/decal))
|
||||||
|
qdel(AM) //No more space blood coming with the shuttle
|
||||||
|
|
||||||
/turf/space/is_space()
|
/turf/space/is_space()
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
@@ -5,26 +5,30 @@
|
|||||||
opacity = 1
|
opacity = 1
|
||||||
blocks_air = TRUE
|
blocks_air = TRUE
|
||||||
|
|
||||||
/turf/space/internal_edge/Initialize()
|
|
||||||
. = ..()
|
|
||||||
build_overedge(dir)
|
|
||||||
|
|
||||||
/turf/space/internal_edge/top
|
/turf/space/internal_edge/top
|
||||||
dir = NORTH
|
dir = NORTH
|
||||||
|
forced_dirs = NORTH
|
||||||
/turf/space/internal_edge/bottom
|
/turf/space/internal_edge/bottom
|
||||||
dir = SOUTH
|
dir = SOUTH
|
||||||
|
forced_dirs = SOUTH
|
||||||
/turf/space/internal_edge/left
|
/turf/space/internal_edge/left
|
||||||
dir = WEST
|
dir = WEST
|
||||||
|
forced_dirs = WEST
|
||||||
/turf/space/internal_edge/right
|
/turf/space/internal_edge/right
|
||||||
dir = EAST
|
dir = EAST
|
||||||
|
forced_dirs = EAST
|
||||||
/turf/space/internal_edge/topleft
|
/turf/space/internal_edge/topleft
|
||||||
dir = NORTHWEST
|
dir = NORTHWEST
|
||||||
|
forced_dirs = NORTHWEST
|
||||||
/turf/space/internal_edge/topright
|
/turf/space/internal_edge/topright
|
||||||
dir = NORTHEAST
|
dir = NORTHEAST
|
||||||
|
forced_dirs = NORTHEAST
|
||||||
/turf/space/internal_edge/bottomleft
|
/turf/space/internal_edge/bottomleft
|
||||||
dir = SOUTHWEST
|
dir = SOUTHWEST
|
||||||
|
forced_dirs = SOUTHWEST
|
||||||
/turf/space/internal_edge/bottomright
|
/turf/space/internal_edge/bottomright
|
||||||
dir = SOUTHEAST
|
dir = SOUTHEAST
|
||||||
|
forced_dirs = SOUTHEAST
|
||||||
|
|
||||||
//These are fake stairs, that when you try to go up them, they shove you to
|
//These are fake stairs, that when you try to go up them, they shove you to
|
||||||
// their 'connected' friend! Try to use the appropriate top/bottom ones for good looks.
|
// their 'connected' friend! Try to use the appropriate top/bottom ones for good looks.
|
||||||
|
|||||||
Reference in New Issue
Block a user