diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 4f8c26a5fa..eda14e2561 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -76,6 +76,16 @@ do_animate("deny") return + if(istype(AM, /obj/vehicle)) + var/obj/vehicle/V = AM + if(density) + if(V.airlock_automatic_opening && V.load && (src.allowed(V.load) || emergency)) + open() + else + do_animate("deny") + return + + if(istype(AM, /obj/structure/stool/bed/chair/wheelchair)) var/obj/structure/stool/bed/chair/wheelchair/wheel = AM if(density) diff --git a/code/modules/research/designs/mechfabricator_designs.dm b/code/modules/research/designs/mechfabricator_designs.dm index 77534f9b74..b71a2da010 100644 --- a/code/modules/research/designs/mechfabricator_designs.dm +++ b/code/modules/research/designs/mechfabricator_designs.dm @@ -908,3 +908,12 @@ materials = list(MAT_METAL=500) construction_time = 50 category = list("Misc") + +/datum/design/segway_common + name = "Segway" + id = "segway_common" + build_type = MECHFAB + build_path =/obj/vehicle/segway + materials = list(MAT_METAL=35000, MAT_GLASS=2500) + construction_time = 80 + category = list("Misc") diff --git a/code/modules/vehicles/segway.dm b/code/modules/vehicles/segway.dm new file mode 100644 index 0000000000..4a64e16278 --- /dev/null +++ b/code/modules/vehicles/segway.dm @@ -0,0 +1,121 @@ +/obj/vehicle/segway + name = "segway" + desc = "two-wheeled vehicle of fashion, WOAH!" + icon_state = "segway" + dir = SOUTH + + load_item_visible = 1 + mob_offset_y = 5 + health = 100 + maxhealth = 100 + on = 1 + can_pull = 1 + anchored = 0 + layer = MOB_LAYER + 2 + airlock_automatic_opening = 1 + + fire_dam_coeff = 0.75 + brute_dam_coeff = 0.65 + var/protection_percent = 60 + + var/land_speed = 1.5 + var/space_speed = 0 + + var/step_energy_drain = 5 + var/obj/item/weapon/stock_parts/cell/powercell = null + +/obj/vehicle/segway/load(mob/living/M) + if(!istype(M)) + return FALSE + if(M.buckled || M.incapacitated() || M.lying || !Adjacent(M) || !M.Adjacent(src)) + return FALSE + . = ..() + if( . ) + M.layer = layer - 0.9 + return + +/obj/vehicle/segway/MouseDrop_T(mob/living/M, mob/living/user) + if(!istype(user, /mob/living/carbon/human) || !istype(M, /mob/living/carbon/human)) + return + if(isessence(user)) + return + if(user.incapacitated() || user.lying) + return + if(!load(M)) + to_chat(user, "You were unable to load \the [M] onto \the [src].") + return + +/obj/vehicle/segway/atom_init() + . = ..() + overlays += image('icons/obj/vehicles.dmi', "[icon_state]_overlay", MOB_LAYER + 1) + turn_off() + +/obj/vehicle/segway/relaymove(mob/user, direction) + if(user.stat || user.stunned || user.weakened || user.paralysis) + unload(user) + return + if(open || !(powercell && powercell.charge >= step_energy_drain)) + return + + . = Move(get_step(src, direction)) + if(.) + powercell.charge = max(0, powercell.charge - step_energy_drain) + user.dir = dir + +/obj/vehicle/segway/Move(var/turf/destination) + if(istype(destination,/turf/space)) + if(!space_speed) + return 0 + move_delay = space_speed + slow_cooef + else + if(!land_speed) + return 0 + move_delay = land_speed + slow_cooef + return ..() + +/obj/vehicle/segway/attack_hand(mob/user) + if(!load) + return + user.SetNextMove(CLICK_CD_MELEE) + if(load != user) + if(do_after(user, 20, target=src)) + load.visible_message(\ + "[load.name] was unbuckled by [user.name]!",\ + "You were unbuckled from [src] by [user.name].",\ + "You hear metal clanking.") + unload(load) + else + load.visible_message(\ + "[load.name] unbuckled \himself!",\ + "You unbuckle yourself from [src].",\ + "You hear metal clanking.") + unload(load) + +/obj/vehicle/segway/attackby(obj/item/weapon/W, mob/user) + if(istype(W, /obj/item/weapon/stock_parts/cell) && !powercell && open) + user.drop_item() + W.forceMove(src) + powercell = W + user.visible_message("[user] inserts a cell into the [name].", "You insert a cell into the [name].") + turn_on() + return + if(istype(W, /obj/item/weapon/crowbar)) + if(open && powercell) + powercell.forceMove(loc) + powercell = null + user.visible_message("[user] removes the cell from the [name].", "You remove the cell from the [name].") + turn_off() + return + return ..() + +/obj/vehicle/segway/examine(mob/user) + ..() + to_chat(user, " [open ? "Maintenance panel is open. " : "Maintenance panel is closed. "] [ open && !powercell ? "Powercell is missing. " : "" ]") + +/obj/vehicle/segway/turn_on() + light_power = 3 + return ..() + +/obj/vehicle/segway/turn_off() + light_power = 0 + ..() \ No newline at end of file diff --git a/code/modules/vehicles/vehicle.dm b/code/modules/vehicles/vehicle.dm index 958d0eba74..a4c533691c 100644 --- a/code/modules/vehicles/vehicle.dm +++ b/code/modules/vehicles/vehicle.dm @@ -27,12 +27,14 @@ var/stat = 0 var/move_delay = 1 //set this to limit the speed of the vehicle var/slow_cooef = 0 + var/can_pull = 0 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 + var/airlock_automatic_opening = 0 //set this 1 if you want airlocks to open(or not open) when you bump into them //------------------------------------------- // Standard procs @@ -54,7 +56,6 @@ //See load_object() proc in cargo_trains.dm for an example if(load && !istype(load, /datum/vehicle_dummy_load)) load.Move(loc, dir) - return 1 else return 0 @@ -62,7 +63,7 @@ /obj/vehicle/proc/can_move() if(world.time <= l_move_time + move_delay) return 0 - if(!on) + if(!on && !can_pull) return 0 if(istype(loc, /turf/space) && !istype(src, /obj/vehicle/space)) return 0 diff --git a/icons/obj/vehicles.dmi b/icons/obj/vehicles.dmi index 6e9a67f10f..d25df9a555 100644 Binary files a/icons/obj/vehicles.dmi and b/icons/obj/vehicles.dmi differ diff --git a/taucetistation.dme b/taucetistation.dme index 7114023694..a67b30e7db 100644 --- a/taucetistation.dme +++ b/taucetistation.dme @@ -1794,6 +1794,7 @@ #include "code\modules\telesci\telepad.dm" #include "code\modules\telesci\telesci_computer.dm" #include "code\modules\tooltip\tooltip.dm" +#include "code\modules\vehicles\segway.dm" #include "code\modules\vehicles\spacebike.dm" #include "code\modules\vehicles\vehicle.dm" #include "code\modules\ventcrawl\ventcrawl.dm"