Grab Stuff (#12731)

Co-authored-by: Werner <1331699+Arrow768@users.noreply.github.com>
This commit is contained in:
Geeves
2021-12-19 22:10:40 +01:00
committed by GitHub
co-authored by Werner
parent aec7d4748f
commit 2003515939
13 changed files with 86 additions and 121 deletions
+3 -10
View File
@@ -166,11 +166,9 @@
/mob/living/carbon/swap_hand()
var/obj/item/item_in_hand = src.get_active_hand()
if(item_in_hand) //this segment checks if the item in your hand is twohanded.
if(istype(item_in_hand,/obj/item/material/twohanded) || istype(item_in_hand,/obj/item/gun) || istype(item_in_hand,/obj/item/pickaxe) || istype(item_in_hand, /obj/item/grab))
if(item_in_hand:wielded == 1)
to_chat(usr, SPAN_WARNING("Your other hand is too busy holding the [item_in_hand.name]"))
return
if(item_in_hand && !item_in_hand.can_swap_hands(src)) //this segment checks if the item in your hand is twohanded.
to_chat(src, SPAN_WARNING("Your other hand is too busy holding \the [item_in_hand]!"))
return
src.hand = !src.hand
if(hud_used.l_hand_hud_object && hud_used.r_hand_hud_object)
if(hand) //This being 1 means the left hand is in use
@@ -179,11 +177,6 @@
else
hud_used.l_hand_hud_object.icon_state = "l_hand_inactive"
hud_used.r_hand_hud_object.icon_state = "r_hand_active"
/*if (!( src.hand ))
src.hands.set_dir(NORTH)
else
src.hands.set_dir(SOUTH)*/
return
/mob/living/carbon/proc/activate_hand(var/selhand) //0 or "r" or "right" for right hand; 1 or "l" or "left" for left hand.
if(istext(selhand))
@@ -95,7 +95,7 @@
var/break_cuffs = FALSE //used in resist.dm to check if they can break hand/leg cuffs
var/natural_climbing = FALSE //If true, the species always succeeds at climbing.
var/climb_coeff = 1.25 //The coefficient to the climbing speed of the individual = 60 SECONDS * climb_coeff
// Death vars.
var/respawn_type = CREW
var/meat_type = /obj/item/reagent_containers/food/snacks/meat/human
@@ -793,3 +793,6 @@
/datum/species/proc/can_hold_s_store(var/obj/item/I)
return FALSE
/datum/species/proc/can_double_fireman_carry()
return FALSE
@@ -255,3 +255,6 @@ Bulwarks are much larger and have significantly thicker carapaces than most Vaur
slot_wrists_str = list("[NORTH]" = list("x" = 15, "y" = 0), "[EAST]" = list("x" = 12, "y" = 0), "[SOUTH]" = list("x" = 4, "y" = 0), "[WEST]" = list("x" = 9, "y" = 0)),
slot_shoes_str = list("[NORTH]" = list("x" = 9, "y" = 0), "[EAST]" = list("x" = 8, "y" = 0), "[SOUTH]" = list("x" = 9, "y" = 0), "[WEST]" = list("x" = 8, "y" = 0))
)
/datum/species/bug/type_e/can_double_fireman_carry()
return TRUE
-35
View File
@@ -348,41 +348,6 @@
face_atom(A)
return 1
/datum/mobl // I have no idea what the fuck this is, but it's better for it to be a datum than an /obj/effect.
var/list/container = list()
var/master
/mob/proc/ret_grab(datum/mobl/L, flag)
if ((!( istype(l_hand, /obj/item/grab) ) && !( istype(r_hand, /obj/item/grab) )))
if (!( L ))
return null
else
return L.container
else
if (!( L ))
L = new /datum/mobl
L.container += src
L.master = src
if (istype(l_hand, /obj/item/grab))
var/obj/item/grab/G = l_hand
if (!(L.container.Find(G.affecting)))
L.container += G.affecting
if (G.affecting)
G.affecting.ret_grab(L, 1)
if (istype(r_hand, /obj/item/grab))
var/obj/item/grab/G = r_hand
if (!(L.container.Find(G.affecting)))
L.container += G.affecting
if (G.affecting)
G.affecting.ret_grab(L, 1)
if (!( flag ))
if (L.master == src)
var/list/temp = L.container.Copy()
qdel(L)
return temp
else
return L.container
return
/mob/verb/mode()
set name = "Activate Held Object"
+41 -22
View File
@@ -116,15 +116,16 @@
if(state <= GRAB_AGGRESSIVE)
allow_upgrade = 1
//disallow upgrading if we're grabbing more than one person
if((assailant.l_hand && assailant.l_hand != src && istype(assailant.l_hand, /obj/item/grab)))
var/obj/item/grab/G = assailant.l_hand
if(G.affecting != affecting)
allow_upgrade = 0
if((assailant.r_hand && assailant.r_hand != src && istype(assailant.r_hand, /obj/item/grab)))
var/obj/item/grab/G = assailant.r_hand
if(G.affecting != affecting)
allow_upgrade = 0
if(!assailant.species.can_double_fireman_carry())
//disallow upgrading if we're grabbing more than one person
if((assailant.l_hand && assailant.l_hand != src && istype(assailant.l_hand, /obj/item/grab)))
var/obj/item/grab/G = assailant.l_hand
if(G.affecting != affecting)
allow_upgrade = 0
if((assailant.r_hand && assailant.r_hand != src && istype(assailant.r_hand, /obj/item/grab)))
var/obj/item/grab/G = assailant.r_hand
if(G.affecting != affecting)
allow_upgrade = 0
//disallow upgrading past aggressive if we're being grabbed aggressively
for(var/obj/item/grab/G in affecting.grabbed_by)
@@ -448,7 +449,7 @@
if(state < GRAB_AGGRESSIVE)
to_chat(H, SPAN_WARNING("You need an aggressive grab before you can fireman carry someone!"))
return
if(H.get_inactive_hand())
if(H.get_inactive_hand() && !H.species.can_double_fireman_carry())
to_chat(H, SPAN_WARNING("Your other hand must be empty to fireman carry someone!"))
return
@@ -460,12 +461,15 @@
if(affecting.buckled_to)
return
if(H.get_inactive_hand())
if(H.get_inactive_hand() && !H.species.can_double_fireman_carry())
to_chat(H, SPAN_WARNING("Your other hand must be empty to fireman carry someone!"))
return
var/obj/item/grab/offhand/OH = new /obj/item/grab/offhand(H, H, affecting, src)
H.put_in_hands(OH)
if(H.species.can_double_fireman_carry())
set_wielding()
else
var/obj/item/grab/offhand/OH = new /obj/item/grab/offhand(H, H, affecting, src)
H.put_in_hands(OH)
H.visible_message("<b>[H]</b> lifts \the [affecting] onto their shoulders!", SPAN_NOTICE("You lift \the [affecting] onto your shoulders!"))
@@ -474,28 +478,43 @@
adjust_position()
moved_event.register(assailant, src, /obj/item/grab/proc/move_affecting)
/obj/item/grab/proc/set_wielding()
wielded = TRUE
state = GRAB_AGGRESSIVE
icon_state = "!reinforce"
hud.icon_state = "!reinforce"
/obj/item/grab/proc/move_affecting()
if(affecting && assailant.Adjacent(affecting)) // Only move if it's near us.
affecting.forceMove(assailant.loc)
/obj/item/grab/can_swap_hands(mob/user)
if(ishuman(user))
var/mob/living/carbon/human/H = user
if(H.species.can_double_fireman_carry())
return TRUE
if(wielded)
return FALSE
return ..()
/obj/item/grab/proc/get_grab_type()
if(wielded)
return MOB_GRAB_FIREMAN
return MOB_GRAB_NORMAL
/obj/item/grab/offhand
icon_state = "!reinforce"
/obj/item/grab/offhand/Initialize(mapload, mob/user, mob/victim, var/obj/item/grab/linked)
. = ..()
set_wielding()
linked_grab = linked
linked.linked_grab = src
linked_grab.wielded = TRUE
linked_grab.state = GRAB_AGGRESSIVE
icon_state = "!reinforce"
hud.icon_state = "!reinforce"
linked_grab.icon_state = "!reinforce"
linked_grab.hud.icon_state = "!reinforce"
linked_grab.set_wielding()
/obj/item/grab/offhand/process()
return
/obj/item/grab/offhand/adjust_position()
return
return
-15
View File
@@ -1244,21 +1244,6 @@ proc/is_blind(A)
if(ear && speaker_coverage[ear])
return TRUE
/mob/proc/has_grab()
. = MOB_GRAB_NONE
if(istype(l_hand, /obj/item/grab))
var/obj/item/grab/l_grab = l_hand
if(l_grab.wielded)
. = max(MOB_GRAB_FIREMAN, .)
else
. = max(MOB_GRAB_NORMAL, .)
if(istype(r_hand, /obj/item/grab))
var/obj/item/grab/r_grab = r_hand
if(r_grab.wielded)
. = max(MOB_GRAB_FIREMAN, .)
else
. = max(MOB_GRAB_NORMAL, .)
/mob/proc/handle_vision()
return
+9 -36
View File
@@ -333,43 +333,16 @@
//We are now going to move
moving = 1
//Something with pulling things
var/grab_level = mob.has_grab()
if(grab_level == MOB_GRAB_FIREMAN)
move_delay++
if (mob_is_human && grab_level == MOB_GRAB_NORMAL)
move_delay = max(move_delay, world.time + 7)
var/list/L = mob.ret_grab()
if(istype(L, /list))
if(L.len == 2)
L -= mob
var/mob/M = L[1]
if(M)
if ((get_dist(mob, M) <= 1 || M.loc == mob.loc))
var/turf/T = mob.loc
. = ..()
if (isturf(M.loc))
var/diag = get_dir(mob, M)
if ((diag - 1) & diag)
else
diag = null
if ((get_dist(mob, M) > 1 || diag))
step(M, get_dir(M.loc, T))
else
for(var/mob/M in L)
M.other_mobs = 1
if(mob != M)
M.animate_movement = 3
for(var/mob/M in L)
spawn( 0 )
step(M, direct)
return
spawn( 1 )
M.other_mobs = null
M.animate_movement = 2
return
if(mob_is_human)
for(var/obj/item/grab/G in list(mob.l_hand, mob.r_hand))
switch(G.get_grab_type())
if(MOB_GRAB_FIREMAN)
move_delay++
if(MOB_GRAB_NORMAL)
move_delay = max(move_delay, world.time + 7)
step(G.affecting, get_dir(G.affecting.loc, mob.loc))
else if(mob.confused && prob(25) && mob.m_intent == M_RUN)
if(mob.confused && prob(25) && mob.m_intent == M_RUN)
step(mob, pick(cardinal))
else
. = mob.SelfMove(n, direct)