Skip to content

Commit

Permalink
TGS Test Merge (#6062)
Browse files Browse the repository at this point in the history
  • Loading branch information
cm13-github committed Apr 15, 2024
2 parents bdee9ec + eb2a451 commit 14d851b
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 3 deletions.
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

0 comments on commit 14d851b

Please sign in to comment.