This commit is contained in:
silicons
2022-05-14 06:45:35 -07:00
parent b46d2cb773
commit 14b7566c1c
14 changed files with 94 additions and 98 deletions

View File

@@ -7,7 +7,6 @@
var/breakable var/breakable
var/parts var/parts
var/list/climbers = list() var/list/climbers = list()
var/block_turf_edges = FALSE // If true, turf edge icons will not be made on the turf this occupies.
var/list/connections var/list/connections
var/list/other_connections var/list/other_connections

View File

@@ -33,7 +33,8 @@ two tiles on initialization, and which way a cliff is facing may change during m
opacity = FALSE opacity = FALSE
climbable = TRUE climbable = TRUE
climb_delay = 10 SECONDS climb_delay = 10 SECONDS
block_turf_edges = TRUE // Don't want turf edges popping up from the cliff edge. // TODO: IMPLEMENT THIS AGAIN, this was done in a horrifically slow and stupid way
// block_turf_edges = TRUE // Don't want turf edges popping up from the cliff edge.
register_as_dangerous_object = TRUE register_as_dangerous_object = TRUE
var/icon_variant = null // Used to make cliffs less repeative by having a selection of sprites to display. var/icon_variant = null // Used to make cliffs less repeative by having a selection of sprites to display.

View File

@@ -1,6 +1,5 @@
/turf/simulated /turf/simulated
name = "station" name = "station"
smoothing_flags = SMOOTH_CUSTOM
var/wet = 0 var/wet = 0
var/image/wet_overlay = null var/image/wet_overlay = null

View File

@@ -3,6 +3,10 @@
desc = "Unfinished flooring." desc = "Unfinished flooring."
icon = 'icons/turf/flooring/plating_vr.dmi' icon = 'icons/turf/flooring/plating_vr.dmi'
icon_state = "plating" icon_state = "plating"
smoothing_flags = SMOOTH_CUSTOM
base_icon_state = "plating"
thermal_conductivity = 0.040
heat_capacity = 10000
// Damage to flooring. // Damage to flooring.
var/broken var/broken
@@ -12,7 +16,6 @@
var/base_name = "plating" var/base_name = "plating"
var/base_desc = "The naked hull." var/base_desc = "The naked hull."
var/base_icon = 'icons/turf/flooring/plating_vr.dmi' var/base_icon = 'icons/turf/flooring/plating_vr.dmi'
base_icon_state = "plating"
var/static/list/base_footstep_sounds = list("human" = list( var/static/list/base_footstep_sounds = list("human" = list(
'sound/effects/footstep/plating1.ogg', 'sound/effects/footstep/plating1.ogg',
'sound/effects/footstep/plating2.ogg', 'sound/effects/footstep/plating2.ogg',
@@ -28,8 +31,13 @@
var/decl/flooring/flooring var/decl/flooring/flooring
var/mineral = MAT_STEEL var/mineral = MAT_STEEL
thermal_conductivity = 0.040 // If greater than 0, this turf will apply edge overlays on top of other turfs cardinally adjacent to it, if those adjacent turfs are of a different icon_state,
heat_capacity = 10000 // and if those adjacent turfs have a lower edge_blending_priority.
var/edge_blending_priority = 0
/// edge icon state, overrides icon_state if set
var/edge_icon_state
// Outdoors var determines if the game should consider the turf to be 'outdoors', which controls certain things such as weather effects.
var/outdoors = FALSE
/turf/simulated/floor/is_plating() /turf/simulated/floor/is_plating()
return !flooring return !flooring
@@ -56,7 +64,7 @@
old_decals = decals old_decals = decals
decals = overfloor_decals decals = overfloor_decals
// VOREStation Edit End // VOREStation Edit End
update_icon(1) QUEUE_SMOOTH_NEIGHBORS(src)
levelupdate() levelupdate()
//This proc will set floor_type to null and the update_icon() proc will then change the icon_state of the turf //This proc will set floor_type to null and the update_icon() proc will then change the icon_state of the turf
@@ -92,7 +100,7 @@
levelupdate() levelupdate()
if(!defer_icon_update) if(!defer_icon_update)
update_icon(1) QUEUE_SMOOTH_NEIGHBORS(src)
/turf/simulated/floor/levelupdate() /turf/simulated/floor/levelupdate()
for(var/obj/O in src) for(var/obj/O in src)

View File

@@ -13,7 +13,7 @@
broken = rand(0,flooring.has_damage_range) broken = rand(0,flooring.has_damage_range)
else else
broken = 0 broken = 0
update_icon() update_appearance()
/turf/simulated/floor/proc/burn_tile(var/exposed_temperature) /turf/simulated/floor/proc/burn_tile(var/exposed_temperature)
if(!flooring || !(flooring.flags & TURF_CAN_BURN) || !isnull(burnt)) if(!flooring || !(flooring.flags & TURF_CAN_BURN) || !isnull(burnt))
@@ -22,4 +22,4 @@
burnt = rand(0,flooring.has_burn_range) burnt = rand(0,flooring.has_burn_range)
else else
burnt = 0 burnt = 0
update_icon() update_appearance()

View File

@@ -1,16 +1,23 @@
GLOBAL_DATUM_INIT(no_ceiling_image, /image, generate_no_ceiling_image())
/proc/generate_no_ceiling_image()
var/image/I = image(icon = 'icons/turf/open_space.dmi', icon_state = "no_ceiling")
I.plane = PLANE_MESONS
return I
/turf/simulated/floor/custom_smooth()
update_icon()
update_border_spillover()
/turf/simulated/floor/calculate_adjacencies()
return NONE
GLOBAL_LIST_EMPTY(turf_edge_cache)
var/list/flooring_cache = list() var/list/flooring_cache = list()
var/image/no_ceiling_image = null /turf/simulated/floor/update_icon()
. = ..()
/hook/startup/proc/setup_no_ceiling_image()
cache_no_ceiling_image()
return TRUE
/proc/cache_no_ceiling_image()
no_ceiling_image = image(icon = 'icons/turf/open_space.dmi', icon_state = "no_ceiling")
no_ceiling_image.plane = PLANE_MESONS
/turf/simulated/floor/update_icon(var/update_neighbors)
cut_overlays() cut_overlays()
if(flooring) if(flooring)
@@ -28,8 +35,8 @@ var/image/no_ceiling_image = null
flooring_override = icon_state flooring_override = icon_state
// Apply edges, corners, and inner corners. // Apply edges, corners, and inner corners.
var/has_border = 0
if(flooring.flags & TURF_HAS_EDGES) if(flooring.flags & TURF_HAS_EDGES)
var/has_border = 0
for(var/step_dir in GLOB.cardinal) for(var/step_dir in GLOB.cardinal)
var/turf/simulated/floor/T = get_step(src, step_dir) var/turf/simulated/floor/T = get_step(src, step_dir)
if(!flooring.test_link(src, T)) if(!flooring.test_link(src, T))
@@ -65,67 +72,61 @@ var/image/no_ceiling_image = null
var/turf/simulated/floor/T = get_step(src, SOUTHWEST) var/turf/simulated/floor/T = get_step(src, SOUTHWEST)
if(!flooring.test_link(src, T)) if(!flooring.test_link(src, T))
add_overlay(flooring.get_flooring_overlay("[flooring.icon_base]-corner-[SOUTHWEST]", "[flooring.icon_base]_corners", SOUTHWEST)) add_overlay(flooring.get_flooring_overlay("[flooring.icon_base]-corner-[SOUTHWEST]", "[flooring.icon_base]_corners", SOUTHWEST))
if(!isnull(broken) && (flooring.flags & TURF_CAN_BREAK))
add_overlay(flooring.get_flooring_overlay("[flooring.icon_base]-broken-[broken]","broken[broken]"))
if(!isnull(burnt) && (flooring.flags & TURF_CAN_BURN))
add_overlay(flooring.get_flooring_overlay("[flooring.icon_base]-burned-[burnt]","burned[burnt]"))
else
// no flooring - just handle plating stuff
if(is_plating() && !(isnull(broken) && isnull(burnt))) //temp, todo
icon = 'icons/turf/flooring/plating.dmi'
icon_state = "dmg[rand(1,4)]"
// Re-apply floor decals // Re-apply floor decals
if(LAZYLEN(decals)) if(LAZYLEN(decals))
add_overlay(decals) add_overlay(decals)
if(is_plating() && !(isnull(broken) && isnull(burnt))) //temp, todo
icon = 'icons/turf/flooring/plating.dmi'
icon_state = "dmg[rand(1,4)]"
else if(flooring)
if(!isnull(broken) && (flooring.flags & TURF_CAN_BREAK))
add_overlay(flooring.get_flooring_overlay("[flooring.icon_base]-broken-[broken]","broken[broken]"))
if(!isnull(burnt) && (flooring.flags & TURF_CAN_BURN))
add_overlay(flooring.get_flooring_overlay("[flooring.icon_base]-burned-[burnt]","burned[burnt]"))
if(update_neighbors)
for(var/turf/simulated/floor/F in range(src, 1))
if(F == src)
continue
F.update_icon()
// Show 'ceilingless' overlay. // Show 'ceilingless' overlay.
var/turf/above = GetAbove(src) var/turf/above = Above(src)
if(above && isopenturf(above) && !istype(src, /turf/simulated/floor/outdoors)) // This won't apply to outdoor turfs since its assumed they don't have a ceiling anyways. if(isopenturf(above) && !istype(src, /turf/simulated/floor/outdoors)) // This won't apply to outdoor turfs since its assumed they don't have a ceiling anyways.
add_overlay(no_ceiling_image) add_overlay(GLOB.no_ceiling_image)
// Update our 'them-to-us' edges, aka edges from external turfs we feel should spill onto us /**
if(edge_blending_priority) * welcome to the less modular but more sensical and efficient way to do icon edges
update_icon_edge() * instead of having every turf check, we only have turfs tha can spill onto others check, and apply their edges to other turfs
* now only on /turf/simulated/floor, because let's be honest,
* 1. no one used borders on walls
* 2. if you want a floor to spill onto a wall, go ahead and reconsider your life/design choices
* 3. i can think of a reason but honestly performance is better than some niche case of floor resin creeping onto walls or something, use objs for that.
*/
/turf/simulated/floor/proc/update_border_spillover()
if(!edge_blending_priority)
return // not us
for(var/d in GLOB.cardinal)
var/turf/simulated/floor/F = get_step(src, d)
if(!istype(F))
continue
// check that their priority is lower than ours, and we don't have the same icon state
if(F.edge_blending_priority < edge_blending_priority && icon_state != F.icon_state)
var/key = "[F.icon_state || F.edge_icon_state]-[d]"
add_overlay(GLOB.turf_edge_cache[key] || generate_border_cache_for(F.icon_state || F.edge_icon_state, d))
// This updates an edge from an adjacent turf onto us, not our own 'internal' edges. /proc/generate_border_cache_for(state, dir)
// For e.g. we might be outdoor metal plating, and we want to find sand next to us to have it 'spill onto' our turf with an overlay. // make it
/turf/simulated/proc/update_icon_edge() var/image/I = image(icon = 'icons/turf/oudoors_edge.dmi', icon_State = "[F.icon_state || F.edge_icon_state]-edge", dir = turn(d, 180), layer = ABOVE_TURF_LAYER)
for(var/checkdir in GLOB.cardinal) // Check every direction I.plane = TURF_PLANE
var/turf/simulated/T = get_step(src, checkdir) // Get the turf in that direction switch(dir)
// Our conditions: if(NORTH)
// Has to be a /turf/simulated I.pixel_y = 32
// Has to have it's own edge_blending_priority if(SOUTH)
// Has to have a higher priority than us I.pixel_y = -32
// Their icon_state is not our icon_state if(EAST)
// They don't forbid_turf_edge I.pixel_x = 32
if(istype(T) && T.edge_blending_priority && edge_blending_priority < T.edge_blending_priority && icon_state != T.icon_state) if(WEST)
var/cache_key = "[T.get_edge_icon_state()]-[checkdir]" // Usually [icon_state]-[dirnum] I.pixel_x = -32
if(!turf_edge_cache[cache_key]) GLOB.turf_edge_cache[key] = I
var/image/I = image(icon = 'icons/turf/outdoors_edge.dmi', icon_state = "[T.get_edge_icon_state()]-edge", dir = checkdir, layer = ABOVE_TURF_LAYER) // Icon should be abstracted out return I
I.plane = TURF_PLANE
turf_edge_cache[cache_key] = I
add_overlay(turf_edge_cache[cache_key])
// We will take this state and use it for a cache key, and append '-edge' to it to get the edge overlay (edges *from other turfs*, not our own internal edges)
/turf/simulated/proc/get_edge_icon_state()
return icon_state
// Tests if we shouldn't apply a turf edge.
// Returns the blocker if one exists.
/*
/turf/simulated/proc/forbid_turf_edge()
for(var/obj/structure/S in contents)
if(S.block_turf_edges)
return S
return null
*/
// wip - turf icon stuff needs to be refactored // wip - turf icon stuff needs to be refactored
//Tests whether this flooring will smooth with the specified turf //Tests whether this flooring will smooth with the specified turf

View File

@@ -21,7 +21,6 @@
/turf/simulated/floor/outdoors/lava/Initialize(mapload) /turf/simulated/floor/outdoors/lava/Initialize(mapload)
if(!outdoors) if(!outdoors)
name = "magma" name = "magma"
update_icon()
return ..() return ..()
/turf/simulated/floor/outdoors/lava/make_outdoors() /turf/simulated/floor/outdoors/lava/make_outdoors()

View File

@@ -1,12 +1,3 @@
var/list/turf_edge_cache = list()
/turf/
// If greater than 0, this turf will apply edge overlays on top of other turfs cardinally adjacent to it, if those adjacent turfs are of a different icon_state,
// and if those adjacent turfs have a lower edge_blending_priority.
var/edge_blending_priority = 0
// Outdoors var determines if the game should consider the turf to be 'outdoors', which controls certain things such as weather effects.
var/outdoors = FALSE
/turf/simulated/floor/outdoors /turf/simulated/floor/outdoors
name = "generic ground" name = "generic ground"
desc = "Rather boring." desc = "Rather boring."
@@ -19,7 +10,7 @@ var/list/turf_edge_cache = list()
baseturfs = /turf/simulated/floor/outdoors/rocks baseturfs = /turf/simulated/floor/outdoors/rocks
/turf/simulated/floor/outdoors/Initialize(mapload) /turf/simulated/floor/outdoors/Initialize(mapload)
update_icon() QUEUE_SMOOTH(src)
. = ..() . = ..()
/turf/simulated/floor/Initialize(mapload) /turf/simulated/floor/Initialize(mapload)

View File

@@ -7,6 +7,7 @@
var/water_state = "water_shallow" var/water_state = "water_shallow"
var/under_state = "rock" var/under_state = "rock"
edge_blending_priority = -1 edge_blending_priority = -1
edge_icon_state = "water_shallow"
movement_cost = 4 movement_cost = 4
outdoors = TRUE outdoors = TRUE
@@ -32,9 +33,6 @@
var/image/water_sprite = image(icon = 'icons/turf/outdoors.dmi', icon_state = water_state, layer = WATER_LAYER) var/image/water_sprite = image(icon = 'icons/turf/outdoors.dmi', icon_state = water_state, layer = WATER_LAYER)
add_overlay(water_sprite) add_overlay(water_sprite)
/turf/simulated/floor/water/get_edge_icon_state()
return "water_shallow"
/turf/simulated/floor/water/attackby(obj/item/O as obj, mob/user as mob) /turf/simulated/floor/water/attackby(obj/item/O as obj, mob/user as mob)
var/obj/item/reagent_containers/RG = O var/obj/item/reagent_containers/RG = O
if (istype(RG) && RG.is_open_container()) if (istype(RG) && RG.is_open_container())
@@ -226,9 +224,6 @@ turf/simulated/floor/water/contaminated/Entered(atom/movable/AM, atom/oldloc)
var/image/acid_sprite = image(icon = 'icons/turf/outdoors.dmi', icon_state = acid_state, layer = WATER_LAYER) var/image/acid_sprite = image(icon = 'icons/turf/outdoors.dmi', icon_state = acid_state, layer = WATER_LAYER)
add_overlay(acid_sprite) add_overlay(acid_sprite)
/turf/simulated/floor/water/acid/get_edge_icon_state()
return "acid_shallow"
/turf/simulated/floor/water/acid/return_air_for_internal_lifeform(var/mob/living/L) /turf/simulated/floor/water/acid/return_air_for_internal_lifeform(var/mob/living/L)
if(L && L.lying) if(L && L.lying)
if(L.can_breathe_water()) // For squid. if(L.can_breathe_water()) // For squid.
@@ -340,9 +335,6 @@ turf/simulated/floor/water/contaminated/Entered(atom/movable/AM, atom/oldloc)
var/image/blood_sprite = image(icon = 'icons/turf/outdoors.dmi', icon_state = blood_state, layer = WATER_LAYER) var/image/blood_sprite = image(icon = 'icons/turf/outdoors.dmi', icon_state = blood_state, layer = WATER_LAYER)
add_overlay(blood_sprite) add_overlay(blood_sprite)
/turf/simulated/floor/water/blood/get_edge_icon_state()
return "acidb_shallow"
/turf/simulated/floor/water/blood/return_air_for_internal_lifeform(var/mob/living/L) /turf/simulated/floor/water/blood/return_air_for_internal_lifeform(var/mob/living/L)
if(L && L.lying) if(L && L.lying)
if(L.can_breathe_water()) // For squid. if(L.can_breathe_water()) // For squid.

View File

@@ -128,7 +128,7 @@ GLOBAL_LIST_EMPTY(fancy_shuttles)
// Trust me, this is WAY faster than the normal wall overlays shenanigans, don't worry about performance // Trust me, this is WAY faster than the normal wall overlays shenanigans, don't worry about performance
/turf/simulated/wall/fancy_shuttle/update_icon() /turf/simulated/wall/fancy_shuttle/update_icon()
if(!damage_overlays[1]) if(!damage_overlays[1])
generate_overlays() generate_damage_overlays()
cut_overlays() cut_overlays()
if(fancy_shuttle_tag) // after a shuttle jump it won't be set anymore, but the shuttle jump proc will set our icon and state if(fancy_shuttle_tag) // after a shuttle jump it won't be set anymore, but the shuttle jump proc will set our icon and state

View File

@@ -15,6 +15,7 @@
thermal_conductivity = WALL_HEAT_TRANSFER_COEFFICIENT thermal_conductivity = WALL_HEAT_TRANSFER_COEFFICIENT
heat_capacity = 312500 //a little over 5 cm thick , 312500 for 1 m by 2.5 m by 0.25 m plasteel wall heat_capacity = 312500 //a little over 5 cm thick , 312500 for 1 m by 2.5 m by 0.25 m plasteel wall
baseturfs = /turf/simulated/floor/plating baseturfs = /turf/simulated/floor/plating
smoothing_flags = SMOOTH_CUSTOM
var/icon/wall_masks = 'icons/turf/wall_masks.dmi' var/icon/wall_masks = 'icons/turf/wall_masks.dmi'
var/damage = 0 var/damage = 0

View File

@@ -6,10 +6,10 @@
var/amt = 16 var/amt = 16
var/alpha_inc = 256 / 16 var/alpha_inc = 256 / 16
var/list/generated = list() var/list/generated = list()
generated.len = mat generated.len = amt
. = generated . = generated
for(var/i in 1 to 16) for(var/i in 1 to 16)
var/image/I = imiage(icon = 'icons/turf/wall/damage_masks.dmi') var/image/I = image(icon = 'icons/turf/wall/damage_masks.dmi', icon_state = "overlay_damage")
I.blend_mode = BLEND_MULTIPLY I.blend_mode = BLEND_MULTIPLY
I.alpha = (i * alpha_inc) - 1 I.alpha = (i * alpha_inc) - 1
damage_overlays[i] = I damage_overlays[i] = I

View File

@@ -35,7 +35,6 @@
/turf/simulated/wall/solidrock/Initialize(mapload) /turf/simulated/wall/solidrock/Initialize(mapload)
. = ..() . = ..()
icon_state = base_state icon_state = base_state
update_icon(1) // TODO: /tg/ icon smoothing
/turf/simulated/wall/solidrock/attackby() /turf/simulated/wall/solidrock/attackby()
return return

View File

@@ -36,6 +36,12 @@ var/list/z_levels = list()// Each bit re... haha just kidding this is a list of
return null return null
return HasBelow(turf.z) ? get_step(turf, DOWN) : null return HasBelow(turf.z) ? get_step(turf, DOWN) : null
/turf/proc/Above()
return HasAbove(z)? get_step(src, UP) : null
/turf/proc/Below()
return HasBelow(z)? get_step(src, DOWN) : null
/proc/GetConnectedZlevels(z) /proc/GetConnectedZlevels(z)
. = list(z) . = list(z)
for(var/level = z, HasBelow(level), level--) for(var/level = z, HasBelow(level), level--)