- Added support for pulledby, which tells you who is pulling this object.

- Replaced all the .pulling = object instances with start_pulling() and stop_pulling(). Use these from now on.
- Ian and Runtime will now no longer move when being pulled

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4155 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
baloh.matevz
2012-07-23 07:45:27 +00:00
parent 0bde5a915c
commit e3d3f2b8e9
34 changed files with 133 additions and 114 deletions
@@ -156,7 +156,7 @@
return 0
if (restrained())
pulling = null
stop_pulling()
var/t7 = 1
if (restrained())
@@ -169,7 +169,7 @@
if (pulling && pulling.loc)
if(!( isturf(pulling.loc) ))
pulling = null
stop_pulling()
return
else
if(Debug)
@@ -178,7 +178,7 @@
/////
if(pulling && pulling.anchored)
pulling = null
stop_pulling()
return
if (!restrained())
@@ -203,21 +203,21 @@
if (locate(/obj/item/weapon/grab, M.grabbed_by.len))
ok = 0
if (ok)
var/t = M.pulling
M.pulling = null
var/atom/movable/t = M.pulling
M.stop_pulling()
step(pulling, get_dir(pulling.loc, T))
M.pulling = t
M.start_pulling(t)
else
if (pulling)
if (istype(pulling, /obj/structure/window))
if(pulling:ini_dir == NORTHWEST || pulling:ini_dir == NORTHEAST || pulling:ini_dir == SOUTHWEST || pulling:ini_dir == SOUTHEAST)
for(var/obj/structure/window/win in get_step(pulling,get_dir(pulling.loc, T)))
pulling = null
stop_pulling()
if (pulling)
step(pulling, get_dir(pulling.loc, T))
else
pulling = null
stop_pulling()
. = ..()
if ((s_active && !( s_active in contents ) ))
s_active.close(src)
@@ -165,7 +165,7 @@
if (pulling && pulling.loc)
if(!( isturf(pulling.loc) ))
pulling = null
stop_pulling()
return
else
if(Debug)
@@ -174,7 +174,7 @@
/////
if(pulling && pulling.anchored)
pulling = null
stop_pulling()
return
if (!restrained())
@@ -199,15 +199,15 @@
if (locate(/obj/item/weapon/grab, M.grabbed_by.len))
ok = 0
if (ok)
var/t = M.pulling
M.pulling = null
var/atom/movable/t = M.pulling
M.stop_pulling()
step(pulling, get_dir(pulling.loc, T))
M.pulling = t
M.start_pulling(t)
else
if (pulling)
step(pulling, get_dir(pulling.loc, T))
else
pulling = null
stop_pulling()
. = ..()
if ((s_active && !( s_active in contents ) ))
s_active.close(src)
@@ -263,7 +263,7 @@
return
if (restrained())
pulling = null
stop_pulling()
var/t7 = 1
@@ -277,7 +277,7 @@
if (pulling && pulling.loc)
if(!( isturf(pulling.loc) ))
pulling = null
stop_pulling()
return
else
if(Debug)
@@ -286,7 +286,7 @@
/////
if(pulling && pulling.anchored)
pulling = null
stop_pulling()
return
if (!restrained())
@@ -311,8 +311,8 @@
if (locate(/obj/item/weapon/grab, M.grabbed_by.len))
ok = 0
if (ok)
var/t = M.pulling
M.pulling = null
var/atom/movable/t = M.pulling
M.stop_pulling()
//this is the gay blood on floor shit -- Added back -- Skie
if (M.lying && (prob(M.getBruteLoss() / 6)))
@@ -322,17 +322,17 @@
step(pulling, get_dir(pulling.loc, T))
M.pulling = t
M.start_pulling(t)
else
if (pulling)
if (istype(pulling, /obj/structure/window))
if(pulling:ini_dir == NORTHWEST || pulling:ini_dir == NORTHEAST || pulling:ini_dir == SOUTHWEST || pulling:ini_dir == SOUTHEAST)
for(var/obj/structure/window/win in get_step(pulling,get_dir(pulling.loc, T)))
pulling = null
stop_pulling()
if (pulling)
step(pulling, get_dir(pulling.loc, T))
else
pulling = null
stop_pulling()
. = ..()
if ((s_active && !( s_active in contents ) ))
s_active.close(src)
@@ -192,7 +192,7 @@
if(pulling)
visible_message("\red <b>[M] has broken [src]'s grip on [pulling]!</B>")
talked = 1
pulling = null
stop_pulling()
//BubbleWrap: Disarming also breaks a grab - this will also stop someone being choked, won't it?
if(istype(l_hand, /obj/item/weapon/grab))
@@ -584,7 +584,7 @@ Please contact me on #coderbus IRC. ~Carn x
/mob/living/carbon/human/update_inv_handcuffed(var/update_icons=1)
if(handcuffed)
pulling = null //TODO: should be handled elsewhere
stop_pulling() //TODO: should be handled elsewhere
overlays_lying[HANDCUFF_LAYER] = image("icon" = 'icons/mob/mob.dmi', "icon_state" = "handcuff2")
overlays_standing[HANDCUFF_LAYER] = image("icon" = 'icons/mob/mob.dmi', "icon_state" = "handcuff1")
else
@@ -237,7 +237,7 @@
if (pulling && pulling.loc)
if(!( isturf(pulling.loc) ))
pulling = null
stop_pulling()
return
else
if(Debug)
@@ -246,7 +246,7 @@
/////
if(pulling && pulling.anchored)
pulling = null
stop_pulling()
return
if (!restrained())
@@ -271,15 +271,15 @@
if (locate(/obj/item/weapon/grab, M.grabbed_by.len))
ok = 0
if (ok)
var/t = M.pulling
M.pulling = null
var/atom/movable/t = M.pulling
M.stop_pulling()
step(pulling, get_dir(pulling.loc, T))
M.pulling = t
M.start_pulling(t)
else
if (pulling)
step(pulling, get_dir(pulling.loc, T))
else
pulling = null
stop_pulling()
. = ..()
if ((s_active && !( s_active in contents ) ))
s_active.close(src)
@@ -403,7 +403,7 @@
if (buckled)
return
if (restrained())
pulling = null
stop_pulling()
var/t7 = 1
if (restrained())
for(var/mob/M in range(src, 1))
@@ -411,11 +411,11 @@
return 0
if ((t7 && pulling && get_dist(src, pulling) <= 1))
if (pulling.anchored)
pulling = null
stop_pulling()
var/T = loc
. = ..()
if (!( isturf(pulling.loc) ))
pulling = null
stop_pulling()
return
if (!( restrained() ))
var/diag = get_dir(src, pulling)
@@ -425,20 +425,20 @@
if ((ismob(pulling) && (get_dist(src, pulling) > 1 || diag)))
if (istype(pulling, type))
var/mob/M = pulling
var/mob/t = M.pulling
M.pulling = null
var/atom/movable/t = M.pulling
M.stop_pulling()
step(pulling, get_dir(pulling.loc, T))
M.pulling = t
M.start_pulling(t)
else
if (pulling)
if (istype(pulling, /obj/structure/window))
if(pulling:ini_dir == NORTHWEST || pulling:ini_dir == NORTHEAST || pulling:ini_dir == SOUTHWEST || pulling:ini_dir == SOUTHEAST)
for(var/obj/structure/window/win in get_step(pulling,get_dir(pulling.loc, T)))
pulling = null
stop_pulling()
if (pulling)
step(pulling, get_dir(pulling.loc, T))
else
pulling = null
stop_pulling()
. = ..()
if ((s_active && !( contents.Find(s_active) )))
s_active.close(src)
@@ -84,7 +84,7 @@
/mob/living/carbon/monkey/update_inv_handcuffed(var/update_icons=1)
if(handcuffed)
pulling = null
stop_pulling()
overlays_lying[M_HANDCUFF_LAYER] = image("icon" = 'icons/mob/monkey.dmi', "icon_state" = "handcuff2")
overlays_standing[M_HANDCUFF_LAYER] = image("icon" = 'icons/mob/monkey.dmi', "icon_state" = "handcuff1")
else
@@ -875,7 +875,7 @@ Frequency:
return
if (restrained())
pulling = null
stop_pulling()
var/t7 = 1
if (restrained())
@@ -888,7 +888,7 @@ Frequency:
if (pulling && pulling.loc)
if(!( isturf(pulling.loc) ))
pulling = null
stop_pulling()
return
else
if(Debug)
@@ -897,7 +897,7 @@ Frequency:
/////
if(pulling && pulling.anchored)
pulling = null
stop_pulling()
return
if (!restrained())
@@ -921,20 +921,20 @@ Frequency:
if (locate(/obj/item/weapon/grab, M.grabbed_by.len))
ok = 0
if (ok)
var/t = M.pulling
M.pulling = null
var/atom/movable/t = M.pulling
M.stop_pulling()
step(pulling, get_dir(pulling.loc, T))
M.pulling = t
M.start_pulling(t)
else
if (pulling)
if (istype(pulling, /obj/structure/window))
if(pulling:ini_dir == NORTHWEST || pulling:ini_dir == NORTHEAST || pulling:ini_dir == SOUTHWEST || pulling:ini_dir == SOUTHEAST)
for(var/obj/structure/window/win in get_step(pulling,get_dir(pulling.loc, T)))
pulling = null
stop_pulling()
if (pulling)
step(pulling, get_dir(pulling.loc, T))
else
pulling = null
stop_pulling()
. = ..()
if ((s_active && !( s_active in contents ) ))
s_active.close(src)
@@ -24,6 +24,7 @@
response_disarm = "gently pushes aside the"
response_harm = "pokes the"
stop_automated_movement_when_pulled = 0
health = 60
//Space bears aren't affected by atmos.
@@ -15,7 +15,8 @@
var/meat_amount = 0
var/meat_type
var/stop_automated_movement = 0 //Use this to temporarely stop random movement or to if you write special movement code for animals.
var/stop_automated_movement_when_pulled = 1 //When set to 1 this stops the animal from moving when someone is pulling it.
//Interaction
var/response_help = "You try to help"
var/response_disarm = "You try to disarm"
@@ -114,8 +115,9 @@
if(isturf(src.loc) && !resting && !buckled && canmove) //This is so it only moves if it's not inside a closet, gentics machine, etc.
turns_since_move++
if(turns_since_move >= turns_per_move)
Move(get_step(src,pick(cardinal)))
turns_since_move = 0
if(!(stop_automated_movement_when_pulled && pulledby)) //Soma animals don't move when pulled
Move(get_step(src,pick(cardinal)))
turns_since_move = 0
+23 -7
View File
@@ -501,22 +501,38 @@
if(LinkBlocked(usr.loc,loc)) return
show_inv(usr)
/atom/movable
var/mob/pulledby = null
/atom/movable/verb/pull()
set name = "Pull"
set category = "IC"
set src in oview(1)
if ( !usr || usr==src || !istype(src.loc,/turf) ) //if there's no person pulling OR the person is pulling themself OR the object being pulled is inside something: abort!
usr.start_pulling(src)
return
/mob/proc/stop_pulling()
if(pulling)
pulling.pulledby = null
pulling = null
/mob/proc/start_pulling(var/atom/movable/AM)
if ( !AM || !usr || src==AM || !isturf(src.loc) ) //if there's no person pulling OR the person is pulling themself OR the object being pulled is inside something: abort!
return
if (!( anchored ))
usr.pulling = src
if(ismob(src))
var/mob/M = src
if(!istype(usr, /mob/living/carbon))
if (!( AM.anchored ))
if(pulling)
stop_pulling()
src.pulling = AM
AM.pulledby = src
if(ismob(AM))
var/mob/M = AM
if(!iscarbon(src))
M.LAssailant = null
else
M.LAssailant = usr
return
/atom/verb/examine()
set name = "Examine"
+1 -1
View File
@@ -62,7 +62,7 @@
assailant.client.screen -= hud1
assailant.client.screen += hud1
if (assailant.pulling == affecting || assailant.pulling == structure)
assailant.pulling = null
assailant.stop_pulling()
if (structure)
structure.loc = assailant.loc
+2 -2
View File
@@ -93,7 +93,7 @@
if(!usr.pulling)
usr << "\blue You are not pulling anything."
return
usr.pulling = null
usr.stop_pulling()
/client/verb/swap_hand()
set hidden = 1
@@ -541,4 +541,4 @@
prob_slip = 0 // Changing this to zero to make it line up with the comment.
prob_slip = round(prob_slip)
return(prob_slip)
return(prob_slip)
+1 -1
View File
@@ -434,7 +434,7 @@
usr.hud_used.action_intent.icon_state = "disarm"
usr.hud_used.show_intent_icons = 0
if("pull")
usr.pulling = null
usr.stop_pulling()
if("throw")
if (!usr.stat && isturf(usr.loc) && !usr.restrained())
usr:toggle_throw_mode()
+3 -3
View File
@@ -10,10 +10,10 @@
return
if (ismob(user.pulling))
var/mob/M = user.pulling
var/mob/t = M.pulling
M.pulling = null
var/atom/movable/t = M.pulling
M.stop_pulling()
step(user.pulling, get_dir(user.pulling.loc, src))
M.pulling = t
M.start_pulling(t)
else
step(user.pulling, get_dir(user.pulling.loc, src))
return
+3 -3
View File
@@ -103,12 +103,12 @@
return
if (ismob(user.pulling))
var/mob/M = user.pulling
M.pulling = null
M.stop_pulling()
step(user.pulling, get_dir(user.pulling.loc, src))
user.pulling = null
user.stop_pulling()
else
step(user.pulling, get_dir(user.pulling.loc, src))
user.pulling = null
user.stop_pulling()
return