Advertisement
Guest User

life.dm

a guest
Aug 9th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.19 KB | None | 0 0
  1. //This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:32
  2.  
  3. //NOTE: Breathing happens once per FOUR TICKS, unless the last breath fails. In which case it happens once per ONE TICK! So oxyloss healing is done once per 4 ticks while oxyloss damage is applied once per tick!
  4.  
  5.  
  6. #define TINT_IMPAIR 2 //Threshold of tint level to apply weld mask overlay
  7. #define TINT_BLIND 3 //Threshold of tint level to obscure vision fully
  8.  
  9. #define HEAT_DAMAGE_LEVEL_1 2 //Amount of damage applied when your body temperature just passes the 360.15k safety point
  10. #define HEAT_DAMAGE_LEVEL_2 3 //Amount of damage applied when your body temperature passes the 400K point
  11. #define HEAT_DAMAGE_LEVEL_3 8 //Amount of damage applied when your body temperature passes the 460K point and you are on fire
  12.  
  13. #define COLD_DAMAGE_LEVEL_1 0.5 //Amount of damage applied when your body temperature just passes the 260.15k safety point
  14. #define COLD_DAMAGE_LEVEL_2 1.5 //Amount of damage applied when your body temperature passes the 200K point
  15. #define COLD_DAMAGE_LEVEL_3 3 //Amount of damage applied when your body temperature passes the 120K point
  16.  
  17. //Note that gas heat damage is only applied once every FOUR ticks.
  18. #define HEAT_GAS_DAMAGE_LEVEL_1 2 //Amount of damage applied when the current breath's temperature just passes the 360.15k safety point
  19. #define HEAT_GAS_DAMAGE_LEVEL_2 4 //Amount of damage applied when the current breath's temperature passes the 400K point
  20. #define HEAT_GAS_DAMAGE_LEVEL_3 8 //Amount of damage applied when the current breath's temperature passes the 1000K point
  21.  
  22. #define COLD_GAS_DAMAGE_LEVEL_1 0.5 //Amount of damage applied when the current breath's temperature just passes the 260.15k safety point
  23. #define COLD_GAS_DAMAGE_LEVEL_2 1.5 //Amount of damage applied when the current breath's temperature passes the 200K point
  24. #define COLD_GAS_DAMAGE_LEVEL_3 3 //Amount of damage applied when the current breath's temperature passes the 120K point
  25.  
  26. /mob/living/carbon/human
  27. var/tinttotal = 0 // Total level of visualy impairing items
  28.  
  29.  
  30.  
  31. /mob/living/carbon/human/Life()
  32. set invisibility = 0
  33. set background = BACKGROUND_ENABLED
  34.  
  35. if(stat == DEAD)
  36. plasma_revive() //Plasmaman resurrection
  37.  
  38. if (notransform)
  39. return
  40.  
  41. tinttotal = tintcheck() //here as both hud updates and status updates call it
  42.  
  43. if(..())
  44. handle_heart()
  45. if(dna)
  46. for(var/datum/mutation/human/HM in dna.mutations)
  47. HM.on_life(src)
  48.  
  49. //Stuff jammed in your limbs hurts
  50. handle_embedded_objects()
  51. //Update our name based on whether our face is obscured/disfigured
  52. name = get_visible_name()
  53.  
  54. if(dna)
  55. dna.species.spec_life(src) // for mutantraces
  56.  
  57.  
  58. /mob/living/carbon/human/calculate_affecting_pressure(var/pressure)
  59. ..()
  60. var/pressure_difference = abs( pressure - ONE_ATMOSPHERE )
  61.  
  62. var/pressure_adjustment_coefficient = 1 //Determins how much the clothing you are wearing protects you in percent.
  63. if(wear_suit && (wear_suit.flags & STOPSPRESSUREDMAGE))
  64. pressure_adjustment_coefficient -= PRESSURE_SUIT_REDUCTION_COEFFICIENT
  65. if(head && (head.flags & STOPSPRESSUREDMAGE))
  66. pressure_adjustment_coefficient -= PRESSURE_HEAD_REDUCTION_COEFFICIENT
  67. pressure_adjustment_coefficient = max(pressure_adjustment_coefficient,0) //So it isn't less than 0
  68. pressure_difference = pressure_difference * pressure_adjustment_coefficient
  69. if(pressure > ONE_ATMOSPHERE)
  70. return ONE_ATMOSPHERE + pressure_difference
  71. else
  72. return ONE_ATMOSPHERE - pressure_difference
  73.  
  74.  
  75. /mob/living/carbon/human/handle_disabilities()
  76. ..()
  77. //Eyes
  78. if(!(disabilities & BLIND))
  79. if(tinttotal >= TINT_BLIND) //covering your eyes heals blurry eyes faster
  80. eye_blurry = max(eye_blurry-2, 0)
  81.  
  82. //Ears
  83. if(!(disabilities & DEAF))
  84. if(istype(ears, /obj/item/clothing/ears/earmuffs)) // earmuffs rest your ears, healing ear_deaf faster and ear_damage, but keeping you deaf.
  85. setEarDamage(max(ear_damage-0.10, 0), max(ear_deaf - 1, 1))
  86.  
  87.  
  88. if (getBrainLoss() >= 60 && stat != DEAD)
  89. if (prob(4))
  90. switch(pick(1,2,3,4))
  91. if(1)
  92. say(pick("IM A PONY NEEEEEEIIIIIIIIIGH", "without oxigen blob don't evoluate?", "CAPTAINS A COMDOM", "[pick("", "that faggot traitor")] [pick("joerge", "george", "gorge", "gdoruge")] [pick("mellens", "melons", "mwrlins")] is grifing me HAL;P!!!", "can u give me [pick("telikesis","halk","eppilapse")]?", "THe saiyans screwed", "Bi is THE BEST OF BOTH WORLDS>", "I WANNA PET TEH monkeyS", "stop grifing me!!!!", "SOTP IT#"))
  93. if(2)
  94. say(pick("FUS RO DAH","fucking 4rries!", "stat me", ">my face", "roll it easy!", "waaaaaagh!!!", "red wonz go fasta", "FOR TEH EMPRAH", "lol2cat", "dem dwarfs man, dem dwarfs", "SPESS MAHREENS", "hwee did eet fhor khayosss", "lifelike texture ;_;", "luv can bloooom", "PACKETS!!!"))
  95. if(3)
  96. say(pick("That's not your authority.", "he does it [pick("fo fwee", "without compemsatiun")]!!", "traps [pick("are", "aren't)] gay!", "THE DICK MACKES IT BETTA!", "10BUX", "[pick("tbh", "TBH", "TEA BEE AITCH")]", "fcuking pubbies sware 2 GOD", "PRAISE KEK!!!!!!!SHADILAY!!"))
  97. if(4)
  98. emote(pick("drool", "ree", "clap")
  99.  
  100.  
  101. /mob/living/carbon/human/handle_mutations_and_radiation()
  102. if(dna)
  103. if(dna.species.handle_mutations_and_radiation(src))
  104. ..()
  105.  
  106. /mob/living/carbon/human/breathe()
  107. if(dna)
  108. dna.species.breathe(src)
  109.  
  110. return
  111.  
  112. /mob/living/carbon/human/handle_environment(datum/gas_mixture/environment)
  113. if(dna)
  114. dna.species.handle_environment(environment, src)
  115.  
  116. return
  117.  
  118. ///FIRE CODE
  119. /mob/living/carbon/human/handle_fire()
  120. if(dna)
  121. dna.species.handle_fire(src)
  122. if(..())
  123. return
  124. var/thermal_protection = 0 //Simple check to estimate how protected we are against multiple temperatures
  125. if(wear_suit)
  126. if(wear_suit.max_heat_protection_temperature >= FIRE_SUIT_MAX_TEMP_PROTECT)
  127. thermal_protection += (wear_suit.max_heat_protection_temperature*0.7)
  128. if(head)
  129. if(head.max_heat_protection_temperature >= FIRE_HELM_MAX_TEMP_PROTECT)
  130. thermal_protection += (head.max_heat_protection_temperature*THERMAL_PROTECTION_HEAD)
  131. thermal_protection = round(thermal_protection)
  132. if(thermal_protection >= FIRE_IMMUNITY_SUIT_MAX_TEMP_PROTECT)
  133. return
  134. if(thermal_protection >= FIRE_SUIT_MAX_TEMP_PROTECT)
  135. bodytemperature += 11
  136. return
  137. else
  138. bodytemperature += BODYTEMP_HEATING_MAX
  139. return
  140.  
  141. /mob/living/carbon/human/IgniteMob()
  142. if(dna)
  143. dna.species.IgniteMob(src)
  144. else
  145. ..()
  146.  
  147. /mob/living/carbon/human/ExtinguishMob()
  148. if(dna)
  149. dna.species.ExtinguishMob(src)
  150. else
  151. ..()
  152. //END FIRE CODE
  153.  
  154.  
  155. /mob/living/carbon/human/proc/stabilize_temperature_from_calories()
  156. switch(bodytemperature)
  157. if(-INFINITY to 260.15) //260.15 is 310.15 - 50, the temperature where you start to feel effects.
  158. if(nutrition >= 2) //If we are very, very cold we'll use up quite a bit of nutriment to heat us up.
  159. nutrition -= 2
  160. var/body_temperature_difference = 310.15 - bodytemperature
  161. bodytemperature += max((body_temperature_difference * metabolism_efficiency / BODYTEMP_AUTORECOVERY_DIVISOR), BODYTEMP_AUTORECOVERY_MINIMUM)
  162. if(260.15 to 360.15)
  163. var/body_temperature_difference = 310.15 - bodytemperature
  164. bodytemperature += body_temperature_difference * metabolism_efficiency / BODYTEMP_AUTORECOVERY_DIVISOR
  165. if(360.15 to INFINITY) //360.15 is 310.15 + 50, the temperature where you start to feel effects.
  166. //We totally need a sweat system cause it totally makes sense...~
  167. var/body_temperature_difference = 310.15 - bodytemperature
  168. bodytemperature += min((body_temperature_difference / BODYTEMP_AUTORECOVERY_DIVISOR), -BODYTEMP_AUTORECOVERY_MINIMUM) //We're dealing with negative numbers
  169.  
  170. //This proc returns a number made up of the flags for body parts which you are protected on. (such as HEAD, CHEST, GROIN, etc. See setup.dm for the full list)
  171. /mob/living/carbon/human/proc/get_heat_protection_flags(temperature) //Temperature is the temperature you're being exposed to.
  172. var/thermal_protection_flags = 0
  173. //Handle normal clothing
  174. if(head)
  175. if(head.max_heat_protection_temperature && head.max_heat_protection_temperature >= temperature)
  176. thermal_protection_flags |= head.heat_protection
  177. if(wear_suit)
  178. if(wear_suit.max_heat_protection_temperature && wear_suit.max_heat_protection_temperature >= temperature)
  179. thermal_protection_flags |= wear_suit.heat_protection
  180. if(w_uniform)
  181. if(w_uniform.max_heat_protection_temperature && w_uniform.max_heat_protection_temperature >= temperature)
  182. thermal_protection_flags |= w_uniform.heat_protection
  183. if(shoes)
  184. if(shoes.max_heat_protection_temperature && shoes.max_heat_protection_temperature >= temperature)
  185. thermal_protection_flags |= shoes.heat_protection
  186. if(gloves)
  187. if(gloves.max_heat_protection_temperature && gloves.max_heat_protection_temperature >= temperature)
  188. thermal_protection_flags |= gloves.heat_protection
  189. if(wear_mask)
  190. if(wear_mask.max_heat_protection_temperature && wear_mask.max_heat_protection_temperature >= temperature)
  191. thermal_protection_flags |= wear_mask.heat_protection
  192.  
  193. return thermal_protection_flags
  194.  
  195. /mob/living/carbon/human/proc/get_heat_protection(temperature) //Temperature is the temperature you're being exposed to.
  196. var/thermal_protection_flags = get_heat_protection_flags(temperature)
  197.  
  198. var/thermal_protection = 0.0
  199. if(thermal_protection_flags)
  200. if(thermal_protection_flags & HEAD)
  201. thermal_protection += THERMAL_PROTECTION_HEAD
  202. if(thermal_protection_flags & CHEST)
  203. thermal_protection += THERMAL_PROTECTION_CHEST
  204. if(thermal_protection_flags & GROIN)
  205. thermal_protection += THERMAL_PROTECTION_GROIN
  206. if(thermal_protection_flags & LEG_LEFT)
  207. thermal_protection += THERMAL_PROTECTION_LEG_LEFT
  208. if(thermal_protection_flags & LEG_RIGHT)
  209. thermal_protection += THERMAL_PROTECTION_LEG_RIGHT
  210. if(thermal_protection_flags & FOOT_LEFT)
  211. thermal_protection += THERMAL_PROTECTION_FOOT_LEFT
  212. if(thermal_protection_flags & FOOT_RIGHT)
  213. thermal_protection += THERMAL_PROTECTION_FOOT_RIGHT
  214. if(thermal_protection_flags & ARM_LEFT)
  215. thermal_protection += THERMAL_PROTECTION_ARM_LEFT
  216. if(thermal_protection_flags & ARM_RIGHT)
  217. thermal_protection += THERMAL_PROTECTION_ARM_RIGHT
  218. if(thermal_protection_flags & HAND_LEFT)
  219. thermal_protection += THERMAL_PROTECTION_HAND_LEFT
  220. if(thermal_protection_flags & HAND_RIGHT)
  221. thermal_protection += THERMAL_PROTECTION_HAND_RIGHT
  222.  
  223.  
  224. return min(1,thermal_protection)
  225.  
  226. //See proc/get_heat_protection_flags(temperature) for the description of this proc.
  227. /mob/living/carbon/human/proc/get_cold_protection_flags(temperature)
  228. var/thermal_protection_flags = 0
  229. //Handle normal clothing
  230.  
  231. if(head)
  232. if(head.min_cold_protection_temperature && head.min_cold_protection_temperature <= temperature)
  233. thermal_protection_flags |= head.cold_protection
  234. if(wear_suit)
  235. if(wear_suit.min_cold_protection_temperature && wear_suit.min_cold_protection_temperature <= temperature)
  236. thermal_protection_flags |= wear_suit.cold_protection
  237. if(w_uniform)
  238. if(w_uniform.min_cold_protection_temperature && w_uniform.min_cold_protection_temperature <= temperature)
  239. thermal_protection_flags |= w_uniform.cold_protection
  240. if(shoes)
  241. if(shoes.min_cold_protection_temperature && shoes.min_cold_protection_temperature <= temperature)
  242. thermal_protection_flags |= shoes.cold_protection
  243. if(gloves)
  244. if(gloves.min_cold_protection_temperature && gloves.min_cold_protection_temperature <= temperature)
  245. thermal_protection_flags |= gloves.cold_protection
  246. if(wear_mask)
  247. if(wear_mask.min_cold_protection_temperature && wear_mask.min_cold_protection_temperature <= temperature)
  248. thermal_protection_flags |= wear_mask.cold_protection
  249.  
  250. return thermal_protection_flags
  251.  
  252. /mob/living/carbon/human/proc/get_cold_protection(temperature)
  253.  
  254. if(dna.check_mutation(COLDRES))
  255. return 1 //Fully protected from the cold.
  256.  
  257. if(dna && COLDRES in dna.species.specflags)
  258. return 1
  259.  
  260. temperature = max(temperature, 2.7) //There is an occasional bug where the temperature is miscalculated in ares with a small amount of gas on them, so this is necessary to ensure that that bug does not affect this calculation. Space's temperature is 2.7K and most suits that are intended to protect against any cold, protect down to 2.0K.
  261. var/thermal_protection_flags = get_cold_protection_flags(temperature)
  262.  
  263. var/thermal_protection = 0.0
  264. if(thermal_protection_flags)
  265. if(thermal_protection_flags & HEAD)
  266. thermal_protection += THERMAL_PROTECTION_HEAD
  267. if(thermal_protection_flags & CHEST)
  268. thermal_protection += THERMAL_PROTECTION_CHEST
  269. if(thermal_protection_flags & GROIN)
  270. thermal_protection += THERMAL_PROTECTION_GROIN
  271. if(thermal_protection_flags & LEG_LEFT)
  272. thermal_protection += THERMAL_PROTECTION_LEG_LEFT
  273. if(thermal_protection_flags & LEG_RIGHT)
  274. thermal_protection += THERMAL_PROTECTION_LEG_RIGHT
  275. if(thermal_protection_flags & FOOT_LEFT)
  276. thermal_protection += THERMAL_PROTECTION_FOOT_LEFT
  277. if(thermal_protection_flags & FOOT_RIGHT)
  278. thermal_protection += THERMAL_PROTECTION_FOOT_RIGHT
  279. if(thermal_protection_flags & ARM_LEFT)
  280. thermal_protection += THERMAL_PROTECTION_ARM_LEFT
  281. if(thermal_protection_flags & ARM_RIGHT)
  282. thermal_protection += THERMAL_PROTECTION_ARM_RIGHT
  283. if(thermal_protection_flags & HAND_LEFT)
  284. thermal_protection += THERMAL_PROTECTION_HAND_LEFT
  285. if(thermal_protection_flags & HAND_RIGHT)
  286. thermal_protection += THERMAL_PROTECTION_HAND_RIGHT
  287.  
  288. return min(1,thermal_protection)
  289.  
  290.  
  291. /mob/living/carbon/human/handle_chemicals_in_body()
  292. ..()
  293. if(dna)
  294. dna.species.handle_chemicals_in_body(src)
  295. for(var/obj/item/I in src)
  296. I.OnMobLife(src)
  297.  
  298. return //TODO: DEFERRED
  299.  
  300. /mob/living/carbon/human/handle_vision()
  301. if(machine)
  302. if(!machine.check_eye(src)) reset_view(null)
  303. else
  304. if(!client.adminobs) reset_view(null)
  305.  
  306. if(dna)
  307. dna.species.handle_vision(src)
  308.  
  309. /mob/living/carbon/human/handle_hud_icons()
  310. if(dna)
  311. dna.species.handle_hud_icons(src)
  312.  
  313. /mob/living/carbon/human/handle_random_events()
  314. // Puke if toxloss is too high
  315. if(!stat)
  316. if (getToxLoss() >= 45 && nutrition > 20)
  317. lastpuke ++
  318. if(lastpuke >= 25) // about 25 second delay I guess
  319. Stun(5)
  320.  
  321. visible_message("<span class='danger'>[src] throws up!</span>", \
  322. "<span class='userdanger'>[src] throws up!</span>")
  323. playsound(loc, 'sound/effects/splat.ogg', 50, 1)
  324.  
  325. var/turf/location = loc
  326. if (istype(location, /turf/simulated))
  327. location.add_vomit_floor(src, 1)
  328.  
  329. nutrition -= 20
  330. adjustToxLoss(-3)
  331.  
  332. // make it so you can only puke so fast
  333. lastpuke = 0
  334.  
  335.  
  336. /mob/living/carbon/human/handle_changeling()
  337. if(mind)
  338. if(mind.changeling)
  339. mind.changeling.regenerate()
  340. if(hud_used)
  341. hud_used.lingchemdisplay.invisibility = 0
  342. hud_used.lingchemdisplay.maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'> <font color='#dd66dd'>[mind.changeling.chem_charges]</font></div>"
  343. else
  344. if(hud_used)
  345. hud_used.lingchemdisplay.invisibility = 101
  346.  
  347. /mob/living/carbon/human/has_smoke_protection()
  348. if(wear_mask)
  349. if(wear_mask.flags & BLOCK_GAS_SMOKE_EFFECT)
  350. . = 1
  351. if(glasses)
  352. if(glasses.flags & BLOCK_GAS_SMOKE_EFFECT)
  353. . = 1
  354. if(head)
  355. if(head.flags & BLOCK_GAS_SMOKE_EFFECT)
  356. . = 1
  357. return .
  358. /mob/living/carbon/human/proc/handle_embedded_objects()
  359. for(var/datum/organ/limb/organdata in get_limbs())
  360. if(organdata.exists())
  361. var/obj/item/organ/limb/L = organdata.organitem
  362. for(var/obj/item/I in L.embedded_objects)
  363. if(prob(I.embedded_pain_chance))
  364. L.take_damage(I.w_class*I.embedded_pain_multiplier)
  365. src << "<span class='userdanger'>\the [I] embedded in your [L] hurts!</span>"
  366.  
  367. if(prob(I.embedded_fall_chance))
  368. L.take_damage(I.w_class*I.embedded_fall_pain_multiplier)
  369. L.embedded_objects -= I
  370. I.loc = get_turf(src)
  371. visible_message("<span class='danger'>\the [I] falls out of [name]'s [L]!</span>","<span class='userdanger'>\the [I] falls out of your [L]!</span>")
  372.  
  373. /mob/living/carbon/human/handle_heart()
  374. if(!heart_attack)
  375. return
  376. else
  377. losebreath += 5
  378. Weaken(1)
  379. adjustOxyLoss(5)
  380. adjustBruteLoss(1)
  381. return
  382.  
  383. /mob/living/carbon/human/proc/plasma_revive()
  384. var/datum/gas_mixture/breath = get_breath_from_internal(BREATH_VOLUME)
  385. if(breath && (disabilities & HUSK || dna.species.safe_toxins_min) && reagents) //Plasmaman re-revival
  386. var/Toxins_pp = breath.get_breath_partial_pressure(breath.toxins)
  387. if(Toxins_pp > 10 && breath.temperature > T0C+150) //Pressure quivalent to about 16.7 at 500K, temperature required is plasmaman cold damage limit
  388. for(var/A in reagents.reagent_list)
  389. var/datum/reagent/R = A
  390. if(R.id == "plasma" && R.volume >= 20)
  391. plasmaman_resurrection(breath.temperature)
  392.  
  393. /* else Doesn't seem to be working. Test more later
  394. if(istype(loc, /obj/machinery/atmospherics/components/unary/cryo_cell))
  395. var/obj/machinery/atmospherics/components/unary/cryo_cell/C = loc
  396. var/datum/gas_mixture/C_air_contents = C.airs[AIR1]
  397.  
  398. if(C_air_contents.total_moles() < 10)
  399. return
  400. if(C_air_contents.temperature > 350)
  401. breath = C.handle_internal_lifeform(src, BREATH_VOLUME)
  402. if(breath.get_breath_partial_pressure(breath.toxins) > 16)
  403. plasmaman_resurrection()*/
  404.  
  405. /mob/living/carbon/human/proc/plasmaman_resurrection(temperature)
  406. var/mob/dead/observer/ghost = get_ghost()
  407. if(ghost && !revivalnotification)
  408. ghost << "<span class='ghostalert'>Your feel a fire burning in your body. Return to your body if you want to be revived!</span> (Verbs -> Ghost -> Re-enter corpse)"
  409. ghost << 'sound/effects/genetics.ogg'
  410. revivalnotification = 1
  411. if(!get_ghost() && exists("brain"))
  412. revivalnotification = 0
  413. hardset_dna(src, null, null, null, null, /datum/species/plasmaman)
  414. bodytemperature = temperature
  415. setOxyLoss(0)
  416. setToxLoss(0)
  417. var/total_burn = getFireLoss()
  418. var/total_brute = getBruteLoss()
  419. //Damage set to max. 75
  420. if(total_burn+total_brute != 0)
  421. var/burn_to_heal = (health + 75) * (total_burn / (total_burn + total_brute))
  422. var/brute_to_heal = (health + 75) * (total_brute / (total_burn + total_brute))
  423. adjustFireLoss(burn_to_heal)
  424. adjustBruteLoss(brute_to_heal)
  425. stat = UNCONSCIOUS
  426. if(disabilities & HUSK)
  427. disabilities &= ~HUSK
  428. //update_base_icon_state()
  429. dead_mob_list -= src
  430. living_mob_list |= list(src)
  431. emote("gasp")
  432.  
  433. #undef HUMAN_MAX_OXYLOSS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement