mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-26 05:27:01 +01:00
add fade out effect to all smoke (untested), move nanofrost smoke to effects_smoke.dm, make smoke effects OOP (unfinished)
This commit is contained in:
@@ -6,138 +6,49 @@
|
||||
|
||||
/obj/effect/effect/smoke
|
||||
name = "smoke"
|
||||
icon = 'icons/effects/water.dmi'
|
||||
icon_state = "smoke"
|
||||
opacity = 1
|
||||
anchored = 0.0
|
||||
mouse_opacity = 0
|
||||
var/amount = 8.0
|
||||
|
||||
/obj/effect/effect/harmless_smoke
|
||||
name = "smoke"
|
||||
icon_state = "smoke"
|
||||
opacity = 1
|
||||
anchored = 0.0
|
||||
mouse_opacity = 0
|
||||
var/amount = 6.0
|
||||
//Remove this bit to use the old smoke
|
||||
icon = 'icons/effects/96x96.dmi'
|
||||
pixel_x = -32
|
||||
pixel_y = -32
|
||||
|
||||
/obj/effect/effect/harmless_smoke/New()
|
||||
..()
|
||||
spawn(100)
|
||||
delete()
|
||||
return
|
||||
|
||||
/obj/effect/effect/harmless_smoke/Move()
|
||||
..()
|
||||
return
|
||||
|
||||
/datum/effect/system/harmless_smoke_spread
|
||||
var/total_smoke = 0 // To stop it being spammed and lagging!
|
||||
var/direction
|
||||
|
||||
/datum/effect/system/harmless_smoke_spread/set_up(n = 5, c = 0, loca, direct)
|
||||
if(n > 10)
|
||||
n = 10
|
||||
number = n
|
||||
cardinals = c
|
||||
if(istype(loca, /turf/))
|
||||
location = loca
|
||||
else
|
||||
location = get_turf(loca)
|
||||
if(direct)
|
||||
direction = direct
|
||||
|
||||
/datum/effect/system/harmless_smoke_spread/start()
|
||||
var/i = 0
|
||||
for(i=0, i<src.number, i++)
|
||||
if(src.total_smoke > 20)
|
||||
return
|
||||
spawn(0)
|
||||
if(holder)
|
||||
src.location = get_turf(holder)
|
||||
var/obj/effect/effect/harmless_smoke/smoke = new /obj/effect/effect/harmless_smoke(src.location)
|
||||
src.total_smoke++
|
||||
var/direction = src.direction
|
||||
if(!direction)
|
||||
if(src.cardinals)
|
||||
direction = pick(cardinal)
|
||||
else
|
||||
direction = pick(alldirs)
|
||||
for(i=0, i<pick(0,1,1,1,2,2,2,3), i++)
|
||||
sleep(10)
|
||||
step(smoke,direction)
|
||||
spawn(75+rand(10,30))
|
||||
smoke.delete()
|
||||
src.total_smoke--
|
||||
|
||||
/////////////////////////////////////////////
|
||||
// Bad smoke
|
||||
/////////////////////////////////////////////
|
||||
|
||||
/obj/effect/effect/bad_smoke
|
||||
name = "smoke"
|
||||
icon_state = "smoke"
|
||||
opacity = 1
|
||||
anchored = 0.0
|
||||
anchored = 0
|
||||
mouse_opacity = 0
|
||||
var/amount = 6.0
|
||||
//Remove this bit to use the old smoke
|
||||
icon = 'icons/effects/96x96.dmi'
|
||||
pixel_x = -32
|
||||
pixel_y = -32
|
||||
var/time_to_live = 100
|
||||
|
||||
/obj/effect/effect/bad_smoke/New()
|
||||
/datum/effect/effect/smoke/proc/fade_out(frames = 16)
|
||||
if(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 = alpha / frames
|
||||
for(var/i = 0, i < frames, i++)
|
||||
alpha -= step
|
||||
sleep(world.tick_lag)
|
||||
|
||||
/obj/effect/effect/smoke/New()
|
||||
..()
|
||||
spawn(200+rand(10,30))
|
||||
spawn(time_to_live)
|
||||
delete()
|
||||
return
|
||||
|
||||
/obj/effect/effect/bad_smoke/Move()
|
||||
..()
|
||||
for(var/mob/living/carbon/M in get_turf(src))
|
||||
if(M.internal != null && M.wear_mask && (M.wear_mask.flags & AIRTIGHT))
|
||||
else
|
||||
M.drop_item()
|
||||
M.adjustOxyLoss(1)
|
||||
if(M.coughedtime != 1)
|
||||
M.coughedtime = 1
|
||||
M.emote("cough")
|
||||
spawn(20)
|
||||
M.coughedtime = 0
|
||||
return
|
||||
/obj/effect/effect/smoke/Crossed(mob/living/M)
|
||||
if(!istype(M))
|
||||
return
|
||||
smoke_mob(M)
|
||||
|
||||
/obj/effect/effect/bad_smoke/CanPass(atom/movable/mover, turf/target, height=0)
|
||||
if(height==0)
|
||||
return 1
|
||||
if(istype(mover, /obj/item/projectile/beam))
|
||||
var/obj/item/projectile/beam/B = mover
|
||||
B.damage = (B.damage/2)
|
||||
return 1
|
||||
/obj/effect/effect/smoke/proc/smoke_mob(mob/living/carbon/C)
|
||||
if(!istype(C))
|
||||
return FALSE
|
||||
if(!C.can_breathe_gas())
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/effect/effect/bad_smoke/Crossed(mob/living/carbon/M)
|
||||
..()
|
||||
if(iscarbon(M))
|
||||
if(M.internal != null && M.wear_mask && (M.wear_mask.flags & AIRTIGHT))
|
||||
return
|
||||
else
|
||||
M.drop_item()
|
||||
M.adjustOxyLoss(1)
|
||||
if(M.coughedtime != 1)
|
||||
M.coughedtime = 1
|
||||
M.emote("cough")
|
||||
spawn(20)
|
||||
M.coughedtime = 0
|
||||
return
|
||||
|
||||
/datum/effect/system/bad_smoke_spread
|
||||
/datum/effect/system/smoke_spread
|
||||
var/total_smoke = 0 // To stop it being spammed and lagging!
|
||||
var/direction
|
||||
var/smoke_type = /obj/effect/effect/smoke
|
||||
|
||||
/datum/effect/system/bad_smoke_spread/set_up(n = 5, c = 0, loca, direct)
|
||||
/datum/effect/system/smoke_spread/set_up(n = 5, c = 0, loca, direct)
|
||||
if(n > 20)
|
||||
n = 20
|
||||
number = n
|
||||
@@ -149,77 +60,165 @@
|
||||
if(direct)
|
||||
direction = direct
|
||||
|
||||
/datum/effect/system/bad_smoke_spread/start()
|
||||
/datum/effect/system/smoke_spread/start()
|
||||
var/i = 0
|
||||
for(i=0, i<src.number, i++)
|
||||
if(src.total_smoke > 20)
|
||||
for(i=0, i<number, i++)
|
||||
if(total_smoke > 20)
|
||||
return
|
||||
spawn(0)
|
||||
if(holder)
|
||||
src.location = get_turf(holder)
|
||||
var/obj/effect/effect/bad_smoke/smoke = new /obj/effect/effect/bad_smoke(src.location)
|
||||
src.total_smoke++
|
||||
location = get_turf(holder)
|
||||
var/obj/effect/effect/harmless_smoke/smoke = new /obj/effect/effect/harmless_smoke(location)
|
||||
total_smoke++
|
||||
var/direction = src.direction
|
||||
if(!direction)
|
||||
if(src.cardinals)
|
||||
if(cardinals)
|
||||
direction = pick(cardinal)
|
||||
else
|
||||
direction = pick(alldirs)
|
||||
for(i=0, i<pick(0,1,1,1,2,2,2,3), i++)
|
||||
sleep(10)
|
||||
step(smoke,direction)
|
||||
spawn(150+rand(10,30))
|
||||
smoke.delete()
|
||||
src.total_smoke--
|
||||
spawn(smoke.time_to_live*0.75+rand(10,30))
|
||||
if(smoke)
|
||||
spawn(0)
|
||||
smoke.fade_out()
|
||||
spawn(10)
|
||||
smoke.delete()
|
||||
total_smoke--
|
||||
|
||||
/////////////////////////////////////////////
|
||||
// Bad smoke
|
||||
/////////////////////////////////////////////
|
||||
|
||||
/obj/effect/effect/smoke/bad
|
||||
time_to_live = 200+rand(10,30)
|
||||
|
||||
/obj/effect/effect/smoke/bad/Move()
|
||||
..()
|
||||
for(var/mob/living/carbon/M in get_turf(src))
|
||||
smoke_mob(M)
|
||||
|
||||
/obj/effect/effect/smoke/bad/CanPass(atom/movable/mover, turf/target, height=0)
|
||||
if(height==0)
|
||||
return 1
|
||||
if(istype(mover, /obj/item/projectile/beam))
|
||||
var/obj/item/projectile/beam/B = mover
|
||||
B.damage = (B.damage/2)
|
||||
return 1
|
||||
|
||||
/obj/effect/effect/smoke/bad/smoke_mob(mob/living/carbon/C)
|
||||
if(..())
|
||||
M.drop_item()
|
||||
M.adjustOxyLoss(1)
|
||||
if(M.coughedtime != 1)
|
||||
M.coughedtime = 1
|
||||
M.emote("cough")
|
||||
spawn(20)
|
||||
M.coughedtime = 0
|
||||
|
||||
/datum/effect/system/smoke_spread/bad
|
||||
smoke_type = /obj/effect/effect/smoke/bad
|
||||
|
||||
/////////////////////////////////////////////
|
||||
// Nanofrost smoke
|
||||
/////////////////////////////////////////////
|
||||
|
||||
/obj/effect/effect/smoke/freezing
|
||||
name = "nanofrost smoke"
|
||||
color = "#B2FFFF"
|
||||
opacity = 0
|
||||
|
||||
/datum/effect/system/smoke_spread/freezing
|
||||
smoke_type = /obj/effect/effect/smoke/freezing
|
||||
var/blast = 0
|
||||
|
||||
/datum/effect/system/smoke_spread/freezing/proc/Chilled(atom/A)
|
||||
if(istype(A, /turf/simulated))
|
||||
var/turf/simulated/T = A
|
||||
if(T.air)
|
||||
var/datum/gas_mixture/G = T.air
|
||||
if(get_dist(T, src) < 2) // Otherwise we'll get silliness like people using Nanofrost to kill people through walls with cold air
|
||||
G.temperature = 2
|
||||
T.air_update_turf()
|
||||
for(var/obj/effect/hotspot/H in T)
|
||||
qdel(H)
|
||||
if(G.toxins)
|
||||
G.nitrogen += (G.toxins)
|
||||
G.toxins = 0
|
||||
for(var/obj/machinery/atmospherics/unary/vent_pump/V in T)
|
||||
if(!isnull(V.welded) && !V.welded) //must be an unwelded vent pump or vent scrubber.
|
||||
V.welded = 1
|
||||
V.update_icon()
|
||||
V.visible_message("<span class='danger'>[V] was frozen shut!</span>")
|
||||
for(var/mob/living/L in T)
|
||||
L.ExtinguishMob()
|
||||
for(var/obj/item/Item in T)
|
||||
Item.extinguish()
|
||||
|
||||
/datum/effect/system/smoke_spread/freezing/set_up(n = 5, c = 0, loca, direct, blasting = 0)
|
||||
..()
|
||||
blast = blasting
|
||||
|
||||
/datum/effect/system/smoke_spread/freezing/start()
|
||||
if(blast)
|
||||
for(var/turf/T in trange(2, location))
|
||||
Chilled(T)
|
||||
..()
|
||||
|
||||
/////////////////////////////////////////////
|
||||
// Sleep smoke
|
||||
/////////////////////////////////////////////
|
||||
|
||||
/obj/effect/effect/smoke/sleeping
|
||||
color = "#9C3636"
|
||||
|
||||
/obj/effect/effect/smoke/sleeping/Move()
|
||||
..()
|
||||
for(var/mob/living/carbon/M in get_turf(src))
|
||||
smoke_mob(M)
|
||||
|
||||
/obj/effect/effect/smoke/sleeping/smoke_mob()
|
||||
if(..())
|
||||
M.drop_item()
|
||||
M.AdjustSleeping(5)
|
||||
if(M.coughedtime != 1)
|
||||
M.coughedtime = 1
|
||||
M.emote("cough")
|
||||
spawn(20)
|
||||
if(M && M.loc)
|
||||
M.coughedtime = 0
|
||||
|
||||
/datum/effect/system/smoke_spread/sleeping
|
||||
smoke_type = /obj/effect/effect/smoke/sleeping
|
||||
|
||||
/////////////////////////////////////////////
|
||||
// Chem smoke
|
||||
/////////////////////////////////////////////
|
||||
|
||||
/obj/effect/effect/chem_smoke
|
||||
name = "smoke"
|
||||
opacity = 0
|
||||
anchored = 0.0
|
||||
mouse_opacity = 0
|
||||
var/amount = 6.0
|
||||
|
||||
/obj/effect/effect/smoke/chem
|
||||
icon = 'icons/effects/chemsmoke.dmi'
|
||||
pixel_x = -32
|
||||
pixel_y = -32
|
||||
opacity = 0
|
||||
time_to_live = 200+rand(10,30)
|
||||
|
||||
/obj/effect/effect/chem_smoke/New()
|
||||
..()
|
||||
spawn(200+rand(10,30))
|
||||
delete()
|
||||
return
|
||||
|
||||
/obj/effect/effect/chem_smoke/Move()
|
||||
..()
|
||||
|
||||
/datum/effect/system/chem_smoke_spread/New()
|
||||
..()
|
||||
chemholder = new/obj()
|
||||
var/datum/reagents/R = new/datum/reagents(500)
|
||||
chemholder.reagents = R
|
||||
R.my_atom = chemholder
|
||||
|
||||
/datum/effect/system/chem_smoke_spread
|
||||
/datum/effect/system/smoke_spread/chem
|
||||
smoke_type = /obj/effect/effect/smoke/chem
|
||||
var/total_smoke = 0 // To stop it being spammed and lagging!
|
||||
var/direction
|
||||
var/obj/chemholder
|
||||
|
||||
/datum/effect/system/chem_smoke_spread/New()
|
||||
/datum/effect/system/smoke_spread/chem/New()
|
||||
..()
|
||||
chemholder = new/obj()
|
||||
var/datum/reagents/R = new/datum/reagents(500)
|
||||
chemholder.reagents = R
|
||||
R.my_atom = chemholder
|
||||
|
||||
/datum/effect/system/chem_smoke_spread/Destroy()
|
||||
/datum/effect/system/smoke_spread/chem/Destroy()
|
||||
QDEL_NULL(chemholder)
|
||||
return ..()
|
||||
|
||||
/datum/effect/system/chem_smoke_spread/set_up(datum/reagents/carry = null, n = 5, c = 0, loca, direct, silent = 0)
|
||||
/datum/effect/system/smoke_spread/chem/set_up(datum/reagents/carry = null, n = 5, c = 0, loca, direct, silent = 0)
|
||||
if(n > 20)
|
||||
n = 20
|
||||
number = n
|
||||
@@ -258,11 +257,11 @@
|
||||
msg_admin_attack("A chemical smoke reaction has taken place in ([whereLink]). No associated key. CODERS: carry.my_atom may be null.", 0, 1)
|
||||
log_game("A chemical smoke reaction has taken place in ([where])[contained]. No associated key. CODERS: carry.my_atom may be null.")
|
||||
|
||||
/datum/effect/system/chem_smoke_spread/start(effect_range = 2)
|
||||
/datum/effect/system/smoke_spread/chem/start(effect_range = 2)
|
||||
var/i = 0
|
||||
|
||||
var/color = mix_color_from_reagents(chemholder.reagents.reagent_list)
|
||||
var/obj/effect/effect/chem_smoke/smokeholder = new /obj/effect/effect/chem_smoke(src.location)
|
||||
var/obj/effect/effect/smoke/chem/smokeholder = new smoke_type(location)
|
||||
for(var/atom/A in view(effect_range, smokeholder))
|
||||
chemholder.reagents.reaction(A)
|
||||
if(iscarbon(A))
|
||||
@@ -271,16 +270,16 @@
|
||||
chemholder.reagents.copy_to(C, chemholder.reagents.total_volume)
|
||||
qdel(smokeholder)
|
||||
for(i=0, i<src.number, i++)
|
||||
if(src.total_smoke > 20)
|
||||
if(total_smoke > 20)
|
||||
return
|
||||
spawn(0)
|
||||
if(holder)
|
||||
src.location = get_turf(holder)
|
||||
var/obj/effect/effect/chem_smoke/smoke = new /obj/effect/effect/chem_smoke(src.location)
|
||||
src.total_smoke++
|
||||
location = get_turf(holder)
|
||||
var/obj/effect/effect/smoke/chem/smoke = new smoke_type(location)
|
||||
total_smoke++
|
||||
var/direction = src.direction
|
||||
if(!direction)
|
||||
if(src.cardinals)
|
||||
if(cardinals)
|
||||
direction = pick(cardinal)
|
||||
else
|
||||
direction = pick(alldirs)
|
||||
@@ -294,102 +293,10 @@
|
||||
for(i=0, i<pick(0,1,1,1,2,2,2,3), i++)
|
||||
sleep(10)
|
||||
step(smoke,direction)
|
||||
spawn(150+rand(10,30))
|
||||
spawn(smoke.time_to_live+rand(10,30))
|
||||
if(smoke)
|
||||
smoke.delete()
|
||||
src.total_smoke--
|
||||
|
||||
/////////////////////////////////////////////
|
||||
// Sleep smoke
|
||||
/////////////////////////////////////////////
|
||||
|
||||
/obj/effect/effect/sleep_smoke
|
||||
name = "smoke"
|
||||
icon_state = "smoke"
|
||||
opacity = 1
|
||||
anchored = 0.0
|
||||
mouse_opacity = 0
|
||||
var/amount = 6.0
|
||||
//Remove this bit to use the old smoke
|
||||
icon = 'icons/effects/96x96.dmi'
|
||||
pixel_x = -32
|
||||
pixel_y = -32
|
||||
color = "#9C3636"
|
||||
|
||||
/obj/effect/effect/sleep_smoke/New()
|
||||
..()
|
||||
spawn(200+rand(10,30))
|
||||
delete()
|
||||
return
|
||||
|
||||
/obj/effect/effect/sleep_smoke/Move()
|
||||
..()
|
||||
for(var/mob/living/carbon/M in get_turf(src))
|
||||
if(M.internal != null && M.wear_mask && (M.wear_mask.flags & AIRTIGHT))
|
||||
// if(M.wear_suit, /obj/item/clothing/suit/wizrobe && (M.hat, /obj/item/clothing/head/wizard) && (M.shoes, /obj/item/clothing/shoes/sandal)) // I'll work on it later
|
||||
else
|
||||
M.drop_item()
|
||||
M.AdjustSleeping(5)
|
||||
if(M.coughedtime != 1)
|
||||
M.coughedtime = 1
|
||||
M.emote("cough")
|
||||
spawn(20)
|
||||
if(M && M.loc)
|
||||
M.coughedtime = 0
|
||||
return
|
||||
|
||||
/obj/effect/effect/sleep_smoke/Crossed(mob/living/carbon/M)
|
||||
..()
|
||||
if(istype(M, /mob/living/carbon))
|
||||
if(M.internal != null && M.wear_mask && (M.wear_mask.flags & AIRTIGHT))
|
||||
// if(M.wear_suit, /obj/item/clothing/suit/wizrobe && (M.hat, /obj/item/clothing/head/wizard) && (M.shoes, /obj/item/clothing/shoes/sandal)) // Work on it later
|
||||
return
|
||||
else
|
||||
M.drop_item()
|
||||
M.AdjustSleeping(5)
|
||||
if(M.coughedtime != 1)
|
||||
M.coughedtime = 1
|
||||
M.emote("cough")
|
||||
spawn(20)
|
||||
if(M && M.loc)
|
||||
M.coughedtime = 0
|
||||
return
|
||||
|
||||
/datum/effect/system/sleep_smoke_spread
|
||||
var/total_smoke = 0 // To stop it being spammed and lagging!
|
||||
var/direction
|
||||
|
||||
/datum/effect/system/sleep_smoke_spread/set_up(n = 5, c = 0, loca, direct)
|
||||
if(n > 20)
|
||||
n = 20
|
||||
number = n
|
||||
cardinals = c
|
||||
if(istype(loca, /turf/))
|
||||
location = loca
|
||||
else
|
||||
location = get_turf(loca)
|
||||
if(direct)
|
||||
direction = direct
|
||||
|
||||
/datum/effect/system/sleep_smoke_spread/start()
|
||||
var/i = 0
|
||||
for(i=0, i<src.number, i++)
|
||||
if(src.total_smoke > 20)
|
||||
return
|
||||
spawn(0)
|
||||
if(holder)
|
||||
src.location = get_turf(holder)
|
||||
var/obj/effect/effect/sleep_smoke/smoke = new /obj/effect/effect/sleep_smoke(src.location)
|
||||
src.total_smoke++
|
||||
var/direction = src.direction
|
||||
if(!direction)
|
||||
if(src.cardinals)
|
||||
direction = pick(cardinal)
|
||||
else
|
||||
direction = pick(alldirs)
|
||||
for(i=0, i<pick(0,1,1,1,2,2,2,3), i++)
|
||||
sleep(10)
|
||||
step(smoke,direction)
|
||||
spawn(150+rand(10,30))
|
||||
smoke.delete()
|
||||
src.total_smoke--
|
||||
spawn(0)
|
||||
smoke.fade_out()
|
||||
spawn(10)
|
||||
smoke.delete()
|
||||
total_smoke--
|
||||
|
||||
Reference in New Issue
Block a user