[MIRROR] Fixes bartender drink throwing, makes smashing always spill [MDB IGNORE] (#12326)

* Fixes bartender drink throwing, makes smashing always spill (#65698)

Tohg's initial pr (9c0b0e5d4c) was rather poorly argued and a bit misleading, but the actual changes were honestly kinda harmless. You could already have thrown beakers to splash shit on someone, it wasn't a big issue.

However it did end up breaking bartending, because it removed the ranged
args that normally get passed into smash and SplashReagent.

I went in intending to fix that, but noticed some dumb copypasta in
broken bottle code, and decided to just start from there.

I've moved that logic to a proc on the broken bottle, and made smashing
a bottle on something splash its contents too.

I can't think of a case where you wouldn't want this, so I'ma just go
for it. Prevents future mistakes like this too.

Oh and because I'm passing ranged in properly now, splashing will not
always splash the whole amount of the bottle's reagents. Doubt that
really matters tho.

Love ya bestie

* Fixes bartender drink throwing, makes smashing always spill

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
This commit is contained in:
SkyratBot
2022-03-27 19:41:41 -04:00
committed by GitHub
co-authored by LemonInTheDark
parent e5f18d54fd
commit 242ef904f0
2 changed files with 29 additions and 45 deletions
+5 -23
View File
@@ -137,8 +137,7 @@
/obj/item/reagent_containers/food/drinks/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum)
. = ..()
if(!.) //if the bottle wasn't caught
SplashReagents(hit_atom, override_spillable = TRUE)
smash(hit_atom)
smash(hit_atom, throwingdatum?.thrower, TRUE)
/obj/item/reagent_containers/food/drinks/proc/smash(atom/target, mob/thrower, ranged = FALSE)
@@ -148,18 +147,9 @@
return
if(bartender_check(target) && ranged)
return
SplashReagents(target, ranged, override_spillable = TRUE)
var/obj/item/broken_bottle/B = new (loc)
B.icon_state = icon_state
var/icon/I = new('icons/obj/drinks.dmi', src.icon_state)
I.Blend(B.broken_outline, ICON_OVERLAY, rand(5), 1)
I.SwapColor(rgb(255, 0, 220, 255), rgb(0, 0, 0, 0))
B.icon = I
B.name = "broken [name]"
if(prob(33))
var/obj/item/shard/S = new(drop_location())
target.Bumped(S)
playsound(src, SFX_SHATTER, 70, TRUE)
transfer_fingerprints_to(B)
B.mimic_broken(src, target)
qdel(src)
target.Bumped(B)
@@ -546,17 +536,9 @@
/obj/item/reagent_containers/food/drinks/sillycup/smallcarton/smash(atom/target, mob/thrower, ranged = FALSE)
if(bartender_check(target) && ranged)
return
SplashReagents(target, ranged, override_spillable = TRUE)
var/obj/item/broken_bottle/B = new (loc)
B.icon_state = icon_state
var/icon/I = new('icons/obj/drinks.dmi', src.icon_state)
I.Blend(B.broken_outline, ICON_OVERLAY, rand(5), 1)
I.SwapColor(rgb(255, 0, 220, 255), rgb(0, 0, 0, 0))
B.icon = I
B.name = "broken [name]"
B.force = 0
B.throwforce = 0
B.desc = "A carton with the bottom half burst open. Might give you a papercut."
transfer_fingerprints_to(B)
B.mimic_broken(src, target)
qdel(src)
target.Bumped(B)
@@ -32,30 +32,13 @@
custom_price = PAYCHECK_EASY * 0.9
/obj/item/reagent_containers/food/drinks/bottle/smash(mob/living/target, mob/thrower, ranged = FALSE)
//Creates a shattering noise and replaces the bottle with a broken_bottle
if(bartender_check(target) && ranged)
return
SplashReagents(target, ranged, override_spillable = TRUE)
var/obj/item/broken_bottle/B = new (loc)
if(!ranged && thrower)
thrower.put_in_hands(B)
B.icon_state = icon_state
var/icon/I = new('icons/obj/drinks.dmi', src.icon_state)
I.Blend(B.broken_outline, ICON_OVERLAY, rand(5), 1)
I.SwapColor(rgb(255, 0, 220, 255), rgb(0, 0, 0, 0))
B.icon = I
if(isGlass)
if(prob(33))
var/obj/item/shard/S = new(drop_location())
target.Bumped(S)
playsound(src, SFX_SHATTER, 70, TRUE)
else
B.force = 0
B.throwforce = 0
B.desc = "A carton with the bottom half burst open. Might give you a papercut."
B.name = "broken [name]"
transfer_fingerprints_to(B)
B.mimic_broken(src, target)
qdel(src)
target.Bumped(B)
@@ -121,9 +104,6 @@
//Attack logs
log_combat(user, target, "attacked", src)
//The reagents in the bottle splash all over the target, thanks for the idea Nodrak
SplashReagents(target, override_spillable = TRUE)
//Finally, smash the bottle. This kills (del) the bottle.
smash(target, user)
@@ -154,6 +134,28 @@
AddComponent(/datum/component/caltrop, min_damage = force)
AddComponent(/datum/component/butchering, 200, 55)
/// Mimics the appearance and properties of the passed in bottle.
/// Takes the broken bottle to mimic, and the thing the bottle was broken agaisnt as args
/obj/item/broken_bottle/proc/mimic_broken(obj/item/reagent_containers/food/drinks/to_mimic, atom/target)
icon_state = to_mimic.icon_state
var/icon/drink_icon = new('icons/obj/drinks.dmi', icon_state)
drink_icon.Blend(broken_outline, ICON_OVERLAY, rand(5), 1)
drink_icon.SwapColor(rgb(255, 0, 220, 255), rgb(0, 0, 0, 0))
icon = drink_icon
if(to_mimic.isGlass)
if(prob(33))
var/obj/item/shard/stab_with = new(to_mimic.drop_location())
target.Bumped(stab_with)
playsound(src, SFX_SHATTER, 70, TRUE)
else
force = 0
throwforce = 0
desc = "A carton with the bottom half burst open. Might give you a papercut."
name = "broken [to_mimic.name]"
to_mimic.transfer_fingerprints_to(src)
/obj/item/reagent_containers/food/drinks/bottle/beer
name = "space beer"
desc = "Beer. In space."