New vehicle loading code

- Vehicles now load items on them somewhat like roller beds, allowing you to interact with them
This commit is contained in:
Loganbacca
2014-06-21 14:13:25 +12:00
parent 68d01b00ab
commit d6022017c8
4 changed files with 40 additions and 58 deletions
+6
View File
@@ -760,6 +760,12 @@ note dizziness decrements automatically in the mob's Life() proc.
canmove = 0
if( istype(buckled,/obj/structure/stool/bed/chair) )
lying = 0
else if(istype(buckled, /obj/vehicle))
var/obj/vehicle/V = buckled
if(V.standing_mob)
lying = 0
else
lying = 1
else
lying = 1
else if( stat || weakened || paralysis || resting || sleeping || (status_flags & FAKEDEATH))
+4 -2
View File
@@ -199,7 +199,7 @@
if(!mob.canmove)
if (mob.buckled && (istype(mob.buckled, /obj/structure/stool/bed/chair/wheelchair))) // Exception for wheelchairs
if (mob.buckled && (istype(mob.buckled, /obj/structure/stool/bed/chair/wheelchair) || istype(mob.buckled, /obj/vehicle))) // Exception for wheelchairs
else return
//if(istype(mob.loc, /turf/space) || (mob.flags & NOGRAV))
@@ -246,7 +246,9 @@
move_delay -= 1.3
var/tickcomp = ((1/(world.tick_lag))*1.3)
move_delay = move_delay + tickcomp
if(istype(mob.buckled, /obj/vehicle))
return mob.buckled.relaymove(mob,direct)
if(mob.pulledby || mob.buckled) // Wheelchair driving!
if(istype(mob.loc, /turf/space))
+15
View File
@@ -6,6 +6,7 @@
powered = 1
locked = 0
standing_mob = 1
load_item_visible = 1
load_offset_x = 0
load_offset_y = 9
@@ -22,6 +23,7 @@
passenger_allowed = 0
locked = 0
standing_mob = 1
load_item_visible = 1
load_offset_x = 0
load_offset_y = 9
@@ -183,6 +185,19 @@
else
usr << "[src] won't start."
/obj/vehicle/train/cargo/engine/verb/climb_down(mob/user as mob)
set name = "Exit vehicle"
set category = "Object"
set src in range(0)
if(!load)
return
if(user != load)
return
unload(user)
//-------------------------------------------
// Latching/unlatching procs
//-------------------------------------------
+15 -56
View File
@@ -1,7 +1,7 @@
/obj/vehicle
name = "vehicle"
icon = 'icons/obj/vehicles.dmi'
layer = MOB_LAYER
layer = 2.9
density = 1
anchored = 1
animate_movement=1
@@ -23,6 +23,7 @@
var/obj/item/weapon/cell/cell
var/power_use = 5 //set this to adjust the amount of power the vehicle uses per move
var/standing_mob = 0 //if a mob loaded on the vehicle should be standing
var/atom/movable/load //all vehicles can take a load, since they should all be a least drivable
var/load_item_visible = 1 //set if the loaded item should be overlayed on the vehicle sprite
var/load_offset_x = 0 //pixel_x offset for item overlay
@@ -46,6 +47,10 @@
if(on && powered)
cell.use(power_use)
anchored = init_anc
if(load)
load.loc = loc
load.dir = dir
return 1
else
@@ -262,49 +267,24 @@
crate.close()
C.loc = loc
sleep(2)
if(C.loc != loc) //To prevent you from going onto more than one train.
return 0
C.loc = src
C.dir = dir
C.anchored = 1
load = C
if(load_item_visible)
C.pixel_x += load_offset_x
C.pixel_y += load_offset_y
C.layer = layer
overlays += C
//we can set these back now since we have already cloned the icon into the overlay
C.pixel_x = initial(C.pixel_x)
C.pixel_y = initial(C.pixel_y)
C.layer = initial(C.layer)
if(ismob(C))
var/mob/M = C
if(M.client)
M.client.perspective = EYE_PERSPECTIVE
M.client.eye = src
M.buckled = src
M.update_canmove()
return 1
/obj/vehicle/proc/unload(var/mob/user, var/direction, var/exception = 0)
if(!load)
// in case non-load items end up in contents, dump everything else too
for(var/atom/movable/AM in src)
AM.loc = get_turf(src)
AM.pixel_x = initial(AM.pixel_x)
AM.pixel_y = initial(AM.pixel_y)
AM.layer = initial(AM.layer)
if(ismob(AM))
var/mob/M = AM
if(M.client)
M.client.perspective = MOB_PERSPECTIVE
M.client.eye = src
return 0
var/turf/dest = null
//find a turf to unload to
@@ -332,42 +312,21 @@
return 0
if(exception) //for handling any players that end up in src.contents that are trying to climb off
user.loc = dest
user.pixel_x = initial(user.pixel_x)
user.pixel_y = initial(user.pixel_y)
user.layer = initial(user.layer)
if(ismob(user))
var/mob/M = user
if(M.client)
M.client.perspective = MOB_PERSPECTIVE
M.client.eye = src
src.contents -= user
return 1
overlays.Cut()
load.loc = dest
/*
load.dir = get_dir(loc, dest)
load.anchored = initial(load.anchored)
load.pixel_x = initial(load.pixel_x)
load.pixel_y = initial(load.pixel_y)
load.layer = initial(load.layer)
*/
if(ismob(load))
var/mob/M = load
if(M.client)
M.client.perspective = MOB_PERSPECTIVE
M.client.eye = src
M.buckled = null
M.anchored = initial(M.anchored)
M.update_canmove()
load = null
unload() //recursive check for anything left in contents
return 1