mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-29 11:31:51 +00:00
Adds Wheelchairs with basic driving functionality
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
107
code/game/objects/structures/stool_bed_chair_nest/wheelchair.dm
Normal file
107
code/game/objects/structures/stool_bed_chair_nest/wheelchair.dm
Normal file
@@ -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
|
||||
..()
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
if (istype(loc, /turf/space)) return -1 // It's hard to be slowed down in space by... anything
|
||||
|
||||
if(embedded_flag)
|
||||
if(embedded_flag)
|
||||
handle_embedded_objects() //Moving with objects stuck in you can cause bad times.
|
||||
|
||||
if(reagents.has_reagent("hyperzine")) return -1
|
||||
@@ -22,17 +22,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
|
||||
|
||||
|
||||
@@ -177,7 +177,14 @@
|
||||
|
||||
if(mob.stat==2) return
|
||||
|
||||
if(isAI(mob)) return AIMove(n,direct,mob)
|
||||
// handle possible spirit movement
|
||||
if(istype(mob,/mob/spirit))
|
||||
var/mob/spirit/currentSpirit = mob
|
||||
return currentSpirit.Spirit_Move(direct)
|
||||
|
||||
// handle possible AI movement
|
||||
if(isAI(mob))
|
||||
return AIMove(n,direct,mob)
|
||||
|
||||
if(mob.monkeyizing) return//This is sota the goto stop mobs from moving var
|
||||
|
||||
@@ -195,10 +202,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
|
||||
@@ -246,7 +253,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
|
||||
|
||||
Reference in New Issue
Block a user