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

Stabilized metallic foam, a gimmick new flamer fuel #6062

Merged
merged 26 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c0d4799
Update flamer.dm
iloveloopers Apr 1, 2024
36a15b4
Update flamer.dm
iloveloopers Apr 1, 2024
16892e0
Update other.dm
iloveloopers Apr 1, 2024
113a263
Update other.dm
iloveloopers Apr 1, 2024
a30bea1
Update gun_attachables.dm
iloveloopers Apr 1, 2024
065bd01
Update gun_attachables.dm
iloveloopers Apr 1, 2024
f66a603
Update flamer.dm
iloveloopers Apr 1, 2024
7bb1ecb
Update flamer.dm
iloveloopers Apr 1, 2024
bf43293
Update flamer.dm
iloveloopers Apr 2, 2024
fb971ee
Merge branch 'master' into FOAM-FLAMER
iloveloopers Apr 2, 2024
2e408cf
Merge branch 'cmss13-devs:master' into FOAM-FLAMER
iloveloopers Apr 6, 2024
01c70fb
Update flamer.dm
iloveloopers Apr 6, 2024
8ec0cd5
Update flamer.dm
iloveloopers Apr 6, 2024
46e3f65
Update flamer.dm
iloveloopers Apr 7, 2024
24ee6a5
Update flamer.dm
iloveloopers Apr 7, 2024
106395d
Merge branch 'master' into FOAM-FLAMER
iloveloopers Apr 7, 2024
1bd4152
Merge branch 'master' into FOAM-FLAMER
iloveloopers Apr 9, 2024
9518752
Merge branch 'master' into FOAM-FLAMER
iloveloopers Apr 13, 2024
60f39dd
Update code/modules/reagents/chemistry_reactions/other.dm
iloveloopers Apr 13, 2024
99f42ec
Merge branch 'cmss13-devs:master' into FOAM-FLAMER
iloveloopers Apr 13, 2024
327c591
Update flamer.dm
iloveloopers Apr 13, 2024
4ef2b6d
Update other.dm
iloveloopers Apr 13, 2024
74ca02d
Merge branch 'cmss13-devs:master' into FOAM-FLAMER
iloveloopers Apr 14, 2024
cf8e3bb
Update foam.dm
iloveloopers Apr 14, 2024
fa28c39
Update code/modules/projectiles/guns/flamer/flamer.dm
iloveloopers Apr 14, 2024
eb2a451
Update code/game/objects/effects/effect_system/foam.dm
iloveloopers Apr 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion code/game/objects/effects/effect_system/foam.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
var/expand = 1
animate_movement = 0
var/metal = FOAM_NOT_METAL
var/time_to_solidify = 4 SECONDS


/obj/effect/particle_effect/foam/Initialize(mapload, ismetal=0)
Expand All @@ -28,7 +29,7 @@
metal = ismetal
playsound(src, 'sound/effects/bubbles2.ogg', 25, 1, 5)
addtimer(CALLBACK(src, PROC_REF(foam_react)), 3 + metal*3)
addtimer(CALLBACK(src, PROC_REF(foam_metal_final_react)), 40)
addtimer(CALLBACK(src, PROC_REF(foam_metal_final_react)), time_to_solidify)

/obj/effect/particle_effect/foam/proc/foam_react()
process()
Expand Down
4 changes: 4 additions & 0 deletions code/modules/projectiles/gun_attachables.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3221,6 +3221,10 @@ Defined in conflicts.dm of the #defines folder.
to_chat(user, SPAN_WARNING("\The [gun] doesn't have enough fuel to launch a projectile!"))
return

if(istype(flamer_reagent, /datum/reagent/foaming_agent/stabilized))
to_chat(user, SPAN_WARNING("This chemical will clog the nozzle!"))
return

gun.last_fired = world.time
gun.current_mag.reagents.remove_reagent(flamer_reagent.id, FLAME_REAGENT_USE_AMOUNT * fuel_per_projectile)

Expand Down
58 changes: 57 additions & 1 deletion code/modules/projectiles/guns/flamer/flamer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@
click_empty(user)
else
user.track_shot(initial(name))
unleash_flame(target, user)
if(current_mag.reagents.has_reagent("stablefoam"))
unleash_foam(target, user)
else
unleash_flame(target, user)
return AUTOFIRE_CONTINUE
return NONE

Expand Down Expand Up @@ -226,6 +229,59 @@

new /obj/flamer_fire(to_fire, create_cause_data(initial(name), user), R, max_range, current_mag.reagents, flameshape, target, CALLBACK(src, PROC_REF(show_percentage), user), fuel_pressure, fire_type)

/obj/item/weapon/gun/flamer/proc/unleash_foam(atom/target, mob/living/user)
last_fired = world.time
if(!current_mag || !current_mag.reagents || !current_mag.reagents.reagent_list.len)
return

var/source_turf = get_turf(user)
var/foam_range = 6 // the max range the foam will travel
var/distance = 0 // the distance traveled
var/use_multiplier = 3 // if you want to increase the ammount of foam drained from the tank
var/datum/reagent/chemical = current_mag.reagents.reagent_list[1]

var/turf/turfs[] = get_line(user, target, FALSE)
var/turf/first_turf = turfs[1]
var/ammount_required = (min(turfs.len, foam_range) * use_multiplier) // the ammount of units that this click requires
for(var/turf/turf in turfs)

if(chemical.volume < ammount_required)
foam_range = round(chemical.volume / use_multiplier)

if(distance >= foam_range)
break

if(turf.density)
break
else
var/obj/effect/particle_effect/foam/checker = new()
var/atom/blocked = LinkBlocked(checker, source_turf, turf)
if(blocked)
break

if(turf == first_turf) // this is so the first foam tile doesn't expand and touch the user
var/datum/effect_system/foam_spread/foam = new()
foam.set_up(0.5, turf, metal_foam = FOAM_METAL_TYPE_IRON)
foam.start()
else
var/datum/effect_system/foam_spread/foam = new()
foam.set_up(1, turf, metal_foam = FOAM_METAL_TYPE_IRON)
foam.start()
sleep(2)

distance++

var/ammount_used = distance * use_multiplier // the actual ammount of units that we used

chemical.volume = max(chemical.volume - ammount_used, 0)

current_mag.reagents.total_volume = chemical.volume // this is needed for show_percentage to work

if(chemical.volume < use_multiplier) // there aren't enough units left for a single tile of foam, empty the tank
current_mag.reagents.clear_reagents()

show_percentage(user)

/obj/item/weapon/gun/flamer/proc/show_percentage(mob/living/user)
if(current_mag)
to_chat(user, SPAN_WARNING("The gauge reads: <b>[round(current_mag.get_ammo_percent())]</b>% fuel remains!"))
Expand Down
2 changes: 1 addition & 1 deletion code/modules/projectiles/magazines/flamer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
to_chat(user, SPAN_WARNING("You can't mix fuel mixtures!"))
return

if(!to_add.intensityfire)
if(!to_add.intensityfire && to_add.id != "stablefoam")
to_chat(user, SPAN_WARNING("This chemical is not potent enough to be used in a flamethrower!"))
return

Expand Down
6 changes: 6 additions & 0 deletions code/modules/reagents/chemistry_reactions/other.dm
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,12 @@
required_reagents = list("fluorine" = 2, "carbon" = 2, "sulphuric acid" = 1)
result_amount = 5

/datum/chemical_reaction/stablefoam
name = "Stabilized metallic foam"
id = "stablefoam"
result = "stablefoam"
required_reagents = list("fluorosurfactant" = 1, "iron" = 1, "sulphuric acid" = 1)
result_amount = 1

/datum/chemical_reaction/foam
name = "Foam"
Expand Down
9 changes: 9 additions & 0 deletions code/modules/reagents/chemistry_reagents/other.dm
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,15 @@
color = "#664B63" // rgb: 102, 75, 99
chemclass = CHEM_CLASS_UNCOMMON

/datum/reagent/foaming_agent/stabilized
name = "Stabilized metallic foam"
id = "stablefoam"
description = "Stabilized metallic foam that solidifies when exposed to an open flame"
reagent_state = LIQUID
color = "#d4b8d1"
chemclass = CHEM_CLASS_UNCOMMON
properties = list(PROPERTY_TOXIC = 8)

/datum/reagent/nicotine
name = "Nicotine"
id = "nicotine"
Expand Down
Loading