-tg- pull refactor

This commit does the following:
 - Overhauls how pull works. It is now based on a mob verb,
   mob/verb/pulled()
 - Makes the pull icon much more responsive. It is now updated whenever a
   mob starts or stops pulling an object, and instantly updates.
   - This required HUD changes. God help me.
This commit is contained in:
Tigercat2000
2015-10-10 11:15:52 -07:00
parent 07770fdda7
commit ccdae149bb
40 changed files with 101 additions and 186 deletions
+26 -31
View File
@@ -844,6 +844,30 @@ var/list/slot_equipment_priority = list( \
if(istype(M,/mob/living/silicon/ai)) return
show_inv(usr)
//this and stop_pulling really ought to be /mob/living procs
/mob/proc/start_pulling(atom/movable/AM)
if ( !AM || !src || src==AM || !isturf(AM.loc) ) //if there's no person pulling OR the person is pulling themself OR the object being pulled is inside something: abort!
return
if (!( AM.anchored ))
AM.add_fingerprint(src)
// If we're pulling something then drop what we're currently pulling and pull this instead.
if(pulling)
// Are we trying to pull something we are already pulling? Then just stop here, no need to continue.
if(AM == pulling)
return
stop_pulling()
src.pulling = AM
AM.pulledby = src
if(pullin)
pullin.update_icon(src)
if(ismob(AM))
var/mob/M = AM
if(!iscarbon(src))
M.LAssailant = null
else
M.LAssailant = usr
/mob/verb/stop_pulling()
@@ -853,37 +877,8 @@ var/list/slot_equipment_priority = list( \
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 (AM.anchored)
usr << "<span class='notice'>It won't budge!</span>"
return
var/mob/M = AM
if(ismob(AM))
if(!iscarbon(src))
M.LAssailant = null
else
M.LAssailant = usr
if(pulling)
var/pulling_old = pulling
stop_pulling()
// Are we pulling the same thing twice? Just stop pulling.
if(pulling_old == AM)
return
src.pulling = AM
AM.pulledby = src
//Attempted fix for people flying away through space when cuffed and dragged.
if(ismob(AM))
var/mob/pulled = AM
pulled.inertia_dir = 0
if(pullin)
pullin.update_icon(src)
/mob/proc/can_use_hands()
return