mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-16 05:02:42 +00:00
Update Movement.dm
jetpack movement
This commit is contained in:
@@ -1,49 +1,52 @@
|
|||||||
var/maxZ = 6
|
/obj/item/weapon/tank/jetpack/verb/moveup()
|
||||||
var/minZ = 2
|
set name = "Move Upwards"
|
||||||
|
set category = "Object"
|
||||||
// Maybe it's best to have this hardcoded for whatever we'd add to the map, in order to avoid exploits
|
if(allow_thrust(0.01, usr))
|
||||||
// (such as mining base => admin station)
|
var/turf/controlerlocation = locate(1, 1, usr.z)
|
||||||
// Note that this assumes the ship's top is at z=1 and bottom at z=4
|
var/legal = 0
|
||||||
/obj/item/weapon/tank/jetpack/proc/move_z(cardinal, mob/user as mob)
|
for(var/obj/effect/landmark/zcontroler/controler in controlerlocation)
|
||||||
if (user.z > 1)
|
legal = controler.up
|
||||||
user << "\red There is nothing of interest in that direction."
|
if (controler.up)
|
||||||
return
|
var/turf/T = locate(usr.x, usr.y, controler.up_target)
|
||||||
if(allow_thrust(0.01, user))
|
if(T && (istype(T, /turf/space) || istype(T, /turf/simulated/floor/open)))
|
||||||
switch(cardinal)
|
|
||||||
if (UP) // Going up!
|
|
||||||
if(user.z > maxZ) // If we aren't at the very top of the ship
|
|
||||||
var/turf/T = locate(user.x, user.y, user.z - 1)
|
|
||||||
// You can only jetpack up if there's space above, and you're sitting on either hull (on the exterior), or space
|
|
||||||
//if(T && istype(T, /turf/space) && (istype(user.loc, /turf/space) || istype(user.loc, /turf/space/*/hull*/)))
|
|
||||||
//check through turf contents to make sure there's nothing blocking the way
|
|
||||||
if(T && istype(T, /turf/space))
|
|
||||||
var/blocked = 0
|
var/blocked = 0
|
||||||
for(var/atom/A in T.contents)
|
for(var/atom/A in T.contents)
|
||||||
if(T.density)
|
if(A.density)
|
||||||
blocked = 1
|
blocked = 1
|
||||||
user << "\red You bump into [T.name]."
|
usr << "\red You bump into [A.name]."
|
||||||
break
|
break
|
||||||
if(!blocked)
|
if(!blocked)
|
||||||
user.Move(T)
|
usr.Move(T)
|
||||||
|
usr << "You move upwards."
|
||||||
else
|
else
|
||||||
user << "\red You bump into the ship's plating."
|
usr << "\red There is something in your way."
|
||||||
else
|
if (legal == 0)
|
||||||
user << "\red The ship's gravity well keeps you in orbit!" // Assuming the ship starts on z level 1, you don't want to go past it
|
usr << "There is nothing of interest in this direction."
|
||||||
|
return 1
|
||||||
|
|
||||||
if (DOWN) // Going down!
|
/obj/item/weapon/tank/jetpack/verb/movedown()
|
||||||
if (user.z < 1) // If we aren't at the very bottom of the ship, or out in space
|
set name = "Move Downwards"
|
||||||
var/turf/T = locate(user.x, user.y, user.z + 1)
|
set category = "Object"
|
||||||
// You can only jetpack down if you're sitting on space and there's space down below, or hull
|
if(allow_thrust(0.01, usr))
|
||||||
if(T && (istype(T, /turf/space) || istype(T, /turf/space/*/hull*/)) && istype(user.loc, /turf/space))
|
var/turf/controlerlocation = locate(1, 1, usr.z)
|
||||||
|
var/legal = 0
|
||||||
|
for(var/obj/effect/landmark/zcontroler/controler in controlerlocation)
|
||||||
|
legal = controler.down
|
||||||
|
if (controler.down == 1)
|
||||||
|
var/turf/T = locate(usr.x, usr.y, controler.down_target)
|
||||||
|
var/turf/S = locate(usr.x, usr.y, usr.z)
|
||||||
|
if(T && (istype(S, /turf/space) || istype(S, /turf/simulated/floor/open)))
|
||||||
var/blocked = 0
|
var/blocked = 0
|
||||||
for(var/atom/A in T.contents)
|
for(var/atom/A in T.contents)
|
||||||
if(T.density)
|
if(A.density)
|
||||||
blocked = 1
|
blocked = 1
|
||||||
user << "\red You bump into [T.name]."
|
usr << "\red You bump into [A.name]."
|
||||||
break
|
break
|
||||||
if(!blocked)
|
if(!blocked)
|
||||||
user.Move(T)
|
usr.Move(T)
|
||||||
|
usr << "You move downwards."
|
||||||
else
|
else
|
||||||
user << "\red You bump into the ship's plating."
|
usr << "\red You cant move through the floor."
|
||||||
else
|
if (legal == 0)
|
||||||
user << "\red The ship's gravity well keeps you in orbit!"
|
usr << "There is nothing of interest in this direction."
|
||||||
|
return 1
|
||||||
|
|||||||
Reference in New Issue
Block a user