-tg- SpaceMove update

This commit updates the spacemove system to -tg-'s; All objects now drift
in space, not just mobs. A few hardcoded space checks have been replaced
with has_gravity(); So it applies to zero-G as well as space.

Spacepods no longer drift, because their snowflakey shitcode just doesn't
work. So they just move.
This commit is contained in:
Tigercat2000
2015-09-25 15:53:59 -07:00
parent 26bc8dff8b
commit 4b6a3ddcb6
35 changed files with 276 additions and 588 deletions
+13 -134
View File
@@ -5,9 +5,8 @@
var/empstun = 0
var/health = 100
var/destroyed = 0
var/inertia_dir = 0
var/allowMove = 1
var/delay = 1
var/move_delay = 1
var/keytype = /obj/item/key
var/datum/effect/effect/system/spark_spread/spark_system = new /datum/effect/effect/system/spark_spread
/obj/structure/stool/bed/chair/cart/process()
@@ -48,96 +47,6 @@
if(istype(W, /obj/item/key))
user << "Hold [W] in one of your hands while you drive this [name]."
/obj/structure/stool/bed/chair/cart/proc/Process_Spacemove(var/check_drift = 0, mob/user)
//First check to see if we can do things
/*
if(istype(src,/mob/living/carbon))
if(src.l_hand && src.r_hand)
return 0
*/
var/dense_object = 0
if(!user)
for(var/turf/turf in oview(1,src))
if(istype(turf,/turf/space))
continue
/*
if((istype(turf,/turf/simulated/floor))
if(user)
if(user.lastarea.has_gravity == 0)
continue*/
/*
if(istype(turf,/turf/simulated/floor) && (src.flags & NOGRAV))
continue
*/
dense_object++
break
if(!dense_object && (locate(/obj/structure/lattice) in oview(1, src)))
dense_object++
//Lastly attempt to locate any dense objects we could push off of
//TODO: If we implement objects drifing in space this needs to really push them
//Due to a few issues only anchored and dense objects will now work.
if(!dense_object)
for(var/obj/O in oview(1, src))
if((O) && (O.density) && (O.anchored))
dense_object++
break
else
for(var/turf/turf in oview(1,user))
if(istype(turf,/turf/space))
continue
/*
if((istype(turf,/turf/simulated/floor))
if(user)
if(user.lastarea.has_gravity == 0)
continue*/
/*
if(istype(turf,/turf/simulated/floor) && (src.flags & NOGRAV))
continue
*/
dense_object++
break
if(!dense_object && (locate(/obj/structure/lattice) in oview(1, user)))
dense_object++
//Lastly attempt to locate any dense objects we could push off of
//TODO: If we implement objects drifing in space this needs to really push them
//Due to a few issues only anchored and dense objects will now work.
if(!dense_object)
for(var/obj/O in oview(1, user))
if((O) && (O.density) && (O.anchored))
dense_object++
break
//Nothing to push off of so end here
if(!dense_object)
return 0
/* The cart has very grippy tires and or magnets to keep it from slipping when on a good surface
//Check to see if we slipped
if(prob(Process_Spaceslipping(5)))
src << "\blue <B>You slipped!</B>"
src.inertia_dir = src.last_move
step(src, src.inertia_dir)
return 0
//If not then we can reset inertia and move
*/
inertia_dir = 0
return 1
/obj/structure/stool/bed/chair/cart/user_buckle_mob(mob/living/M, mob/user)
if(user.incapacitated()) //user can't move the mob on the janicart's turf if incapacitated
@@ -263,16 +172,12 @@
var/amount_per_transfer_from_this = 5 //shit I dunno, adding this so syringes stop runtime erroring. --NeoFite
var/obj/item/weapon/storage/bag/trash/mybag = null
/obj/structure/stool/bed/chair/cart/janicart/New()
..()
var/datum/reagents/R = new/datum/reagents(100)
reagents = R
R.my_atom = src
/obj/structure/stool/bed/chair/cart/janicart/examine(mob/user)
if(!..(user, 1))
return
@@ -314,21 +219,15 @@
if(user)
user << "\red \the [src] is unresponsive."
return
if((istype(src.loc, /turf/space)))
if(!src.Process_Spacemove(0)) return
if(istype(user.l_hand, /obj/item/key) || istype(user.r_hand, /obj/item/key))
if(!allowMove)
if(istype(user.l_hand, keytype) || istype(user.r_hand, keytype))
if(!Process_Spacemove(direction) || !has_gravity(src.loc) || move_delay || !isturf(loc))
return
allowMove = 0
step(src, direction)
update_mob()
handle_rotation()
sleep(delay)
allowMove = 1
/*
if(istype(src.loc, /turf/space) && (!src.Process_Spacemove(0, user)))
var/turf/space/S = src.loc
S.Entered(src)*/
move_delay = 1
spawn(2)
move_delay = 0
else
user << "<span class='notice'>You'll need the keys in one of your hands to drive this pimpin' ride.</span>"
@@ -338,7 +237,7 @@
name = "ambulance"
icon = 'icons/obj/vehicles.dmi'
icon_state = "docwagon"
anchored = 1
anchored = 0
density = 1
/var/brightness = 4
/var/strobe = 0
@@ -351,39 +250,19 @@
if(user)
user << "\red \the [src] is unresponsive."
return
if((istype(src.loc, /turf/space)))
if(!src.Process_Spacemove(0)) return
if(istype(user.l_hand, /obj/item/key) || istype(user.r_hand, /obj/item/key))
if(!allowMove)
if(istype(user.l_hand, keytype) || istype(user.r_hand, keytype))
if(!Process_Spacemove(direction) || !has_gravity(src.loc) || move_delay || !isturf(loc))
return
allowMove = 0
step(src, direction)
// NEW PULLING CODE
if (istype(user.pulling, /obj/structure/stool/bed/roller))
var/turf/T = loc
step(user.pulling, get_dir(user.pulling.loc, T))
// END NEW PULLING CODE
update_mob()
handle_rotation()
sleep(delay)
allowMove = 1
/*
if(istype(src.loc, /turf/space) && (!src.Process_Spacemove(0, user)))
var/turf/space/S = src.loc
S.Entered(src)*/
move_delay = 1
spawn(2)
move_delay = 0
else
user << "<span class='notice'>You'll need the keys in one of your hands to drive this ambulance.</span>"
/obj/item/key
name = "key"
desc = "A keyring with a small steel key, and a pink fob reading \"Pussy Wagon\"."
@@ -36,9 +36,15 @@
if(!buckled_mob.Move(loc, direct))
loc = buckled_mob.loc //we gotta go back
last_move = buckled_mob.last_move
inertia_dir = last_move
buckled_mob.inertia_dir = last_move
. = 0
/obj/structure/stool/bed/Process_Spacemove(movement_dir = 0)
if(buckled_mob)
return buckled_mob.Process_Spacemove(movement_dir)
return ..()
/obj/structure/stool/bed/CanPass(atom/movable/mover, turf/target, height=1.5)
if(mover == buckled_mob)
return 1
@@ -14,6 +14,10 @@
handle_rotation()
return
/obj/structure/stool/bed/chair/Move(atom/newloc, direct)
..()
handle_rotation()
/obj/structure/stool/bed/chair/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
..()
if(istype(W, /obj/item/assembly/shock_kit))
@@ -25,6 +25,11 @@
return ..()
/obj/structure/transit_tube_pod/Process_Spacemove()
if(moving) //No drifting while moving in the tubes
return 1
else return ..()
/obj/structure/transit_tube_pod/proc/follow_tube(var/reverse_launch)
if(moving)
return
@@ -67,7 +72,7 @@
if(current_tube == null)
dir = next_dir
Move(get_step(loc, dir)) // Allow collisions when leaving the tubes.
Move(get_step(loc, dir), dir) // Allow collisions when leaving the tubes.
break
last_delay = current_tube.enter_delay(src, next_dir)
@@ -82,21 +87,6 @@
density = 1
// If the pod is no longer in a tube, move in a line until stopped or slowed to a halt.
// /turf/inertial_drift appears to only work on mobs, and re-implementing some of the
// logic allows a gradual slowdown and eventual stop when passing over non-space turfs.
if(!current_tube && last_delay <= 10)
do
sleep(last_delay)
if(!istype(loc, /turf/space))
last_delay++
if(last_delay > 10)
break
while(isturf(loc) && Move(get_step(loc, dir)))
moving = 0