-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 13:56:33 -07:00
parent 26bc8dff8b
commit 4b6a3ddcb6
35 changed files with 276 additions and 588 deletions
@@ -179,9 +179,6 @@
/mob/living/carbon/alien/IsAdvancedToolUser()
return has_fine_manipulation
/mob/living/carbon/alien/Process_Spaceslipping()
return 0 // Don't slip in space.
/mob/living/carbon/alien/Stat()
statpanel("Status")
+1 -13
View File
@@ -481,19 +481,7 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump,
item.layer = initial(item.layer)
src.visible_message("\red [src] has thrown [item].")
if(!src.lastarea)
src.lastarea = get_area(src.loc)
if((istype(src.loc, /turf/space)) || (src.lastarea.has_gravity == 0))
src.inertia_dir = get_dir(target, src)
step(src, inertia_dir)
/*
if(istype(src.loc, /turf/space) || (src.flags & NOGRAV)) //they're in space, move em one space in the opposite direction
src.inertia_dir = get_dir(target, src)
step(src, inertia_dir)
*/
newtonian_move(get_dir(target, src))
item.throw_at(target, item.throw_range, item.throw_speed, src)
/*
@@ -144,7 +144,7 @@
..(new_loc, "Stok")
/mob/living/carbon/human/Bump(atom/movable/AM as mob|obj, yes)
if ((!( yes ) || now_pushing))
if ((!( yes ) || now_pushing || buckled))
return
now_pushing = 1
if (ismob(AM))
@@ -4,7 +4,8 @@
if(species.slowdown)
tally = species.slowdown
if (istype(loc, /turf/space)) return -1 // It's hard to be slowed down in space by... anything
if(!has_gravity(src))
return -1 // It's hard to be slowed down in space by... anything
if(flying) return -1
@@ -62,44 +63,18 @@
return (tally+config.human_delay)
/mob/living/carbon/human/Process_Spacemove(var/check_drift = 0)
//Can we act
if(restrained()) return 0
/mob/living/carbon/human/Process_Spacemove(movement_dir = 0)
//Are we flying?
if(flying)
inertia_dir = 0
if(..())
return 1
//Do we have a working jetpack
if(istype(back, /obj/item/weapon/tank/jetpack))
if(istype(back, /obj/item/weapon/tank/jetpack) && isturf(loc)) //Second check is so you can't use a jetpack in a mech
var/obj/item/weapon/tank/jetpack/J = back
if(((!check_drift) || (check_drift && J.stabilization_on)) && (!lying) && (J.allow_thrust(0.01, src)))
inertia_dir = 0
if((movement_dir || J.stabilization_on) && J.allow_thrust(0.01, src))
return 1
//If no working jetpack or magboots then use the other checks
if(..()) return 1
return 0
/mob/living/carbon/human/Process_Spaceslipping(var/prob_slip = 5)
//If knocked out we might just hit it and stop. This makes it possible to get dead bodies and such.
if(stat)
prob_slip = 0 // Changing this to zero to make it line up with the comment, and also, make more sense.
//Do we have magboots or such on if so no slip
if(istype(shoes, /obj/item/clothing/shoes/magboots) && (shoes.flags & NOSLIP))
prob_slip = 0
//Check hands and mod slip
if(!l_hand) prob_slip -= 2
else if(l_hand.w_class <= 2) prob_slip -= 1
if (!r_hand) prob_slip -= 2
else if(r_hand.w_class <= 2) prob_slip -= 1
prob_slip = round(prob_slip)
return(prob_slip)
/mob/living/carbon/human/mob_has_gravity()
. = ..()
if(!.)
@@ -152,7 +152,7 @@
step(AM, t)
now_pushing = null
/mob/living/carbon/slime/Process_Spacemove()
/mob/living/carbon/slime/Process_Spacemove(var/movement_dir = 0)
return 2
/mob/living/carbon/slime/Stat()
+8 -13
View File
@@ -399,10 +399,10 @@
return
/mob/living/Move(a, b, flag)
if (buckled && buckled.loc != a)
/mob/living/Move(atom/newloc, direct)
if (buckled && buckled.loc != newloc)
if (!buckled.anchored)
return buckled.Move(a, b)
return buckled.Move(newloc, direct)
else
return 0
@@ -415,7 +415,7 @@
for(var/mob/living/M in range(src, 1))
if ((M.pulling == src && M.stat == 0 && !( M.restrained() )))
t7 = null
if ((t7 && (pulling && ((get_dist(src, pulling) <= 1 || pulling.loc == loc) && (client && client.moving)))))
if(t7 && pulling && (get_dist(src, pulling) <= 1 || pulling.loc == loc))
var/turf/T = loc
. = ..()
@@ -463,17 +463,12 @@
var/turf/location = M.loc
if (istype(location, /turf/simulated))
location.add_blood()
step(pulling, get_dir(pulling.loc, T))
M.start_pulling(t)
pulling.Move(T, get_dir(pulling, T))
if(M)
M.start_pulling(t)
else
if (pulling)
if (istype(pulling, /obj/structure/window/full))
for(var/obj/structure/window/win in get_step(pulling,get_dir(pulling.loc, T)))
stop_pulling()
if (pulling)
step(pulling, get_dir(pulling.loc, T))
pulling.Move(T, get_dir(pulling, T))
else
stop_pulling()
. = ..()
@@ -76,15 +76,15 @@
aiCamera = new/obj/item/device/camera/siliconcam/drone_camera(src)
additional_law_channels["Drone"] = ":d"
playsound(src.loc, 'sound/machines/twobeep.ogg', 50, 0)
//Redefining some robot procs...
/mob/living/silicon/robot/drone/SetName(pickedName as text)
// Would prefer to call the grandparent proc but this isn't possible, so..
real_name = pickedName
name = real_name
name = real_name
//Redefining some robot procs...
/mob/living/silicon/robot/drone/updatename()
real_name = "maintenance drone ([rand(100,999)])"
@@ -127,13 +127,13 @@
if(!allowed(usr))
user << "\red Access denied."
return
var/delta = (world.time / 10) - last_reboot
if(reboot_cooldown > delta)
var/cooldown_time = round(reboot_cooldown - ((world.time / 10) - last_reboot), 1)
usr << "\red The reboot system is currently offline. Please wait another [cooldown_time] seconds."
return
user.visible_message("\red \the [user] swipes \his ID card through \the [src], attempting to reboot it.", "\red You swipe your ID card through \the [src], attempting to reboot it.")
last_reboot = world.time / 10
var/drones = 0
@@ -225,10 +225,6 @@
..(gibbed)
//DRONE MOVEMENT.
/mob/living/silicon/robot/drone/Process_Spaceslipping(var/prob_slip)
//TODO: Consider making a magboot item for drones to equip. ~Z
return 0
//CONSOLE PROCS
/mob/living/silicon/robot/drone/proc/law_resync()
@@ -338,4 +334,4 @@
src.verbs |= silicon_subsystems
/mob/living/silicon/robot/drone/remove_robot_verbs()
src.verbs -= silicon_subsystems
src.verbs -= silicon_subsystems
@@ -1,9 +1,4 @@
/mob/living/silicon/robot/Process_Spaceslipping(var/prob_slip)
if(module && (istype(module,/obj/item/weapon/robot_module/drone)))
return 0
..(prob_slip)
/mob/living/silicon/robot/Process_Spacemove()
/mob/living/silicon/robot/Process_Spacemove(var/movement_dir = 0)
if(module)
for(var/obj/item/weapon/tank/jetpack/J in module.modules)
if(J && istype(J, /obj/item/weapon/tank/jetpack))
@@ -24,7 +19,7 @@
/mob/living/silicon/robot/Move()
..()
/mob/living/silicon/robot/mob_negates_gravity()
return magpulse
@@ -290,7 +290,7 @@
attack_sound = 'sound/weapons/tap.ogg'
construct_spells = list(/obj/effect/proc_holder/spell/targeted/smoke/disable)
/mob/living/simple_animal/construct/harvester/Process_Spacemove(var/check_drift = 0)
/mob/living/simple_animal/construct/harvester/Process_Spacemove(var/movement_dir = 0)
return 1
@@ -30,8 +30,10 @@
if(isturf(src.loc) && !resting && !buckled) //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(4,8)))
turns_since_move = 0
var/east_vs_west = pick(4, 8)
if(Process_Spacemove(east_vs_west))
Move(get_step(src, east_vs_west), east_vs_west)
turns_since_move = 0
regenerate_icons()
//COFFEE! SQUEEEEEEEEE!
@@ -119,7 +119,7 @@
target = M
..()
/mob/living/simple_animal/hostile/bear/Process_Spacemove(var/check_drift = 0)
/mob/living/simple_animal/hostile/bear/Process_Spacemove(var/movement_dir = 0)
return 1 //No drifting in space for space bears!
/mob/living/simple_animal/hostile/bear/FindTarget()
@@ -42,7 +42,7 @@
faction = list("carp")
flying = 1
/mob/living/simple_animal/hostile/carp/Process_Spacemove(var/check_drift = 0)
/mob/living/simple_animal/hostile/carp/Process_Spacemove(var/movement_dir = 0)
return 1 //No drifting in space for space carp! //original comments do not steal
/mob/living/simple_animal/hostile/carp/FindTarget()
@@ -33,7 +33,7 @@
faction = list("faithless")
/mob/living/simple_animal/hostile/faithless/Process_Spacemove(var/check_drift = 0)
/mob/living/simple_animal/hostile/faithless/Process_Spacemove(var/movement_dir = 0)
return 1
/mob/living/simple_animal/hostile/faithless/FindTarget()
@@ -100,7 +100,7 @@
corpse = /obj/effect/landmark/mobcorpse/syndicatecommando
speed = 1
/mob/living/simple_animal/hostile/syndicate/melee/space/Process_Spacemove(var/check_drift = 0)
/mob/living/simple_animal/hostile/syndicate/melee/space/Process_Spacemove(var/movement_dir = 0)
return
/mob/living/simple_animal/hostile/syndicate/ranged
@@ -132,7 +132,7 @@
corpse = /obj/effect/landmark/mobcorpse/syndicatecommando
speed = 1
/mob/living/simple_animal/hostile/syndicate/ranged/space/Process_Spacemove(var/check_drift = 0)
/mob/living/simple_animal/hostile/syndicate/ranged/space/Process_Spacemove(var/movement_dir = 0)
return
@@ -130,8 +130,10 @@
turns_since_move++
if(turns_since_move >= turns_per_move)
if(!(stop_automated_movement_when_pulled && pulledby)) //Soma animals don't move when pulled
Move(get_step(src,pick(cardinal)))
turns_since_move = 0
var/anydir = pick(cardinal)
if(Process_Spacemove(anydir))
Move(get_step(src,anydir), anydir)
turns_since_move = 0
//Speaking
if(!client && speak_chance && (ckey == null))
-2
View File
@@ -142,8 +142,6 @@
var/emote_cd = 0 // Used to supress emote spamming. 1 if on CD, 2 if disabled by admin (manually set), else 0
var/inertia_dir = 0
var/music_lastplayed = "null"
var/job = null//Living
+38 -99
View File
@@ -127,41 +127,6 @@
return
/atom/movable/Move(NewLoc, direct)
if (direct & (direct - 1))
if (direct & 1)
if (direct & 4)
if (step(src, NORTH))
step(src, EAST)
else
if (step(src, EAST))
step(src, NORTH)
else
if (direct & 8)
if (step(src, NORTH))
step(src, WEST)
else
if (step(src, WEST))
step(src, NORTH)
else
if (direct & 2)
if (direct & 4)
if (step(src, SOUTH))
step(src, EAST)
else
if (step(src, EAST))
step(src, SOUTH)
else
if (direct & 8)
if (step(src, SOUTH))
step(src, WEST)
else
if (step(src, WEST))
step(src, SOUTH)
else
. = ..()
return
/client/proc/Move_object(direct)
if(mob && mob.control_object)
@@ -243,14 +208,13 @@
if(!mob.lastarea)
mob.lastarea = get_area(mob.loc)
if((istype(mob.loc, /turf/space)) || ((mob.lastarea.has_gravity == 0) && (!istype(mob.loc, /obj/spacepod)))) // spacepods shouldn't get affected by changes in gravity
if(!mob.Process_Spacemove(0)) return 0
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
if(isturf(mob.loc))
if(mob.restrained())//Why being pulled while cuffed prevents you from moving
@@ -319,7 +283,7 @@
else if(mob.confused)
step(mob, pick(cardinal))
mob.last_movement=world.time
mob.last_movement = world.time
else
. = ..()
mob.last_movement=world.time
@@ -332,6 +296,8 @@
G.adjust_position()
moving = 0
if(mob && .)
mob.throwing = 0
return .
@@ -434,62 +400,44 @@
///Called by /client/Move()
///For moving in space
///Return 1 for movement 0 for none
/mob/proc/Process_Spacemove(var/check_drift = 0)
//First check to see if we can do things
if(restrained())
return 0
/mob/Process_Spacemove(var/movement_dir = 0)
/*
if(istype(src,/mob/living/carbon))
if(src.l_hand && src.r_hand)
return 0
*/
if(..())
return 1
var/dense_object = 0
for(var/turf/turf in oview(1,src))
if(istype(turf,/turf/space))
var/atom/movable/dense_object_backup
for(var/atom/A in orange(1, get_turf(src)))
if(isarea(A))
continue
if(!turf.density && !mob_negates_gravity())
continue
else if(isturf(A))
var/turf/turf = A
if(istype(turf,/turf/space))
continue
if(!turf.density && !mob_negates_gravity())
continue
return 1
else
var/atom/movable/AM = A
if(AM == buckled) //Kind of unnecessary but let's just be sure
continue
if(AM.density)
if(AM.anchored)
return 1
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>"
/*
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
//Nothing to push off of so end here
if(!dense_object)
return 0
//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
return 1
return 0
/mob/proc/mob_has_gravity(turf/T)
return has_gravity(src, T)
@@ -497,14 +445,5 @@
/mob/proc/mob_negates_gravity()
return 0
/mob/proc/Process_Spaceslipping(var/prob_slip = 5)
//Setup slipage
//If knocked out we might just hit it and stop. This makes it possible to get dead bodies and such.
if(stat)
prob_slip = 0 // Changing this to zero to make it line up with the comment.
prob_slip = round(prob_slip)
return(prob_slip)
/mob/proc/update_gravity()
return
@@ -268,6 +268,8 @@
step(src, movement_dir)
/obj/singularity/Process_Spacemove() //The singularity stops drifting for no man!
return 0
/obj/singularity/proc/check_turfs_in(var/direction = 0, var/step = 0)
if(!direction)
+2 -1
View File
@@ -45,7 +45,7 @@
var/can_flashlight = 0
var/heavy_weapon = 0
var/randomspread = 0
var/burst_size = 1
proc/ready_to_fire()
@@ -186,6 +186,7 @@
user.drop_item()
break
user.newtonian_move(get_dir(target, user))
update_icon()
if(user.hand)
user.update_inv_l_hand()
+10 -5
View File
@@ -89,8 +89,8 @@
return L.apply_effects(stun, weaken, paralyze, irradiate, slur, stutter, eyeblur, drowsy, agony, blocked, stamina, jitter)
proc/OnFired() //if assigned, allows for code when the projectile gets fired
return 1
return 1
proc/check_fire(var/mob/living/target as mob, var/mob/living/user as mob) //Checks if you can hit them or not.
if(!istype(target) || !istype(user))
return 0
@@ -137,7 +137,7 @@
var/mob/living/carbon/human/H = A
var/obj/item/organ/external/organ = H.get_organ(check_zone(def_zone))
if(isnull(organ))
return
return
if(silenced)
playsound(loc, hitsound, 5, 1, -1)
M << "\red You've been shot in the [parse_zone(def_zone)] by the [src.name]!"
@@ -189,6 +189,11 @@
return 1
Process_Spacemove(var/movement_dir = 0)
return 1 //Bullets don't drift in space
process(var/setAngle)
if(setAngle) Angle = setAngle
if(!legacy)
@@ -332,7 +337,7 @@
M = locate() in get_step(src,target)
if(istype(M))
return 1
/proc/check_trajectory(atom/target as mob|obj, atom/firer as mob|obj, var/pass_flags=PASSTABLE|PASSGLASS|PASSGRILLE, flags=null) //Checks if you can hit them or not.
if(!istype(target) || !istype(firer))
return 0
@@ -343,4 +348,4 @@
trace.pass_flags = pass_flags //And the pass flags to that of the real projectile...
var/output = trace.process() //Test it!
qdel(trace) //No need for it anymore
return output //Send it back to the gun!
return output //Send it back to the gun!
@@ -46,6 +46,7 @@
playsound(src.loc, 'sound/effects/spray2.ogg', 50, 1, -6)
user.changeNext_move(CLICK_CD_RANGE*2)
user.newtonian_move(get_dir(A, user))
if(reagents.has_reagent("sacid"))
msg_admin_attack("[key_name_admin(user)] fired sulphuric acid from \a [src].")
@@ -1,36 +1,11 @@
/obj/mecha/working/hoverpod
name = "hover pod"
icon_state = "engineering_pod"
desc = "Stubby and round, it has a human sized access hatch on the top."
wreckage = /obj/effect/decal/mecha_wreckage/hoverpod
//duplicate of parent proc, but without space drifting
/obj/mecha/working/hoverpod/dyndomove(direction)
if(!can_move)
return 0
if(src.pr_inertial_movement.active())
return 0
if(!has_charge(step_energy_drain))
return 0
var/move_result = 0
if(hasInternalDamage(MECHA_INT_CONTROL_LOST))
move_result = mechsteprand()
else if(src.dir!=direction)
move_result = mechturn(direction)
else
move_result = mechstep(direction)
if(move_result)
can_move = 0
use_power(step_energy_drain)
/*if(istype(src.loc, /turf/space))
if(!src.check_for_support())
src.pr_inertial_movement.start(list(src,direction))
src.log_message("Movement control lost. Inertial movement started.")*/
if(do_after(step_in, target = src))
can_move = 1
return 1
return 0
/obj/mecha/working/hoverpod/Process_Spacemove(var/movement_dir = 0)
return 1 // puts the hover in hoverpod
//these three procs overriden to play different sounds
/obj/mecha/working/hoverpod/mechturn(direction)
+1 -1
View File
@@ -94,7 +94,7 @@
for(var/turf/T in dstturfs)
var/turf/D = locate(T.x, throwy - 1, 1)
for(var/atom/movable/AM as mob|obj in T)
AM.Move(D)
AM.Move(D, SOUTH)
if(istype(T, /turf/simulated))
qdel(T)