Merge pull request #9191 from Linzolle/fireman
Ports fireman carrying from /tg/
This commit is contained in:
@@ -859,52 +859,84 @@
|
||||
.["Copy outfit"] = "?_src_=vars;[HrefToken()];copyoutfit=[REF(src)]"
|
||||
|
||||
/mob/living/carbon/human/MouseDrop_T(mob/living/target, mob/living/user)
|
||||
//If they dragged themselves and we're currently aggressively grabbing them try to piggyback
|
||||
if(user == target && can_piggyback(target) && pulling == target && (HAS_TRAIT(src, TRAIT_PACIFISM) || grab_state >= GRAB_AGGRESSIVE) && stat == CONSCIOUS)
|
||||
buckle_mob(target,TRUE,TRUE)
|
||||
if(pulling == target && grab_state >= GRAB_AGGRESSIVE && stat == CONSCIOUS)
|
||||
//If they dragged themselves and we're currently aggressively grabbing them try to piggyback
|
||||
if(user == target && can_piggyback(target))
|
||||
piggyback(target)
|
||||
return
|
||||
//If you dragged them to you and you're aggressively grabbing try to fireman carry them
|
||||
else if(user != target && can_be_firemanned(target))
|
||||
fireman_carry(target)
|
||||
return
|
||||
. = ..()
|
||||
|
||||
/mob/living/carbon/human/proc/piggyback_instant(mob/living/M)
|
||||
return buckle_mob(M, TRUE, TRUE, FALSE, TRUE)
|
||||
//src is the user that will be carrying, target is the mob to be carried
|
||||
/mob/living/carbon/human/proc/can_piggyback(mob/living/carbon/target)
|
||||
return (istype(target) && target.stat == CONSCIOUS)
|
||||
|
||||
//Can C try to piggyback at all.
|
||||
/mob/living/carbon/human/proc/can_piggyback(mob/living/carbon/C)
|
||||
if(istype(C) && C.stat == CONSCIOUS)
|
||||
return TRUE
|
||||
return FALSE
|
||||
/mob/living/carbon/human/proc/can_be_firemanned(mob/living/carbon/target)
|
||||
return (ishuman(target) && target.lying)
|
||||
|
||||
/mob/living/carbon/human/buckle_mob(mob/living/M, force = FALSE, check_loc = TRUE, bypass_piggybacking = FALSE, no_delay = FALSE)
|
||||
/mob/living/carbon/human/proc/fireman_carry(mob/living/carbon/target)
|
||||
if(can_be_firemanned(target))
|
||||
visible_message("<span class='notice'>[src] starts lifting [target] onto their back...</span>",
|
||||
"<span class='notice'>You start lifting [target] onto your back...</span>")
|
||||
if(do_after(src, 30, TRUE, target))
|
||||
//Second check to make sure they're still valid to be carried
|
||||
if(can_be_firemanned(target) && !incapacitated(FALSE, TRUE))
|
||||
target.resting = FALSE
|
||||
buckle_mob(target, TRUE, TRUE, 90, 1, 0)
|
||||
return
|
||||
visible_message("<span class='warning'>[src] fails to fireman carry [target]!")
|
||||
else
|
||||
to_chat(src, "<span class='notice'>You can't fireman carry [target] while they're standing!</span>")
|
||||
|
||||
/mob/living/carbon/human/proc/piggyback(mob/living/carbon/target)
|
||||
if(can_piggyback(target))
|
||||
visible_message("<span class='notice'>[target] starts to climb onto [src]...</span>")
|
||||
if(do_after(target, 15, target = src))
|
||||
if(can_piggyback(target))
|
||||
if(target.incapacitated(FALSE, TRUE) || incapacitated(FALSE, TRUE))
|
||||
target.visible_message("<span class='warning'>[target] can't hang onto [src]!</span>")
|
||||
return
|
||||
buckle_mob(target, TRUE, TRUE, FALSE, 0, 2)
|
||||
else
|
||||
visible_message("<span class='warning'>[target] fails to climb onto [src]!</span>")
|
||||
else
|
||||
to_chat(target, "<span class='warning'>You can't piggyback ride [src] right now!</span>")
|
||||
|
||||
/mob/living/carbon/human/buckle_mob(mob/living/target, force = FALSE, check_loc = TRUE, lying_buckle = FALSE, hands_needed = 0, target_hands_needed = 0)
|
||||
if(!force)//humans are only meant to be ridden through piggybacking and special cases
|
||||
return
|
||||
if(bypass_piggybacking)
|
||||
return ..()
|
||||
if(!is_type_in_typecache(M, can_ride_typecache))
|
||||
M.visible_message("<span class='warning'>[M] really can't seem to mount [src]...</span>")
|
||||
if(!is_type_in_typecache(target, can_ride_typecache))
|
||||
target.visible_message("<span class='warning'>[target] really can't seem to mount [src]...</span>")
|
||||
return
|
||||
buckle_lying = lying_buckle
|
||||
var/datum/component/riding/human/riding_datum = LoadComponent(/datum/component/riding/human)
|
||||
riding_datum.ride_check_rider_incapacitated = TRUE
|
||||
riding_datum.ride_check_rider_restrained = TRUE
|
||||
riding_datum.set_riding_offsets(RIDING_OFFSET_ALL, list(TEXT_NORTH = list(0, 6), TEXT_SOUTH = list(0, 6), TEXT_EAST = list(-6, 4), TEXT_WEST = list( 6, 4)))
|
||||
if(buckled_mobs && ((M in buckled_mobs) || (buckled_mobs.len >= max_buckled_mobs)) || buckled || (M.stat != CONSCIOUS))
|
||||
if(target_hands_needed)
|
||||
riding_datum.ride_check_rider_restrained = TRUE
|
||||
if(buckled_mobs && ((target in buckled_mobs) || (buckled_mobs.len >= max_buckled_mobs)) || buckled)
|
||||
return
|
||||
if(can_piggyback(M))
|
||||
riding_datum.ride_check_ridden_incapacitated = TRUE
|
||||
visible_message("<span class='notice'>[M] starts to climb onto [src]...</span>")
|
||||
if(no_delay || do_after(M, 15, target = src))
|
||||
if(can_piggyback(M))
|
||||
if(M.incapacitated(FALSE, TRUE) || incapacitated(FALSE, TRUE))
|
||||
M.visible_message("<span class='warning'>[M] can't hang onto [src]!</span>")
|
||||
return
|
||||
if(!riding_datum.equip_buckle_inhands(M, 2)) //MAKE SURE THIS IS LAST!!
|
||||
M.visible_message("<span class='warning'>[M] can't climb onto [src]!</span>")
|
||||
return
|
||||
. = ..(M, force, check_loc)
|
||||
stop_pulling()
|
||||
else
|
||||
visible_message("<span class='warning'>[M] fails to climb onto [src]!</span>")
|
||||
else
|
||||
. = ..(M,force,check_loc)
|
||||
stop_pulling()
|
||||
var/equipped_hands_self
|
||||
var/equipped_hands_target
|
||||
if(hands_needed)
|
||||
equipped_hands_self = riding_datum.equip_buckle_inhands(src, hands_needed, target)
|
||||
if(target_hands_needed)
|
||||
equipped_hands_target = riding_datum.equip_buckle_inhands(target, target_hands_needed)
|
||||
|
||||
if(hands_needed || target_hands_needed)
|
||||
if(hands_needed && !equipped_hands_self)
|
||||
src.visible_message("<span class='warning'>[src] can't get a grip on [target] because their hands are full!</span>",
|
||||
"<span class='warning'>You can't get a grip on [target] because your hands are full!</span>")
|
||||
return
|
||||
else if(target_hands_needed && !equipped_hands_target)
|
||||
target.visible_message("<span class='warning'>[target] can't get a grip on [src] because their hands are full!</span>",
|
||||
"<span class='warning'>You can't get a grip on [src] because your hands are full!</span>")
|
||||
return
|
||||
|
||||
stop_pulling()
|
||||
riding_datum.handle_vehicle_layer()
|
||||
. = ..(target, force, check_loc)
|
||||
|
||||
/mob/living/carbon/human/proc/is_shove_knockdown_blocked() //If you want to add more things that block shove knockdown, extend this
|
||||
for(var/obj/item/clothing/C in get_equipped_items()) //doesn't include pockets
|
||||
|
||||
@@ -287,6 +287,8 @@
|
||||
if(HAS_TRAIT(src, TRAIT_STRONG_GRABBER))
|
||||
C.grippedby(src)
|
||||
|
||||
update_pull_movespeed()
|
||||
|
||||
//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))
|
||||
@@ -300,6 +302,7 @@
|
||||
|
||||
/mob/living/stop_pulling()
|
||||
..()
|
||||
update_pull_movespeed()
|
||||
update_pull_hud_icon()
|
||||
|
||||
/mob/living/verb/stop_pulling1()
|
||||
@@ -520,6 +523,10 @@
|
||||
|
||||
var/old_direction = dir
|
||||
var/turf/T = loc
|
||||
|
||||
if(pulling)
|
||||
update_pull_movespeed()
|
||||
|
||||
. = ..()
|
||||
|
||||
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.
|
||||
@@ -1023,6 +1030,9 @@
|
||||
stop_pulling() //CIT CHANGE - Ditto...
|
||||
else if(has_legs || ignore_legs)
|
||||
lying = 0
|
||||
if (pulledby)
|
||||
var/mob/living/L = pulledby
|
||||
L.update_pull_movespeed()
|
||||
if(buckled)
|
||||
lying = 90*buckle_lying
|
||||
else if(!lying)
|
||||
|
||||
@@ -153,7 +153,7 @@
|
||||
to_chat(user, "<span class='warning'>[src] can't be grabbed more aggressively!</span>")
|
||||
return FALSE
|
||||
|
||||
if(HAS_TRAIT(user, TRAIT_PACIFISM))
|
||||
if(user.grab_state >= GRAB_AGGRESSIVE && HAS_TRAIT(user, TRAIT_PACIFISM))
|
||||
to_chat(user, "<span class='notice'>You don't want to risk hurting [src]!</span>")
|
||||
return FALSE
|
||||
|
||||
@@ -184,11 +184,17 @@
|
||||
user.grab_state++
|
||||
switch(user.grab_state)
|
||||
if(GRAB_AGGRESSIVE)
|
||||
log_combat(user, src, "grabbed", addition="aggressive grab")
|
||||
visible_message("<span class='danger'>[user] has grabbed [src] aggressively!</span>", \
|
||||
"<span class='userdanger'>[user] has grabbed [src] aggressively!</span>")
|
||||
drop_all_held_items()
|
||||
var/add_log = ""
|
||||
if(HAS_TRAIT(user, TRAIT_PACIFISM))
|
||||
visible_message("<span class='danger'>[user] has firmly gripped [src]!</span>",
|
||||
"<span class='danger'>[user] has firmly gripped you!</span>")
|
||||
add_log = " (pacifist)"
|
||||
else
|
||||
visible_message("<span class='danger'>[user] has grabbed [src] aggressively!</span>", \
|
||||
"<span class='userdanger'>[user] has grabbed you aggressively!</span>")
|
||||
drop_all_held_items()
|
||||
stop_pulling()
|
||||
log_combat(user, src, "grabbed", addition="aggressive grab[add_log]")
|
||||
if(GRAB_NECK)
|
||||
log_combat(user, src, "grabbed", addition="neck grab")
|
||||
visible_message("<span class='danger'>[user] has grabbed [src] by the neck!</span>",\
|
||||
|
||||
@@ -110,3 +110,5 @@
|
||||
//List of active diseases
|
||||
var/list/diseases = list() // list of all diseases in a mob
|
||||
var/list/disease_resistances = list()
|
||||
|
||||
var/drag_slowdown = TRUE //Whether the mob is slowed down when dragging another prone mob
|
||||
@@ -25,3 +25,11 @@
|
||||
add_movespeed_modifier(MOVESPEED_ID_LIVING_TURF_SPEEDMOD, TRUE, 100, override = TRUE, multiplicative_slowdown = T.slowdown)
|
||||
else
|
||||
remove_movespeed_modifier(MOVESPEED_ID_LIVING_TURF_SPEEDMOD)
|
||||
|
||||
/mob/living/proc/update_pull_movespeed()
|
||||
if(pulling && isliving(pulling))
|
||||
var/mob/living/L = pulling
|
||||
if(drag_slowdown && L.lying && !L.buckled && grab_state < GRAB_AGGRESSIVE)
|
||||
add_movespeed_modifier(MOVESPEED_ID_PRONE_DRAGGING, multiplicative_slowdown = PULL_PRONE_SLOWDOWN)
|
||||
return
|
||||
remove_movespeed_modifier(MOVESPEED_ID_PRONE_DRAGGING)
|
||||
@@ -1216,14 +1216,15 @@
|
||||
return
|
||||
if(incapacitated())
|
||||
return
|
||||
if(M.incapacitated())
|
||||
return
|
||||
if(module)
|
||||
if(!module.allow_riding)
|
||||
M.visible_message("<span class='boldwarning'>Unfortunately, [M] just can't seem to hold onto [src]!</span>")
|
||||
return
|
||||
if(iscarbon(M) && (!riding_datum.equip_buckle_inhands(M, 1)))
|
||||
M.visible_message("<span class='boldwarning'>[M] can't climb onto [src] because [M.p_their()] hands are full!</span>")
|
||||
if(iscarbon(M) && !M.incapacitated() && !riding_datum.equip_buckle_inhands(M, 1))
|
||||
if(M.get_num_arms() <= 0)
|
||||
M.visible_message("<span class='boldwarning'>[M] can't climb onto [src] because [M.p_they()] don't have any usable arms!</span>")
|
||||
else
|
||||
M.visible_message("<span class='boldwarning'>[M] can't climb onto [src] because [M.p_their()] hands are full!</span>")
|
||||
return
|
||||
. = ..(M, force, check_loc)
|
||||
|
||||
|
||||
@@ -534,7 +534,12 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0)
|
||||
return
|
||||
if(isAI(M))
|
||||
return
|
||||
show_inv(usr)
|
||||
|
||||
/mob/MouseDrop_T(atom/dropping, atom/user)
|
||||
. = ..()
|
||||
if(ismob(dropping) && dropping != user)
|
||||
var/mob/M = dropping
|
||||
M.show_inv(user)
|
||||
|
||||
/mob/proc/is_muzzled()
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user