Files
SyncIt21 81427cd5cf Unit tests, refactor & realignment for map loaded wall mounts (#93662)
## About The Pull Request
This 1st has to be PR'd so the integration tests can point out all
wallmounts that could not find a support structure to mount on. I then
will do many map edits to align them onto the closest atom

Yes we no longer use wall mount but atom mounted component. All objects
that are mounted on windows/tables & fences now also fall off when
destroyed

It'll probably be a WHILE before I can fix all wall mounts. Long day.
Expect me to misalign many stuff to fix failing CI so make sure to
provide suggestions when possible

Improved wallmount code overall
- Fixes #93793


## Changelog
🆑
fix: fixes all incorrectly maploded wall mounts that aren't actually
hanging on any support structure
fix: objects mounted on tables, windows & fences also fall off now when
destoryed
qol: lights can be mounted on windows
qol: cameras can be mounted on windows
qol: buttons can be mounted on tables
refactor: improved how wall mounts interact with objects as a whole
report bugs on github
/🆑
2025-11-18 22:37:12 -07:00

65 lines
2.2 KiB
Plaintext

/obj/item/wallframe/light_fixture
name = "light fixture frame"
desc = "Used for building lights."
icon = 'icons/obj/lighting.dmi'
icon_state = "tube-construct-item"
result_path = /obj/structure/light_construct
wall_external = TRUE
/obj/item/wallframe/light_fixture/find_support_structure(atom/structure)
return istype(structure, /obj/structure/window) ? structure : ..()
/obj/item/wallframe/light_fixture/try_build(atom/support, mob/user)
var/area/A = get_area(user)
if(A.always_unpowered)
balloon_alert(user, "cannot place in this area!")
return FALSE
return ..()
/obj/item/wallframe/light_fixture/small
name = "small light fixture frame"
icon_state = "bulb-construct-item"
result_path = /obj/structure/light_construct/small
custom_materials = list(/datum/material/iron=SHEET_MATERIAL_AMOUNT)
/obj/item/wallframe/light_fixture/try_build(turf/on_wall, user)
if(!..())
return
var/area/local_area = get_area(user)
if(!local_area.static_lighting)
to_chat(user, span_warning("You cannot place [src] in this area!"))
return
return TRUE
/obj/item/wallframe/light_fixture/small/attack_self(mob/user)
var/turf/local_turf = get_turf(user)
var/area/local_area = get_area(user)
if(!isturf(user.loc) || !isfloorturf(local_turf))
balloon_alert(user, "cannot place here!")
return
if(local_area.always_unpowered || !local_area.static_lighting)
balloon_alert(user, "cannot place in this area!")
return
for(var/obj/object in local_turf)
if(object.density && !(object.obj_flags & IGNORE_DENSITY) || object.obj_flags & BLOCKS_CONSTRUCTION)
balloon_alert(user, "something is in the way!")
return
if(local_turf.underfloor_accessibility < UNDERFLOOR_INTERACTABLE)
balloon_alert(user, "remove the floor plating!")
return
if(locate(/obj/structure/light_construct/floor) in local_turf)
balloon_alert(user, "already has a light!")
return
if(locate(/obj/machinery/light/floor) in local_turf)
balloon_alert(user, "already has a light!")
return
playsound(src.loc, 'sound/machines/click.ogg', 75, TRUE)
user.visible_message(span_notice("[user.name] attaches [src] to the floor."),
span_notice("You attach [src] to the floor."),
span_hear("You hear clicking."))
new /obj/structure/light_construct/floor(local_turf)
qdel(src)