Skip to content

Commit

Permalink
ghommie review
Browse files Browse the repository at this point in the history
  • Loading branch information
LemonInTheDark committed Aug 2, 2024
1 parent 4bb2a85 commit 525121d
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 32 deletions.
22 changes: 13 additions & 9 deletions code/datums/components/split_overlay.dm
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
/// Applies and maintains overlays for /datum/element/split_visibility'd atoms
/// This allows us to apply conditions, nick nacks, and animations to splitvis'd walls without massively bloating their DMIs (and thus leading to client performance issues)
/// Want to draw a cute animation on your wall but only if the SOUTH wall is exposed? this is how you do it (see also: hilbert doors)
/// Accepts an overlay to use, and a list of the directions to apply it in (see the icon_smoothing.dm defines for this list, which allow for angles to be specified seperately)
/// If the direction is blocked, the overlay won't draw. it'll also use as a dir the direction it's being drawn in
/// If the overlay has no plane/layer of its own, we'll give it ones that will at the least draw above wall splits, ensuring it actually renders
/datum/component/split_overlay
/// We draw this normally, in the splitvis form
var/mutable_appearance/standard
/// This is drawn hidden (IE: onto a separate plane and onto the wall itself to avoid seeing it through the void with mesons)
var/mutable_appearance/hidden
/// And then this one just exists to make sure we render right at z borders, drawing to ourselves if there is nothing around us
var/mutable_appearance/non_offset_standard
var/list/dirs_to_apply

Expand Down Expand Up @@ -90,15 +94,15 @@
// Otherwise we'll draw to them, offset slightly
else
below.add_overlay(standard)
else
// Remove our overlay from the turf below, to ensure it gets properly cleared out
if(below)
below.cut_overlay(standard)
// Clear from us too, just to be safe
apply_to.cut_overlay(hidden)
// If there's nothing below us, clear the non offset version too
if(!below)
apply_to.cut_overlay(non_offset_standard)
continue
// Remove our overlay from the turf below, to ensure it gets properly cleared out
if(below)
below.cut_overlay(standard)
// Clear from us too, just to be safe
apply_to.cut_overlay(hidden)
// If there's nothing below us, clear the non offset version too
if(!below)
apply_to.cut_overlay(non_offset_standard)

/datum/component/split_overlay/proc/on_turf_junction_change(turf/source, new_junction)
SIGNAL_HANDLER
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/wall_mounted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
return FALSE //For now, we're going to keep the component off of shuttles to avoid the turf changing issue. We'll hit that later really;
var/turf/attachable_wall
if(directional)
attachable_wall = get_step(src, turn(dir,180))
attachable_wall = get_step(src, REVERSE_DIR(dir))
else
attachable_wall = loc ///Pull from the curent object loc
if(!iswallturf(attachable_wall))
Expand Down
23 changes: 12 additions & 11 deletions code/datums/elements/split_visibility.dm
Original file line number Diff line number Diff line change
Expand Up @@ -180,23 +180,24 @@ GLOBAL_LIST_INIT(diagonal_junctions, generate_splitvis_lookup())
if(!operating_turf)
continue

if(add_to_turfs)
var/mutable_appearance/split_vis/vis
// If we're trying to draw to something with splitvis, just draw to yourself, and use the hidden wall plane
// Wallening todo: Frills should block emissives
if(HAS_TRAIT(operating_turf, TRAIT_CONTAINS_SPLITVIS))
vis = get_splitvis_object(offset, icon_path, "innercorner", direction, color, 0, 0, HIDDEN_WALL_PLANE, ABOVE_WALL_LAYER)
target_turf.overlays += vis
else
vis = get_splitvis_object(offset, icon_path, "innercorner", direction, color, -DIR_TO_PIXEL_X(direction), -DIR_TO_PIXEL_Y(direction), layer = ABOVE_WALL_LAYER)
operating_turf.overlays += vis
else
if(!add_to_turfs)
// I HATE the code duping, but we need to try both to ensure it's properly cleared
var/mutable_appearance/split_vis/vis
vis = get_splitvis_object(offset, icon_path, "innercorner", direction, color, 0, 0, HIDDEN_WALL_PLANE, ABOVE_WALL_LAYER)
target_turf.overlays -= vis
vis = get_splitvis_object(offset, icon_path, "innercorner", direction, color, -DIR_TO_PIXEL_X(direction), -DIR_TO_PIXEL_Y(direction), layer = ABOVE_WALL_LAYER)
operating_turf.overlays -= vis
continue
var/mutable_appearance/split_vis/vis
// If we're trying to draw to something with splitvis, just draw to yourself, and use the hidden wall plane
// Wallening todo: Frills should block emissives
if(HAS_TRAIT(operating_turf, TRAIT_CONTAINS_SPLITVIS))
vis = get_splitvis_object(offset, icon_path, "innercorner", direction, color, 0, 0, HIDDEN_WALL_PLANE, ABOVE_WALL_LAYER)
target_turf.overlays += vis
else
vis = get_splitvis_object(offset, icon_path, "innercorner", direction, color, -DIR_TO_PIXEL_X(direction), -DIR_TO_PIXEL_Y(direction), layer = ABOVE_WALL_LAYER)
operating_turf.overlays += vis


/datum/element/split_visibility/Detach(atom/target)
target.cut_overlay(mutable_appearance('icons/turf/walls/wall_blackness.dmi', "wall_background", UNDER_WALL_LAYER, target, GAME_PLANE))
Expand Down
2 changes: 1 addition & 1 deletion code/datums/elements/wall_mount.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
RegisterSignal(target, COMSIG_ATOM_DIR_CHANGE, PROC_REF(on_dir_changed))
on_dir_changed(real_target, real_target.dir, real_target.dir)

/datum/element/wall_mount/Detach(datum/source, ...)
/datum/element/wall_mount/Detach(datum/source)
. = ..()
UnregisterSignal(source, COMSIG_ATOM_DIR_CHANGE)

Expand Down
8 changes: 4 additions & 4 deletions code/game/atom/_atom.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ GLOBAL_LIST_INIT(lower_priority_connectables, typecacheof(list(
if(turf_to_check.density) //Dense turfs are connectable
dirs_usable -= dir_to_check
continue
for(var/atom/movable/thing_to_check in turf_to_check)
for(var/atom/movable/thing_to_check as anything in turf_to_check)
if(is_type_in_typecache(thing_to_check, connectables_typecache))
dirs_usable -= dir_to_check //So are things in the default typecache
break
Expand All @@ -1037,11 +1037,11 @@ GLOBAL_LIST_INIT(lower_priority_connectables, typecacheof(list(

var/dirs_avalible = length(dirs_usable)
//Only continue if we've got ourself either a corner or a side piece. Only side pieces really work well here, since corners aren't really something we can fudge handling for
if(dirs_avalible <= 2 && dirs_avalible != 0)
if(dirs_avalible && dirs_avalible <= 2)
setDir(dirs_usable[1]) //Just take the first dir avalible
return
dirs_usable &= dirs_secondary_priority //Only consider dirs we both share
dirs_avalible = length(dirs_usable)
if(dirs_avalible <= 2 && dirs_avalible != 0)
setDir(dirs_usable[1]) //Just take the first dir avalible
if(dirs_avalible && dirs_avalible <= 2)
setDir(dirs_usable[1])
return
6 changes: 5 additions & 1 deletion code/game/objects/structures/false_walls.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ GLOBAL_LIST_INIT(falsewall_alpha_icons, generate_transparent_falsewalls())
vis_flags = VIS_INHERIT_ID
appearance_flags = parent_type::appearance_flags | KEEP_TOGETHER | RESET_TRANSFORM

/obj/effect/falsewall_mask/New()
/obj/effect/falsewall_mask/init_air_alarm_modes()
. = ..()
render_target = "*falsewall_mask"

Expand Down Expand Up @@ -129,6 +129,10 @@ GLOBAL_LIST_INIT(falsewall_alpha_icons, generate_transparent_falsewalls())
set_opacity(TRUE) // walls cannot be transparent fuck u materials
air_update_turf(TRUE, TRUE)

/obj/structure/falsewall/Destroy(force)
QDEL_NULL(visuals)
return ..()

/obj/structure/falsewall/set_smoothed_icon_state(new_junction)
. = ..()
visuals.set_smoothed_icon_state(new_junction)
Expand Down
10 changes: 5 additions & 5 deletions code/game/objects/structures/window_frames.dm
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
if(!isliving(AM))
return
var/mob/living/potential_victim = AM
if(potential_victim.movement_type & (FLOATING|FLYING))
if(potential_victim.movement_type & MOVETYPES_NOT_TOUCHING_GROUND)
return
try_shock(potential_victim, 100)

Expand Down Expand Up @@ -160,12 +160,12 @@
if(!tool.tool_start_check(user, amount = 0))
return

to_chat(user, span_notice("You begin repairing [src]..."))
balloon_alert(user, "Repairing...")
if(!tool.use_tool(src, user, 40, volume = 50))
return
return ITEM_INTERACT_BLOCKING

atom_integrity = max_integrity
to_chat(user, span_notice("You repair [src]."))
balloon_alert(user, "Repaired!")
update_appearance()
return ITEM_INTERACT_SUCCESS

Expand Down Expand Up @@ -321,7 +321,7 @@

/obj/structure/window_frame/reinforced/damaged/Initialize(mapload)
. = ..()
var/obj/structure/window/our_window = locate(/obj/structure/window) in get_turf(src)
var/obj/structure/window/our_window = locate() in get_turf(src)
if(!our_window)
return

Expand Down

0 comments on commit 525121d

Please sign in to comment.