diff --git a/code/modules/food_and_drinks/drinks/drinks.dm b/code/modules/food_and_drinks/drinks/drinks.dm index 36f3c5f6a24..b65d7c3d061 100644 --- a/code/modules/food_and_drinks/drinks/drinks.dm +++ b/code/modules/food_and_drinks/drinks/drinks.dm @@ -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) diff --git a/code/modules/food_and_drinks/drinks/drinks/bottle.dm b/code/modules/food_and_drinks/drinks/drinks/bottle.dm index 390c09d7197..edf70da9687 100644 --- a/code/modules/food_and_drinks/drinks/drinks/bottle.dm +++ b/code/modules/food_and_drinks/drinks/drinks/bottle.dm @@ -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."