diff --git a/aurora.dme b/aurora.dme index 858cb0a4..c1df4764 100644 --- a/aurora.dme +++ b/aurora.dme @@ -1441,6 +1441,9 @@ #include "code\modules\telesci\gps.dm" #include "code\modules\telesci\telepad.dm" #include "code\modules\telesci\telesci_computer.dm" +#include "code\modules\vehicles\cargo_train.dm" +#include "code\modules\vehicles\train.dm" +#include "code\modules\vehicles\vehicle.dm" #include "code\modules\virus2\analyser.dm" #include "code\modules\virus2\antibodies.dm" #include "code\modules\virus2\centrifuge.dm" diff --git a/code/datums/supplypacks.dm b/code/datums/supplypacks.dm index f09a659a..6616fda5 100644 --- a/code/datums/supplypacks.dm +++ b/code/datums/supplypacks.dm @@ -251,6 +251,22 @@ var/list/all_supply_groups = list("Operations","Security","Hospitality","Enginee containername = "MULEbot Crate" group = "Operations" +/datum/supply_packs/cargotrain + name = "Cargo Train Tug" + contains = list(/obj/vehicle/train/cargo/engine) + cost = 30 + containertype = /obj/structure/largecrate + containername = "Cargo Train Tug Crate" + group = "Operations" + +/datum/supply_packs/cargotrailer + name = "Cargo Train Trolley" + contains = list(/obj/vehicle/train/cargo/trolley) + cost = 20 + containertype = /obj/structure/largecrate + containername = "Cargo Train Trolley Crate" + group = "Operations" + /datum/supply_packs/lisa name = "Corgi Crate" contains = list() diff --git a/code/game/objects/items/weapons/cards_ids.dm b/code/game/objects/items/weapons/cards_ids.dm index 931edd3d..71b1629f 100644 --- a/code/game/objects/items/weapons/cards_ids.dm +++ b/code/game/objects/items/weapons/cards_ids.dm @@ -100,7 +100,8 @@ /obj/machinery/bot, /obj/machinery/door, /obj/machinery/telecomms, - /obj/machinery/mecha_part_fabricator + /obj/machinery/mecha_part_fabricator, + /obj/vehicle ) @@ -200,7 +201,7 @@ access = list(access_maint_tunnels, access_syndicate, access_external_airlocks) origin_tech = "syndicate=3" var/registered_user=null - + /obj/item/weapon/card/id/syndicate/New(mob/user as mob) ..() if(!isnull(user)) // Runtime prevention on laggy starts or where users log out because of lag at round start. @@ -208,7 +209,7 @@ else registered_name = "Agent Card" assignment = "Agent" - name = "[registered_name]'s ID Card ([assignment])" + name = "[registered_name]'s ID Card ([assignment])" /obj/item/weapon/card/id/syndicate/afterattack(var/obj/item/weapon/O as obj, mob/user as mob, proximity) if(!proximity) return @@ -239,7 +240,7 @@ registered_user = user else if(!registered_user || registered_user == user) - if(!registered_user) registered_user = user // + if(!registered_user) registered_user = user // switch(alert("Would you like to display the ID, or retitle it?","Choose.","Rename","Show")) if("Rename") diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 6d81acee..49f0c755 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -478,10 +478,9 @@ var/obj/machinery/bot/mulebot/MB = AM MB.RunOver(src) -/* if(istype(AM, /obj/vehicle)) + if(istype(AM, /obj/vehicle)) var/obj/vehicle/V = AM V.RunOver(src) -*/ //gets assignment from ID or ID inside PDA or PDA itself //Useful when player do something with computers diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index ca8015e6..3e58626b 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -203,7 +203,8 @@ if(!mob.canmove) - return + 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)) // if(!mob.Process_Spacemove(0)) return 0 @@ -257,6 +258,9 @@ if(mob.machine.relaymove(mob,direct)) return + 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)) return // No wheelchair driving in space diff --git a/code/modules/vehicles/cargo_train.dm b/code/modules/vehicles/cargo_train.dm new file mode 100644 index 00000000..ea3f7b72 --- /dev/null +++ b/code/modules/vehicles/cargo_train.dm @@ -0,0 +1,303 @@ +/obj/vehicle/train/cargo/engine + name = "cargo train tug" + desc = "A ridable electric car designed for pulling cargo trolleys." + icon = 'icons/obj/vehicles.dmi' + icon_state = "cargo_engine" + on = 0 + powered = 1 + locked = 0 + + load_item_visible = 1 + load_offset_x = 0 + mob_offset_y = 7 + + var/car_limit = 3 //how many cars an engine can pull before performance degrades + active_engines = 1 + var/obj/item/weapon/key/cargo_train/key + +/obj/item/weapon/key/cargo_train + name = "key" + desc = "A keyring with a small steel key, and a yellow fob reading \"Choo Choo!\"." + icon = 'icons/obj/vehicles.dmi' + icon_state = "train_keys" + w_class = 1 + +/obj/vehicle/train/cargo/trolley + name = "cargo train trolley" + icon = 'icons/obj/vehicles.dmi' + icon_state = "cargo_trailer" + anchored = 0 + passenger_allowed = 0 + locked = 0 + + load_item_visible = 1 + load_offset_x = 0 + load_offset_y = 4 + mob_offset_y = 8 + +//------------------------------------------- +// Standard procs +//------------------------------------------- +/obj/vehicle/train/cargo/engine/New() + ..() + cell = new /obj/item/weapon/cell/high + verbs -= /atom/movable/verb/pull + 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 + turn_off() //so engine verbs are correctly set + +/obj/vehicle/train/cargo/engine/Move() + if(on && cell.charge < charge_use) + turn_off() + update_stats() + if(load && is_train_head()) + load << "The drive motor briefly whines, then drones to a stop." + + if(is_train_head() && !on) + return 0 + + return ..() + +/obj/vehicle/train/cargo/trolley/attackby(obj/item/weapon/W as obj, mob/user as mob) + if(open && istype(W, /obj/item/weapon/wirecutters)) + passenger_allowed = !passenger_allowed + user.visible_message("[user] [passenger_allowed ? "cuts" : "mends"] a cable in [src].","You [passenger_allowed ? "cut" : "mend"] the load limiter cable.") + else + ..() + +/obj/vehicle/train/cargo/engine/attackby(obj/item/weapon/W as obj, mob/user as mob) + if(istype(W, /obj/item/weapon/key/cargo_train)) + if(!key) + user.drop_item() + W.forceMove(src) + key = W + verbs += /obj/vehicle/train/cargo/engine/verb/remove_key + return + ..() + +/obj/vehicle/train/cargo/update_icon() + if(open) + icon_state = initial(icon_state) + "_open" + else + icon_state = initial(icon_state) + +/obj/vehicle/train/cargo/trolley/insert_cell(var/obj/item/weapon/cell/C, var/mob/living/carbon/human/H) + return + +/obj/vehicle/train/cargo/engine/insert_cell(var/obj/item/weapon/cell/C, var/mob/living/carbon/human/H) + ..() + update_stats() + +/obj/vehicle/train/cargo/engine/remove_cell(var/mob/living/carbon/human/H) + ..() + update_stats() + +/obj/vehicle/train/cargo/engine/Bump(atom/Obstacle) + 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 respects access rights + + ..() + +/obj/vehicle/train/cargo/trolley/Bump(atom/Obstacle) + if(!lead) + return //so people can't knock others over by pushing a trolley around + ..() + +//------------------------------------------- +// Train procs +//------------------------------------------- +/obj/vehicle/train/cargo/engine/turn_on() + if(!key) + return + else + ..() + update_stats() + + 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 + verbs += /obj/vehicle/train/cargo/engine/verb/start_engine + +/obj/vehicle/train/cargo/engine/turn_off() + ..() + + 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 + verbs += /obj/vehicle/train/cargo/engine/verb/stop_engine + +/obj/vehicle/train/cargo/RunOver(var/mob/living/carbon/human/H) + var/list/parts = list("head", "chest", "l_leg", "r_leg", "l_arm", "r_arm") + + H.apply_effects(5, 5) + for(var/i = 0, i < rand(1,3), i++) + H.apply_damage(rand(1,5), BRUTE, pick(parts)) + +/obj/vehicle/train/cargo/trolley/RunOver(var/mob/living/carbon/human/H) + ..() + attack_log += text("\[[time_stamp()]\] ran over [H.name] ([H.ckey])") + +/obj/vehicle/train/cargo/engine/RunOver(var/mob/living/carbon/human/H) + ..() + + if(is_train_head() && istype(load, /mob/living/carbon/human)) + var/mob/living/carbon/human/D = load + D << "\red \b You ran over [H]!" + visible_message("\red \The [src] ran over [H]!") + attack_log += text("\[[time_stamp()]\] ran over [H.name] ([H.ckey]), driven by [D.name] ([D.ckey])") + msg_admin_attack("[D.name] ([D.ckey]) ran over [H.name] ([H.ckey]). (JMP)") + else + attack_log += text("\[[time_stamp()]\] ran over [H.name] ([H.ckey])") + + +//------------------------------------------- +// Interaction procs +//------------------------------------------- +/obj/vehicle/train/cargo/engine/relaymove(mob/user, direction) + if(user != load) + return 0 + + if(is_train_head()) + if(direction == reverse_direction(dir) && tow) + return 0 + if(Move(get_step(src, direction))) + return 1 + return 0 + else + return ..() + +/obj/vehicle/train/cargo/engine/examine() + ..() + + if(!istype(usr, /mob/living/carbon/human)) + return + + if(get_dist(usr,src) <= 1) + usr << "The power light is [on ? "on" : "off"].\nThere are[key ? "" : " no"] keys in the ignition." + usr << "The charge meter reads [cell? round(cell.percent(), 0.01) : 0]%" + +/obj/vehicle/train/cargo/engine/verb/start_engine() + set name = "Start engine" + set category = "Object" + set src in view(1) + + if(!istype(usr, /mob/living/carbon/human)) + return + + if(on) + usr << "The engine is already running." + return + + turn_on() + if (on) + usr << "You start [src]'s engine." + else + if(cell.charge < charge_use) + usr << "[src] is out of power." + else + usr << "[src]'s engine won't start." + +/obj/vehicle/train/cargo/engine/verb/stop_engine() + set name = "Stop engine" + set category = "Object" + set src in view(1) + + if(!istype(usr, /mob/living/carbon/human)) + return + + if(!on) + usr << "The engine is already stopped." + return + + turn_off() + if (!on) + usr << "You stop [src]'s engine." + +/obj/vehicle/train/cargo/engine/verb/remove_key() + set name = "Remove key" + set category = "Object" + set src in view(1) + + if(!istype(usr, /mob/living/carbon/human)) + return + + if(!key || (load && load != usr)) + return + + if(on) + turn_off() + + key.loc = usr.loc + if(!usr.get_active_hand()) + usr.put_in_hands(key) + key = null + + verbs -= /obj/vehicle/train/cargo/engine/verb/remove_key + +//------------------------------------------- +// Loading/unloading procs +//------------------------------------------- +/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) && !istype(C, /mob/living/carbon/human)) + return 0 + + ..() + + if(load) + return 1 + +/obj/vehicle/train/cargo/engine/load(var/atom/movable/C) + if(!istype(C, /mob/living/carbon/human)) + return 0 + + return ..() + + +//------------------------------------------------------- +// Stat update procs +// +// Update the trains stats for speed calculations. +// The longer the train, the slower it will go. car_limit +// sets the max number of cars one engine can pull at +// full speed. Adding more cars beyond this will slow the +// train proportionate to the length of the train. Adding +// more engines increases this limit by car_limit per +// engine. +//------------------------------------------------------- +/obj/vehicle/train/cargo/engine/update_car(var/train_length, var/active_engines) + src.train_length = train_length + src.active_engines = active_engines + + //Update move delay + if(!is_train_head() || !on) + move_delay = initial(move_delay) //so that engines that have been turned off don't lag behind + else + 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.1 //makes cargo trains 10% slower than running when not overweight + +/obj/vehicle/train/cargo/trolley/update_car(var/train_length, var/active_engines) + src.train_length = train_length + src.active_engines = active_engines + + if(!lead && !tow) + anchored = 0 + if(verbs.Find(/atom/movable/verb/pull)) + return + else + verbs += /atom/movable/verb/pull + else + anchored = 1 + verbs -= /atom/movable/verb/pull diff --git a/code/modules/vehicles/train.dm b/code/modules/vehicles/train.dm new file mode 100644 index 00000000..d8e372d8 --- /dev/null +++ b/code/modules/vehicles/train.dm @@ -0,0 +1,229 @@ +/obj/vehicle/train + name = "train" + dir = 4 + + move_delay = 1 + + health = 100 + maxhealth = 100 + fire_dam_coeff = 0.7 + brute_dam_coeff = 0.5 + + var/passenger_allowed = 1 + + var/active_engines = 0 + var/train_length = 0 + + var/obj/vehicle/train/lead + var/obj/vehicle/train/tow + + +//------------------------------------------- +// Standard procs +//------------------------------------------- +/obj/vehicle/train/initialize() + for(var/obj/vehicle/train/T in orange(1, src)) + latch(T) + +/obj/vehicle/train/Move() + var/old_loc = get_turf(src) + if(..()) + if(tow) + tow.Move(old_loc) + return 1 + else + if(lead) + unattach() + return 0 + +/obj/vehicle/train/Bump(atom/Obstacle) + if(!istype(Obstacle, /atom/movable)) + return + var/atom/movable/A = Obstacle + + if(!A.anchored) + var/turf/T = get_step(A, dir) + if(isturf(T)) + A.Move(T) //bump things away when hit + + if(emagged) + 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(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() + if (tow) + tow.unattach() + unattach() + ..() + + +//------------------------------------------- +// Interaction procs +//------------------------------------------- +/obj/vehicle/train/relaymove(mob/user, direction) + var/turf/T = get_step_to(src, get_step(src, direction)) + if(!T) + user << "You can't find a clear area to step onto." + return 0 + + if(user != load) + if(user in src) //for handling players stuck in src - this shouldn't happen - but just in case it does + user.forceMove(T) + return 1 + return 0 + + unload(user, direction) + + user << "\blue You climb down from [src]." + + 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) || (user == C && !user.canmove)) + return + if(istype(C,/obj/vehicle/train)) + latch(C, user) + else + if(!load(C)) + user << "\red You were unable to load [C] on [src]." + +/obj/vehicle/train/attack_hand(mob/user as mob) + if(user.stat || user.restrained() || !Adjacent(user)) + return 0 + + if(user != load && (user in src)) + user.forceMove(loc) //for handling players stuck in src + else if(load) + unload(user) //unload if loaded + else if(!load && !user.buckled) + load(user) //else try climbing on board + else + return 0 + +/obj/vehicle/train/verb/unlatch_v() + set name = "Unlatch" + set desc = "Unhitches this train from the one in front of it." + set category = "Object" + set src in view(1) + + if(!istype(usr, /mob/living/carbon/human)) + return + + if(!usr.canmove || usr.stat || usr.restrained() || !Adjacent(usr)) + return + + unattach(usr) + + +//------------------------------------------- +// Latching/unlatching procs +//------------------------------------------- + +//attempts to attach src as a follower of the train T +/obj/vehicle/train/proc/attach_to(obj/vehicle/train/T, mob/user) + if (get_dist(src, T) > 1) + user << "\red [src] is too far away from [T] to hitch them together." + return + + if (lead) + user << "\red [src] is already hitched to something." + return + + if (T.tow) + user << "\red [T] is already towing something." + return + + //check for cycles. + var/obj/vehicle/train/next_car = T + while (next_car) + if (next_car == src) + user << "\red That seems very silly." + return + next_car = next_car.lead + + //latch with src as the follower + lead = T + T.tow = src + dir = lead.dir + + if(user) + user << "\blue You hitch [src] to [T]." + + update_stats() + + +//detaches the train from whatever is towing it +/obj/vehicle/train/proc/unattach(mob/user) + if (!lead) + user << "\red [src] is not hitched to anything." + return + + lead.tow = null + lead.update_stats() + + user << "\blue You unhitch [src] from [lead]." + lead = null + + update_stats() + +/obj/vehicle/train/proc/latch(obj/vehicle/train/T, mob/user) + if(!istype(T) || !Adjacent(T)) + return 0 + + var/T_dir = get_dir(src, T) //figure out where T is wrt src + + if(dir == T_dir) //if car is ahead + src.attach_to(T, user) + else if(reverse_direction(dir) == T_dir) //else if car is behind + T.attach_to(src, user) + +//returns 1 if this is the lead car of the train +/obj/vehicle/train/proc/is_train_head() + if (lead) + return 0 + return 1 + +//------------------------------------------------------- +// Stat update procs +// +// Used for updating the stats for how long the train is. +// These are useful for calculating speed based on the +// size of the train, to limit super long trains. +//------------------------------------------------------- +/obj/vehicle/train/update_stats() + //first, seek to the end of the train + var/obj/vehicle/train/T = src + while(T.tow) + //check for cyclic train. + if (T.tow == src) + lead.tow = null + lead.update_stats() + + lead = null + update_stats() + return + T = T.tow + + //now walk back to the front. + var/active_engines = 0 + var/train_length = 0 + while(T) + train_length++ + if (powered && on) + active_engines++ + T.update_car(train_length, active_engines) + T = T.lead + +/obj/vehicle/train/proc/update_car(var/train_length, var/active_engines) + return diff --git a/code/modules/vehicles/vehicle.dm b/code/modules/vehicles/vehicle.dm new file mode 100644 index 00000000..76fd7d89 --- /dev/null +++ b/code/modules/vehicles/vehicle.dm @@ -0,0 +1,358 @@ +/obj/vehicle + name = "vehicle" + icon = 'icons/obj/vehicles.dmi' + layer = MOB_LAYER + 0.1 //so it sits above objects including mobs + density = 1 + anchored = 1 + animate_movement=1 + luminosity = 3 + + var/attack_log = null + var/on = 0 + var/health = 0 //do not forget to set health for your vehicle! + var/maxhealth = 0 + var/fire_dam_coeff = 1.0 + var/brute_dam_coeff = 1.0 + var/open = 0 //Maint panel + var/locked = 1 + var/stat = 0 + var/emagged = 0 + var/powered = 0 //set if vehicle is powered and should use fuel when moving + var/move_delay = 1 //set this to limit the speed of the vehicle + var/movable = 1 + + var/obj/item/weapon/cell/cell + var/charge_use = 5 //set this to adjust the amount of power the vehicle uses per move + + 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 +//------------------------------------------- +/obj/vehicle/New() + ..() + //spawn the cell you want in each vehicle + +/obj/vehicle/Move() + if(world.time > l_move_time + move_delay) + if(on && powered && cell.charge < charge_use) + turn_off() + + var/init_anc = anchored + anchored = 0 + if(!..()) + anchored = init_anc + return 0 + + anchored = init_anc + + if(on && powered) + cell.use(charge_use) + + if(load) + load.forceMove(loc)// = loc + load.dir = dir + + return 1 + else + return 0 + +/obj/vehicle/attackby(obj/item/weapon/W as obj, mob/user as mob) + if(istype(W, /obj/item/weapon/hand_labeler)) + return + if(istype(W, /obj/item/weapon/screwdriver)) + if(!locked) + open = !open + update_icon() + user << "Maintenance panel is now [open ? "opened" : "closed"]." + else if(istype(W, /obj/item/weapon/crowbar) && cell && open) + remove_cell(user) + + else if(istype(W, /obj/item/weapon/cell) && !cell && open) + insert_cell(W, user) + else if(istype(W, /obj/item/weapon/weldingtool)) + var/obj/item/weapon/weldingtool/T = W + if(T.welding) + if(health < maxhealth) + if(open) + health = min(maxhealth, health+10) + user.visible_message("\red [user] repairs [src]!","\blue You repair [src]!") + else + user << "Unable to repair with the maintenance panel closed." + else + user << "[src] does not need a repair." + else + user << "Unable to repair while [src] is off." + else if(istype(W, /obj/item/weapon/card/emag) && !emagged) + Emag(user) + else if(hasvar(W,"force") && hasvar(W,"damtype")) + switch(W.damtype) + if("fire") + health -= W.force * fire_dam_coeff + if("brute") + health -= W.force * brute_dam_coeff + ..() + healthcheck() + else + ..() + +/obj/vehicle/attack_animal(var/mob/living/simple_animal/M as mob) + if(M.melee_damage_upper == 0) return + health -= M.melee_damage_upper + src.visible_message("\red [M] has [M.attacktext] [src]!") + M.attack_log += text("\[[time_stamp()]\] attacked [src.name]") + if(prob(10)) + new /obj/effect/decal/cleanable/blood/oil(src.loc) + healthcheck() + +/obj/vehicle/bullet_act(var/obj/item/projectile/Proj) + health -= Proj.damage + ..() + healthcheck() + +/obj/vehicle/meteorhit() + explode() + return + +/obj/vehicle/blob_act() + src.health -= rand(20,40)*fire_dam_coeff + healthcheck() + return + +/obj/vehicle/ex_act(severity) + switch(severity) + if(1.0) + explode() + return + if(2.0) + health -= rand(5,10)*fire_dam_coeff + health -= rand(10,20)*brute_dam_coeff + healthcheck() + return + if(3.0) + if (prob(50)) + health -= rand(1,5)*fire_dam_coeff + health -= rand(1,5)*brute_dam_coeff + healthcheck() + return + return + +/obj/vehicle/emp_act(severity) + var/was_on = on + stat |= EMPED + var/obj/effect/overlay/pulse2 = new/obj/effect/overlay ( src.loc ) + pulse2.icon = 'icons/effects/effects.dmi' + pulse2.icon_state = "empdisable" + pulse2.name = "emp sparks" + pulse2.anchored = 1 + pulse2.dir = pick(cardinal) + + spawn(10) + pulse2.delete() + if(on) + turn_off() + spawn(severity*300) + stat &= ~EMPED + if(was_on) + turn_on() + +/obj/vehicle/attack_ai(mob/user as mob) + return + +/obj/vehicle/proc/handle_rotation() + return + +//------------------------------------------- +// Vehicle procs +//------------------------------------------- +/obj/vehicle/proc/turn_on() + if(stat) + return 0 + if(powered && cell.charge < charge_use) + return 0 + on = 1 + luminosity = initial(luminosity) + update_icon() + return 1 + +/obj/vehicle/proc/turn_off() + on = 0 + luminosity = 0 + update_icon() + +/obj/vehicle/proc/Emag(mob/user as mob) + emagged = 1 + + if(locked) + locked = 0 + user << "You bypass [src]'s controls." + +/obj/vehicle/proc/explode() + src.visible_message("\red [src] blows apart!", 1) + var/turf/Tsec = get_turf(src) + + new /obj/item/stack/rods(Tsec) + new /obj/item/stack/rods(Tsec) +// new /obj/item/stack/cable_coil/cut(Tsec) THIS DOESN'T WORK SO I'M GETTING RID OF IT. + + if(cell) + cell.forceMove(Tsec) + 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) + new /obj/effect/decal/cleanable/blood/oil(src.loc) + + del(src) + +/obj/vehicle/proc/healthcheck() + if(health <= 0) + explode() + +/obj/vehicle/proc/powercheck() + if(!cell && !powered) + return + + if(!cell && powered) + turn_off() + return + + if(cell.charge < charge_use) + turn_off() + return + + if(cell && powered) + turn_on() + return + +/obj/vehicle/proc/insert_cell(var/obj/item/weapon/cell/C, var/mob/living/carbon/human/H) + if(cell) + return + if(!istype(C)) + return + + H.drop_from_inventory(C) + C.forceMove(src) + cell = C + powercheck() + usr << "You install [C] in [src]." + +/obj/vehicle/proc/remove_cell(var/mob/living/carbon/human/H) + if(!cell) + return + + usr << "You remove [cell] from [src]." + cell.forceMove(get_turf(H)) + H.put_in_hands(cell) + cell = null + powercheck() + +/obj/vehicle/proc/RunOver(var/mob/living/carbon/human/H) + return //write specifics for different vehicles + +//------------------------------------------- +// Loading/unloading procs +// +// Set specific item restriction checks in +// the vehicle load() definition before +// calling this parent proc. +//------------------------------------------- +/obj/vehicle/proc/load(var/atom/movable/C) + //define allowed items for loading in specific vehicle definitions + + if(!isturf(C.loc)) //To prevent loading things from someone's inventory, which wouldn't get handled properly. + return 0 + if(load || C.anchored) + return 0 + + // if a create/closet, close before loading + var/obj/structure/closet/crate = C + if(istype(crate)) + crate.close() + + C.forceMove(loc) + C.dir = dir + C.anchored = 1 + + load = C + + if(load_item_visible) + C.pixel_x += load_offset_x + 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)) + var/mob/M = C + M.buckled = src + M.update_canmove() + + return 1 + + +/obj/vehicle/proc/unload(var/mob/user, var/direction) + if(!load) + return + + var/turf/dest = null + + //find a turf to unload to + if(direction) //if direction specified, unload in that direction + dest = get_step(src, direction) + else if(user) //if a user has unloaded the vehicle, unload at their feet + dest = get_turf(user) + + if(!dest) + dest = get_step_to(src, get_step(src, turn(dir, 90))) //try unloading to the side of the vehicle first if neither of the above are present + + //if these all result in the same turf as the vehicle or nullspace, pick a new turf with open space + if(!dest || dest == get_turf(src)) + 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 && load.Adjacent(new_dir)) + options += new_dir + if(options.len) + dest = pick(options) + else + dest = get_turf(src) //otherwise just dump it on the same turf as the vehicle + + if(!isturf(dest)) //if there still is nowhere to unload, cancel out since the vehicle is probably in nullspace + return 0 + + load.forceMove(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 + M.buckled = null + M.anchored = initial(M.anchored) + M.update_canmove() + + load = null + + return 1 + + +//------------------------------------------------------- +// Stat update procs +//------------------------------------------------------- +/obj/vehicle/proc/update_stats() + return \ No newline at end of file diff --git a/data/investigate/gravity.html b/data/investigate/gravity.html index cbab9d0b..7166030e 100644 --- a/data/investigate/gravity.html +++ b/data/investigate/gravity.html @@ -1,12 +1,18 @@ -22:30 [0x20078ca] (92,152,1) || the gravitational generator has regained power.
-22:30 [0x20078ca] (92,152,1) || the gravitational generator is now charging.
-22:31 [0x20078ca] (92,152,1) || the gravitational generator has regained power.
-22:31 [0x20078ca] (92,152,1) || the gravitational generator is now charging.
-22:31 [0x20078ca] (92,152,1) || the gravitational generator has regained power.
-22:31 [0x20078ca] (92,152,1) || the gravitational generator is now charging.
-22:36 [0x20078ca] (92,152,1) || the gravitational generator has regained power.
-22:36 [0x20078ca] (92,152,1) || the gravitational generator is now charging.
-22:41 [0x20078ca] (92,152,1) || the gravitational generator has regained power.
-22:41 [0x20078ca] (92,152,1) || the gravitational generator is now charging.
-22:45 [0x20078ca] (92,152,1) || the gravitational generator has regained power.
-22:45 [0x20078ca] (92,152,1) || the gravitational generator is now charging.
+23:57 [0x200793a] (92,152,1) || the gravitational generator has regained power.
+23:57 [0x200793a] (92,152,1) || the gravitational generator is now charging.
+23:57 [0x200793a] (92,152,1) || the gravitational generator has regained power.
+23:57 [0x200793a] (92,152,1) || the gravitational generator is now charging.
+23:58 [0x200793a] (92,152,1) || the gravitational generator has regained power.
+23:58 [0x200793a] (92,152,1) || the gravitational generator is now charging.
+00:03 [0x200793a] (92,152,1) || the gravitational generator has regained power.
+00:03 [0x200793a] (92,152,1) || the gravitational generator is now charging.
+00:08 [0x200793a] (92,152,1) || the gravitational generator has regained power.
+00:08 [0x200793a] (92,152,1) || the gravitational generator is now charging.
+00:12 [0x200793a] (92,152,1) || the gravitational generator has regained power.
+00:12 [0x200793a] (92,152,1) || the gravitational generator is now charging.
+00:17 [0x200793a] (92,152,1) || the gravitational generator has regained power.
+00:17 [0x200793a] (92,152,1) || the gravitational generator is now charging.
+00:22 [0x200793a] (92,152,1) || the gravitational generator has regained power.
+00:22 [0x200793a] (92,152,1) || the gravitational generator is now charging.
+00:27 [0x200793a] (92,152,1) || the gravitational generator has regained power.
+00:27 [0x200793a] (92,152,1) || the gravitational generator is now charging.
diff --git a/icons/obj/vehicles.dmi b/icons/obj/vehicles.dmi index fd6daee8..e7027559 100644 Binary files a/icons/obj/vehicles.dmi and b/icons/obj/vehicles.dmi differ