mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 13:10:02 +01:00
Merge pull request #14450 from AnturK/mechboots
Fixes mechs using occupant spacemove
This commit is contained in:
@@ -295,3 +295,23 @@
|
||||
if(buckled_mob == mover)
|
||||
return 1
|
||||
return ..()
|
||||
|
||||
|
||||
/atom/movable/proc/get_spacemove_backup()
|
||||
var/atom/movable/dense_object_backup
|
||||
for(var/A in orange(1, get_turf(src)))
|
||||
if(isarea(A))
|
||||
continue
|
||||
else if(isturf(A))
|
||||
var/turf/turf = A
|
||||
if(!turf.density)
|
||||
continue
|
||||
return turf
|
||||
else
|
||||
var/atom/movable/AM = A
|
||||
if(!AM.CanPass(src) || AM.density)
|
||||
if(AM.anchored)
|
||||
return AM
|
||||
dense_object_backup = AM
|
||||
break
|
||||
. = dense_object_backup
|
||||
@@ -406,9 +406,17 @@
|
||||
events.fireEvent("onMove",get_turf(src))
|
||||
|
||||
/obj/mecha/Process_Spacemove(var/movement_dir = 0)
|
||||
if(occupant)
|
||||
return occupant.Process_Spacemove(movement_dir) //We'll just say you used the clamp to grab the wall
|
||||
return ..()
|
||||
. = ..()
|
||||
if(.)
|
||||
return 1
|
||||
|
||||
var/atom/movable/backup = get_spacemove_backup()
|
||||
if(backup)
|
||||
if(istype(backup) && movement_dir && !!backup.anchored)
|
||||
if(backup.newtonian_move(turn(movement_dir, 180)))
|
||||
if(occupant)
|
||||
occupant << "<span class='info'>You push off of [backup] to propel yourself.</span>"
|
||||
return 1
|
||||
|
||||
/obj/mecha/relaymove(mob/user,direction)
|
||||
if(!direction)
|
||||
|
||||
@@ -305,43 +305,40 @@
|
||||
///For moving in space
|
||||
///Return 1 for movement 0 for none
|
||||
/mob/Process_Spacemove(movement_dir = 0)
|
||||
|
||||
if(..())
|
||||
return 1
|
||||
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
|
||||
src << "<span class='info'>You push off of [backup] to propel yourself.</span>"
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/mob/get_spacemove_backup()
|
||||
var/atom/movable/dense_object_backup
|
||||
for(var/atom/A in orange(1, get_turf(src)))
|
||||
for(var/A in orange(1, get_turf(src)))
|
||||
if(isarea(A))
|
||||
continue
|
||||
|
||||
else if(isturf(A))
|
||||
var/turf/turf = A
|
||||
if(istype(turf,/turf/space))
|
||||
continue
|
||||
|
||||
if(!turf.density && !mob_negates_gravity())
|
||||
continue
|
||||
|
||||
return 1
|
||||
|
||||
return A
|
||||
else
|
||||
var/atom/movable/AM = A
|
||||
if(AM == buckled) //Kind of unnecessary but let's just be sure
|
||||
continue
|
||||
if(!AM.CanPass(src) || AM.density)
|
||||
if(AM.anchored)
|
||||
return 1
|
||||
return AM
|
||||
if(pulling == AM)
|
||||
continue
|
||||
dense_object_backup = AM
|
||||
|
||||
if(movement_dir && dense_object_backup)
|
||||
if(dense_object_backup.newtonian_move(turn(movement_dir, 180))) //You're pushing off something movable, so it moves
|
||||
src << "<span class='info'>You push off of [dense_object_backup] to propel yourself.</span>"
|
||||
|
||||
|
||||
return 1
|
||||
return 0
|
||||
break
|
||||
. = dense_object_backup
|
||||
|
||||
/mob/proc/mob_has_gravity(turf/T)
|
||||
return has_gravity(src, T)
|
||||
|
||||
Reference in New Issue
Block a user