From 70d96aedde2c6d4ceba79df95380ec9c82aa6575 Mon Sep 17 00:00:00 2001 From: Hubblenaut Date: Thu, 29 May 2014 22:51:36 +0200 Subject: [PATCH] Makes crashing into things possible with extinguisher or harm intent --- .../objects/items/weapons/extinguisher.dm | 5 + .../structures/stool_bed_chair_nest/chairs.dm | 38 +++++- .../stool_bed_chair_nest/wheelchair.dm | 115 ++++++++++++------ 3 files changed, 117 insertions(+), 41 deletions(-) diff --git a/code/game/objects/items/weapons/extinguisher.dm b/code/game/objects/items/weapons/extinguisher.dm index e1d42e21d6e..4742ef912d1 100644 --- a/code/game/objects/items/weapons/extinguisher.dm +++ b/code/game/objects/items/weapons/extinguisher.dm @@ -146,8 +146,12 @@ if(usr.buckled && isobj(usr.buckled) && !usr.buckled.anchored ) spawn(0) + var/obj/structure/stool/bed/chair/C = null + if(istype(usr.buckled, /obj/structure/stool/bed/chair)) + C = usr.buckled var/obj/B = usr.buckled var/movementdirection = turn(direction,180) + if(C) C.propelled = 1 B.Move(get_step(usr,movementdirection), movementdirection) sleep(1) B.Move(get_step(usr,movementdirection), movementdirection) @@ -159,6 +163,7 @@ B.Move(get_step(usr,movementdirection), movementdirection) sleep(2) B.Move(get_step(usr,movementdirection), movementdirection) + if(C) C.propelled = 0 sleep(3) B.Move(get_step(usr,movementdirection), movementdirection) sleep(3) diff --git a/code/game/objects/structures/stool_bed_chair_nest/chairs.dm b/code/game/objects/structures/stool_bed_chair_nest/chairs.dm index 9c5aecfab68..0502eaa901a 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/chairs.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/chairs.dm @@ -3,6 +3,8 @@ desc = "You sit in this. Either by will or force." icon_state = "chair" + var/propelled = 0 // Check for fire-extinguisher-driven chairs + /obj/structure/stool/MouseDrop(atom/over_object) return @@ -113,13 +115,39 @@ /obj/structure/stool/bed/chair/office/Move() ..() if(buckled_mob) - buckled_mob.buckled = null //Temporary, so Move() succeeds. - var/moved = buckled_mob.Move(src.loc) - buckled_mob.buckled = src - if(!moved) - unbuckle() + var/mob/living/occupant = buckled_mob + occupant.buckled = null + occupant.Move(src.loc) + occupant.buckled = src + if (occupant && (src.loc != occupant.loc)) + if (propelled) + for (var/mob/O in src.loc) + if (O != occupant) + Bump(O) + else + unbuckle() handle_rotation() +/obj/structure/stool/bed/chair/office/Bump(atom/A) + ..() + if(!buckled_mob) return + + if(propelled) + var/mob/living/occupant = buckled_mob + unbuckle() + occupant.throw_at(A, 3, 2) + occupant.apply_effect(6, STUN, 0) + occupant.apply_effect(6, WEAKEN, 0) + occupant.apply_effect(6, STUTTER, 0) + playsound(src.loc, 'sound/weapons/punch1.ogg', 50, 1, -1) + if(istype(A, /mob/living)) + var/mob/living/victim = A + victim.apply_effect(6, STUN, 0) + victim.apply_effect(6, WEAKEN, 0) + victim.apply_effect(6, STUTTER, 0) + victim.take_organ_damage(10) + occupant.visible_message("[occupant] clashed into \the [A]!") + /obj/structure/stool/bed/chair/office/light icon_state = "officechair_white" diff --git a/code/game/objects/structures/stool_bed_chair_nest/wheelchair.dm b/code/game/objects/structures/stool_bed_chair_nest/wheelchair.dm index 65794bc6b52..c3ad95b8323 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/wheelchair.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/wheelchair.dm @@ -21,52 +21,68 @@ pulling = null user.pulledby = null user << "\red You lost your grip!" - else if(user.pulling) + return + if(user.pulling) pulling = null user.pulledby = null - else if(pulling && (get_dist(src, pulling) > 1)) + return + if(propelled) + return + if(pulling && (get_dist(src, pulling) > 1)) pulling = null user.pulledby = null - else if(pulling && (get_dir(src.loc, pulling.loc) == direction)) + return + if(pulling && (get_dir(src.loc, pulling.loc) == direction)) user << "\red You cannot go there." - else if(pulling && buckled_mob && (buckled_mob == user)) + return + 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 + return + + // 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) + if(get_dist(src, pulling) > 1) // We are too far away? Losing control. + pulling = null + user.pulledby = null + 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() + var/mob/living/occupant = buckled_mob + occupant.buckled = null + occupant.Move(src.loc) + occupant.buckled = src + if (occupant && (src.loc != occupant.loc)) + if (propelled) + for (var/mob/O in src.loc) + if (O != occupant) + Bump(O) + else + unbuckle() handle_rotation() /obj/structure/stool/bed/chair/wheelchair/attack_hand(mob/user as mob) @@ -100,6 +116,33 @@ pulling = null return +/obj/structure/stool/bed/chair/wheelchair/Bump(atom/A) + ..() + if(!buckled_mob) return + + if(propelled || (pulling && (pulling.a_intent == "hurt"))) + var/mob/living/occupant = buckled_mob + unbuckle() + occupant.throw_at(A, 3, 2) + occupant.apply_effect(6, STUN, 0) + occupant.apply_effect(6, WEAKEN, 0) + occupant.apply_effect(6, STUTTER, 0) + playsound(src.loc, 'sound/weapons/punch1.ogg', 50, 1, -1) + if(istype(A, /mob/living)) + var/mob/living/victim = A + victim.apply_effect(6, STUN, 0) + victim.apply_effect(6, WEAKEN, 0) + victim.apply_effect(6, STUTTER, 0) + victim.take_organ_damage(10) + if(pulling) + occupant.visible_message("[pulling] has thrusted \the [name] into \the [A], throwing \the [occupant] out of it!") + + pulling.attack_log += "\[[time_stamp()]\] Clashed [occupant.name]'s ([occupant.ckey]) [name] into \a [A]" + occupant.attack_log += "\[[time_stamp()]\] Thrusted into \a [A] by [pulling.name] ([pulling.ckey]) with \the [name]" + msg_admin_attack("[pulling.name] ([pulling.ckey]) has thrusted [occupant.name]'s ([occupant.ckey]) [name] into \a [A] (JMP)") + else + occupant.visible_message("[occupant] clashed into \the [A]!") + /obj/structure/stool/bed/chair/wheelchair/buckle_mob(mob/M as mob, mob/user as mob) if(M == pulling) pulling = null