[MIRROR] Refactors flightsuit code to hopefully be less dumb (#1975)

* Refactors flightsuit code to hopefully be less dumb

* Update flightsuit.dm

* Delete flightsuit.dm.rej

* Delete objs.dm.rej

* Delete mob_movement.dm.rej

* Delete carbon_movement.dm.rej

* Update mob_movement.dm

* Update flightsuit.dm

* Update mob_movement.dm

* fix
This commit is contained in:
CitadelStationBot
2017-07-12 07:24:50 -05:00
committed by kevinz000
parent 97269f8cd1
commit 85fa3c0bee
4 changed files with 232 additions and 213 deletions
+1
View File
@@ -104,6 +104,7 @@
//The last mob/living/carbon to push/drag/grab this mob (mostly used by slimes friend recognition)
var/mob/living/carbon/LAssailant = null
var/list/obj/user_movement_hooks //Passes movement in client/Move() to these!
var/list/mob_spell_list = list() //construct spells and mime spells. Spells that do not transfer from one mob to another and can not be lost in mindswap.
+26 -22
View File
@@ -1,15 +1,15 @@
/mob/CanPass(atom/movable/mover, turf/target, height=0)
if(height==0)
return 1
return TRUE
if(istype(mover, /obj/item/projectile) || mover.throwing)
return (!density || lying)
if(mover.checkpass(PASSMOB))
return 1
return TRUE
if(buckled == mover)
return 1
return TRUE
if(ismob(mover))
if (mover in buckled_mobs)
return 1
return TRUE
return (!mover.density || !density || lying)
@@ -113,29 +113,30 @@
#define MOVEMENT_DELAY_BUFFER_DELTA 1.25
/client/Move(n, direct)
if(world.time < move_delay)
return 0
return FALSE
var/old_move_delay = move_delay
move_delay = world.time+world.tick_lag //this is here because Move() can now be called mutiple times per tick
if(!mob || !mob.loc)
return 0
return FALSE
var/oldloc = mob.loc
if(mob.notransform)
return 0 //This is sota the goto stop mobs from moving var
return FALSE //This is sota the goto stop mobs from moving var
if(mob.control_object)
return Move_object(direct)
if(!isliving(mob))
return mob.Move(n,direct)
if(mob.stat == DEAD)
mob.ghostize()
return 0
return FALSE
if(moving)
return 0
return FALSE
if(mob.force_moving)
return 0
return FALSE
if(isliving(mob))
var/mob/living/L = mob
if(L.incorporeal_move) //Move though walls
Process_Incorpmove(direct)
return 0
return FALSE
if(mob.remote_control) //we're controlling something, our movement is relayed to it
return mob.remote_control.relaymove(mob, direct)
@@ -150,14 +151,14 @@
return mob.buckled.relaymove(mob, direct)
if(!mob.canmove)
return 0
return FALSE
if(isobj(mob.loc) || ismob(mob.loc)) //Inside an object, tell it we moved
var/atom/O = mob.loc
return O.relaymove(mob, direct)
if(!mob.Process_Spacemove(direct))
return 0
return FALSE
//We are now going to move
moving = 1
@@ -184,6 +185,10 @@
if(mob.throwing)
mob.throwing.finalize(FALSE)
if(LAZYLEN(mob.user_movement_hooks))
for(var/obj/O in mob.user_movement_hooks)
O.intercept_user_move(direct, mob, n, oldloc)
return .
/mob/Moved(oldLoc, dir)
@@ -204,15 +209,14 @@
if(mob.pulledby)
if(mob.incapacitated(ignore_restraints = 1))
move_delay = world.time + 10
return 1
return TRUE
else if(mob.restrained(ignore_grab = 1))
move_delay = world.time + 10
to_chat(src, "<span class='warning'>You're restrained! You can't move!</span>")
return 1
return TRUE
else
return mob.resist_grab(1)
///Process_Incorpmove
///Called by client/Move()
///Allows mobs to run though walls
@@ -277,23 +281,23 @@
else
L.loc = get_step(L, direct)
L.setDir(direct)
return 1
return TRUE
///Process_Spacemove
///Called by /client/Move()
///For moving in space
///Return 1 for movement 0 for none
///return TRUE for movement 0 for none
/mob/Process_Spacemove(movement_dir = 0)
if(..())
return 1
return TRUE
var/atom/movable/backup = get_spacemove_backup()
if(backup)
if(istype(backup) && movement_dir && !backup.anchored)
if(backup.newtonian_move(turn(movement_dir, 180))) //You're pushing off something movable, so it moves
to_chat(src, "<span class='info'>You push off of [backup] to propel yourself.</span>")
return 1
return 0
return TRUE
return FALSE
/mob/get_spacemove_backup()
for(var/A in orange(1, get_turf(src)))
@@ -325,7 +329,7 @@
return has_gravity()
/mob/proc/mob_negates_gravity()
return 0
return FALSE
//moves the mob/object we're pulling
/mob/proc/Move_Pulled(atom/A)