Files
Aurora.3/code/game/objects/buckling.dm
Fluffy 9acce89e2a Weapons Racks (#19338)
Added weapons racks, can be locked/unlocked with an ID card.
Added weapons racks sprites, from Wezzy.
Refactored some circuitboard code, moved the defines, applied the
defines, DMDocs.
Moved mutable appearance appearance flag set to the mutable appearance
file.
Reorganized the Horizon armory with the weapons racks, moved things
around, put down markers on lockers depending on the danger level of
their content, reorganized content of the remaining lockers.
Made weapons racks constructable with circuitboards.


![image](https://github.com/Aurorastation/Aurora.3/assets/65877598/8b4ec7ae-40c4-4cd7-b338-76120d468b90)

![image](https://github.com/Aurorastation/Aurora.3/assets/65877598/a69d1f85-c4b2-4643-af2b-6832e3ea2c43)

![image](https://github.com/Aurorastation/Aurora.3/assets/65877598/11c1afe4-0fa1-4708-8eb4-64e1f5594913)

sound/items/metal_shutter.ogg -
https://freesound.org/people/bruno.auzet/sounds/524695/ (CC0, sound was
edited)
2024-06-09 17:07:52 +00:00

153 lines
4.8 KiB
Plaintext

/obj/attack_hand(mob/living/user)
. = ..()
if(buckled)
user_unbuckle(user)
/obj/MouseDrop_T(atom/dropping, mob/user)
. = ..()
if(is_type_in_list(dropping, can_buckle))
user_buckle(dropping, user)
/**
* Buckles an `/atom/movable` to this obj, performed by a `/mob`
*
* Returns `TRUE` if the buckling was successful, `FALSE` otherwise
*
* * buckling_atom - The `/atom/movable` to buckle
* * user - The `/mob` that performs the buclking action
*/
/obj/proc/buckle(atom/movable/buckling_atom, mob/user)
if(!buckling_atom.can_be_buckled || buckling_atom.buckled_to)
return FALSE
if(!is_type_in_list(buckling_atom, can_buckle))
return FALSE
if(buckling_atom.loc != loc)
step_towards(buckling_atom, src)
if(buckling_atom.loc != loc)
return FALSE
if(buckling_atom != user && isliving(buckling_atom))
var/mob/living/buckling_mob = buckling_atom
//If the mob is not lying, check if there's an user that is performing the action, if there is add 3 seconds to perform the action,
//otherwise just continue as do_mob requires an user and a target
if(!buckling_mob.lying && !isnull(user) && !do_mob(user, buckling_mob, 3 SECONDS))
return FALSE
buckling_atom.buckled_to = src
buckled = buckling_atom
if(istype(buckling_atom, /mob/living))
var/mob/living/buckling_mob = buckling_atom
if(length(buckling_mob.pinned) || (buckle_require_restraints && !buckling_mob.restrained()))
return FALSE
buckling_mob.set_dir(buckle_dir ? buckle_dir : dir)
buckling_mob.facing_dir = null
buckling_mob.update_canmove()
else
buckling_atom.anchored = TRUE
post_buckle(buckling_atom)
buckling_atom.layer = layer + 0.1
return TRUE
/obj/proc/unbuckle()
var/atom/movable/MA = buckled
if(MA && MA.buckled_to == src)
. = MA
MA.buckled_to = null
MA.anchored = initial(MA.anchored)
buckled = null
if(istype(MA, /mob/living))
var/mob/living/M = MA
M.update_canmove()
post_buckle(.)
/obj/proc/post_buckle(atom/movable/MA)
return
/obj/proc/user_buckle(atom/movable/MA, mob/user)
if(!ROUND_IS_STARTED)
to_chat(user, SPAN_WARNING("You can't buckle anything in before the game starts."))
if(!user.Adjacent(MA) || user.restrained() || user.stat || istype(user, /mob/living/silicon/pai))
return
if(!MA.can_be_buckled)
to_chat(user, SPAN_WARNING("\The [MA] can't be buckled_to!"))
return
if(MA == buckled)
return
if(istype(MA, /mob/living/carbon/slime))
to_chat(user, SPAN_WARNING("\The [MA] is too squishy to buckle in."))
return
if(buckled)
to_chat(user, SPAN_WARNING("\The [buckled.name] is already there, unbuckle [istype(buckled, /mob/living) ? "them" : "it"] first!."))
return
add_fingerprint(user)
unbuckle()//this is now just for safety, buckling someone into an occupied chair will fail, instead of removing the occupant
if(buckle_delay)
if(MA == user)
MA.visible_message(\
"<b>[MA.name]</b> starts buckling themselves to [src].",\
SPAN_NOTICE("You start buckling yourself to [src]."),\
SPAN_NOTICE("You hear metal clanking."))
else if(isliving(MA))
MA.visible_message(\
SPAN_DANGER("[MA.name] is starting to be buckled to [src] by [user.name]!"),\
SPAN_DANGER("You are starting to be buckled to [src] by [user.name]!"),\
SPAN_NOTICE("You hear metal clanking."))
else
MA.visible_message(\
SPAN_DANGER("\The [MA] is starting to be buckled to [src] by [user.name]!"),\
SPAN_NOTICE("You hear metal clanking."))
if(!do_after(user, buckle_delay, src))
return
if(buckle(MA, user))
if(MA == user)
MA.visible_message(\
"<b>[MA.name]</b> buckles themselves to [src].",\
SPAN_NOTICE("You buckle yourself to [src]."),\
SPAN_NOTICE("You hear metal clanking."))
else if(isliving(MA))
MA.visible_message(\
SPAN_DANGER("[MA.name] is buckled to [src] by [user.name]!"),\
SPAN_DANGER("You are buckled to [src] by [user.name]!"),\
SPAN_NOTICE("You hear metal clanking."))
else
MA.visible_message(\
SPAN_DANGER("\The [MA] is buckled to [src] by [user.name]!"),\
SPAN_NOTICE("You hear metal clanking."))
/obj/proc/user_unbuckle(mob/user)
var/atom/movable/MA = unbuckle()
if(MA)
if(MA == user)
MA.visible_message(\
"<b>[MA.name]</b> unbuckles themselves.",\
SPAN_NOTICE("You unbuckle yourself from [src]."),\
SPAN_NOTICE("You hear metal clanking."))
else if(isliving(MA))
MA.visible_message(\
"<b>[user.name]</b> unbuckles [MA.name].", \
SPAN_NOTICE("You were unbuckled from [src] by [user.name]."),\
SPAN_NOTICE("You hear metal clanking."))
else if(isliving(user) && isobj(MA))
user.visible_message(\
"<b>[user]</b> unbuckles \the [MA] from [src].",\
SPAN_NOTICE("You unbuckle \the [MA] from [src]."),\
SPAN_NOTICE("You hear metal clanking."))
else
MA.visible_message(\
"<b>[MA.name]</b> unbuckles themselves.",\
SPAN_NOTICE("You hear metal clanking."))
add_fingerprint(user)
return MA