From 5faef31f606221916c42b84cf79abe89ad6ee1c1 Mon Sep 17 00:00:00 2001 From: Loganbacca Date: Sun, 3 Aug 2014 20:45:41 +1200 Subject: [PATCH] Train fixes and balancing - Slows trains to 90% of running speed - Changes train impact damage to only take into account speed, not train length (otherwise you could insta kill people with a long enough train) - Fixes a bug with towed cars ghosting through closed airlocks - Stuns mobs who fall off a train that has blown up - Fixes mobs standing/lying on vehicles - Fixes exploding trains not decoupling correctly Conflicts: code/modules/mob/mob.dm code/modules/vehicles/cargo_train.dm code/modules/vehicles/train.dm --- code/modules/mob/mob.dm | 20 ++++++++++++-------- code/modules/vehicles/cargo_train.dm | 16 ++++++---------- code/modules/vehicles/train.dm | 16 +++++++++++++--- code/modules/vehicles/vehicle.dm | 22 +++++++++++++++++----- 4 files changed, 48 insertions(+), 26 deletions(-) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 35d7fc64221..32aa6704c42 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -914,17 +914,21 @@ var/list/slot_equipment_priority = list( \ if(buckled && istype(buckled)) is_movable = buckled.movable - if(buckled && !is_movable) + if(istype(buckled, /obj/vehicle)) + var/obj/vehicle/V = buckled + if(stat || weakened || paralysis || resting || sleeping || (status_flags & FAKEDEATH)) + lying = 1 + canmove = 0 + pixel_y = V.mob_offset_y - 5 + else + lying = 0 + canmove = 1 + pixel_y = V.mob_offset_y + else if(buckled && (!buckled.movable)) anchored = 1 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(buckled && is_movable) @@ -1229,4 +1233,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." \ No newline at end of file + 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." diff --git a/code/modules/vehicles/cargo_train.dm b/code/modules/vehicles/cargo_train.dm index 410e2b75372..f1d069c0d3a 100644 --- a/code/modules/vehicles/cargo_train.dm +++ b/code/modules/vehicles/cargo_train.dm @@ -7,10 +7,9 @@ powered = 1 locked = 0 - standing_mob = 1 load_item_visible = 1 load_offset_x = 0 - load_offset_y = 7 + mob_offset_y = 7 var/car_limit = 3 //how many cars an engine can pull before performance degrades active_engines = 1 @@ -31,10 +30,10 @@ passenger_allowed = 0 locked = 0 - standing_mob = 1 load_item_visible = 1 load_offset_x = 0 load_offset_y = 4 + mob_offset_y = 8 //------------------------------------------- // Standard procs @@ -119,7 +118,7 @@ verbs -= /obj/vehicle/train/cargo/engine/verb/stop_engine verbs -= /obj/vehicle/train/cargo/engine/verb/start_engine - + if(on) verbs += /obj/vehicle/train/cargo/engine/verb/stop_engine else @@ -130,7 +129,7 @@ verbs -= /obj/vehicle/train/cargo/engine/verb/stop_engine verbs -= /obj/vehicle/train/cargo/engine/verb/start_engine - + if(!on) verbs += /obj/vehicle/train/cargo/engine/verb/start_engine else @@ -267,10 +266,7 @@ return 0 ..() - - if(istype(load, /mob/living/carbon/human)) - load.pixel_y += 4 - + if(load) return 1 @@ -317,4 +313,4 @@ move_delay = max(0, (-car_limit * active_engines) + train_length - active_engines) //limits base overweight so you cant overspeed trains move_delay *= (1 / max(1, active_engines)) * 2 //overweight penalty (scaled by the number of engines) move_delay += config.run_speed //base reference speed - move_delay *= 1.05 + move_delay *= 1.1 //makes cargo trains 10% slower than running when not overweight diff --git a/code/modules/vehicles/train.dm b/code/modules/vehicles/train.dm index 097808bc865..cc5c732c341 100644 --- a/code/modules/vehicles/train.dm +++ b/code/modules/vehicles/train.dm @@ -32,6 +32,8 @@ tow.Move(old_loc) return 1 else + if(lead) + unattach() return 0 /obj/vehicle/train/Bump(atom/Obstacle) @@ -48,14 +50,22 @@ if(istype(A, /mob/living)) var/mob/living/M = A visible_message("\red [src] knocks over [M]!") - M.apply_effects(5, 5) //knock people down if you hit them - M.apply_damages(5 * train_length / move_delay) // and do damage according to how fast the train is going and how heavy it is + M.apply_effects(5, 5) //knock people down if you hit them + M.apply_damages(22 / move_delay) // and do damage according to how fast the train is going if(istype(load, /mob/living/carbon/human)) var/mob/living/D = load D << "\red You hit [M]!" msg_admin_attack("[D.name] ([D.ckey]) hit [M.name] ([M.ckey]) with [src]. (JMP)") +//------------------------------------------- +// Vehicle procs +//------------------------------------------- +/obj/vehicle/train/explode() + tow.unattach() + unattach() + ..() + //------------------------------------------- // Interaction procs @@ -79,7 +89,7 @@ return 1 /obj/vehicle/train/MouseDrop_T(var/atom/movable/C, mob/user as mob) - if(user.buckled || user.stat || user.restrained() || !Adjacent(user) || !user.Adjacent(C) || !istype(C)) + if(user.buckled || user.stat || user.restrained() || !Adjacent(user) || !user.Adjacent(C) || !istype(C) || (user == C && !user.canmove)) return if(istype(C,/obj/vehicle/train)) latch(C, user) diff --git a/code/modules/vehicles/vehicle.dm b/code/modules/vehicles/vehicle.dm index 9be275b1fd0..a9770aa3d28 100644 --- a/code/modules/vehicles/vehicle.dm +++ b/code/modules/vehicles/vehicle.dm @@ -24,11 +24,11 @@ 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 var/load_offset_y = 0 //pixel_y offset for item overlay + var/mob_offset_y = 0 //pixel_y offset for mob overlay //------------------------------------------- // Standard procs @@ -44,11 +44,15 @@ var/init_anc = anchored anchored = 0 - if(..()) - if(on && powered) - cell.use(power_use) + if(!..()) + anchored = init_anc + return 0 + anchored = init_anc + if(on && powered) + cell.use(power_use) + if(load) load.forceMove(loc)// = loc load.dir = dir @@ -200,6 +204,11 @@ cell.update_icon() cell = null + //stuns people who are thrown off a train that has been blown up + if(istype(load, /mob/living)) + var/mob/living/M = load + M.apply_effects(5, 5) + unload() new /obj/effect/gibspawner/robot(Tsec) @@ -280,7 +289,10 @@ if(load_item_visible) C.pixel_x += load_offset_x - C.pixel_y += load_offset_y + if(ismob(C)) + C.pixel_y += mob_offset_y + else + C.pixel_y += load_offset_y C.layer = layer + 0.1 //so it sits above the vehicle if(ismob(C))