- Chemistry smoke now is laced with everything inside of the beaker/container. Using a new smoke icon, the smoke will exhibit a color combination of the reagents just like normal, so you can easily identify a cloud of pacid smoke from dexalin smoke. (space drugs smoke, anyone?)

- A new /datum/reagents proc called copy_to() works like trans_to() except that it "copies" reagents instead of transferring them.

- Modified all breathing mobs to support inhaling chemical smoke reagents.


If you are a-hatin', please leave all your hate in this revision page. This is a very significant game change, and to be honest I only briefly mentioned it over IRC a couple of times (however the idea was positively received).

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2033 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
vageyenaman@gmail.com
2011-08-21 05:07:00 +00:00
parent 6a4b3e236b
commit 73a73a8211
10 changed files with 2771 additions and 2550 deletions
+131
View File
@@ -214,6 +214,7 @@ steam.start() -- spawns the effect
// in case you wanted a vent to always smoke north for example
/////////////////////////////////////////////
/obj/effects/harmless_smoke
name = "smoke"
icon_state = "smoke"
@@ -388,6 +389,136 @@ steam.start() -- spawns the effect
src.total_smoke--
/////////////////////////////////////////////
// Chem smoke
/////////////////////////////////////////////
/obj/effects/chem_smoke
name = "smoke"
opacity = 1
anchored = 0.0
mouse_opacity = 0
var/amount = 6.0
icon = 'chemsmoke.dmi'
pixel_x = -32
pixel_y = -32
/obj/effects/chem_smoke/New()
..()
var/datum/reagents/R = new/datum/reagents(500)
reagents = R
R.my_atom = src
spawn (200+rand(10,30))
del(src)
return
/obj/effects/chem_smoke/Move()
..()
for(var/atom/A in view(2, src))
reagents.reaction(A)
return
/obj/effects/chem_smoke/HasEntered(mob/living/carbon/M as mob )
..()
reagents.reaction(M)
return
/datum/effects/system/chem_smoke_spread
var/number = 3
var/cardinals = 0
var/turf/location
var/atom/holder
var/total_smoke = 0 // To stop it being spammed and lagging!
var/direction
var/obj/chemholder
New()
..()
chemholder = new/obj()
var/datum/reagents/R = new/datum/reagents(500)
chemholder.reagents = R
R.my_atom = chemholder
/datum/effects/system/chem_smoke_spread/proc/set_up(var/datum/reagents/carry = null, n = 5, c = 0, loca, direct)
if(n > 20)
n = 20
number = n
cardinals = c
carry.copy_to(chemholder, carry.total_volume)
if(istype(loca, /turf/))
location = loca
else
location = get_turf(loca)
if(direct)
direction = direct
/datum/effects/system/chem_smoke_spread/proc/attach(atom/atom)
holder = atom
/datum/effects/system/chem_smoke_spread/proc/start()
var/i = 0
// Calculate the smokes' color
var/list/rgbcolor = list(0,0,0)
var/finalcolor
for(var/datum/reagent/re in chemholder.reagents.reagent_list)
if(!finalcolor)
rgbcolor = GetColors(re.color)
finalcolor = re.color
else
var/newcolor[3]
var/prergbcolor[3]
prergbcolor = rgbcolor
newcolor = GetColors(re.color)
rgbcolor[1] = (prergbcolor[1]+newcolor[1])/2
rgbcolor[2] = (prergbcolor[2]+newcolor[2])/2
rgbcolor[3] = (prergbcolor[3]+newcolor[3])/2
finalcolor = rgb(rgbcolor[1], rgbcolor[2], rgbcolor[3])
if(finalcolor)
finalcolor = rgb(rgbcolor[1], rgbcolor[2], rgbcolor[3]) // slightly darker color
for(i=0, i<src.number, i++)
if(src.total_smoke > 20)
return
spawn(0)
if(holder)
src.location = get_turf(holder)
var/obj/effects/chem_smoke/smoke = new /obj/effects/chem_smoke(src.location)
src.total_smoke++
var/direction = src.direction
if(!direction)
if(src.cardinals)
direction = pick(cardinal)
else
direction = pick(alldirs)
chemholder.reagents.copy_to(smoke, chemholder.reagents.total_volume) // copy reagents to each smoke
if(finalcolor)
smoke.icon += finalcolor // give the smoke color, if it has any to begin with
else
// if no color, just use the old smoke icon
smoke.icon = '96x96.dmi'
smoke.icon_state = "smoke"
for(i=0, i<pick(0,1,1,1,2,2,2,3), i++)
sleep(10)
step(smoke,direction)
spawn(150+rand(10,30))
del(smoke)
src.total_smoke--
/////////////////////////////////////////////
// Sleep smoke
/////////////////////////////////////////////
+21
View File
@@ -79,6 +79,27 @@ datum
src.handle_reactions()
return amount
copy_to(var/obj/target, var/amount=1, var/multiplier=1, var/preserve_data=1)
if(!target)
return
if(!target.reagents || src.total_volume<=0)
return
var/datum/reagents/R = target.reagents
amount = min(min(amount, src.total_volume), R.maximum_volume-R.total_volume)
var/part = amount / src.total_volume
var/trans_data = null
for (var/datum/reagent/current_reagent in src.reagent_list)
var/current_reagent_transfer = current_reagent.volume * part
if(preserve_data)
trans_data = current_reagent.data
R.add_reagent(current_reagent.id, (current_reagent_transfer * multiplier), trans_data)
src.update_total()
R.update_total()
R.handle_reactions()
src.handle_reactions()
return amount
trans_id_to(var/obj/target, var/reagent, var/amount=1, var/preserve_data=1)//Not sure why this proc didn't exist before. It does now! /N
if (!target)
return
@@ -342,6 +342,7 @@ datum
holder.del_reagent("napalm")
return
/*
smoke
name = "Smoke"
id = "smoke"
@@ -366,6 +367,26 @@ datum
sleep(10)
S.start()
holder.clear_reagents()
return */
chemsmoke
name = "Chemsmoke"
id = "chemsmoke"
result = null
required_reagents = list("potassium" = 1, "sugar" = 1, "phosphorus" = 1)
result_amount = null
secondary = 1
on_reaction(var/datum/reagents/holder, var/created_volume)
var/location = get_turf(holder.my_atom)
var/datum/effects/system/chem_smoke_spread/S = new /datum/effects/system/chem_smoke_spread
S.attach(location)
S.set_up(holder, 10, 0, location)
playsound(location, 'smoke.ogg', 50, 1, -3)
spawn(0)
S.start()
sleep(10)
S.start()
holder.clear_reagents()
return
chloralhydrate
@@ -211,6 +211,16 @@
breath = loc.remove_air(breath_moles)
// Handle chem smoke effects -- Doohl
for(var/obj/effects/chem_smoke/smoke in view(2, src))
if(smoke.reagents.total_volume)
smoke.reagents.reaction(src, INGEST)
spawn(5)
if(smoke)
smoke.reagents.copy_to(src, 10) // 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
else //Still give containing object the chance to interact
if(istype(loc, /obj/))
var/obj/location_as_object = loc
@@ -192,6 +192,16 @@
breath = loc.remove_air(breath_moles)
// Handle chem smoke effects -- Doohl
for(var/obj/effects/chem_smoke/smoke in view(2, src))
if(smoke.reagents.total_volume)
smoke.reagents.reaction(src, INGEST)
spawn(5)
if(smoke)
smoke.reagents.copy_to(src, 10) // 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
else //Still give containing object the chance to interact
if(istype(loc, /obj/))
var/obj/location_as_object = loc
@@ -282,6 +282,15 @@
breath = loc.remove_air(breath_moles)
// Handle chem smoke effects -- Doohl
for(var/obj/effects/chem_smoke/smoke in view(2, src))
if(smoke.reagents.total_volume)
smoke.reagents.reaction(src, INGEST)
spawn(5)
if(smoke)
smoke.reagents.copy_to(src, 10) // 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
else //Still give containing object the chance to interact
if(istype(loc, /obj/))
var/obj/location_as_object = loc
@@ -407,6 +416,7 @@
fire_alert = 0
//Temporary fixes to the alerts.
return 1
@@ -202,6 +202,16 @@
var/breath_moles = environment.total_moles()*BREATH_PERCENTAGE
breath = loc.remove_air(breath_moles)
// Handle chem smoke effects -- Doohl
for(var/obj/effects/chem_smoke/smoke in view(2, src))
if(smoke.reagents.total_volume)
smoke.reagents.reaction(src, INGEST)
spawn(5)
if(smoke)
smoke.reagents.copy_to(src, 10) // 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
else //Still give containing object the chance to interact
if(istype(loc, /obj/))
var/obj/location_as_object = loc