More train fixes

- No passing plastic flaps
- Only human based mobs can board trains
- Adjacent checks for exiting vehicles
- Cleaned up as many direct loc moves as possible
- Places removed cells in the removers hand
This commit is contained in:
Loganbacca
2014-07-28 20:39:42 +12:00
committed by ZomgPonies
parent 45bcd41b9d
commit 0affd2b7c8
4 changed files with 23 additions and 17 deletions
+4 -1
View File
@@ -54,7 +54,10 @@ var/list/mechtoys = list(
if (istype(A, /obj/structure/stool/bed) && B.buckled_mob)//if it's a bed/chair and someone is buckled, it will not pass
return 0
else if(istype(A, /mob/living)) // You Shall Not Pass!
if(istype(A, /obj/vehicle)) //no vehicles
return 0
if(istype(A, /mob/living)) // You Shall Not Pass!
var/mob/living/M = A
if(!M.lying && !istype(M, /mob/living/carbon/monkey) && !istype(M, /mob/living/carbon/slime) && !istype(M, /mob/living/simple_animal/mouse) && !istype(M, /mob/living/silicon/robot/drone)) //If your not laying down, or a small creature, no pass.
return 0
+9 -4
View File
@@ -43,6 +43,7 @@
..()
cell = new /obj/item/weapon/cell/high
verbs -= /atom/movable/verb/pull
verbs -= /obj/vehicle/train/cargo/engine/verb/stop_engine
key = new()
var/image/I = new(icon = 'icons/obj/vehicles.dmi', icon_state = "cargo_engine_overlay", layer = src.layer + 0.2) //over mobs
overlays += I
@@ -70,8 +71,8 @@
if(istype(W, /obj/item/weapon/key/cargo_train))
if(!key)
user.drop_item()
W.forceMove(src)
key = W
W.loc = src
verbs += /obj/vehicle/train/cargo/engine/verb/remove_key
return
..()
@@ -97,7 +98,7 @@
var/obj/machinery/door/D = Obstacle
var/mob/living/carbon/human/H = load
if(istype(D) && istype(H))
D.Bumped(H) //a little hacky, but hey, it works, and repects access rights
D.Bumped(H) //a little hacky, but hey, it works, and respects access rights
..()
@@ -194,6 +195,8 @@
turn_on()
if (on)
usr << "You start [src]'s engine."
verbs += /obj/vehicle/train/cargo/engine/verb/stop_engine
verbs -= /obj/vehicle/train/cargo/engine/verb/start_engine
else
if(cell.charge < power_use)
usr << "[src] is out of power."
@@ -215,6 +218,8 @@
turn_off()
if (!on)
usr << "You stop [src]'s engine."
verbs -= /obj/vehicle/train/cargo/engine/verb/stop_engine
verbs += /obj/vehicle/train/cargo/engine/verb/start_engine
/obj/vehicle/train/cargo/engine/verb/remove_key()
set name = "Remove key"
@@ -243,7 +248,7 @@
/obj/vehicle/train/cargo/trolley/load(var/atom/movable/C)
if(ismob(C) && !passenger_allowed)
return 0
if(!istype(C,/obj/machinery) && !istype(C,/obj/structure/closet) && !istype(C,/obj/structure/largecrate) && !istype(C,/obj/structure/reagent_dispensers) && !istype(C,/obj/structure/ore_box) && !ismob(C))
if(!istype(C,/obj/machinery) && !istype(C,/obj/structure/closet) && !istype(C,/obj/structure/largecrate) && !istype(C,/obj/structure/reagent_dispensers) && !istype(C,/obj/structure/ore_box) && !istype(C, /mob/living/carbon/human))
return 0
..()
@@ -255,7 +260,7 @@
return 1
/obj/vehicle/train/cargo/engine/load(var/atom/movable/C)
if(!ismob(C))
if(!istype(C, /mob/living/carbon/human))
return 0
return ..()
+2 -4
View File
@@ -68,8 +68,7 @@
if(user != load)
if(user in src) //for handling players stuck in src - this shouldn't happen - but just in case it does
user.loc = T
contents -= user
user.forceMove(T)
return 1
return 0
@@ -93,8 +92,7 @@
return 0
if(user != load && (user in src))
user.loc = loc //for handling players stuck in src
contents -= user
user.forceMove(loc) //for handling players stuck in src
else if(load)
unload(user) //unload if loaded
else if(!load && !user.buckled)
+8 -8
View File
@@ -50,7 +50,7 @@
anchored = init_anc
if(load)
load.loc = loc
load.forceMove(loc)// = loc
load.dir = dir
return 1
@@ -196,7 +196,7 @@
new /obj/item/stack/cable_coil/cut(Tsec)
if(cell)
cell.loc = Tsec
cell.forceMove(Tsec)
cell.update_icon()
cell = null
@@ -234,8 +234,8 @@
return
H.drop_from_inventory(C)
C.forceMove(src)
cell = C
C.loc = null //this wont be GC'd since it's referrenced above
powercheck()
usr << "<span class='notice'>You install [C] in [src].</span>"
@@ -244,7 +244,8 @@
return
usr << "<span class='notice'>You remove [cell] from [src].</span>"
cell.loc = get_turf(H)
cell.forceMove(get_turf(H))
H.put_in_hands(cell)
cell = null
powercheck()
@@ -271,7 +272,7 @@
if(istype(crate))
crate.close()
C.loc = loc
C.forceMove(loc)
C.dir = dir
C.anchored = 1
@@ -310,7 +311,7 @@
var/list/options = new()
for(var/test_dir in alldirs)
var/new_dir = get_step_to(src, get_step(src, test_dir))
if(new_dir)
if(new_dir && load.Adjacent(new_dir))
options += new_dir
if(options.len)
dest = pick(options)
@@ -320,8 +321,7 @@
if(!isturf(dest)) //if there still is nowhere to unload, cancel out since the vehicle is probably in nullspace
return 0
load.loc = dest
load.forceMove(dest)
load.dir = get_dir(loc, dest)
load.anchored = initial(load.anchored)
load.pixel_x = initial(load.pixel_x)