Porting "Mobs now turn towards and are shifted based on grab state towards something pulling them"
This commit is contained in:
@@ -28,6 +28,8 @@
|
||||
|
||||
/obj/machinery/atmospherics/pipe/manifold/update_icon()
|
||||
cut_overlays()
|
||||
if(!center)
|
||||
center = mutable_appearance(icon, "manifold_center")
|
||||
PIPING_LAYER_DOUBLE_SHIFT(center, piping_layer)
|
||||
add_overlay(center)
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
|
||||
/obj/machinery/atmospherics/pipe/manifold4w/update_icon()
|
||||
cut_overlays()
|
||||
if(!center)
|
||||
center = mutable_appearance(icon, "manifold_center")
|
||||
PIPING_LAYER_DOUBLE_SHIFT(center, piping_layer)
|
||||
add_overlay(center)
|
||||
|
||||
|
||||
@@ -316,6 +316,45 @@
|
||||
|
||||
update_pull_movespeed()
|
||||
|
||||
set_pull_offsets(M, state)
|
||||
|
||||
/mob/living/proc/set_pull_offsets(mob/living/M, grab_state = GRAB_PASSIVE)
|
||||
if(M.buckled)
|
||||
return //don't make them change direction or offset them if they're buckled into something.
|
||||
var/offset = 0
|
||||
switch(grab_state)
|
||||
if(GRAB_PASSIVE)
|
||||
offset = GRAB_PIXEL_SHIFT_PASSIVE
|
||||
if(GRAB_AGGRESSIVE)
|
||||
offset = GRAB_PIXEL_SHIFT_AGGRESSIVE
|
||||
if(GRAB_NECK)
|
||||
offset = GRAB_PIXEL_SHIFT_NECK
|
||||
if(GRAB_KILL)
|
||||
offset = GRAB_PIXEL_SHIFT_NECK
|
||||
M.setDir(get_dir(M, src))
|
||||
switch(M.dir)
|
||||
if(NORTH)
|
||||
animate(M, pixel_x = 0, pixel_y = offset, 3)
|
||||
if(SOUTH)
|
||||
animate(M, pixel_x = 0, pixel_y = -offset, 3)
|
||||
if(EAST)
|
||||
if(M.lying == 270) //update the dragged dude's direction if we've turned
|
||||
M.lying = 90
|
||||
M.update_transform() //force a transformation update, otherwise it'll take a few ticks for update_mobility() to do so
|
||||
M.lying_prev = M.lying
|
||||
animate(M, pixel_x = offset, pixel_y = 0, 3)
|
||||
if(WEST)
|
||||
if(M.lying == 90)
|
||||
M.lying = 270
|
||||
M.update_transform()
|
||||
M.lying_prev = M.lying
|
||||
animate(M, pixel_x = -offset, pixel_y = 0, 3)
|
||||
|
||||
/mob/living/proc/reset_pull_offsets(mob/living/M, override)
|
||||
if(!override && M.buckled)
|
||||
return
|
||||
animate(M, pixel_x = 0, pixel_y = 0, 1)
|
||||
|
||||
//mob verbs are a lot faster than object verbs
|
||||
//for more info on why this is not atom/pull, see examinate() in mob.dm
|
||||
/mob/living/verb/pulled(atom/movable/AM as mob|obj in oview(1))
|
||||
@@ -328,6 +367,8 @@
|
||||
stop_pulling()
|
||||
|
||||
/mob/living/stop_pulling()
|
||||
if(ismob(pulling))
|
||||
reset_pull_offsets(pulling)
|
||||
..()
|
||||
update_pull_movespeed()
|
||||
update_pull_hud_icon()
|
||||
|
||||
@@ -264,6 +264,7 @@
|
||||
update_mobility() //we fall down
|
||||
if(!buckled && !density)
|
||||
Move(user.loc)
|
||||
user.set_pull_offsets(src, grab_state)
|
||||
return 1
|
||||
|
||||
/mob/living/attack_hand(mob/user)
|
||||
|
||||
@@ -75,8 +75,12 @@
|
||||
|
||||
. = ..()
|
||||
|
||||
if(pulledby && moving_diagonally != FIRST_DIAG_STEP && get_dist(src, pulledby) > 1)//separated from our puller and not in the middle of a diagonal move.
|
||||
if(pulledby && moving_diagonally != FIRST_DIAG_STEP && get_dist(src, pulledby) > 1 && (pulledby != moving_from_pull))//separated from our puller and not in the middle of a diagonal move.
|
||||
pulledby.stop_pulling()
|
||||
else
|
||||
if(isliving(pulledby))
|
||||
var/mob/living/L = pulledby
|
||||
L.set_pull_offsets(src, pulledby.grab_state)
|
||||
|
||||
if(active_storage && !(CanReach(active_storage.parent,view_only = TRUE)))
|
||||
active_storage.close(src)
|
||||
@@ -84,6 +88,14 @@
|
||||
if(lying && !buckled && prob(getBruteLoss()*200/maxHealth))
|
||||
makeTrail(newloc, T, old_direction)
|
||||
|
||||
|
||||
/mob/living/Move_Pulled(atom/A)
|
||||
. = ..()
|
||||
if(!. || !isliving(A))
|
||||
return
|
||||
var/mob/living/L = A
|
||||
set_pull_offsets(L, grab_state)
|
||||
|
||||
/mob/living/forceMove(atom/destination)
|
||||
stop_pulling()
|
||||
if(buckled)
|
||||
|
||||
@@ -109,6 +109,8 @@
|
||||
/// Process_Grab(): checks for grab, attempts to break if so. Return TRUE to prevent movement.
|
||||
/client/proc/Process_Grab()
|
||||
if(mob.pulledby)
|
||||
if((mob.pulledby == mob.pulling) && (mob.pulledby.grab_state == GRAB_PASSIVE)) //Don't autoresist passive grabs if we're grabbing them too.
|
||||
return
|
||||
if(mob.incapacitated(ignore_restraints = 1))
|
||||
move_delay = world.time + 10
|
||||
return TRUE
|
||||
|
||||
Reference in New Issue
Block a user