Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lube foam! #14773

Merged
merged 5 commits into from Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion code/datums/effects/system/foam_spread.dm
Expand Up @@ -3,10 +3,14 @@
var/turf/location
var/list/carried_reagents // the IDs of reagents present when the foam was mixed
var/metal = 0 // 0=foam, 1=metalfoam, 2=ironfoam,
var/lube = 0 //! 1 = normal lube, 2 = harmlube
var/temperature = T0C
var/list/banned_reagents = list("smokepowder", "propellant", "pyrosium", "fluorosurfactant", "salt", "poor_concrete", "okay_concrete", "good_concrete", "perfect_concrete")

/datum/effects/system/foam_spread/proc/set_up(amt=5, loca, var/datum/reagents/carry = null, var/metalfoam = 0, var/carry_volume = 0)
var/list/lubelist = list("superlube" = 2,"invislube" = 2, "lube" = 1) //! a list of lubes and their strenght
var/lube_treshhold = 0.25 //! if 25% of the amount of reagents left is lube, we gonna make the foam slippery

if (!carry)
return
amount = round(amt/5, 1)
Expand All @@ -32,6 +36,10 @@
for(var/reagent_id in carry.reagent_list)
var/datum/reagent/current_reagent = carry.reagent_list[reagent_id]
carried_reagents[reagent_id] = current_reagent.volume * carrymult
//For lubes, we check if enough lube is in the non-metal-foam to make it slippery
if (!src.metal && (reagent_id in lubelist) && ((current_reagent.volume / carry.total_volume) >= lube_treshhold))
var/lube_level = lubelist[reagent_id]
src.lube = max(src.lube, lube_level)

/datum/effects/system/foam_spread/proc/start()
SPAWN(0)
Expand All @@ -49,7 +57,7 @@

F = new /obj/effects/foam
F.foam_id = "\ref[src][world.time]"
F.set_up(src.location, metal)
F.set_up(src.location, src.metal, src.lube)
F.amount = amount

playsound(F.loc, 'sound/effects/bubbles2.ogg', 80, 1, -3) //let's not play this from every single foam obj
Expand Down
32 changes: 26 additions & 6 deletions code/obj/effects/foam.dm
Expand Up @@ -17,6 +17,7 @@
var/expand = 1
animate_movement = 0
var/metal = 0
var/lube = 0 //! 1 = normal lube, 2 = harmlube
var/foam_id = null
var/repeated_applications = 0 //bandaid for foam being abuseable by spamming chem group... diminishing returns. only works if the repeated application is on the same tile (chem dispensers!!)

Expand All @@ -35,13 +36,14 @@
I.Blend(src.foamcolor, ICON_ADD)
src.overlays += I

/obj/effects/foam/proc/set_up(loc, var/ismetal)
/obj/effects/foam/proc/set_up(loc, var/ismetal, var/islube)
src.set_loc(loc)
expand = 1
if(!ismetal && reagents)
reagents.inert = 1 //Wait for it...

metal = ismetal
src.lube = islube
//NOW WHO THOUGH IT WOULD BE A GOOD IDEA TO PLAY THIS ON EVERY FOAM OBJ
//playsound(src, 'sound/effects/bubbles2.ogg', 80, 1, -3)

Expand Down Expand Up @@ -126,7 +128,7 @@
if(no_merge) continue

F = new /obj/effects/foam
F.set_up(T, metal)
F.set_up(T, src.metal, src.lube)
F.amount = amount
F.foam_id = src.foam_id //Just keep track of us being from the same source
if(!metal && src.reagents)
Expand Down Expand Up @@ -162,12 +164,30 @@

if (ishuman(AM))
var/mob/living/carbon/human/M = AM
if (src.lube) //lubefoam goes wheeeeeee!
if(!M.throwing && !M.lying)
M.remove_pulling()
playsound(src, 'sound/misc/slip.ogg', 50, 1, -3)
boutput(M, "<span class='notice'>You slipped on the foam!</span>")
var/atom/target = get_edge_target_turf(M, M.dir)
switch (src.lube)
if (1) //lube
M.throw_at(target, 12, 1, throw_type = THROW_SLIP)
if (2) //harmlube
M.changeStatus("weakened", 3.5 SECONDS)
M.throw_at(target, 30, 1, throw_type = THROW_SLIP)
random_brute_damage(M, 10)
if(M.throwing)
//like with normal foam, each tile the person passes while on their wild ride, they get splashed by the foam
logTheThing(LOG_CHEMISTRY, M, "is hit by chemical foam [log_reagents(src)] at [log_loc(src)].")
src.reagents.reaction(M, TOUCH, 5)

if (M.slip())
logTheThing(LOG_CHEMISTRY, M, "is hit by chemical foam [log_reagents(src)] at [log_loc(src)].")
reagents.reaction(M, TOUCH, 5)
else
if (M.slip())
logTheThing(LOG_CHEMISTRY, M, "is hit by chemical foam [log_reagents(src)] at [log_loc(src)].")
reagents.reaction(M, TOUCH, 5)

M.show_text("You slip on the foam!", "red")
M.show_text("You slip on the foam!", "red")


/obj/effects/foam/gas_cross(turf/target)
Expand Down