Files
Bubberstation/code/game/objects/buckling.dm
Cyberboss d9fe5c06ea Fix playsound_local (#1)
* Adds Show/Hide functionality to plane masters (#25474)

* Adds Show/Hide functionality to plane masters

* Capitalise names to avoid clashes with existing procs

* Fixes rad storms making space black (#25482)

* Removes an unused var (#25484)

* Fixes damage overlay bugs (#25494)

* Gives an icon to the zombie festering ooze (#25493)

* fixes safes (#25478)

* SNPC Refactor (#25429)

* Move the interactive file to the right spot

* Proper scheduling

* dOY

* Fix shit

* Fixes a bug (#25509)

* oh god why

* still not done..

* Update chameleon.dm

* Makes Ratvar more powerful than the admins (#25440)

* Update possess.dm

* Update possess.dm

* Update objs.dm

* Update ratvar_the_clockwork_justicar.dm

* Update singularity.dm

* Update possess.dm

* Update objs.dm

* Update objs.dm

* Update objs.dm

* Update possess.dm

* Borer can't use its power while dead (#25444)

* Borer can't use its power while dead

* Define

* Borer infesting no longer requires input if there's only 1 target (#25491)

* Infesting is now isntant if there's only 1 target

* Protect it

* Same thing for dominate

* Fixes door shock overlay (#25492)

* Fixes door shock overlay

* undefs

* Automatic changelog generation for PR #25492 [ci skip]

* Supermatter Area / Air Alarm Tweak Cont'd (#25496)

* Automatic changelog generation for PR #25496 [ci skip]

* Gives multitoolable assemblies examine text about it (#25500)

* Gives multitoolable assemblies examine text about it

* oxford comma

* Qbopper's Drone Flavortext Addition+ (#25499)

* Free Drone

* Excuse you please fix my drones!

* this is probably going to be a bad web edit.

* THIS IS WHY WE DON'T WEBEDIT

* STUPID CLOCK DRONES

* Automatic changelog generation for PR #25499 [ci skip]

* Automatic changelog compile, [ci skip]

* Fixes a runtime when cutting lattice (#25504)

* Fixes hyperspace being black (#25507)

Fixes #25272

* [S] Fix the ability to exploit statues for extra resources (#25532)

* Fix runtime with hostile simple mobs (#25505)

* Fixes wood tiles interaction with quick tile replacement (#25489)

* Automatic changelog generation for PR #25489 [ci skip]

* Fixes coin flipping (#25518)

* Stops monkey hordes from spamming chat log to some extent (#25517)

* Gives backup nukies the code (#25519)

* Automatic changelog generation for PR #25519 [ci skip]

* Cleans up TK code a bit (#25516)

* Prevents clicks until atoms are initialized (#25460)

* Fix bonfire/buckle_mob() runtime (#25527)

* Automatic changelog generation for PR #25527 [ci skip]

* Refactors disposal bins (#25487)

* Refactors disposal bins

* conflicts begone

* eh sure

* Kills more spawns (#25528)

* Die

* Die

* Die

* Fix

* Die

* Die

* Alright

* Whoops

* bluh

* < can't code

* Update human.dm (#25535)

* Admin sound channel tweaks (#25537)

* Update playsound.dm

* Update sound.dm

* Update sound.dm

* Update playsound.dm

* Fix mob/playsound_local prototype (#25538)

* Automatic changelog compile, [ci skip]

* Makes the thing use channels
2017-03-28 14:33:07 -04:00

143 lines
4.2 KiB
Plaintext

/atom/movable
var/can_buckle = 0
var/buckle_lying = -1 //bed-like behaviour, forces mob.lying = buckle_lying if != -1
var/buckle_requires_restraints = 0 //require people to be handcuffed before being able to buckle. eg: pipes
var/list/mob/living/buckled_mobs = null //list()
var/max_buckled_mobs = 1
var/buckle_prevents_pull = FALSE
//Interaction
/atom/movable/attack_hand(mob/living/user)
. = ..()
if(can_buckle && has_buckled_mobs())
if(buckled_mobs.len > 1)
var/unbuckled = input(user, "Who do you wish to unbuckle?","Unbuckle Who?") as null|mob in buckled_mobs
if(user_unbuckle_mob(unbuckled,user))
return 1
else
if(user_unbuckle_mob(buckled_mobs[1],user))
return 1
/atom/movable/MouseDrop_T(mob/living/M, mob/living/user)
. = ..()
if(can_buckle && istype(M))
if(user_buckle_mob(M, user))
return 1
//Cleanup
/atom/movable/Destroy()
. = ..()
unbuckle_all_mobs(force=1)
/atom/movable/proc/has_buckled_mobs()
if(!buckled_mobs)
return FALSE
if(buckled_mobs.len)
return TRUE
//procs that handle the actual buckling and unbuckling
/atom/movable/proc/buckle_mob(mob/living/M, force = FALSE, check_loc = TRUE)
if(!buckled_mobs)
buckled_mobs = list()
if(!istype(M))
return 0
if(check_loc && M.loc != loc)
return 0
if((!can_buckle && !force) || M.buckled || (buckled_mobs.len >= max_buckled_mobs) || (buckle_requires_restraints && !M.restrained()) || M == src)
return 0
if(!M.can_buckle() && !force)
if(M == usr)
to_chat(M, "<span class='warning'>You are unable to buckle yourself to the [src]!</span>")
else
to_chat(usr, "<span class='warning'>You are unable to buckle [M] to the [src]!</span>")
return 0
if(M.pulledby && buckle_prevents_pull)
M.pulledby.stop_pulling()
if(!check_loc && M.loc != loc)
M.forceMove(loc)
M.buckled = src
M.setDir(dir)
buckled_mobs |= M
M.update_canmove()
M.throw_alert("buckled", /obj/screen/alert/restrained/buckled, new_master = src)
post_buckle_mob(M)
return 1
/obj/buckle_mob(mob/living/M, force = FALSE, check_loc = TRUE)
. = ..()
if(.)
if(resistance_flags & ON_FIRE) //Sets the mob on fire if you buckle them to a burning atom/movableect
M.adjust_fire_stacks(1)
M.IgniteMob()
/atom/movable/proc/unbuckle_mob(mob/living/buckled_mob, force=FALSE)
if(istype(buckled_mob) && buckled_mob.buckled == src && (buckled_mob.can_unbuckle() || force))
. = buckled_mob
buckled_mob.buckled = null
buckled_mob.anchored = initial(buckled_mob.anchored)
buckled_mob.update_canmove()
buckled_mob.clear_alert("buckled")
buckled_mobs -= buckled_mob
post_buckle_mob(.)
/atom/movable/proc/unbuckle_all_mobs(force=FALSE)
if(!has_buckled_mobs())
return
for(var/m in buckled_mobs)
unbuckle_mob(m, force)
//Handle any extras after buckling/unbuckling
//Called on buckle_mob() and unbuckle_mob()
/atom/movable/proc/post_buckle_mob(mob/living/M)
return
//Wrapper procs that handle sanity and user feedback
/atom/movable/proc/user_buckle_mob(mob/living/M, mob/user, check_loc = TRUE)
if(!in_range(user, src) || user.stat || user.restrained())
return 0
add_fingerprint(user)
if(buckle_mob(M, check_loc = check_loc))
if(M == user)
M.visible_message(\
"<span class='notice'>[M] buckles [M.p_them()]self to [src].</span>",\
"<span class='notice'>You buckle yourself to [src].</span>",\
"<span class='italics'>You hear metal clanking.</span>")
else
M.visible_message(\
"<span class='warning'>[user] buckles [M] to [src]!</span>",\
"<span class='warning'>[user] buckles you to [src]!</span>",\
"<span class='italics'>You hear metal clanking.</span>")
return 1
/atom/movable/proc/user_unbuckle_mob(mob/living/buckled_mob, mob/user)
var/mob/living/M = unbuckle_mob(buckled_mob)
if(M)
if(M != user)
M.visible_message(\
"<span class='notice'>[user] unbuckles [M] from [src].</span>",\
"<span class='notice'>[user] unbuckles you from [src].</span>",\
"<span class='italics'>You hear metal clanking.</span>")
else
M.visible_message(\
"<span class='notice'>[M] unbuckles [M.p_them()]self from [src].</span>",\
"<span class='notice'>You unbuckle yourself from [src].</span>",\
"<span class='italics'>You hear metal clanking.</span>")
add_fingerprint(user)
return M