mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-26 14:31:59 +01:00
Leanable component (#21431)
Refactors leanable code into a component, now attached to walls, (full) windows, doors (of all types), and vending machines. See video for example behavior. https://github.com/user-attachments/assets/032d2cb2-17e3-4604-90b6-040e183dccd9
This commit is contained in:
@@ -103,28 +103,24 @@
|
||||
return FALSE
|
||||
|
||||
/obj/structure/mouse_drop_receive(atom/dropped, mob/user, params)
|
||||
|
||||
var/mob/living/H = user
|
||||
if(istype(H) && can_climb(H) && dropped == user)
|
||||
do_climb(dropped)
|
||||
else
|
||||
return ..()
|
||||
if(!do_climb(dropped))
|
||||
return ..()
|
||||
|
||||
/obj/structure/proc/can_climb(var/mob/living/user, post_climb_check=0)
|
||||
if (!climbable)
|
||||
to_chat(user, SPAN_WARNING("\The [src] cannot be climbed!"))
|
||||
return FALSE
|
||||
|
||||
if (!can_touch(user) || (!post_climb_check && (user in climbers)))
|
||||
return FALSE
|
||||
|
||||
if (!user.Adjacent(src))
|
||||
to_chat(user, SPAN_WARNING("You must be next to \the [src] to climb it."))
|
||||
return FALSE
|
||||
|
||||
var/obj/occupied = turf_is_crowded()
|
||||
if(occupied)
|
||||
to_chat(user, SPAN_WARNING("There's \a [occupied] in the way."))
|
||||
to_chat(user, SPAN_WARNING("There's \a [occupied] in the way of climbing this."))
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
@@ -145,7 +141,7 @@
|
||||
|
||||
/obj/structure/proc/do_climb(var/mob/living/user)
|
||||
if (!can_climb(user))
|
||||
return
|
||||
return FALSE
|
||||
|
||||
user.visible_message(SPAN_WARNING("[user] starts [atom_flags & ATOM_FLAG_CHECKS_BORDER ? "leaping over" : "climbing onto"] \the [src]!"))
|
||||
LAZYADD(climbers, user)
|
||||
|
||||
@@ -781,6 +781,10 @@
|
||||
qdel(src)
|
||||
update_nearby_icons()
|
||||
|
||||
/obj/structure/window/full/mouse_drop_receive(atom/dropping, mob/user, params)
|
||||
//Adds the component only once. We do it here & not in Initialize() because there are tons of walls & we don't want to add to their init times
|
||||
LoadComponent(/datum/component/leanable, dropping)
|
||||
|
||||
/********** Full Windows **********/
|
||||
// Reinforced Window
|
||||
/obj/structure/window/full/reinforced
|
||||
|
||||
Reference in New Issue
Block a user