wheelchair #1

vehicles can have their speed changed
all floor tiles have random pixel_x and pixel_y (instead of just metal
tiles)

wheelchair #2

wheelchairs can be ordered for 40 bucks each at cargo
medbay starts with a wheelchairs
fixzes

removes debug stuff

stuff

-rename speed var to movement_delay to be more accurate
-rename getSpeed to getMovementDelay to be more accurate
-vehicles have the same speed as they had before
-aliens and monkeys can use wheelchairs

hope

better way to do it

+ changelog

send help
This commit is contained in:
Unfit
2015-06-25 15:57:50 +02:00
parent c2df591938
commit d2e6a0e26a
15 changed files with 182 additions and 25 deletions

View File

@@ -8,6 +8,11 @@
/obj/item/stack/tile
var/material
/obj/item/stack/tile/New()
. = ..()
pixel_x = rand(1, 14)
pixel_y = rand(1, 14)
/obj/item/stack/tile/ex_act(severity)
switch(severity)
if(1.0)

View File

@@ -22,11 +22,12 @@
density = 1
nick = "honkin' ride" //For fucks sake, well then
flags = OPENCONTAINER
max_health = 100 //Bananium sheets increases maximum health by 20
var/activated = 0 //Honk to activate, it stays active while you sit in it, and will deactivate when you unbuckle
var/mode = MODE_NORMAL
//Modes 1 and 2 consume extra fuel
//Use bananium coins to cycle between modes
var/max_health = 100 //Bananium sheets increases maximum health by 20
var/max_health_top = 1000 //That's 45 sheets of Bananium, as much as four tens and five, and that's terrible
var/printing_text = "nothing" //What is printed on the ground in mode 1
var/printing_pos //'Rune' draws runes and 'graffiti' draws graffiti, other draws text

View File

@@ -25,6 +25,7 @@
var/empstun = 0
var/health = 100
var/max_health = 100
var/destroyed = 0
var/inertia_dir = 0
@@ -35,6 +36,14 @@
var/obj/item/key/mykey
var/vin=null
var/datum/delay_controller/move_delayer = new(1,ARBITRARILY_LARGE_NUMBER) //See setup.dm, 12
var/movement_delay = 0 //Speed of the vehicle decreases as this value increases. Anything above 6 is slow, 1 is fast and 0 is very fast
/obj/structure/stool/bed/chair/vehicle/proc/getMovementDelay()
return movement_delay
/obj/structure/stool/bed/chair/vehicle/proc/delayNextMove(var/delay, var/additive=0)
move_delayer.delayNext(delay,additive)
/obj/structure/stool/bed/chair/vehicle/New()
..()
@@ -90,9 +99,13 @@
if(user)
user << "<span class='warning'>\the [src] is unresponsive.</span>"
return
if(move_delayer.blocked())
return
if(istype(src.loc, /turf/space))
if(!src.Process_Spacemove(0)) return
step(src, direction)
delayNextMove(getMovementDelay())
update_mob()
handle_rotation()
/*
@@ -207,8 +220,13 @@
if(buckled_mob.buckled == src)
buckled_mob.forceMove(loc)
/obj/structure/stool/bed/chair/vehicle/buckle_mob(mob/M, mob/user)
/obj/structure/stool/bed/chair/vehicle/proc/can_buckle(mob/M, mob/user)
if(M != user || !ishuman(user) || !Adjacent(user) || user.restrained() || user.lying || user.stat || user.buckled || destroyed)
return 0
return 1
/obj/structure/stool/bed/chair/vehicle/buckle_mob(mob/M, mob/user)
if(!can_buckle(M,user))
return
unbuckle()
@@ -231,12 +249,15 @@
buckled_mob.pixel_y = 0
..()
/obj/structure/stool/bed/chair/vehicle/handle_rotation()
/obj/structure/stool/bed/chair/vehicle/handle_layer()
if(dir == SOUTH)
layer = FLY_LAYER
else
layer = OBJ_LAYER
/obj/structure/stool/bed/chair/vehicle/handle_rotation()
handle_layer()
if(buckled_mob)
if(buckled_mob.loc != loc)
buckled_mob.buckled = null //Temporary, so Move() succeeds.
@@ -303,7 +324,7 @@
HealthCheck()
/obj/structure/stool/bed/chair/vehicle/proc/HealthCheck()
if(health > 100) health = 100
if(health > max_health) health = max_health
if(health <= 0 && !destroyed)
die()
@@ -330,4 +351,4 @@
if(istype(obstacle, /obj/structure))// || istype(obstacle, /mob/living)
if(!obstacle.anchored)
obstacle.Move(get_step(obstacle,src.dir))
..()
..()

View File

@@ -0,0 +1,116 @@
/obj/structure/stool/bed/chair/vehicle/wheelchair
name = "wheelchair"
nick = "cripplin' ride"
desc = "A chair with fitted wheels. Used by handicapped to make life easier, however it still requires hands to drive."
icon = 'icons/obj/objects.dmi'
icon_state = "wheelchair"
anchored = 0
movement_delay = 3
health = 50
max_health = 50
var/image/wheel_overlay
/obj/structure/stool/bed/chair/vehicle/wheelchair/New()
.=..()
wheel_overlay = image("icons/obj/objects.dmi", "[icon_state]_overlay", MOB_LAYER + 0.1)
/obj/structure/stool/bed/chair/vehicle/wheelchair/buckle_mob()
.=..()
update_icon()
/obj/structure/stool/bed/chair/vehicle/wheelchair/unbuckle()
.=..()
update_icon()
/obj/structure/stool/bed/chair/vehicle/wheelchair/update_icon()
..()
if(buckled_mob)
overlays |= wheel_overlay
else
overlays -= wheel_overlay
/obj/structure/stool/bed/chair/vehicle/wheelchair/can_buckle(mob/M, mob/user)
if(M != user || !Adjacent(user) || (!ishuman(user) && !isalien(user) && !ismonkey(user)) || user.restrained() || user.stat || user.buckled || destroyed) //Same as vehicle/can_buckle, minus check for user.lying as well as allowing monkey and ayliens
return 0
return 1
/obj/structure/stool/bed/chair/vehicle/wheelchair/proc/check_hands(var/mob/user)
//Returns a number from 0 to 4 depending on usability of user's hands
//Human with no hands gets 0
//Human with one hand holding something gets 1
//Human with one empty hand gets 2
//Human with two hands both holding something gets 2
//Human with one empty and one full hand gets 3
//Human with two empty hands gets 4
//Wheelchair's speed depends on the resulting value
var/left_hand_exists = 1
var/right_hand_exists = 1
if(ishuman(user)) //Human check - 0 to 4
var/mob/living/carbon/human/H = user
if(H.l_hand == null) left_hand_exists++ //Check to see if left hand is holding anything
var/datum/organ/external/left_hand = H.get_organ("l_hand")
if(!left_hand)
left_hand_exists = 0
else if(left_hand.status & ORGAN_DESTROYED)
left_hand_exists = 0
if(H.r_hand == null) right_hand_exists++
var/datum/organ/external/right_hand = H.get_organ("r_hand")
if(!right_hand)
right_hand_exists = 0
else if(right_hand.status & ORGAN_DESTROYED)
right_hand_exists = 0
else if( ismonkey(user) || isalien(user) ) //Monkey and alien check - 0 to 2
left_hand_exists = 0
if(user.l_hand == null) left_hand_exists++
right_hand_exists = 0
if(user.r_hand == null) right_hand_exists++
return ( left_hand_exists + right_hand_exists )
/obj/structure/stool/bed/chair/vehicle/wheelchair/getMovementDelay()
//Speed is determined by amount of usable hands and whether they're carrying something
var/hands = check_hands(buckled_mob) //See check_hands() proc above
if(hands <= 0) return 0
return movement_delay * (4 / hands)
/obj/structure/stool/bed/chair/vehicle/wheelchair/relaymove(var/mob/user, direction)
if(!check_key(user))
user << "<span class='warning'>You need at least one hand to use [src]!</span>"
return
return ..()
/obj/structure/stool/bed/chair/vehicle/wheelchair/handle_layer()
if(dir == NORTH)
layer = FLY_LAYER
else
layer = OBJ_LAYER
/obj/structure/stool/bed/chair/vehicle/wheelchair/check_key(var/mob/user)
if(check_hands(user))
return 1
return 0
/obj/structure/stool/bed/chair/vehicle/wheelchair/emp_act(severity)
return
/obj/structure/stool/bed/chair/vehicle/wheelchair/update_mob()
if(buckled_mob)
buckled_mob.dir = dir
buckled_mob.pixel_x = 0
buckled_mob.pixel_y = 3
/obj/structure/stool/bed/chair/vehicle/wheelchair/die()
if(buckled_mob)
unbuckle()
getFromPool(/obj/item/stack/sheet/metal, get_turf(src), 4)
getFromPool(/obj/item/stack/rods, get_turf(src), 2)
qdel(src)