From a72d2824dc1e52f76c469624cbce16569583359e Mon Sep 17 00:00:00 2001 From: Loganbacca Date: Fri, 20 Jun 2014 23:48:41 +1200 Subject: [PATCH] New vehicle loading code Conflicts: code/modules/mob/mob.dm code/modules/mob/mob_movement.dm --- code/modules/mob/mob.dm | 8 +++- code/modules/mob/mob_movement.dm | 7 ++- code/modules/vehicles/cargo_train.dm | 15 ++++++ code/modules/vehicles/vehicle.dm | 71 ++++++---------------------- 4 files changed, 40 insertions(+), 61 deletions(-) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 690591bdf6a..3c804652f37 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -914,6 +914,12 @@ var/list/slot_equipment_priority = list( \ 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)) @@ -1216,4 +1222,4 @@ mob/proc/yank_out_object() if(host) host.ckey = src.ckey - host << "You are now a mouse. Try to avoid interaction with players, and do not give hints away that you are more than a simple rodent." + host << "You are now a mouse. Try to avoid interaction with players, and do not give hints away that you are more than a simple rodent." \ No newline at end of file diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index f912fe59d63..4dfaabf5763 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -206,8 +206,7 @@ if(!mob.canmove) - if (mob.buckled && (istype(mob.buckled, /obj/structure/stool/bed/chair/wheelchair))) // Exception for wheelchairs - else if (mob.buckled && (istype(mob.buckled, /obj/structure/stool/bed/chair/cart))) + if (mob.buckled && (istype(mob.buckled, /obj/structure/stool/bed/chair/wheelchair) || istype(mob.buckled, /obj/structure/stool/bed/chair/cart) || istype(mob.buckled, /obj/vehicle))) // Exception for wheelchairs else return //if(istype(mob.loc, /turf/space) || (mob.flags & NOGRAV)) @@ -255,6 +254,8 @@ var/tickcomp = ((1/(world.tick_lag))*1.3) move_delay = move_delay + tickcomp + if(istype(mob.buckled, /obj/vehicle) || istype(mob.buckled, /obj/structure/stool/bed/chair/cart)) + return mob.buckled.relaymove(mob,direct) if(mob.pulledby || mob.buckled) // Wheelchair driving! if(istype(mob.loc, /turf/space)) @@ -270,8 +271,6 @@ return // No hands to drive your chair? Tough luck! move_delay += 2 return mob.buckled.relaymove(mob,direct) - else if(istype(mob.buckled, /obj/structure/stool/bed/chair/cart)) - return mob.buckled.relaymove(mob,direct) //We are now going to move moving = 1 diff --git a/code/modules/vehicles/cargo_train.dm b/code/modules/vehicles/cargo_train.dm index 1f26e2bec07..65a0eb10d8e 100644 --- a/code/modules/vehicles/cargo_train.dm +++ b/code/modules/vehicles/cargo_train.dm @@ -6,6 +6,7 @@ powered = 1 locked = 0 + standing_mob = 1 load_item_visible = 1 load_offset_x = 0 load_offset_y = 5 @@ -22,6 +23,7 @@ passenger_allowed = 0 locked = 0 + standing_mob = 1 load_item_visible = 1 load_offset_x = 1 load_offset_y = 7 @@ -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 //------------------------------------------- diff --git a/code/modules/vehicles/vehicle.dm b/code/modules/vehicles/vehicle.dm index 2179cc9e099..814c54383a6 100644 --- a/code/modules/vehicles/vehicle.dm +++ b/code/modules/vehicles/vehicle.dm @@ -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