Skip to content

Commit

Permalink
[MIRROR] Fire Extinguisher Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Chiquiii authored and SuhEugene committed Oct 31, 2023
1 parent b9c0718 commit c067f25
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 30 deletions.
6 changes: 4 additions & 2 deletions code/game/objects/effects/chem/water.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@
if(reagents.total_volume < 1)
break
if(T == get_turf(target))
for(var/atom/A in splash_others)
reagents.splash(A, reagents.total_volume/length(splash_others)) //splash anything left
var/list/splash_targets = splash_others + splash_mobs
var/splash_amount = reagents.total_volume / length(splash_targets)
for(var/atom/atom in splash_targets)
reagents.splash(atom, splash_amount)
break

sleep(delay)
Expand Down
38 changes: 10 additions & 28 deletions code/game/objects/items/weapons/extinguisher.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
matter = list(MATERIAL_STEEL = 90)
attack_verb = list("slammed", "whacked", "bashed", "thunked", "battered", "bludgeoned", "thrashed")

var/spray_particles = 3
var/spray_amount = 120 //units of liquid per spray - 120 -> same as splashing them with a bucket per spray
var/starting_water = 2000
var/max_water = 2000
Expand Down Expand Up @@ -62,23 +61,6 @@
to_chat(user, "The safety is [safety ? "on" : "off"].")
return

/obj/item/extinguisher/use_before(mob/living/M, mob/user)
. = FALSE
if (user.a_intent == I_HELP && !safety)
if (world.time < last_use + 20)
return TRUE
if (reagents.total_volume < 1)
to_chat(user, SPAN_NOTICE("\The [src] is empty."))
return TRUE

last_use = world.time
reagents.splash(M, min(reagents.total_volume, spray_amount))

user.visible_message(SPAN_NOTICE("\The [user] sprays \the [M] with \the [src]."))
playsound(src.loc, 'sound/effects/extinguish.ogg', 75, 1, -3)

return TRUE

/obj/item/extinguisher/proc/propel_object(obj/O, mob/user, movementdirection)
if(O.anchored) return

Expand All @@ -102,7 +84,6 @@
return FALSE
return ..()


/obj/item/extinguisher/afterattack(atom/target, mob/user, flag)
var/issink = istype(target, /obj/structure/hygiene/sink)

Expand Down Expand Up @@ -145,6 +126,7 @@
if(user.buckled && isobj(user.buckled))
addtimer(new Callback(src, .proc/propel_object, user.buckled, user, direction), 0)

visible_message(SPAN_NOTICE("\The [user] sprays towards \the [target] with \the [src]."))
addtimer(new Callback(src, .proc/do_spray, target), 0)

if(!user.check_space_footing())
Expand All @@ -156,12 +138,12 @@

/obj/item/extinguisher/proc/do_spray(atom/Target)
var/turf/T = get_turf(Target)
var/per_particle = min(spray_amount, reagents.total_volume)/spray_particles
for(var/a = 1 to spray_particles)
if(!src || !reagents.total_volume) return

var/obj/effect/water/W = new /obj/effect/water(get_turf(src))
W.create_reagents(per_particle)
reagents.trans_to_obj(W, per_particle)
W.set_color()
W.set_up(T)
var/available_spray = min(spray_amount, reagents.total_volume)
if(!src || !reagents.total_volume)
return

var/obj/effect/water/W = new /obj/effect/water(get_turf(src))
W.create_reagents(available_spray)
reagents.trans_to_holder(W.reagents, available_spray, safety = 1)
W.set_color()
W.set_up(T)

0 comments on commit c067f25

Please sign in to comment.