-tg- buckling system

This commit overhauls a bunch of systems so that buckling works for
any subtype of /obj. This means that space vines and chairs and beds all
use the same system. A lot of stuff has been touched.
This commit is contained in:
Tigercat2000
2015-09-24 15:52:10 -07:00
parent 87147930d0
commit 4f3938d68b
38 changed files with 457 additions and 526 deletions
+1 -1
View File
@@ -24,7 +24,7 @@
src.ExtinguishMob()
if(src.buckled)
src.buckled.unbuckle()
src.buckled.unbuckle_mob()
if(src.pulling && src.bloodcrawl == BLOODCRAWL_EAT)
if(istype(src.pulling, /mob/living/))
var/mob/living/victim = src.pulling
+6 -1
View File
@@ -529,6 +529,8 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump,
update_inv_wear_mask(0)
else if(I == handcuffed)
handcuffed = null
if(buckled && buckled.buckle_requires_restraints)
buckled.unbuckle_mob()
update_inv_handcuffed(1)
else if(I == legcuffed)
legcuffed = null
@@ -677,6 +679,9 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump,
/mob/living/carbon/proc/canBeHandcuffed()
return 0
/mob/living/carbon/fall(forced)
loc.handle_fall(src, forced)//it's loc so it doesn't call the mob's handle_fall which does nothing
/mob/living/carbon/is_muzzled()
return(istype(src.wear_mask, /obj/item/clothing/mask/muzzle))
@@ -686,7 +691,7 @@ var/list/ventcrawl_machinery = list(/obj/machinery/atmospherics/unary/vent_pump,
return -6
else
return initial(pixel_y)
/mob/living/carbon/get_all_slots()
return list(l_hand,
r_hand,
@@ -396,23 +396,4 @@ This function restores all organs.
// Will set our damageoverlay icon to the next level, which will then be set back to the normal level the next mob.Life().
updatehealth()
hud_updateflag |= 1 << HEALTH_HUD
return 1
// incredibly important stuff follows
/mob/living/carbon/human/fall(var/forced)
..()
if(forced)
playsound(loc, "bodyfall", 50, 1, -1)
/* if(head)
var/multiplier = 1
if(stat || (status_flags & FAKEDEATH))
multiplier = 2
var/obj/item/clothing/head/H = head
if(!istype(H) || prob(H.loose * multiplier))
unEquip(H)
if(prob(60))
step_rand(H)
if(!stat)
src << "<span class='warning'>Your [H] fell off!</span>" */
return 1
@@ -193,7 +193,7 @@ emp_act
var/turf/picked = pick(turfs)
if(!isturf(picked)) return
if(buckled)
buckled.unbuckle()
buckled.unbuckle_mob()
src.loc = picked
return 1
return 0
+9 -4
View File
@@ -400,8 +400,11 @@
return
/mob/living/Move(a, b, flag)
if (buckled)
return
if (buckled && buckled.loc != a)
if (!buckled.anchored)
return buckled.Move(a, b)
else
return 0
if (restrained())
stop_pulling()
@@ -639,10 +642,10 @@
for(var/mob/O in viewers(C))
O.show_message("\red <B>[usr] manages to unbuckle themself!</B>", 1)
C << "\blue You successfully unbuckle yourself."
C.buckled.manual_unbuckle(C)
C.buckled.user_unbuckle_mob(C,C)
else
L.buckled.manual_unbuckle(L)
L.buckled.user_unbuckle_mob(L,L)
/* resist_closet() allows a mob to break out of a welded/locked closet
*/////
@@ -779,6 +782,8 @@
CM.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" ))
qdel(CM.handcuffed)
CM.handcuffed = null
if(CM.buckled && CM.buckled.buckle_requires_restraints)
CM.buckled.unbuckle_mob()
CM.update_inv_handcuffed()
return
+5 -1
View File
@@ -12,7 +12,7 @@
*/
/mob/living/proc/run_armor_check(var/def_zone = null, var/attack_flag = "melee", var/absorb_text = null, var/soften_text = null, armour_penetration, penetrated_text)
var/armor = getarmor(def_zone, attack_flag)
//the if "armor" check is because this is used for everything on /living, including humans
if(armor && armor < 100 && armour_penetration) // Armor with 100+ protection can not be penetrated for admin items
armor = max(0, armor - armour_penetration)
@@ -368,3 +368,7 @@
else*///This is an example of how you can make special types of grabs simply based on direction.
if(!supress_message)
visible_message("<span class='warning'>[user] has grabbed [src] passively!</span>")
/mob/living/incapacitated()
if(stat || paralysis || stunned || weakened || restrained())
return 1
+18 -62
View File
@@ -135,6 +135,9 @@
/mob/proc/restrained()
return
/mob/proc/incapacitated()
return
//This proc is called whenever someone clicks an inventory ui slot.
/mob/proc/attack_ui(slot)
var/obj/item/W = get_active_hand()
@@ -989,76 +992,29 @@ var/list/slot_equipment_priority = list( \
//Updates canmove, lying and icons. Could perhaps do with a rename but I can't think of anything to describe it.
/mob/proc/update_canmove()
var/ko = weakened || paralysis || stat || (status_flags & FAKEDEATH)
if(ko || resting || buckled)
canmove = 0
if(!lying)
if(resting) //Presuming that you're resting on a bed, which would look goofy lying the wrong way
lying = 90
else
lying = pick(90, 270) //180 looks like shit since BYOND inverts rather than turns in that case
else if(stunned)
drop_l_hand()
var/buckle_lying = !(buckled && !buckled.buckle_lying)
if(ko || resting || stunned)
drop_r_hand()
canmove = 0
drop_l_hand()
else
lying = 0
canmove = 1
var/is_movable
if(buckled && istype(buckled))
is_movable = buckled.movable
if(istype(buckled, /obj/vehicle))
var/obj/vehicle/V = buckled
if(stat || weakened || paralysis || resting || sleeping || (status_flags & FAKEDEATH))
lying = 90
canmove = 0
pixel_y = V.mob_offset_y - 5
else
lying = 0
canmove = 1
pixel_y = V.mob_offset_y
else if(buckled && (!buckled.movable))
anchored = 1
canmove = 0
if( istype(buckled,/obj/structure/stool/bed/chair) )
lying = 0
else
lying = 90
else if(buckled && is_movable)
anchored = 0
canmove = 1
lying = 0
else if( stat || weakened || paralysis || resting || sleeping || (status_flags & FAKEDEATH))
lying = 90
canmove = 0
else if( stunned )
drop_l_hand()
drop_r_hand()
canmove = 0
if(buckled)
lying = 90 * buckle_lying
else
lying = 0
canmove = 1
if(lying)
density = 0
drop_l_hand()
drop_r_hand()
else
density = 1
//Temporarily moved here from the various life() procs
//I'm fixing stuff incrementally so this will likely find a better home.
//It just makes sense for now. ~Carn
if(lying != lying_prev)
if(lying && !lying_prev)
if((ko || resting) && !lying)
fall(ko)
if(update_icon) //forces a full overlay update
update_icon = 0
regenerate_icons()
canmove = !(ko || resting || stunned || buckled)
density = !lying
if(lying)
if(layer == initial(layer))
layer = MOB_LAYER - 0.2
else
if(layer == MOB_LAYER - 0.2)
layer = initial(layer)
update_transform()
lying_prev = lying
return canmove
/mob/proc/fall(var/forced)
+4 -20
View File
@@ -225,13 +225,15 @@
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.remote_control) //we're controlling something, our movement is relayed to it
return mob.remote_control.relaymove(mob, direct)
if(isAI(mob))
return AIMove(n,direct,mob)
return AIMove(n,direct,mob)
if(!mob.canmove)
return
@@ -280,24 +282,6 @@
var/tickcomp = ((1/(world.tick_lag))*1.3)
move_delay = move_delay + tickcomp
if(istype(mob.buckled, /obj/vehicle) || istype(mob.buckled, /obj/structure/stool/bed/chair/cart))
return mob.buckled.relaymove(mob,direct)
if(mob.pulledby || mob.buckled) // Wheelchair driving!
if(istype(mob.loc, /turf/space))
return // No wheelchair driving in space
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/obj/item/organ/external/l_hand = driver.get_organ("l_hand")
var/obj/item/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
//Something with pulling things