Files
Paradise/code/game/objects/effects/effect_system/effects_foam.dm
T
Charlie NolanGitHubBurzahGDNAffectedArc07FunnyMan3595paradisess13[bot] <165046124+paradisess13[bot]@users.noreply.github.com>warriorstar-orionGDN
d3584b1d1c LINDA -> MILLA (#25328)
* LINDA -> MILLA

* Tiles now change their atmos mode properly.

* Fixed a bug that made walls generate supercold air when deconstructed/destroyed.

* Apply suggestions from code review

Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Co-authored-by: GDN <96800819+GDNgit@users.noreply.github.com>
Signed-off-by: Charlie Nolan <funnyman3595@gmail.com>

* Begone, var!

* MILLA -> milla

* Lint.

* More lint.

* Prevent negative/NaN atmos from spreading.

* Made fires start more reliably.

* Undef what the rest should not see.

* Enums are nice.

* Match LINDA better.

* Debugging verbs.

* Debug verb fixes.

* Labelled more lavaland stuff with ATMOS_MODE_LAVALAND

* Block superconductivity on a couple more things for Lavaland.

* Updated milla.dll

* Lavaland map fixes.

* Missed a spot.

* Begone, var! (again)

* Add libmilla_ci.so for continuous integration tests.

* Install/contributing instructions for MILLA.

* Directional plasmaglass windows on shuttles shouldn't stop protecting from heat after moving.

* Banish bad naming.

* Better naming and debug stats for SSair.

* Apply suggestions from code review

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
Signed-off-by: Charlie Nolan <funnyman3595@gmail.com>

* Magic numbers and formatting.

* Don't screw up the temperature during reactions.

* Efficiency and readability.

* Fix hotspots.

* Removed redundant safety (MILLA will already output an error)

* Optimizations.

* oops

* TGS build script update.

* Change API of gas_mixture and how you get one from a turf.

* Get in there.

* so many vars

* MILLA binary updates.

* Lint

* Made MT cost more honest.

* Gave MILLA a read-only mode.

* More read-only vs synchronized mode work.

* Even more.

* Synchronize disposals.

* Updated a bunch of stuff to use SSair.synchronize or GM.synchronize.

* MILLA <3 Tracy

* lint

* cargo fmt

* more lint

* Test needed MILLA sync.

* Silence atmos machinery that's behaving as intended, but continue objecting to other potential failures to synchronize.

* Push new MILLA DLL

* Build MILLA

* Update PR instructions for MILLA.

* Add some fancy plasmaglass windows to the Lifebringers' ship.

* The golems remembered that they should insulate *all* their engines.

* First round of TM bugfixes.

* Build MILLA

* fix two lavaland ruin turf types

* bunch more maps

* fixes milla ci and makes the interesting turf verb better

* Solid turfs can no longer conduct heat (for now...)

* Made indoor tiles in beach and winter biodomes not lavaland air.

* Re-added random IT teleport, adjusted warning message

* Fixed a tinted window on Lavaland to be a plasglass window instead.

* Made firelocks and holofans heatproof

* Made RPD auto-wrench pipes if you have a wrench in your offhand.

* Runtime fixes.

* Made visuals update more reliably.

* Lint

* Update .github/CONTRIBUTING.md

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
Signed-off-by: Charlie Nolan <funnyman3595@gmail.com>

* Build MILLA

* The Syndicate have installed tiny fans on their research base.

* The syndicate have figured out how to make plastitanium windows heatproof.

* This is getting out of hand. Now there are two of them.

* Un-break the auto-wrenching that I broke before committing.

* Build MILLA

* Build MILLA

* Massive MILLA refactor, assorted bugfixes.

* Build MILLA

* Explicit typing.

* Less sleeping/blocking.

* Build MILLA

* Yes, yes, this part can sleep.

* Build MILLA

* SSair reporting improvements.

* Build MILLA

* Please do not dock twice and splat yourself.

* Build MILLA

* Pls to not make SM go nuts.

* Build MILLA

* Build MILLA

* Added stricter lower bounds on plasmafire, fixing perpetually-burning SM.

* Build MILLA

* Lint

* Temporary logging, begone.

* Build MILLA

* Prevent hotspot strobing.

* Add in radiate_to_spess behavior.

* Build MILLA

* progress

* Compiling is good.

* bugfixes

* Progress.

* Ruins update.

* This one exists.

* Fixup temporary hotspots to last longer than one tick.

* Add/fix comments.

* Cut the slash.

* Fix test.

* No sleep for you.

* Build MILLA

* Prevent nested MILLA safety from runtiming.

* Build MILLA

* Runtime fix.

* Build MILLA

* Fix canisters not updating icon when gas contents change.

* Build MILLA

* Build MILLA

* Fixed an issue that made mechs very cold on environment air.

* Build MILLA

* oops

* Build MILLA

* Walls can make loud noises again.

* Build MILLA

* Fixes a rare runtime.

* Build MILLA

* Update .github/DOWNLOADING.md

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
Signed-off-by: Charlie Nolan <funnyman3595@gmail.com>

* Review suggestions

* Lint

* Build MILLA

* bound_mixtures now only contains mixtures that can be written

* Build MILLA

* Apply suggestions from code review

Co-authored-by: Matt <116982774+Burzah@users.noreply.github.com>
Signed-off-by: Charlie Nolan <funnyman3595@gmail.com>

* Build MILLA

* Restore the original async behavior of pyro anomalies.

* Build MILLA

* Build MILLA

* Make the safety assertion in /datum/milla_safe safer.

* Build MILLA

---------

Signed-off-by: Charlie Nolan <funnyman3595@gmail.com>
Co-authored-by: FunnyMan3595 (Charlie Nolan) <funnyman@google.com>
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Co-authored-by: GDN <96800819+GDNgit@users.noreply.github.com>
Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
Co-authored-by: paradisess13[bot] <165046124+paradisess13[bot]@users.noreply.github.com>
Co-authored-by: warriorstar-orion <orion@snowfrost.garden>
Co-authored-by: GDN <Roanrichards1@Gmail.com>
2024-06-09 07:18:11 +00:00

226 lines
6.5 KiB
Plaintext

// Foam
// Similar to smoke, but spreads out more
// metal foams leave behind a foamed metal wall
/obj/effect/particle_effect/foam
name = "foam"
icon_state = "foam"
opacity = FALSE
density = FALSE
layer = OBJ_LAYER + 0.9
animate_movement = NO_STEPS
var/amount = 3
var/expand = 1
var/metal = 0
/obj/effect/particle_effect/foam/New(loc, ismetal = FALSE)
..(loc)
icon_state = "[ismetal ? "m":""]foam"
if(!ismetal && reagents)
color = mix_color_from_reagents(reagents.reagent_list)
metal = ismetal
playsound(src, 'sound/effects/bubbles2.ogg', 80, TRUE, -3)
spawn(3 + metal * 3)
process()
spawn(120)
STOP_PROCESSING(SSobj, src)
sleep(30)
if(metal)
var/turf/T = get_turf(src)
if(isspaceturf(T) && !istype(T, /turf/space/transit))
T.ChangeTurf(/turf/simulated/floor/plating/metalfoam)
var/turf/simulated/floor/plating/metalfoam/MF = get_turf(src)
MF.metal = metal
MF.update_icon()
var/obj/structure/foamedmetal/M = new(src.loc)
M.metal = metal
M.update_state()
flick("[icon_state]-disolve", src)
sleep(5)
qdel(src)
return
// on delete, transfer any reagents to the floor
/obj/effect/particle_effect/foam/Destroy()
if(!metal && reagents)
reagents.handle_reactions()
for(var/atom/A in oview(1, src))
if(A == src)
continue
if(reagents.total_volume)
var/fraction = 5 / reagents.total_volume
reagents.reaction(A, REAGENT_TOUCH, fraction)
return ..()
/obj/effect/particle_effect/foam/process()
if(--amount < 0)
return
for(var/direction in GLOB.cardinal)
var/turf/T = get_step(src,direction)
if(!T)
continue
if(!T.Enter(src))
continue
var/obj/effect/particle_effect/foam/F = locate() in T
if(F)
continue
F = new /obj/effect/particle_effect/foam(T, metal)
F.amount = amount
if(!metal)
F.create_reagents(25)
if(reagents)
for(var/datum/reagent/R in reagents.reagent_list)
F.reagents.add_reagent(R.id, min(R.volume, 5), R.data, reagents.chem_temp)
F.color = mix_color_from_reagents(reagents.reagent_list)
// foam disolves when heated
// except metal foams
/obj/effect/particle_effect/foam/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume, global_overlay = TRUE) //Don't heat the reagents inside
return
/obj/effect/particle_effect/foam/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume) // overriden to prevent weird behaviors with heating reagents inside
if(!metal && prob(max(0, exposed_temperature - 475)))
flick("[icon_state]-disolve", src)
spawn(5)
qdel(src)
/obj/effect/particle_effect/foam/Crossed(atom/movable/AM, oldloc)
if(metal)
return
if(iscarbon(AM))
var/mob/living/carbon/M = AM
if(M.slip("foam", 10 SECONDS))
if(reagents)
for(var/reagent_id in reagents.reagent_list)
var/amount = M.reagents.get_reagent_amount(reagent_id)
if(amount < 25)
M.reagents.add_reagent(reagent_id, min(round(amount / 2), 15))
if(reagents.total_volume)
var/fraction = 5 / reagents.total_volume
reagents.reaction(M, REAGENT_TOUCH, fraction)
/datum/effect_system/foam_spread
effect_type = /obj/effect/particle_effect/foam
var/amount = 5 // the size of the foam spread.
var/list/carried_reagents // the IDs of reagents present when the foam was mixed
var/metal = 0 // 0=foam, 1=metalfoam, 2=ironfoam
var/temperature = T0C
var/list/banned_reagents = list("smoke_powder", "fluorosurfactant", "stimulants")
/datum/effect_system/foam_spread/set_up(amt=5, loca, datum/reagents/carry = null, metalfoam = 0)
amount = min(round(amt/5, 1), 7)
if(isturf(loca))
location = loca
else
location = get_turf(loca)
carried_reagents = list()
metal = metalfoam
temperature = carry.chem_temp
// bit of a hack here. Foam carries along any reagent also present in the glass it is mixed
// with (defaults to water if none is present). Rather than actually transfer the reagents,
// this makes a list of the reagent ids and spawns 1 unit of that reagent when the foam disolves.
if(carry && !metal)
for(var/datum/reagent/R in carry.reagent_list)
carried_reagents[R.id] = R.volume
/datum/effect_system/foam_spread/start()
spawn(0)
var/obj/effect/particle_effect/foam/F = locate() in location
if(F)
F.amount += amount
F.amount = min(F.amount, 27)
return
F = new /obj/effect/particle_effect/foam(location, metal)
F.amount = amount
if(!metal) // don't carry other chemicals if a metal foam
F.create_reagents(25)
if(carried_reagents)
for(var/id in carried_reagents)
if(banned_reagents.Find("[id]"))
continue
var/datum/reagent/reagent_volume = carried_reagents[id]
F.reagents.add_reagent(id, min(reagent_volume, 5), null, temperature)
F.color = mix_color_from_reagents(F.reagents.reagent_list)
else
F.reagents.add_reagent("cleaner", 1)
F.color = mix_color_from_reagents(F.reagents.reagent_list)
// wall formed by metal foams
// dense and opaque, but easy to break
/obj/structure/foamedmetal
name = "foamed metal"
desc = "A lightweight foamed metal wall."
icon = 'icons/effects/effects.dmi'
icon_state = "metalfoam"
resistance_flags = FIRE_PROOF | ACID_PROOF
density = TRUE
opacity = TRUE // changed in New()
anchored = TRUE
max_integrity = 20
var/metal = MFOAM_ALUMINUM
/obj/structure/foamedmetal/Initialize()
. = ..()
recalculate_atmos_connectivity()
/obj/structure/foamedmetal/Destroy()
var/turf/T = get_turf(src)
. = ..()
T.recalculate_atmos_connectivity()
/obj/structure/foamedmetal/Move()
var/turf/T = loc
..()
move_update_air(T)
/obj/structure/foamedmetal/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
playsound(src.loc, 'sound/weapons/tap.ogg', 100, TRUE)
/obj/structure/foamedmetal/proc/update_state()
if(metal == MFOAM_ALUMINUM)
max_integrity = 20
obj_integrity = max_integrity
else
max_integrity = 50
obj_integrity = max_integrity
update_icon(UPDATE_ICON_STATE)
/obj/structure/foamedmetal/update_icon_state()
if(metal == MFOAM_ALUMINUM)
icon_state = "metalfoam"
else
icon_state = "ironfoam"
/obj/structure/foamedmetal/attack_hand(mob/user)
user.changeNext_move(CLICK_CD_MELEE)
user.do_attack_animation(src, ATTACK_EFFECT_PUNCH)
if(prob(75 - metal * 25))
user.visible_message("<span class='warning'>[user] smashes through [src].</span>", "<span class='notice'>You smash through [src].</span>")
qdel(src)
else
to_chat(user, "<span class='notice'>You hit the metal foam but bounce off it.</span>")
playsound(loc, 'sound/weapons/tap.ogg', 100, 1)
/obj/structure/foamedmetal/CanPass(atom/movable/mover, turf/target)
return !density
/obj/structure/foamedmetal/CanAtmosPass(direction)
return !density