Files
4ab234f10c maploader / overmaps update - struct system, overmaps location bindings, misc backend improvements (#6403)
tl;dr level collections that can easily be logically restructured/moved
as necessary

will eventually be used for radio and overmaps location resolution.

this is the last part of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP/pull/4841
that has not yet been integrated.
this will be a draft for a while.

---------

Co-authored-by: LetterN <24603524+LetterN@users.noreply.github.com>
2025-11-06 17:49:23 -08:00

145 lines
5.0 KiB
Plaintext

// todo: why is this here?
GLOBAL_LIST_INIT(wallframe_typecache, typecacheof(list(
/obj/structure/window/reinforced/tinted/full,
/obj/structure/window/reinforced/full,
/obj/structure/window/phoronreinforced/full,
/obj/structure/window/phoronbasic/full,
/obj/structure/window/basic/full,
/obj/structure/window/reinforced/polarized/full,
/obj/machinery/door/airlock,
/obj/structure/grille,
/obj/machinery/smartfridge,
/turf/simulated/wall,
/turf/simulated/shuttle/wall,
)))
// todo: either this file should be wall_frame or this structure should be /low_wall, not both
/obj/structure/wall_frame
name = "low wall"
desc = "A low wall, with space to mount windows or grilles on top of it."
icon = 'icons/obj/structures/low_wall.dmi'
icon_state = "wall-0"
base_icon_state = "wall"
color = "#57575c" //To display in mapping softwares
density = TRUE
anchored = TRUE
pass_flags_self = ATOM_PASS_TABLE | ATOM_PASS_THROWN | ATOM_PASS_CLICK
layer = LOW_WALL_LAYER
smoothing_flags = SMOOTH_BITMASK
smoothing_groups = (SMOOTH_GROUP_LOW_WALL)
canSmoothWith = (SMOOTH_GROUP_AIRLOCK+SMOOTH_GROUP_LOW_WALL+SMOOTH_GROUP_WALLS)
depth_projected = TRUE
depth_level = 8
climb_allowed = TRUE
climb_delay = 2.0 SECONDS
plane = OBJ_PLANE
obj_flags = OBJ_MELEE_TARGETABLE | OBJ_RANGE_TARGETABLE | OBJ_ALLOW_THROW_THROUGH
material_parts = /datum/prototype/material/steel
material_primary = MATERIAL_PART_DEFAULT
material_costs = SHEET_MATERIAL_AMOUNT * 2
var/stripe_color
var/str
var/static/list/airlock_typecache
var/shiny_stripe
var/health
var/max_health
var/material_color = TRUE
/obj/structure/wall_frame/prepainted
stripe_color = COLOR_WALL_GUNMETAL
/obj/structure/wall_frame/Initialize(mapload, datum/prototype/material/material_like)
if(!isnull(material_like))
var/resolved_material = RSmaterials.fetch_or_defer(material_like)
switch(resolved_material)
if(REPOSITORY_FETCH_DEFER)
// todo: handle
else
set_primary_material(resolved_material)
. = ..()
update_overlays()
/obj/structure/wall_frame/update_material_single(datum/prototype/material/material)
. = ..()
name = "[material.display_name] [initial(name)]"
set_multiplied_integrity(material.relative_integrity)
/obj/structure/wall_frame/update_overlays()
cut_overlays()
var/datum/prototype/material/const_material = get_primary_material()
color = const_material.icon_colour
var/image/smoothed_stripe = image(const_material.wall_stripe_icon, icon_state, layer = ABOVE_WINDOW_LAYER)
smoothed_stripe.appearance_flags = RESET_COLOR
smoothed_stripe.color = stripe_color || const_material.icon_colour
add_overlay(smoothed_stripe)
if(!GLOB.wallframe_typecache)
GLOB.wallframe_typecache = typecacheof(list(/obj/machinery/door/airlock))
var/neighbor_stripe = NONE
for(var/cardinal in GLOB.cardinal)
var/turf/step_turf = get_step(src, cardinal)
var/obj/structure/wall_frame/neighbor = locate() in step_turf
if(neighbor)
continue
var/can_area_smooth
CAN_AREAS_SMOOTH(src, step_turf, can_area_smooth)
if(isnull(can_area_smooth))
continue
for(var/atom/movable/movable_thing as anything in step_turf)
if(GLOB.wallframe_typecache[movable_thing.type])
neighbor_stripe ^= cardinal
break
if(GLOB.wallframe_typecache[step_turf.type])
neighbor_stripe ^= cardinal
if(neighbor_stripe)
var/image/neighb_stripe_overlay = new ('icons/turf/walls/neighbor_stripe.dmi', "stripe-[neighbor_stripe]", layer = ABOVE_WINDOW_LAYER)
neighb_stripe_overlay.appearance_flags = RESET_COLOR
neighb_stripe_overlay.color = stripe_color || const_material.icon_colour
add_overlay(neighb_stripe_overlay)
if(shiny_stripe)
var/image/shine = image('icons/turf/walls/neighbor_stripe.dmi', "shine-[smoothing_junction]")
shine.appearance_flags = RESET_COLOR
add_overlay(shine)
return ..()
/obj/structure/wall_frame/CanAllowThrough(atom/movable/mover, turf/target)
if(istype(mover,/obj/projectile))
return TRUE
if(istype(mover) && mover.check_pass_flags(ATOM_PASS_TABLE))
return TRUE
/obj/structure/wall_frame/attackby(var/obj/item/I, var/mob/user)
//grille placing
if(istype(I, /obj/item/stack/rods))
for(var/obj/structure/window/WINDOW in loc)
if(WINDOW.dir == get_dir(src, user))
to_chat(user, SPAN_WARNING("There is a window in the way."))
return CLICKCHAIN_DO_NOT_PROPAGATE
place_grille(user, loc, I)
return CLICKCHAIN_DO_NOT_PROPAGATE | CLICKCHAIN_DID_SOMETHING
//window placing
if(istype(I,/obj/item/stack/material/glass) && isnull(locate(/obj/structure/window) in loc))
var/obj/item/stack/material/ST = I
if(ST.material.opacity <= 0.7)
place_window(user, loc, ST, TRUE, TRUE)
return CLICKCHAIN_DO_NOT_PROPAGATE | CLICKCHAIN_DID_SOMETHING
if(I.is_wrench())
if(do_after(user,40 * I.tool_speed))
playsound(src, I.tool_sound, 100, 1)
deconstruct(ATOM_DECONSTRUCT_DISASSEMBLED)
return CLICKCHAIN_DO_NOT_PROPAGATE | CLICKCHAIN_DID_SOMETHING
return CLICKCHAIN_DO_NOT_PROPAGATE
return ..()
/obj/structure/wall_frame/drop_products(method, atom/where)
. = ..()
var/datum/prototype/material/made_of = get_primary_material()
made_of?.place_sheet(where, 2)