Adds Wheelchairs with basic driving functionality

Conflicts:
	baystation12.dme
	icons/obj/objects.dmi
This commit is contained in:
Hubblenaut
2014-06-03 18:46:21 -04:00
committed by ZomgPonies
parent 2a2cfacc44
commit 2e644b845a
6 changed files with 152 additions and 14 deletions
+1
View File
@@ -738,6 +738,7 @@
#include "code\game\objects\structures\stool_bed_chair_nest\bed.dm"
#include "code\game\objects\structures\stool_bed_chair_nest\chairs.dm"
#include "code\game\objects\structures\stool_bed_chair_nest\stools.dm"
#include "code\game\objects\structures\stool_bed_chair_nest\wheelchair.dm"
#include "code\game\objects\structures\transit_tubes\station.dm"
#include "code\game\objects\structures\transit_tubes\transit_tube.dm"
#include "code\game\objects\structures\transit_tubes\transit_tube_pod.dm"
+8
View File
@@ -81,6 +81,14 @@
else
flick("door_deny", src)
return
if(istype(AM, /obj/structure/stool/bed/chair/wheelchair))
var/obj/structure/stool/bed/chair/wheelchair/wheel = AM
if(density)
if(wheel.pulling && (src.allowed(wheel.pulling)))
open()
else
flick("door_deny", src)
return
return
@@ -0,0 +1,107 @@
/obj/structure/stool/bed/chair/wheelchair
name = "wheelchair"
desc = "You sit in this. Either by will or force."
icon_state = "wheelchair"
anchored = 0
var/driving = 0
var/mob/living/pulling = null
/obj/structure/stool/bed/chair/wheelchair/handle_rotation()
overlays = null
var/image/O = image(icon = 'icons/obj/objects.dmi', icon_state = "w_overlay", layer = FLY_LAYER, dir = src.dir)
overlays += O
if(buckled_mob)
buckled_mob.dir = dir
/obj/structure/stool/bed/chair/wheelchair/relaymove(mob/user, direction)
if(user.stat || user.stunned || user.weakened || user.paralysis || user.lying || user.restrained())
if(user==pulling)
pulling = null
user.pulledby = null
user << "\red You lost your grip!"
else if(user.pulling)
pulling = null
user.pulledby = null
else if(pulling && (get_dist(src, pulling) > 1))
pulling = null
user.pulledby = null
else if(pulling && (get_dir(src.loc, pulling.loc) == direction))
user << "\red You cannot go there."
else if(pulling && buckled_mob && (buckled_mob == user))
user << "\red You cannot drive while being pushed."
else
// Let's roll
driving = 1
var/turf/T = null
//--1---Move occupant---1--//
if(buckled_mob)
buckled_mob.buckled = null
step(buckled_mob, direction)
buckled_mob.buckled = src
//--2----Move driver----2--//
if(pulling)
T = pulling.loc
if(get_dist(src, pulling) >= 1)
step(pulling, get_dir(pulling.loc, src.loc))
//--3--Move wheelchair--3--//
step(src, direction)
if(buckled_mob) // Make sure it stays beneath the occupant
Move(buckled_mob.loc)
dir = direction
handle_rotation()
if(pulling) // Driver
if(pulling.loc == src.loc) // We moved onto the wheelchair? Revert!
pulling.loc = T
else
spawn(0)
pulling.dir = get_dir(pulling, src) // When everything is right, face the wheelchair
driving = 0
/obj/structure/stool/bed/chair/wheelchair/Move()
..()
if(!driving && buckled_mob)
buckled_mob.buckled = null
buckled_mob.Move(src.loc)
buckled_mob.buckled = src
if (buckled_mob && (src.loc != buckled_mob.loc))
unbuckle()
handle_rotation()
/obj/structure/stool/bed/chair/wheelchair/attack_hand(mob/user as mob)
if (pulling && (pulling == usr))
MouseDrop(usr)
else
manual_unbuckle(user)
return
/obj/structure/stool/bed/chair/wheelchair/MouseDrop(over_object, src_location, over_location)
..()
if(over_object == usr && in_range(src, usr))
if(!ishuman(usr)) return
if(usr == buckled_mob)
usr << "\red You realize you are unable to push the wheelchair you sit in."
return
if(!pulling)
pulling = usr
usr.pulledby = src
if(usr.pulling)
usr.stop_pulling()
usr.dir = get_dir(usr, src)
usr << "You grip \the [name]'s handles."
else
if(usr != pulling)
for(var/mob/O in viewers(pulling, null))
O.show_message("\red [usr] breaks [pulling]'s grip on the wheelchair.", 1)
else
usr << "You let go of \the [name]'s handles."
pulling.pulledby = null
pulling = null
return
/obj/structure/stool/bed/chair/wheelchair/buckle_mob(mob/M as mob, mob/user as mob)
if(M == pulling)
pulling = null
usr.pulledby = null
..()
@@ -30,17 +30,28 @@
if(wear_suit)
tally += wear_suit.slowdown
if(shoes)
tally += shoes.slowdown
if(!pulledby || (pulledby && !istype(pulledby, /obj/structure/stool/bed/chair/wheelchair)))
if(shoes)
tally += shoes.slowdown
for(var/organ_name in list("l_foot","r_foot","l_leg","r_leg"))
var/datum/organ/external/E = get_organ(organ_name)
if(!E || (E.status & ORGAN_DESTROYED))
tally += 4
if(E.status & ORGAN_SPLINTED)
tally += 0.5
else if(E.status & ORGAN_BROKEN)
tally += 1.5
for(var/organ_name in list("l_foot","r_foot","l_leg","r_leg"))
var/datum/organ/external/E = get_organ(organ_name)
if(!E || (E.status & ORGAN_DESTROYED))
tally += 4
if(E.status & ORGAN_SPLINTED)
tally += 0.5
else if(E.status & ORGAN_BROKEN)
tally += 1.5
if(pulledby && istype(pulledby, /obj/structure/stool/bed/chair/wheelchair))
for(var/organ_name in list("l_hand","r_hand","l_arm","r_arm"))
var/datum/organ/external/E = get_organ(organ_name)
if(!E || (E.status & ORGAN_DESTROYED))
tally += 4
if(E.status & ORGAN_SPLINTED)
tally += 0.5
else if(E.status & ORGAN_BROKEN)
tally += 1.5
if(shock_stage >= 10) tally += 3
+15 -4
View File
@@ -204,10 +204,10 @@
if(Process_Grab()) return
if(mob.buckled) //if we're buckled to something, tell it we moved.
return mob.buckled.relaymove(mob, direct)
if(!mob.canmove) return
if(!mob.canmove)
if (mob.buckled && (istype(mob.buckled, /obj/structure/stool/bed/chair/wheelchair))) // Exception for wheelchairs
else return
//if(istype(mob.loc, /turf/space) || (mob.flags & NOGRAV))
// if(!mob.Process_Spacemove(0)) return 0
@@ -255,7 +255,18 @@
move_delay = move_delay + tickcomp
if(mob.pulledby || mob.buckled) // Wheelchair driving!
if(istype(mob.pulledby, /obj/structure/stool/bed/chair/wheelchair))
return mob.pulledby.relaymove(mob, direct)
else if(istype(mob.buckled, /obj/structure/stool/bed/chair/wheelchair))
if(ishuman(mob.buckled))
var/mob/living/carbon/human/driver = mob.buckled
var/datum/organ/external/l_hand = driver.get_organ("l_hand")
var/datum/organ/external/r_hand = driver.get_organ("r_hand")
if((!l_hand || l_hand.status & ORGAN_DESTROYED) && (!r_hand || r_hand.status & ORGAN_DESTROYED))
return // No hands to drive your chair? Tough luck!
move_delay += 2
return mob.buckled.relaymove(mob,direct)
//We are now going to move
moving = 1
Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 127 KiB