Merge remote-tracking branch 'upstream/master' into dev-freeze

Conflicts:
	code/modules/mob/living/carbon/human/life.dm
	code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Food-Drinks.dm
This commit is contained in:
PsiOmegaDelta
2015-10-27 12:38:28 +01:00
9 changed files with 162 additions and 92 deletions

View File

@@ -528,7 +528,7 @@ Turf and target are seperate in case you want to teleport some distance from a t
var/y = min(world.maxy, max(1, A.y + dy)) var/y = min(world.maxy, max(1, A.y + dy))
return locate(x,y,A.z) return locate(x,y,A.z)
//Makes sure MIDDLE is between LOW and HIGH. If not, it adjusts it. Returns the adjusted value. //Makes sure MIDDLE is between LOW and HIGH. If not, it adjusts it. Returns the adjusted value. Lower bound takes priority.
/proc/between(var/low, var/middle, var/high) /proc/between(var/low, var/middle, var/high)
return max(min(middle, high), low) return max(min(middle, high), low)

View File

@@ -4,14 +4,76 @@
/obj/effect/effect/smoke/chem /obj/effect/effect/smoke/chem
icon = 'icons/effects/chemsmoke.dmi' icon = 'icons/effects/chemsmoke.dmi'
opacity = 0 opacity = 0
layer = 6
time_to_live = 300 time_to_live = 300
pass_flags = PASSTABLE | PASSGRILLE | PASSGLASS //PASSGLASS is fine here, it's just so the visual effect can "flow" around glass pass_flags = PASSTABLE | PASSGRILLE | PASSGLASS //PASSGLASS is fine here, it's just so the visual effect can "flow" around glass
var/splash_amount = 10 //atoms moving through a smoke cloud get splashed with up to 10 units of reagent
var/turf/destination
/obj/effect/effect/smoke/chem/New() /obj/effect/effect/smoke/chem/New(var/newloc, smoke_duration, turf/dest_turf = null, icon/cached_icon = null)
time_to_live = smoke_duration
..() ..()
create_reagents(500) create_reagents(500)
return
if(cached_icon)
icon = cached_icon
set_dir(pick(cardinal))
pixel_x = -32 + rand(-8, 8)
pixel_y = -32 + rand(-8, 8)
//switching opacity on after the smoke has spawned, and then turning it off before it is deleted results in cleaner
//lighting and view range updates (Is this still true with the new lighting system?)
opacity = 1
//float over to our destination, if we have one
destination = dest_turf
if(destination)
walk_to(src, destination)
/obj/effect/effect/smoke/chem/Destroy()
opacity = 0
fadeOut()
..()
/obj/effect/effect/smoke/chem/Move()
var/list/oldlocs = view(1, src)
. = ..()
if(.)
for(var/turf/T in view(1, src) - oldlocs)
for(var/atom/movable/AM in T)
if(!istype(AM, /obj/effect/effect/smoke/chem))
reagents.splash(AM, splash_amount, copy = 1)
if(loc == destination)
bound_width = 96
bound_height = 96
/obj/effect/effect/smoke/chem/Crossed(atom/movable/AM)
..()
if(!istype(AM, /obj/effect/effect/smoke/chem))
reagents.splash(AM, splash_amount, copy = 1)
/obj/effect/effect/smoke/chem/proc/initial_splash()
for(var/turf/T in view(1, src))
for(var/atom/movable/AM in T)
if(!istype(AM, /obj/effect/effect/smoke/chem))
reagents.splash(AM, splash_amount, copy = 1)
// Fades out the smoke smoothly using it's alpha variable.
/obj/effect/effect/smoke/chem/proc/fadeOut(var/frames = 16)
if(!alpha) return //already transparent
frames = max(frames, 1) //We will just assume that by 0 frames, the coder meant "during one frame".
var/alpha_step = round(alpha / frames)
while(alpha > 0)
alpha = max(0, alpha - alpha_step)
sleep(world.tick_lag)
/////////////////////////////////////////////
// Chem Smoke Effect System
/////////////////////////////////////////////
/datum/effect/effect/system/smoke_spread/chem /datum/effect/effect/system/smoke_spread/chem
smoke_type = /obj/effect/effect/smoke/chem smoke_type = /obj/effect/effect/smoke/chem
var/obj/chemholder var/obj/chemholder
@@ -115,13 +177,21 @@
else else
I = icon('icons/effects/96x96.dmi', "smoke") I = icon('icons/effects/96x96.dmi', "smoke")
//Calculate smoke duration
var/smoke_duration = 150
var/pressure = 0
var/datum/gas_mixture/environment = location.return_air()
if(environment) pressure = environment.return_pressure()
smoke_duration = between(5, smoke_duration*pressure/(ONE_ATMOSPHERE/3), smoke_duration)
var/const/arcLength = 2.3559 //distance between each smoke cloud var/const/arcLength = 2.3559 //distance between each smoke cloud
for(var/i = 0, i < range, i++) //calculate positions for smoke coverage - then spawn smoke for(var/i = 0, i < range, i++) //calculate positions for smoke coverage - then spawn smoke
var/radius = i * 1.5 var/radius = i * 1.5
if(!radius) if(!radius)
spawn(0) spawn(0)
spawnSmoke(location, I, 1) spawnSmoke(location, I, 1, 1)
continue continue
var/offset = 0 var/offset = 0
@@ -146,43 +216,26 @@
// Randomizes and spawns the smoke effect. // Randomizes and spawns the smoke effect.
// Also handles deleting the smoke once the effect is finished. // Also handles deleting the smoke once the effect is finished.
//------------------------------------------ //------------------------------------------
/datum/effect/effect/system/smoke_spread/chem/proc/spawnSmoke(var/turf/T, var/icon/I, var/dist = 1, var/obj/effect/effect/smoke/chem/passed_smoke) /datum/effect/effect/system/smoke_spread/chem/proc/spawnSmoke(var/turf/T, var/icon/I, var/smoke_duration, var/dist = 1, var/splash_initial=0, var/obj/effect/effect/smoke/chem/passed_smoke)
var/obj/effect/effect/smoke/chem/smoke var/obj/effect/effect/smoke/chem/smoke
if(passed_smoke) if(passed_smoke)
smoke = passed_smoke smoke = passed_smoke
else else
smoke = PoolOrNew(/obj/effect/effect/smoke/chem, location) smoke = PoolOrNew(/obj/effect/effect/smoke/chem, list(location, smoke_duration + rand(0, 20), T, I))
if(chemholder.reagents.reagent_list.len) if(chemholder.reagents.reagent_list.len)
chemholder.reagents.trans_to_obj(smoke, chemholder.reagents.total_volume / dist, copy = 1) //copy reagents to the smoke so mob/breathe() can handle inhaling the reagents chemholder.reagents.trans_to_obj(smoke, chemholder.reagents.total_volume / dist, copy = 1) //copy reagents to the smoke so mob/breathe() can handle inhaling the reagents
smoke.icon = I
smoke.layer = 6
smoke.set_dir(pick(cardinal))
smoke.pixel_x = -32 + rand(-8, 8)
smoke.pixel_y = -32 + rand(-8, 8)
walk_to(smoke, T)
smoke.opacity = 1 //switching opacity on after the smoke has spawned, and then
sleep(150+rand(0,20)) // turning it off before it is deleted results in cleaner
smoke.opacity = 0 // lighting and view range updates
fadeOut(smoke)
qdel(src)
/datum/effect/effect/system/smoke_spread/chem/spores/spawnSmoke(var/turf/T, var/icon/I, var/dist = 1) //Kinda ugly, but needed unless the system is reworked
if(splash_initial)
smoke.initial_splash()
/datum/effect/effect/system/smoke_spread/chem/spores/spawnSmoke(var/turf/T, var/smoke_duration, var/icon/I, var/dist = 1)
var/obj/effect/effect/smoke/chem/spores = PoolOrNew(/obj/effect/effect/smoke/chem, location) var/obj/effect/effect/smoke/chem/spores = PoolOrNew(/obj/effect/effect/smoke/chem, location)
spores.name = "cloud of [seed.seed_name] [seed.seed_noun]" spores.name = "cloud of [seed.seed_name] [seed.seed_noun]"
..(T, I, dist, spores) ..(T, I, smoke_duration, dist, spores)
/datum/effect/effect/system/smoke_spread/chem/proc/fadeOut(var/atom/A, var/frames = 16) // Fades out the smoke smoothly using it's alpha variable.
if(A.alpha == 0) //Handle already transparent case
return
if(frames == 0)
frames = 1 //We will just assume that by 0 frames, the coder meant "during one frame".
var/step = A.alpha / frames
for(var/i = 0, i < frames, i++)
A.alpha -= step
sleep(world.tick_lag)
return
/datum/effect/effect/system/smoke_spread/chem/proc/smokeFlow() // Smoke pathfinder. Uses a flood fill method based on zones to quickly check what turfs the smoke (airflow) can actually reach. /datum/effect/effect/system/smoke_spread/chem/proc/smokeFlow() // Smoke pathfinder. Uses a flood fill method based on zones to quickly check what turfs the smoke (airflow) can actually reach.

View File

@@ -65,13 +65,15 @@
//Handle possble chem smoke effect //Handle possble chem smoke effect
/mob/living/carbon/proc/handle_chemical_smoke(var/datum/gas_mixture/environment) /mob/living/carbon/proc/handle_chemical_smoke(var/datum/gas_mixture/environment)
if(species && environment.return_pressure() < species.breath_pressure/5)
return //pressure is too low to even breathe in.
if(wear_mask && (wear_mask.flags & BLOCK_GAS_SMOKE_EFFECT)) if(wear_mask && (wear_mask.flags & BLOCK_GAS_SMOKE_EFFECT))
return return
for(var/obj/effect/effect/smoke/chem/smoke in view(1, src)) for(var/obj/effect/effect/smoke/chem/smoke in view(1, src))
if(smoke.reagents.total_volume) if(smoke.reagents.total_volume)
smoke.reagents.trans_to_mob(src, 10, CHEM_INGEST, copy = 1) smoke.reagents.trans_to_mob(src, 5, CHEM_INGEST, copy = 1)
//maybe check air pressure here or something to see if breathing in smoke is even possible. smoke.reagents.trans_to_mob(src, 5, CHEM_BLOOD, copy = 1)
// I dunno, maybe the reagents enter the blood stream through the lungs? // I dunno, maybe the reagents enter the blood stream through the lungs?
break // If they breathe in the nasty stuff once, no need to continue checking break // If they breathe in the nasty stuff once, no need to continue checking

View File

@@ -362,7 +362,7 @@
oxygen_alert = max(oxygen_alert, 1) oxygen_alert = max(oxygen_alert, 1)
return 0 return 0
var/safe_pressure_min = 16 // Minimum safe partial pressure of breathable gas in kPa var/safe_pressure_min = species.breath_pressure // Minimum safe partial pressure of breathable gas in kPa
// Lung damage increases the minimum safe pressure. // Lung damage increases the minimum safe pressure.
if(species.has_organ["lungs"]) if(species.has_organ["lungs"])

View File

@@ -64,6 +64,7 @@
// Environment tolerance/life processes vars. // Environment tolerance/life processes vars.
var/reagent_tag //Used for metabolizing reagents. var/reagent_tag //Used for metabolizing reagents.
var/breath_pressure = 16 // Minimum partial pressure safe for breathing, kPa
var/breath_type = "oxygen" // Non-oxygen gas breathed, if any. var/breath_type = "oxygen" // Non-oxygen gas breathed, if any.
var/poison_type = "phoron" // Poisonous air. var/poison_type = "phoron" // Poisonous air.
var/exhale_type = "carbon_dioxide" // Exhaled gas type. var/exhale_type = "carbon_dioxide" // Exhaled gas type.

View File

@@ -298,7 +298,7 @@
trans_to(target, amount, multiplier, copy) trans_to(target, amount, multiplier, copy)
/datum/reagents/proc/trans_id_to(var/atom/target, var/id, var/amount = 1) /datum/reagents/proc/trans_id_to(var/atom/target, var/id, var/amount = 1)
if (!target || !target.reagents) if (!target || !target.reagents || !target.simulated)
return return
amount = min(amount, get_reagent_amount(id)) amount = min(amount, get_reagent_amount(id))
@@ -327,7 +327,7 @@
return return
/datum/reagents/proc/touch_mob(var/mob/target) /datum/reagents/proc/touch_mob(var/mob/target)
if(!target || !istype(target)) if(!target || !istype(target) || !target.simulated)
return return
for(var/datum/reagent/current in reagent_list) for(var/datum/reagent/current in reagent_list)
@@ -336,7 +336,7 @@
update_total() update_total()
/datum/reagents/proc/touch_turf(var/turf/target) /datum/reagents/proc/touch_turf(var/turf/target)
if(!target || !istype(target)) if(!target || !istype(target) || !target.simulated)
return return
for(var/datum/reagent/current in reagent_list) for(var/datum/reagent/current in reagent_list)
@@ -345,7 +345,7 @@
update_total() update_total()
/datum/reagents/proc/touch_obj(var/obj/target) /datum/reagents/proc/touch_obj(var/obj/target)
if(!target || !istype(target)) if(!target || !istype(target) || !target.simulated)
return return
for(var/datum/reagent/current in reagent_list) for(var/datum/reagent/current in reagent_list)
@@ -364,7 +364,7 @@
return trans_to_mob(target, amount, CHEM_TOUCH, perm, copy) return trans_to_mob(target, amount, CHEM_TOUCH, perm, copy)
/datum/reagents/proc/trans_to_mob(var/mob/target, var/amount = 1, var/type = CHEM_BLOOD, var/multiplier = 1, var/copy = 0) // Transfer after checking into which holder... /datum/reagents/proc/trans_to_mob(var/mob/target, var/amount = 1, var/type = CHEM_BLOOD, var/multiplier = 1, var/copy = 0) // Transfer after checking into which holder...
if(!target || !istype(target)) if(!target || !istype(target) || !target.simulated)
return return
if(iscarbon(target)) if(iscarbon(target))
var/mob/living/carbon/C = target var/mob/living/carbon/C = target
@@ -383,7 +383,7 @@
R.touch_mob(target) R.touch_mob(target)
/datum/reagents/proc/trans_to_turf(var/turf/target, var/amount = 1, var/multiplier = 1, var/copy = 0) // Turfs don't have any reagents (at least, for now). Just touch it. /datum/reagents/proc/trans_to_turf(var/turf/target, var/amount = 1, var/multiplier = 1, var/copy = 0) // Turfs don't have any reagents (at least, for now). Just touch it.
if(!target) if(!target || !target.simulated)
return return
var/datum/reagents/R = new /datum/reagents(amount * multiplier) var/datum/reagents/R = new /datum/reagents(amount * multiplier)
@@ -392,7 +392,7 @@
return return
/datum/reagents/proc/trans_to_obj(var/turf/target, var/amount = 1, var/multiplier = 1, var/copy = 0) // Objects may or may not; if they do, it's probably a beaker or something and we need to transfer properly; otherwise, just touch. /datum/reagents/proc/trans_to_obj(var/turf/target, var/amount = 1, var/multiplier = 1, var/copy = 0) // Objects may or may not; if they do, it's probably a beaker or something and we need to transfer properly; otherwise, just touch.
if(!target) if(!target || !target.simulated)
return return
if(!target.reagents) if(!target.reagents)

View File

@@ -219,6 +219,10 @@
description = "This is what makes chilis hot." description = "This is what makes chilis hot."
reagent_state = LIQUID reagent_state = LIQUID
color = "#B31008" color = "#B31008"
var/agony_dose = 5
var/agony_amount = 2
var/discomfort_message = "<span class='danger'>Your insides feel uncomfortably hot!</span>"
var/slime_temp_adj = 10
/datum/reagent/capsaicin/affect_blood(var/mob/living/carbon/M, var/alien, var/removed) /datum/reagent/capsaicin/affect_blood(var/mob/living/carbon/M, var/alien, var/removed)
if(alien == IS_DIONA) if(alien == IS_DIONA)
@@ -232,82 +236,82 @@
var/mob/living/carbon/human/H = M var/mob/living/carbon/human/H = M
if(H.species && (H.species.flags & (NO_PAIN))) if(H.species && (H.species.flags & (NO_PAIN)))
return return
if(dose < 5 && (dose == metabolism || prob(5))) if(dose < agony_dose)
M << "<span class='danger'>Your insides feel uncomfortably hot!</span>" if(prob(5) || dose == metabolism) //dose == metabolism is a very hacky way of forcing the message the first time this procs
if(dose >= 5) M << discomfort_message
M.apply_effect(2, AGONY, 0) else
M.apply_effect(agony_amount, AGONY, 0)
if(prob(5)) if(prob(5))
M.visible_message("<span class='warning'>[M] [pick("dry heaves!","coughs!","splutters!")]</span>", "<span class='danger'>You feel like your insides are burning!</span>") M.custom_emote(2, "[pick("dry heaves!","coughs!","splutters!")]")
M << "<span class='danger'>You feel like your insides are burning!</span>"
if(istype(M, /mob/living/carbon/slime)) if(istype(M, /mob/living/carbon/slime))
M.bodytemperature += rand(10, 25) M.bodytemperature += rand(0, 15) + slime_temp_adj
holder.remove_reagent("frostoil", 5) holder.remove_reagent("frostoil", 5)
/datum/reagent/condensedcapsaicin /datum/reagent/capsaicin/condensed
name = "Condensed Capsaicin" name = "Condensed Capsaicin"
id = "condensedcapsaicin" id = "condensedcapsaicin"
description = "A chemical agent used for self-defense and in police work." description = "A chemical agent used for self-defense and in police work."
reagent_state = LIQUID reagent_state = LIQUID
touch_met = 50 // Get rid of it quickly touch_met = 50 // Get rid of it quickly
color = "#B31008" color = "#B31008"
agony_dose = 0.5
agony_amount = 4
discomfort_message = "<span class='danger'>You feel like your insides are burning!</span>"
slime_temp_adj = 15
/datum/reagent/condensedcapsaicin/affect_blood(var/mob/living/carbon/M, var/alien, var/removed) /datum/reagent/capsaicin/condensed/affect_touch(var/mob/living/carbon/M, var/alien, var/removed)
if(alien == IS_DIONA)
return
M.adjustToxLoss(0.5 * removed)
/datum/reagent/condensedcapsaicin/affect_touch(var/mob/living/carbon/M, var/alien, var/removed)
var/eyes_covered = 0 var/eyes_covered = 0
var/mouth_covered = 0 var/mouth_covered = 0
var/obj/item/safe_thing = null var/no_pain = 0
var/obj/item/eye_protection = null
var/obj/item/face_protection = null
var/list/protection
if(istype(M, /mob/living/carbon/human)) if(istype(M, /mob/living/carbon/human))
var/mob/living/carbon/human/H = M var/mob/living/carbon/human/H = M
protection = list(H.head, H.glasses, H.wear_mask)
if(H.species && (H.species.flags & NO_PAIN)) if(H.species && (H.species.flags & NO_PAIN))
return no_pain = 1 //TODO: living-level can_feel_pain() proc
if(H.head) else
if(H.head.flags & MASKCOVERSEYES) protection = list(M.wear_mask)
for(var/obj/item/I in protection)
if(I)
if(I.flags & MASKCOVERSEYES)
eyes_covered = 1 eyes_covered = 1
safe_thing = H.head eye_protection = I.name
if(H.head.flags & MASKCOVERSMOUTH) if(I.flags & MASKCOVERSMOUTH)
mouth_covered = 1 mouth_covered = 1
safe_thing = H.head face_protection = I.name
if(H.wear_mask)
if(!eyes_covered && H.wear_mask.flags & MASKCOVERSEYES) var/message = null
eyes_covered = 1 if(eyes_covered)
safe_thing = H.wear_mask if(!mouth_covered)
if(!mouth_covered && H.wear_mask.flags & MASKCOVERSMOUTH) message = "<span class='warning'>Your [eye_protection] protects your eyes from the pepperspray!</span>"
mouth_covered = 1 else
safe_thing = H.wear_mask message = "<span class='warning'>The pepperspray gets in your eyes!</span>"
if(H.glasses) if(mouth_covered)
if(!eyes_covered) M.eye_blurry = max(M.eye_blurry, 15)
eyes_covered = 1 M.eye_blind = max(M.eye_blind, 5)
if(!safe_thing) else
safe_thing = H.glasses M.eye_blurry = max(M.eye_blurry, 25)
if(eyes_covered && mouth_covered) M.eye_blind = max(M.eye_blind, 10)
M << "<span class='warning'>Your [safe_thing] protects you from the pepperspray!</span>"
return if(mouth_covered)
else if(eyes_covered) if(!message)
M << "<span class='warning'>Your [safe_thing] protect you from most of the pepperspray!</span>" message = "<span class='warning'>Your [face_protection] protects you from the pepperspray!</span>"
M.eye_blurry = max(M.eye_blurry, 15) else if(!no_pain)
M.eye_blind = max(M.eye_blind, 5) message = "<span class='danger'>Your face and throat burn!</span>"
if(prob(25))
M.custom_emote(2, "[pick("coughs!","coughs hysterically!","splutters!")]")
M.Stun(5) M.Stun(5)
M.Weaken(5) M.Weaken(5)
return
else if (mouth_covered) // Mouth cover is better than eye cover
M << "<span class='warning'>Your [safe_thing] protects your face from the pepperspray!</span>"
M.eye_blurry = max(M.eye_blurry, 5)
return
else // Oh dear :D
M << "<span class='warning'>You're sprayed directly in the eyes with pepperspray!</span>"
M.eye_blurry = max(M.eye_blurry, 25)
M.eye_blind = max(M.eye_blind, 10)
M.Stun(5)
M.Weaken(5)
return
/datum/reagent/condensedcapsaicin/affect_ingest(var/mob/living/carbon/M, var/alien, var/removed) /datum/reagent/condensedcapsaicin/affect_ingest(var/mob/living/carbon/M, var/alien, var/removed)
if(ishuman(M)) if(ishuman(M))
var/mob/living/carbon/human/H = M var/mob/living/carbon/human/H = M
if(H.species && (H.species.flags & (NO_PAIN))) if(H.species && (H.species.flags & (NO_PAIN | IS_SYNTHETIC)))
return return
if(dose == metabolism) if(dose == metabolism)
M << "<span class='danger'>You feel like your insides are burning!</span>" M << "<span class='danger'>You feel like your insides are burning!</span>"

View File

@@ -56,6 +56,12 @@
--> -->
<div class="commit sansserif"> <div class="commit sansserif">
<h2 class="date">27 October 2015</h2>
<h3 class="author">HarpyEagle updated:</h3>
<ul class="changes bgimages16">
<li class="bugfix">When affected by pepperspray, eye protection now prevents blindness and face protection now prevents stun, instead of face protection doing both.</li>
</ul>
<h2 class="date">14 October 2015</h2> <h2 class="date">14 October 2015</h2>
<h3 class="author">Hubblenaut updated:</h3> <h3 class="author">Hubblenaut updated:</h3>
<ul class="changes bgimages16"> <ul class="changes bgimages16">

View File

@@ -2142,3 +2142,7 @@ DO NOT EDIT THIS FILE BY HAND! AUTOMATICALLY GENERATED BY ss13_genchangelog.py.
- bugfix: Messages for adding to existing stack appear again. - bugfix: Messages for adding to existing stack appear again.
TheWelp: TheWelp:
- rscdel: Removed higher Secret player requirements. - rscdel: Removed higher Secret player requirements.
2015-10-27:
HarpyEagle:
- bugfix: When affected by pepperspray, eye protection now prevents blindness and
face protection now prevents stun, instead of face protection doing both.