TG Buckle Update (#12375)

This commit is contained in:
Fox McCloud
2019-09-22 18:22:57 -07:00
committed by variableundefined
parent 7846268dae
commit c87389a595
60 changed files with 640 additions and 533 deletions
+38 -13
View File
@@ -17,7 +17,7 @@
qdel(tkgrabbed_objects[I])
tkgrabbed_objects = null
if(buckled)
buckled.unbuckle_mob()
buckled.unbuckle_mob(src, force = TRUE)
if(viewing_alternate_appearances)
for(var/datum/alternate_appearance/AA in viewing_alternate_appearances)
AA.viewers -= src
@@ -1192,31 +1192,52 @@ var/list/slot_equipment_priority = list( \
/mob/proc/handle_ventcrawl()
return // Only living mobs can ventcrawl
//You can buckle on mobs if you're next to them since most are dense
/mob/buckle_mob(mob/living/M, force = 0)
/**
* Buckle to another mob
*
* You can buckle on mobs if you're next to them since most are dense
*
* Turns you to face the other mob too
*/
/mob/buckle_mob(mob/living/M, force = FALSE, check_loc = TRUE)
if(M.buckled)
return 0
var/turf/T = get_turf(src)
if(M.loc != T)
var/old_density = density
density = 0
density = FALSE
var/can_step = step_towards(M, T)
density = old_density
if(!can_step)
return 0
return ..()
//Default buckling shift visual for mobs
///Call back post buckle to a mob to offset your visual height
/mob/post_buckle_mob(mob/living/M)
if(M == buckled_mob) //post buckling
M.pixel_y = initial(M.pixel_y) + 9
if(M.layer < layer)
M.layer = layer + 0.1
else //post unbuckling
M.layer = initial(M.layer)
M.pixel_y = initial(M.pixel_y)
var/height = M.get_mob_buckling_height(src)
M.pixel_y = initial(M.pixel_y) + height
if(M.layer < layer)
M.layer = layer + 0.1
/mob/proc/can_unbuckle(mob/user)
///Call back post unbuckle from a mob, (reset your visual height here)
/mob/post_unbuckle_mob(mob/living/M)
M.layer = initial(M.layer)
M.pixel_y = initial(M.pixel_y)
///returns the height in pixel the mob should have when buckled to another mob.
/mob/proc/get_mob_buckling_height(mob/seat)
if(isliving(seat))
var/mob/living/L = seat
if(L.mob_size <= MOB_SIZE_SMALL) //being on top of a small mob doesn't put you very high.
return 0
return 9
///can the mob be buckled to something by default?
/mob/proc/can_buckle()
return 1
///can the mob be unbuckled from something by default?
/mob/proc/can_unbuckle()
return 1
@@ -1307,6 +1328,10 @@ var/list/slot_equipment_priority = list( \
.["Gib"] = "?_src_=vars;gib=[UID()]"
///Can this mob resist (default FALSE)
/mob/proc/can_resist()
return FALSE //overridden in living.dm
/mob/proc/spin(spintime, speed)
set waitfor = 0
var/D = dir