Merge pull request #7801 from Mloc/bs12-glowypipes

refactor buckling + glowy HE pipes
This commit is contained in:
Chinsky
2015-02-03 18:12:09 +03:00
29 changed files with 250 additions and 145 deletions

View File

@@ -211,7 +211,7 @@
/obj/structure/stool/bed/chair/janicart/relaymove(mob/user, direction)
if(user.stat || user.stunned || user.weakened || user.paralysis)
unbuckle()
unbuckle_mob()
if(istype(user.l_hand, /obj/item/key) || istype(user.r_hand, /obj/item/key))
step(src, direction)
update_mob()
@@ -226,22 +226,9 @@
buckled_mob.loc = loc
/obj/structure/stool/bed/chair/janicart/buckle_mob(mob/M, mob/user)
if(M != user || !ismob(M) || get_dist(src, user) > 1 || user.restrained() || user.lying || user.stat || M.buckled || istype(user, /mob/living/silicon))
return
unbuckle()
M.visible_message(\
"<span class='notice'>[M] climbs onto the [callme]!</span>",\
"<span class='notice'>You climb onto the [callme]!</span>")
M.buckled = src
M.loc = loc
M.set_dir(dir)
M.update_canmove()
buckled_mob = M
/obj/structure/stool/bed/chair/janicart/post_buckle_mob(mob/living/M)
update_mob()
add_fingerprint(user)
return ..()
/obj/structure/stool/bed/chair/janicart/update_layer()
@@ -251,11 +238,12 @@
layer = OBJ_LAYER
/obj/structure/stool/bed/chair/janicart/unbuckle()
if(buckled_mob)
buckled_mob.pixel_x = 0
buckled_mob.pixel_y = 0
..()
/obj/structure/stool/bed/chair/janicart/unbuckle_mob()
var/mob/living/M = ..()
if(M)
M.pixel_x = 0
M.pixel_y = 0
return M
/obj/structure/stool/bed/chair/janicart/set_dir()

View File

@@ -8,7 +8,7 @@
icon_state = "nest"
var/health = 100
/obj/structure/stool/bed/nest/manual_unbuckle(mob/user as mob)
/obj/structure/stool/bed/nest/user_unbuckle_mob(mob/user as mob)
if(buckled_mob)
if(buckled_mob.buckled == src)
if(buckled_mob != user)
@@ -18,7 +18,7 @@
"<span class='notice'>You hear squelching...</span>")
buckled_mob.pixel_y = 0
buckled_mob.old_y = 0
unbuckle()
unbuckle_mob()
else
if(world.time <= buckled_mob.last_special+NEST_RESIST_TIME)
return
@@ -32,16 +32,15 @@
buckled_mob.last_special = world.time
buckled_mob.pixel_y = 0
buckled_mob.old_y = 0
unbuckle()
unbuckle_mob()
src.add_fingerprint(user)
return
/obj/structure/stool/bed/nest/buckle_mob(mob/M as mob, mob/user as mob)
/obj/structure/stool/bed/nest/user_buckle_mob(mob/M as mob, mob/user as mob)
if ( !ismob(M) || (get_dist(src, user) > 1) || (M.loc != src.loc) || user.restrained() || usr.stat || M.buckled || istype(user, /mob/living/silicon/pai) )
return
unbuckle()
unbuckle_mob()
var/mob/living/carbon/xenos = user
var/mob/living/carbon/victim = M

View File

@@ -11,8 +11,10 @@
name = "bed"
desc = "This is used to lie in, sleep in or strap on."
icon_state = "bed"
var/mob/living/buckled_mob
var/movable = 0 // For mobility checks
can_buckle = 1
buckle_lying = 1
//var/mob/living/buckled_mob
//var/movable = 0 // For mobility checks
/obj/structure/stool/bed/psych
name = "psychiatrists couch"
@@ -24,7 +26,7 @@
desc = "This looks similar to contraptions from earth. Could aliens be stealing our technology?"
icon_state = "abed"
/obj/structure/stool/bed/Del()
/*/obj/structure/stool/bed/Del()
unbuckle()
..()
return
@@ -80,7 +82,7 @@
/obj/structure/stool/bed/proc/buckle_mob(mob/M as mob, mob/user as mob)
if (!ticker)
user << "You can't buckle anyone in before the game starts."
if ( !ismob(M) || (get_dist(src, user) > 1) || (M.loc != src.loc) || user.restrained() || user.lying || user.stat || M.buckled || M.pinned.len || istype(user, /mob/living/silicon/pai) )
if (!ismob(M) || (get_dist(src, user) > 1) || (M.loc != src.loc) || user.restrained() || user.lying || user.stat || M.buckled || M.pinned.len || istype(user, /mob/living/silicon/pai) )
return
if (istype(M, /mob/living/carbon/slime))
@@ -106,7 +108,7 @@
src.buckled_mob = M
src.add_fingerprint(user)
afterbuckle(M)
return
return*/
/*
* Roller beds
@@ -120,7 +122,7 @@
/obj/structure/stool/bed/roller/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W,/obj/item/roller_holder))
if(buckled_mob)
manual_unbuckle()
user_unbuckle_mob(user)
else
visible_message("[user] collapses \the [src.name].")
new/obj/item/roller(get_turf(src))
@@ -185,29 +187,19 @@
else
buckled_mob = null
/obj/structure/stool/bed/roller/buckle_mob(mob/M as mob, mob/user as mob)
if ( !ismob(M) || (get_dist(src, user) > 1) || (M.loc != src.loc) || user.restrained() || user.lying || user.stat || M.buckled || istype(usr, /mob/living/silicon/pai) )
return
M.pixel_y = 6
M.old_y = 6
density = 1
icon_state = "up"
..()
return
/obj/structure/stool/bed/roller/post_buckle_mob(mob/living/M as mob)
if(M == buckled_mob)
M.pixel_y = 6
M.old_y = 6
density = 1
icon_state = "up"
else
buckled_mob.pixel_y = 0
buckled_mob.old_y = 0
density = 0
icon_state = "down"
/obj/structure/stool/bed/roller/manual_unbuckle(mob/user as mob)
if(buckled_mob)
if(buckled_mob.buckled == src) //this is probably unneccesary, but it doesn't hurt
buckled_mob.pixel_y = 0
buckled_mob.old_y = 0
buckled_mob.anchored = initial(buckled_mob.anchored)
buckled_mob.buckled = null
buckled_mob.update_canmove()
buckled_mob = null
density = 0
icon_state = "down"
..()
return
return ..()
/obj/structure/stool/bed/roller/MouseDrop(over_object, src_location, over_location)
..()

View File

@@ -2,12 +2,10 @@
name = "chair"
desc = "You sit in this. Either by will or force."
icon_state = "chair"
buckle_lying = 0 //force people to sit up in chairs when buckled
var/propelled = 0 // Check for fire-extinguisher-driven chairs
/obj/structure/stool/MouseDrop(atom/over_object)
return
/obj/structure/stool/bed/chair/New()
..()
spawn(3) //sorry. i don't think there's a better way to do this.
@@ -68,11 +66,6 @@
src.set_dir(turn(src.dir, 90))
return
/obj/structure/stool/bed/chair/MouseDrop_T(mob/M as mob, mob/user as mob)
if(!istype(M)) return
buckle_mob(M, user)
return
// Chair types
/obj/structure/stool/bed/chair/wood/normal
icon_state = "wooden_chair"
@@ -105,7 +98,7 @@
return ..()
/obj/structure/stool/bed/chair/comfy/afterbuckle()
/obj/structure/stool/bed/chair/comfy/post_buckle_mob()
if(buckled_mob)
overlays += armrest
else
@@ -122,7 +115,7 @@
/obj/structure/stool/bed/chair/office
anchored = 0
movable = 1
buckle_movable = 1
/obj/structure/stool/bed/chair/comfy/black
color = rgb(167,164,153)
@@ -143,15 +136,14 @@
if (O != occupant)
Bump(O)
else
unbuckle()
unbuckle_mob()
/obj/structure/stool/bed/chair/office/Bump(atom/A)
..()
if(!buckled_mob) return
if(propelled)
var/mob/living/occupant = buckled_mob
unbuckle()
var/mob/living/occupant = unbuckle_mob()
var/def_zone = ran_zone()
var/blocked = occupant.run_armor_check(def_zone, "melee")

View File

@@ -34,7 +34,7 @@
return
/obj/structure/stool/MouseDrop(atom/over_object)
if (istype(over_object, /mob/living/carbon/human))
if(istype(over_object, /mob/living/carbon/human) && type == /obj/structure/stool) //i am sorry for this, but the inheritance mess requires it
var/mob/living/carbon/human/H = over_object
if (H==usr && !H.restrained() && !H.stat && in_range(src, over_object))
var/obj/item/weapon/stool/S = new/obj/item/weapon/stool()
@@ -42,6 +42,8 @@
src.loc = S
H.put_in_hands(S)
H.visible_message("\red [H] grabs [src] from the floor!", "\red You grab [src] from the floor!")
return
return ..()
/obj/item/weapon/stool
name = "stool"

View File

@@ -3,7 +3,7 @@
desc = "You sit in this. Either by will or force."
icon_state = "wheelchair"
anchored = 0
movable = 1
buckle_movable = 1
var/driving = 0
var/mob/living/pulling = null
@@ -93,7 +93,7 @@
if (O != occupant)
Bump(O)
else
unbuckle()
unbuckle_mob()
if (pulling && (get_dist(src, pulling) > 1))
pulling.pulledby = null
pulling << "\red You lost your grip!"
@@ -102,11 +102,11 @@
if (occupant && (src.loc != occupant.loc))
src.loc = occupant.loc // Failsafe to make sure the wheelchair stays beneath the occupant after driving
/obj/structure/stool/bed/chair/wheelchair/attack_hand(mob/user as mob)
/obj/structure/stool/bed/chair/wheelchair/attack_hand(mob/living/user as mob)
if (pulling)
MouseDrop(usr)
else
manual_unbuckle(user)
user_unbuckle_mob(user)
return
/obj/structure/stool/bed/chair/wheelchair/MouseDrop(over_object, src_location, over_location)
@@ -138,8 +138,7 @@
if(!buckled_mob) return
if(propelled || (pulling && (pulling.a_intent == "hurt")))
var/mob/living/occupant = buckled_mob
unbuckle()
var/mob/living/occupant = unbuckle_mob()
if (pulling && (pulling.a_intent == "hurt"))
occupant.throw_at(A, 3, 3, pulling)