[s] Blocks any doubled wall mount placement (#27016)

* Blocks any doubled wall mount placement

* Fixes direction stuff

* Remove old code
This commit is contained in:
DGamerL
2024-10-07 20:08:11 +00:00
committed by GitHub
parent 19a8edae33
commit a01f41e904
3 changed files with 16 additions and 33 deletions
+7 -25
View File
@@ -1141,41 +1141,23 @@ Checks if that loc and dir has a item on the wall
*/
GLOBAL_LIST_INIT(wall_items, typecacheof(list(/obj/machinery/power/apc, /obj/machinery/alarm,
/obj/item/radio/intercom, /obj/structure/extinguisher_cabinet, /obj/structure/reagent_dispensers/peppertank,
/obj/machinery/status_display, /obj/machinery/requests_console, /obj/machinery/light_switch, /obj/structure/sign,
/obj/machinery/status_display, /obj/machinery/requests_console, /obj/structure/sign,
/obj/machinery/newscaster, /obj/machinery/firealarm, /obj/structure/noticeboard, /obj/machinery/door_control,
/obj/machinery/computer/security/telescreen, /obj/machinery/airlock_controller,
/obj/item/storage/secure/safe, /obj/machinery/door_timer, /obj/machinery/flasher, /obj/machinery/keycard_auth,
/obj/structure/mirror, /obj/structure/closet/fireaxecabinet, /obj/machinery/computer/security/telescreen/entertainment,
/obj/structure/sign, /obj/machinery/barsign)))
/obj/structure/sign, /obj/machinery/barsign, /obj/machinery/light, /obj/machinery/light_construct)))
/proc/gotwallitem(loc, dir)
for(var/obj/O in loc)
if(is_type_in_typecache(O, GLOB.wall_items))
//Direction works sometimes
if(O.dir == dir)
return 1
if(is_type_in_typecache(O, GLOB.wall_items) && dir == O.dir)
return TRUE
//Some stuff doesn't use dir properly, so we need to check pixel instead
switch(dir)
if(SOUTH)
if(O.pixel_y > 10)
return 1
if(NORTH)
if(O.pixel_y < -10)
return 1
if(WEST)
if(O.pixel_x > 10)
return 1
if(EAST)
if(O.pixel_x < -10)
return 1
//Some stuff is placed directly on the wallturf (signs)
// Some stuff is placed directly on the wallturf (signs)
for(var/obj/O in get_step(loc, dir))
if(is_type_in_typecache(O, GLOB.wall_items))
if(abs(O.pixel_x) <= 10 && abs(O.pixel_y) <= 10)
return 1
return 0
return TRUE
return FALSE
/proc/atan2(x, y)
if(!x && !y) return 0
@@ -22,15 +22,15 @@
/obj/item/mounted/frame/try_build(turf/on_wall, mob/user)
if(!..())
return
return FALSE
var/turf/build_turf = get_turf(user)
if((mount_requirements & MOUNTED_FRAME_SIMFLOOR) && !isfloorturf(build_turf))
to_chat(user, "<span class='warning'>[src] cannot be placed on this spot.</span>")
return
return FALSE
if(mount_requirements & MOUNTED_FRAME_NOSPACE)
var/area/my_area = get_area(build_turf)
if(!istype(my_area) || !my_area.requires_power || isspacearea(my_area))
to_chat(user, "<span class='warning'>[src] cannot be placed in this area.</span>")
return
return FALSE
return TRUE
@@ -14,17 +14,18 @@
/obj/item/mounted/proc/try_build(turf/on_wall, mob/user, proximity_flag) //checks
if(!on_wall || !user)
return
return FALSE
if(!proximity_flag) //if we aren't next to the turf
return
return FALSE
if(!allow_floor_mounting)
if(!(get_dir(on_wall, user) in GLOB.cardinal))
to_chat(user, "<span class='warning'>You need to be standing next to [on_wall] to place [src].</span>")
return
return FALSE
if(gotwallitem(get_turf(user), get_dir(on_wall, user)))
if(gotwallitem(get_turf(user), get_dir(user, on_wall)))
to_chat(user, "<span class='warning'>There's already an item on this wall!</span>")
return
return FALSE
return TRUE