mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-19 13:35:10 +00:00
850 lines
26 KiB
Plaintext
850 lines
26 KiB
Plaintext
/mob/living/carbon/New()
|
|
create_reagents(1000)
|
|
..()
|
|
|
|
/mob/living/carbon/prepare_huds()
|
|
..()
|
|
prepare_data_huds()
|
|
|
|
/mob/living/carbon/proc/prepare_data_huds()
|
|
..()
|
|
med_hud_set_health()
|
|
med_hud_set_status()
|
|
|
|
/mob/living/carbon/updatehealth()
|
|
..()
|
|
med_hud_set_health()
|
|
|
|
/mob/living/carbon/Destroy()
|
|
for(var/atom/movable/guts in internal_organs)
|
|
qdel(guts)
|
|
for(var/atom/movable/food in stomach_contents)
|
|
qdel(food)
|
|
remove_from_all_data_huds()
|
|
if(dna)
|
|
qdel(dna)
|
|
return ..()
|
|
|
|
/mob/living/carbon/Move(NewLoc, direct)
|
|
. = ..()
|
|
if(.)
|
|
if(src.nutrition && src.stat != 2)
|
|
src.nutrition -= HUNGER_FACTOR/10
|
|
if(src.m_intent == "run")
|
|
src.nutrition -= HUNGER_FACTOR/10
|
|
if((src.disabilities & FAT) && src.m_intent == "run" && src.bodytemperature <= 360)
|
|
src.bodytemperature += 2
|
|
|
|
|
|
/mob/living/carbon/Process_Spacemove(movement_dir = 0)
|
|
if(..())
|
|
return 1
|
|
if(!isturf(loc)) // In a mecha? A locker? Who knows!
|
|
return 0
|
|
|
|
var/obj/item/weapon/tank/jetpack/J = get_jetpack()
|
|
if(istype(J) && J.allow_thrust(0.01, src))
|
|
return 1
|
|
|
|
|
|
/mob/living/carbon/movement_delay()
|
|
. = ..()
|
|
if(legcuffed)
|
|
. += legcuffed.slowdown
|
|
|
|
/mob/living/carbon/relaymove(mob/user, direction)
|
|
if(user in src.stomach_contents)
|
|
if(prob(40))
|
|
if(prob(25))
|
|
audible_message("<span class='warning'>You hear something rumbling inside [src]'s stomach...</span>", \
|
|
"<span class='warning'>You hear something rumbling.</span>", 4,\
|
|
"<span class='userdanger'>Something is rumbling inside your stomach!</span>")
|
|
var/obj/item/I = user.get_active_hand()
|
|
if(I && I.force)
|
|
var/d = rand(round(I.force / 4), I.force)
|
|
if(istype(src, /mob/living/carbon/human))
|
|
var/mob/living/carbon/human/H = src
|
|
var/organ = H.get_organ("chest")
|
|
if (istype(organ, /obj/item/organ/limb))
|
|
var/obj/item/organ/limb/temp = organ
|
|
if(temp.take_damage(d, 0))
|
|
H.update_damage_overlays(0)
|
|
H.updatehealth()
|
|
else
|
|
src.take_organ_damage(d)
|
|
visible_message("<span class='danger'>[user] attacks [src]'s stomach wall with the [I.name]!</span>", \
|
|
"<span class='userdanger'>[user] attacks your stomach wall with the [I.name]!</span>")
|
|
playsound(user.loc, 'sound/effects/attackblob.ogg', 50, 1)
|
|
|
|
if(prob(src.getBruteLoss() - 50))
|
|
for(var/atom/movable/A in stomach_contents)
|
|
A.loc = loc
|
|
stomach_contents.Remove(A)
|
|
src.gib()
|
|
|
|
/mob/living/carbon/gib(animation = 1, var/no_brain = 0)
|
|
death(1)
|
|
for(var/obj/item/organ/internal/I in internal_organs)
|
|
if(no_brain && istype(I, /obj/item/organ/internal/brain))
|
|
continue
|
|
if(I)
|
|
I.Remove(src)
|
|
I.loc = get_turf(src)
|
|
I.throw_at_fast(get_edge_target_turf(src,pick(alldirs)),rand(1,3),5)
|
|
|
|
for(var/mob/M in src)
|
|
if(M in stomach_contents)
|
|
stomach_contents.Remove(M)
|
|
M.loc = loc
|
|
visible_message("<span class='danger'>[M] bursts out of [src]!</span>")
|
|
. = ..()
|
|
|
|
|
|
/mob/living/carbon/electrocute_act(shock_damage, obj/source, siemens_coeff = 1, override = 0, tesla_shock = 0)
|
|
shock_damage *= siemens_coeff
|
|
if(shock_damage<1 && !override)
|
|
return 0
|
|
if(reagents.has_reagent("teslium"))
|
|
shock_damage *= 1.5 //If the mob has teslium in their body, shocks are 50% more damaging!
|
|
take_overall_damage(0,shock_damage)
|
|
//src.adjustFireLoss(shock_damage)
|
|
//src.updatehealth()
|
|
visible_message(
|
|
"<span class='danger'>[src] was shocked by \the [source]!</span>", \
|
|
"<span class='userdanger'>You feel a powerful shock coursing through your body!</span>", \
|
|
"<span class='italics'>You hear a heavy electrical crack.</span>" \
|
|
)
|
|
jitteriness += 1000 //High numbers for violent convulsions
|
|
do_jitter_animation(jitteriness)
|
|
stuttering += 2
|
|
if(!tesla_shock || (tesla_shock && siemens_coeff > 0.5))
|
|
Stun(2)
|
|
spawn(20)
|
|
jitteriness = max(jitteriness - 990, 10) //Still jittery, but vastly less
|
|
if(!tesla_shock || (tesla_shock && siemens_coeff > 0.5))
|
|
Stun(3)
|
|
Weaken(3)
|
|
if(override)
|
|
return override
|
|
else
|
|
return shock_damage
|
|
|
|
|
|
/mob/living/carbon/swap_hand()
|
|
var/obj/item/item_in_hand = src.get_active_hand()
|
|
if(item_in_hand) //this segment checks if the item in your hand is twohanded.
|
|
if(istype(item_in_hand,/obj/item/weapon/twohanded))
|
|
if(item_in_hand:wielded == 1)
|
|
usr << "<span class='warning'>Your other hand is too busy holding the [item_in_hand.name]</span>"
|
|
return
|
|
src.hand = !( src.hand )
|
|
if(hud_used.l_hand_hud_object && hud_used.r_hand_hud_object)
|
|
if(hand) //This being 1 means the left hand is in use
|
|
hud_used.l_hand_hud_object.icon_state = "hand_l_active"
|
|
hud_used.r_hand_hud_object.icon_state = "hand_r_inactive"
|
|
else
|
|
hud_used.l_hand_hud_object.icon_state = "hand_l_inactive"
|
|
hud_used.r_hand_hud_object.icon_state = "hand_r_active"
|
|
/*if (!( src.hand ))
|
|
src.hands.dir = NORTH
|
|
else
|
|
src.hands.dir = SOUTH*/
|
|
return
|
|
|
|
/mob/living/carbon/activate_hand(selhand) //0 or "r" or "right" for right hand; 1 or "l" or "left" for left hand.
|
|
|
|
if(istext(selhand))
|
|
selhand = lowertext(selhand)
|
|
|
|
if(selhand == "right" || selhand == "r")
|
|
selhand = 0
|
|
if(selhand == "left" || selhand == "l")
|
|
selhand = 1
|
|
|
|
if(selhand != src.hand)
|
|
swap_hand()
|
|
else
|
|
mode() // Activate held item
|
|
|
|
/mob/living/carbon/proc/help_shake_act(mob/living/carbon/M)
|
|
if(on_fire)
|
|
M << "<span class='warning'>You can't put them out with just your bare hands!"
|
|
return
|
|
|
|
if(health >= 0)
|
|
|
|
if(lying)
|
|
M.visible_message("<span class='notice'>[M] shakes [src] trying to get \him up!</span>", \
|
|
"<span class='notice'>You shake [src] trying to get \him up!</span>")
|
|
else
|
|
M.visible_message("<span class='notice'>[M] hugs [src] to make \him feel better!</span>", \
|
|
"<span class='notice'>You hug [src] to make \him feel better!</span>")
|
|
AdjustSleeping(-5)
|
|
AdjustParalysis(-3)
|
|
AdjustStunned(-3)
|
|
AdjustWeakened(-3)
|
|
if(resting)
|
|
resting = 0
|
|
update_canmove()
|
|
|
|
playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1)
|
|
|
|
/mob/living/carbon/flash_eyes(intensity = 1, override_blindness_check = 0, affect_silicon = 0, visual = 0)
|
|
. = ..()
|
|
var/damage = intensity - check_eye_prot()
|
|
if(.) // we've been flashed
|
|
if(visual)
|
|
return
|
|
if(weakeyes)
|
|
Stun(2)
|
|
switch(damage)
|
|
if(1)
|
|
src << "<span class='warning'>Your eyes sting a little.</span>"
|
|
if(prob(40))
|
|
adjust_eye_damage(1)
|
|
|
|
if(2)
|
|
src << "<span class='warning'>Your eyes burn.</span>"
|
|
adjust_eye_damage(rand(2, 4))
|
|
|
|
else
|
|
src << "<span class='warning'>Your eyes itch and burn severely!</span>"
|
|
adjust_eye_damage(rand(12, 16))
|
|
|
|
if(eye_damage > 10)
|
|
blind_eyes(damage)
|
|
blur_eyes(damage * rand(3, 6))
|
|
|
|
if(eye_damage > 20)
|
|
if(prob(eye_damage - 20))
|
|
if(become_nearsighted())
|
|
src << "<span class='warning'>Your eyes start to burn badly!</span>"
|
|
else if(prob(eye_damage - 25))
|
|
if(become_blind())
|
|
src << "<span class='warning'>You can't see anything!</span>"
|
|
else
|
|
src << "<span class='warning'>Your eyes are really starting to hurt. This can't be good for you!</span>"
|
|
return 1
|
|
else if(damage == 0) // just enough protection
|
|
if(prob(20))
|
|
src << "<span class='notice'>Something bright flashes in the corner of your vision!</span>"
|
|
|
|
//Throwing stuff
|
|
/mob/living/carbon/proc/toggle_throw_mode()
|
|
if(stat)
|
|
return
|
|
if(in_throw_mode)
|
|
throw_mode_off()
|
|
else
|
|
throw_mode_on()
|
|
|
|
|
|
/mob/living/carbon/proc/throw_mode_off()
|
|
in_throw_mode = 0
|
|
if(client && hud_used)
|
|
hud_used.throw_icon.icon_state = "act_throw_off"
|
|
|
|
|
|
/mob/living/carbon/proc/throw_mode_on()
|
|
in_throw_mode = 1
|
|
if(client && hud_used)
|
|
hud_used.throw_icon.icon_state = "act_throw_on"
|
|
|
|
/mob/proc/throw_item(atom/target)
|
|
return
|
|
|
|
/mob/living/carbon/throw_item(atom/target)
|
|
throw_mode_off()
|
|
if(!target || !isturf(loc))
|
|
return
|
|
if(istype(target, /obj/screen)) return
|
|
|
|
var/atom/movable/item = src.get_active_hand()
|
|
|
|
if(!item || (item.flags & NODROP)) return
|
|
|
|
if(istype(item, /obj/item/weapon/grab))
|
|
var/obj/item/weapon/grab/G = item
|
|
item = G.get_mob_if_throwable() //throw the person instead of the grab
|
|
qdel(G) //We delete the grab, as it needs to stay around until it's returned.
|
|
if(ismob(item))
|
|
var/turf/start_T = get_turf(loc) //Get the start and target tile for the descriptors
|
|
var/turf/end_T = get_turf(target)
|
|
if(start_T && end_T)
|
|
var/mob/M = item
|
|
var/start_T_descriptor = "<font color='#6b5d00'>tile at [start_T.x], [start_T.y], [start_T.z] in area [get_area(start_T)]</font>"
|
|
var/end_T_descriptor = "<font color='#6b4400'>tile at [end_T.x], [end_T.y], [end_T.z] in area [get_area(end_T)]</font>"
|
|
|
|
add_logs(src, M, "thrown", addition="from [start_T_descriptor] with the target [end_T_descriptor]")
|
|
|
|
if(!item) return //Grab processing has a chance of returning null
|
|
|
|
if(!ismob(item)) //Honk mobs don't have a dropped() proc honk
|
|
unEquip(item)
|
|
if(src.client)
|
|
src.client.screen -= item
|
|
|
|
//actually throw it!
|
|
if(item)
|
|
item.layer = initial(item.layer)
|
|
src.visible_message("<span class='danger'>[src] has thrown [item].</span>")
|
|
|
|
newtonian_move(get_dir(target, src))
|
|
|
|
item.throw_at(target, item.throw_range, item.throw_speed, src)
|
|
|
|
/mob/living/carbon/restrained()
|
|
if (handcuffed)
|
|
return 1
|
|
return
|
|
|
|
/mob/living/carbon/proc/canBeHandcuffed()
|
|
return 0
|
|
|
|
|
|
/mob/living/carbon/show_inv(mob/user)
|
|
user.set_machine(src)
|
|
var/dat = {"
|
|
<HR>
|
|
<B><FONT size=3>[name]</FONT></B>
|
|
<HR>
|
|
<BR><B>Head:</B> <A href='?src=\ref[src];item=[slot_head]'> [(head && !(head.flags&ABSTRACT)) ? head : "Nothing"]</A>
|
|
<BR><B>Mask:</B> <A href='?src=\ref[src];item=[slot_wear_mask]'> [(wear_mask && !(wear_mask.flags&ABSTRACT)) ? wear_mask : "Nothing"]</A>
|
|
<BR><B>Left Hand:</B> <A href='?src=\ref[src];item=[slot_l_hand]'> [(l_hand && !(l_hand.flags&ABSTRACT)) ? l_hand : "Nothing"]</A>
|
|
<BR><B>Right Hand:</B> <A href='?src=\ref[src];item=[slot_r_hand]'> [(r_hand && !(r_hand.flags&ABSTRACT)) ? r_hand : "Nothing"]</A>"}
|
|
|
|
dat += "<BR><B>Back:</B> <A href='?src=\ref[src];item=[slot_back]'>[back ? back : "Nothing"]</A>"
|
|
|
|
if(istype(wear_mask, /obj/item/clothing/mask) && istype(back, /obj/item/weapon/tank))
|
|
dat += "<BR><A href='?src=\ref[src];internal=1'>[internal ? "Disable Internals" : "Set Internals"]</A>"
|
|
|
|
if(handcuffed)
|
|
dat += "<BR><A href='?src=\ref[src];item=[slot_handcuffed]'>Handcuffed</A>"
|
|
if(legcuffed)
|
|
dat += "<BR><A href='?src=\ref[src];item=[slot_legcuffed]'>Legcuffed</A>"
|
|
|
|
dat += {"
|
|
<BR>
|
|
<BR><A href='?src=\ref[user];mach_close=mob\ref[src]'>Close</A>
|
|
"}
|
|
user << browse(dat, "window=mob\ref[src];size=325x500")
|
|
onclose(user, "mob\ref[src]")
|
|
|
|
/mob/living/carbon/Topic(href, href_list)
|
|
..()
|
|
//strip panel
|
|
if(usr.canUseTopic(src, BE_CLOSE, NO_DEXTERY))
|
|
if(href_list["internal"])
|
|
var/slot = text2num(href_list["internal"])
|
|
var/obj/item/ITEM = get_item_by_slot(slot)
|
|
if(ITEM && istype(ITEM, /obj/item/weapon/tank) && wear_mask && (wear_mask.flags & MASKINTERNALS))
|
|
visible_message("<span class='danger'>[usr] tries to [internal ? "close" : "open"] the valve on [src]'s [ITEM].</span>", \
|
|
"<span class='userdanger'>[usr] tries to [internal ? "close" : "open"] the valve on [src]'s [ITEM].</span>")
|
|
if(do_mob(usr, src, POCKET_STRIP_DELAY))
|
|
if(internal)
|
|
internal = null
|
|
update_internals_hud_icon(0)
|
|
else if(ITEM && istype(ITEM, /obj/item/weapon/tank))
|
|
if((wear_mask && (wear_mask.flags & MASKINTERNALS)) || getorganslot("breathing_tube"))
|
|
internal = ITEM
|
|
update_internals_hud_icon(1)
|
|
|
|
visible_message("<span class='danger'>[usr] [internal ? "opens" : "closes"] the valve on [src]'s [ITEM].</span>", \
|
|
"<span class='userdanger'>[usr] [internal ? "opens" : "closes"] the valve on [src]'s [ITEM].</span>")
|
|
|
|
|
|
|
|
/mob/living/carbon/getTrail()
|
|
if(getBruteLoss() < 300)
|
|
if(prob(50))
|
|
return "ltrails_1"
|
|
return "ltrails_2"
|
|
else if(prob(50))
|
|
return "trails_1"
|
|
return "trails_2"
|
|
|
|
var/const/NO_SLIP_WHEN_WALKING = 1
|
|
var/const/SLIDE = 2
|
|
var/const/GALOSHES_DONT_HELP = 4
|
|
/mob/living/carbon/slip(s_amount, w_amount, obj/O, lube)
|
|
add_logs(src,, "slipped",, "on [O ? O.name : "floor"]")
|
|
return loc.handle_slip(src, s_amount, w_amount, O, lube)
|
|
|
|
/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))
|
|
|
|
/mob/living/carbon/blob_act()
|
|
if (stat == DEAD)
|
|
return
|
|
else
|
|
show_message("<span class='userdanger'>The blob attacks!</span>")
|
|
adjustBruteLoss(10)
|
|
|
|
/mob/living/carbon/proc/spin(spintime, speed)
|
|
set waitfor = 0
|
|
var/D = dir
|
|
while(spintime >= speed)
|
|
sleep(speed)
|
|
switch(D)
|
|
if(NORTH)
|
|
D = EAST
|
|
if(SOUTH)
|
|
D = WEST
|
|
if(EAST)
|
|
D = SOUTH
|
|
if(WEST)
|
|
D = NORTH
|
|
dir = D
|
|
spintime -= speed
|
|
|
|
/mob/living/carbon/resist_buckle()
|
|
if(restrained())
|
|
changeNext_move(CLICK_CD_BREAKOUT)
|
|
last_special = world.time + CLICK_CD_BREAKOUT
|
|
visible_message("<span class='warning'>[src] attempts to unbuckle themself!</span>", \
|
|
"<span class='notice'>You attempt to unbuckle yourself... (This will take around one minute and you need to stay still.)</span>")
|
|
if(do_after(src, 600, 0, target = src))
|
|
if(!buckled)
|
|
return
|
|
buckled.user_unbuckle_mob(src,src)
|
|
else
|
|
if(src && buckled)
|
|
src << "<span class='warning'>You fail to unbuckle yourself!</span>"
|
|
else
|
|
buckled.user_unbuckle_mob(src,src)
|
|
|
|
/mob/living/carbon/resist_fire()
|
|
fire_stacks -= 5
|
|
Weaken(3,1)
|
|
spin(32,2)
|
|
visible_message("<span class='danger'>[src] rolls on the floor, trying to put themselves out!</span>", \
|
|
"<span class='notice'>You stop, drop, and roll!</span>")
|
|
sleep(30)
|
|
if(fire_stacks <= 0)
|
|
visible_message("<span class='danger'>[src] has successfully extinguished themselves!</span>", \
|
|
"<span class='notice'>You extinguish yourself.</span>")
|
|
ExtinguishMob()
|
|
return
|
|
|
|
/mob/living/carbon/resist_restraints()
|
|
var/obj/item/I = null
|
|
if(handcuffed)
|
|
I = handcuffed
|
|
else if(legcuffed)
|
|
I = legcuffed
|
|
if(I)
|
|
changeNext_move(CLICK_CD_BREAKOUT)
|
|
last_special = world.time + CLICK_CD_BREAKOUT
|
|
cuff_resist(I)
|
|
|
|
|
|
/mob/living/carbon/proc/cuff_resist(obj/item/I, breakouttime = 600, cuff_break = 0)
|
|
breakouttime = I.breakouttime
|
|
var/displaytime = breakouttime / 600
|
|
if(!cuff_break)
|
|
visible_message("<span class='warning'>[src] attempts to remove [I]!</span>")
|
|
src << "<span class='notice'>You attempt to remove [I]... (This will take around [displaytime] minutes and you need to stand still.)</span>"
|
|
if(do_after(src, breakouttime, 0, target = src))
|
|
if(I.loc != src || buckled)
|
|
return
|
|
visible_message("<span class='danger'>[src] manages to remove [I]!</span>")
|
|
src << "<span class='notice'>You successfully remove [I].</span>"
|
|
|
|
if(I == handcuffed)
|
|
handcuffed.loc = loc
|
|
handcuffed.dropped(src)
|
|
handcuffed = null
|
|
if(buckled && buckled.buckle_requires_restraints)
|
|
buckled.unbuckle_mob()
|
|
update_handcuffed()
|
|
return
|
|
if(I == legcuffed)
|
|
legcuffed.loc = loc
|
|
legcuffed.dropped()
|
|
legcuffed = null
|
|
update_inv_legcuffed()
|
|
return
|
|
return 1
|
|
else
|
|
src << "<span class='warning'>You fail to remove [I]!</span>"
|
|
|
|
else
|
|
breakouttime = 50
|
|
visible_message("<span class='warning'>[src] is trying to break [I]!</span>")
|
|
src << "<span class='notice'>You attempt to break [I]... (This will take around 5 seconds and you need to stand still.)</span>"
|
|
if(do_after(src, breakouttime, 0, target = src))
|
|
if(!I.loc || buckled)
|
|
return
|
|
visible_message("<span class='danger'>[src] manages to break [I]!</span>")
|
|
src << "<span class='notice'>You successfully break [I].</span>"
|
|
qdel(I)
|
|
|
|
if(I == handcuffed)
|
|
handcuffed = null
|
|
update_handcuffed()
|
|
return
|
|
else if(I == legcuffed)
|
|
legcuffed = null
|
|
update_inv_legcuffed()
|
|
return
|
|
return 1
|
|
else
|
|
src << "<span class='warning'>You fail to break [I]!</span>"
|
|
|
|
/mob/living/carbon/proc/uncuff()
|
|
if (handcuffed)
|
|
var/obj/item/weapon/W = handcuffed
|
|
handcuffed = null
|
|
if (buckled && buckled.buckle_requires_restraints)
|
|
buckled.unbuckle_mob()
|
|
update_handcuffed()
|
|
if (client)
|
|
client.screen -= W
|
|
if (W)
|
|
W.loc = loc
|
|
W.dropped(src)
|
|
if (W)
|
|
W.layer = initial(W.layer)
|
|
if (legcuffed)
|
|
var/obj/item/weapon/W = legcuffed
|
|
legcuffed = null
|
|
update_inv_legcuffed()
|
|
if (client)
|
|
client.screen -= W
|
|
if (W)
|
|
W.loc = loc
|
|
W.dropped(src)
|
|
if (W)
|
|
W.layer = initial(W.layer)
|
|
|
|
/mob/living/carbon/proc/is_mouth_covered(head_only = 0, mask_only = 0)
|
|
if( (!mask_only && head && (head.flags_cover & HEADCOVERSMOUTH)) || (!head_only && wear_mask && (wear_mask.flags_cover & MASKCOVERSMOUTH)) )
|
|
return 1
|
|
|
|
/mob/living/carbon/get_standard_pixel_y_offset(lying = 0)
|
|
if(lying)
|
|
return -6
|
|
else
|
|
return initial(pixel_y)
|
|
|
|
/mob/living/carbon/check_ear_prot()
|
|
if(head && (head.flags & HEADBANGPROTECT))
|
|
return 1
|
|
|
|
/mob/living/carbon/proc/accident(obj/item/I)
|
|
if(!I || (I.flags & (NODROP|ABSTRACT)))
|
|
return
|
|
|
|
unEquip(I)
|
|
|
|
var/modifier = 0
|
|
if(disabilities & CLUMSY)
|
|
modifier -= 40 //Clumsy people are more likely to hit themselves -Honk!
|
|
|
|
switch(rand(1,100)+modifier) //91-100=Nothing special happens
|
|
if(-INFINITY to 0) //attack yourself
|
|
I.attack(src,src)
|
|
if(1 to 30) //throw it at yourself
|
|
I.throw_impact(src)
|
|
if(31 to 60) //Throw object in facing direction
|
|
var/turf/target = get_turf(loc)
|
|
var/range = rand(2,I.throw_range)
|
|
for(var/i = 1; i < range; i++)
|
|
var/turf/new_turf = get_step(target, dir)
|
|
target = new_turf
|
|
if(new_turf.density)
|
|
break
|
|
I.throw_at(target,I.throw_range,I.throw_speed,src)
|
|
if(61 to 90) //throw it down to the floor
|
|
var/turf/target = get_turf(loc)
|
|
I.throw_at(target,I.throw_range,I.throw_speed,src)
|
|
|
|
/mob/living/carbon/emp_act(severity)
|
|
for(var/obj/item/organ/internal/O in internal_organs)
|
|
O.emp_act(severity)
|
|
..()
|
|
|
|
/mob/living/carbon/check_eye_prot()
|
|
var/number = ..()
|
|
for(var/obj/item/organ/internal/cyberimp/eyes/EFP in internal_organs)
|
|
number += EFP.flash_protect
|
|
return number
|
|
|
|
/mob/living/carbon/proc/AddAbility(obj/effect/proc_holder/alien/A)
|
|
abilities.Add(A)
|
|
A.on_gain(src)
|
|
if(A.has_action)
|
|
A.action.Grant(src)
|
|
sortInsert(abilities, /proc/cmp_abilities_cost, 0)
|
|
|
|
/mob/living/carbon/proc/RemoveAbility(obj/effect/proc_holder/alien/A)
|
|
abilities.Remove(A)
|
|
A.on_lose(src)
|
|
if(A.action)
|
|
A.action.Remove(src)
|
|
|
|
/mob/living/carbon/proc/add_abilities_to_panel()
|
|
for(var/obj/effect/proc_holder/alien/A in abilities)
|
|
statpanel("[A.panel]",A.plasma_cost > 0?"([A.plasma_cost])":"",A)
|
|
|
|
/mob/living/carbon/Stat()
|
|
..()
|
|
if(statpanel("Status"))
|
|
var/obj/item/organ/internal/alien/plasmavessel/vessel = getorgan(/obj/item/organ/internal/alien/plasmavessel)
|
|
if(vessel)
|
|
stat(null, "Plasma Stored: [vessel.storedPlasma]/[vessel.max_plasma]")
|
|
if(locate(/obj/item/device/assembly/health) in src)
|
|
stat(null, "Health: [health]")
|
|
|
|
add_abilities_to_panel()
|
|
|
|
/mob/living/carbon/proc/vomit(var/lost_nutrition = 10, var/blood = 0, var/stun = 1, var/distance = 0, var/message = 1)
|
|
if(src.is_muzzled())
|
|
if(message)
|
|
src << "<span class='warning'>The muzzle prevents you from vomiting!</span>"
|
|
return 0
|
|
if(stun)
|
|
Stun(4)
|
|
if(nutrition < 100 && !blood)
|
|
if(message)
|
|
visible_message("<span class='warning'>[src] dry heaves!</span>", \
|
|
"<span class='userdanger'>You try to throw up, but there's nothing your stomach!</span>")
|
|
if(stun)
|
|
Weaken(10)
|
|
else
|
|
if(message)
|
|
visible_message("<span class='danger'>[src] throws up!</span>", \
|
|
"<span class='userdanger'>You throw up!</span>")
|
|
playsound(get_turf(src), 'sound/effects/splat.ogg', 50, 1)
|
|
var/turf/T = get_turf(src)
|
|
for(var/i=0 to distance)
|
|
if(blood)
|
|
if(T)
|
|
T.add_blood_floor(src)
|
|
if(stun)
|
|
adjustBruteLoss(3)
|
|
else
|
|
if(T)
|
|
T.add_vomit_floor(src)
|
|
nutrition -= lost_nutrition
|
|
if(stun)
|
|
adjustToxLoss(-3)
|
|
T = get_step(T, dir)
|
|
if (is_blocked_turf(T))
|
|
break
|
|
return 1
|
|
|
|
|
|
|
|
/mob/living/carbon/fully_replace_character_name(oldname,newname)
|
|
..()
|
|
if(dna)
|
|
dna.real_name = real_name
|
|
|
|
/mob/living/carbon/update_sight()
|
|
if(!client)
|
|
return
|
|
if(stat == DEAD)
|
|
sight = (SEE_TURFS|SEE_MOBS|SEE_OBJS)
|
|
see_in_dark = 8
|
|
see_invisible = SEE_INVISIBLE_OBSERVER
|
|
return
|
|
|
|
see_invisible = initial(see_invisible)
|
|
see_in_dark = initial(see_in_dark)
|
|
sight = initial(sight)
|
|
|
|
if(client.eye != src)
|
|
var/atom/A = client.eye
|
|
if(A.update_remote_sight(src)) //returns 1 if we override all other sight updates.
|
|
return
|
|
|
|
for(var/obj/item/organ/internal/cyberimp/eyes/E in internal_organs)
|
|
sight |= E.sight_flags
|
|
if(E.dark_view)
|
|
see_in_dark = max(see_in_dark,E.dark_view)
|
|
if(E.see_invisible)
|
|
see_invisible = min(see_invisible, E.see_invisible)
|
|
|
|
if(see_override)
|
|
see_invisible = see_override
|
|
|
|
|
|
//to recalculate and update the mob's total tint from tinted equipment it's wearing.
|
|
/mob/living/carbon/proc/update_tint()
|
|
if(!tinted_weldhelh)
|
|
return
|
|
tinttotal = get_total_tint()
|
|
if(tinttotal >= TINT_BLIND)
|
|
overlay_fullscreen("tint", /obj/screen/fullscreen/blind)
|
|
else if(tinttotal >= TINT_DARKENED)
|
|
overlay_fullscreen("tint", /obj/screen/fullscreen/impaired, 2)
|
|
else
|
|
clear_fullscreen("tint", 0)
|
|
|
|
/mob/living/carbon/proc/get_total_tint()
|
|
. = 0
|
|
if(istype(head, /obj/item/clothing/head))
|
|
var/obj/item/clothing/head/HT = head
|
|
. += HT.tint
|
|
if(wear_mask)
|
|
. += wear_mask.tint
|
|
|
|
//this handles hud updates
|
|
/mob/living/carbon/update_damage_hud()
|
|
|
|
if(!client)
|
|
return
|
|
|
|
if(stat == UNCONSCIOUS && health <= config.health_threshold_crit)
|
|
var/severity = 0
|
|
switch(health)
|
|
if(-20 to -10) severity = 1
|
|
if(-30 to -20) severity = 2
|
|
if(-40 to -30) severity = 3
|
|
if(-50 to -40) severity = 4
|
|
if(-60 to -50) severity = 5
|
|
if(-70 to -60) severity = 6
|
|
if(-80 to -70) severity = 7
|
|
if(-90 to -80) severity = 8
|
|
if(-95 to -90) severity = 9
|
|
if(-INFINITY to -95) severity = 10
|
|
overlay_fullscreen("crit", /obj/screen/fullscreen/crit, severity)
|
|
else
|
|
clear_fullscreen("crit")
|
|
if(oxyloss)
|
|
var/severity = 0
|
|
switch(oxyloss)
|
|
if(10 to 20) severity = 1
|
|
if(20 to 25) severity = 2
|
|
if(25 to 30) severity = 3
|
|
if(30 to 35) severity = 4
|
|
if(35 to 40) severity = 5
|
|
if(40 to 45) severity = 6
|
|
if(45 to INFINITY) severity = 7
|
|
overlay_fullscreen("oxy", /obj/screen/fullscreen/oxy, severity)
|
|
else
|
|
clear_fullscreen("oxy")
|
|
|
|
//Fire and Brute damage overlay (BSSR)
|
|
var/hurtdamage = getBruteLoss() + getFireLoss() + damageoverlaytemp
|
|
if(hurtdamage)
|
|
var/severity = 0
|
|
switch(hurtdamage)
|
|
if(5 to 15) severity = 1
|
|
if(15 to 30) severity = 2
|
|
if(30 to 45) severity = 3
|
|
if(45 to 70) severity = 4
|
|
if(70 to 85) severity = 5
|
|
if(85 to INFINITY) severity = 6
|
|
overlay_fullscreen("brute", /obj/screen/fullscreen/brute, severity)
|
|
else
|
|
clear_fullscreen("brute")
|
|
|
|
/mob/living/carbon/update_health_hud(shown_health_amount)
|
|
if(!client || !hud_used)
|
|
return
|
|
if(hud_used.healths)
|
|
if(stat != DEAD)
|
|
. = 1
|
|
if(!shown_health_amount)
|
|
shown_health_amount = health
|
|
if(shown_health_amount >= maxHealth)
|
|
hud_used.healths.icon_state = "health0"
|
|
else if(shown_health_amount > maxHealth*0.8)
|
|
hud_used.healths.icon_state = "health1"
|
|
else if(shown_health_amount > maxHealth*0.6)
|
|
hud_used.healths.icon_state = "health2"
|
|
else if(shown_health_amount > maxHealth*0.4)
|
|
hud_used.healths.icon_state = "health3"
|
|
else if(shown_health_amount > maxHealth*0.2)
|
|
hud_used.healths.icon_state = "health4"
|
|
else if(shown_health_amount > 0)
|
|
hud_used.healths.icon_state = "health5"
|
|
else
|
|
hud_used.healths.icon_state = "health6"
|
|
else
|
|
hud_used.healths.icon_state = "health7"
|
|
|
|
/mob/living/carbon/proc/update_internals_hud_icon(internal_state = 0)
|
|
if(hud_used && hud_used.internals)
|
|
hud_used.internals.icon_state = "internal[internal_state]"
|
|
|
|
/mob/living/carbon/update_stat()
|
|
if(status_flags & GODMODE)
|
|
return
|
|
if(stat != DEAD)
|
|
if(health<= config.health_threshold_dead || !getorgan(/obj/item/organ/internal/brain))
|
|
death()
|
|
return
|
|
if(paralysis || sleeping || getOxyLoss() > 50 || (status_flags & FAKEDEATH) || health <= config.health_threshold_crit)
|
|
if(stat == CONSCIOUS)
|
|
stat = UNCONSCIOUS
|
|
blind_eyes(1)
|
|
update_canmove()
|
|
else
|
|
if(stat == UNCONSCIOUS)
|
|
stat = CONSCIOUS
|
|
resting = 0
|
|
adjust_blindness(-1)
|
|
update_canmove()
|
|
update_damage_hud()
|
|
update_health_hud()
|
|
med_hud_set_status()
|
|
|
|
//called when we get cuffed/uncuffed
|
|
/mob/living/carbon/proc/update_handcuffed()
|
|
if(handcuffed)
|
|
drop_r_hand()
|
|
drop_l_hand()
|
|
stop_pulling()
|
|
throw_alert("handcuffed", /obj/screen/alert/restrained/handcuffed, new_master = src.handcuffed)
|
|
else
|
|
clear_alert("handcuffed")
|
|
update_action_buttons_icon() //some of our action buttons might be unusable when we're handcuffed.
|
|
update_inv_handcuffed()
|
|
update_hud_handcuffed()
|
|
|
|
/mob/living/carbon/fully_heal(admin_revive = 0)
|
|
if(reagents)
|
|
reagents.clear_reagents()
|
|
var/obj/item/organ/internal/brain/B = getorgan(/obj/item/organ/internal/brain)
|
|
if(B)
|
|
B.damaged_brain = 0
|
|
if(admin_revive)
|
|
handcuffed = initial(handcuffed)
|
|
for(var/obj/item/weapon/restraints/R in contents) //actually remove cuffs from inventory
|
|
qdel(R)
|
|
update_handcuffed()
|
|
if(reagents)
|
|
reagents.addiction_list = list()
|
|
|
|
for(var/datum/disease/D in viruses)
|
|
D.cure(0)
|
|
..()
|
|
|
|
/mob/living/carbon/can_be_revived()
|
|
. = ..()
|
|
if(!getorgan(/obj/item/organ/internal/brain))
|
|
return 0
|
|
|
|
/mob/living/carbon/harvest(mob/living/user)
|
|
if(qdeleted(src))
|
|
return
|
|
var/organs_amt = 0
|
|
for(var/obj/item/organ/internal/O in internal_organs)
|
|
if(prob(50))
|
|
organs_amt++
|
|
O.Remove(src)
|
|
O.loc = get_turf(src)
|
|
if(organs_amt)
|
|
user << "<span class='notice'>You retrieve some of [src]\'s internal organs!</span>"
|
|
|
|
..()
|
|
|
|
|
|
|