mirror of
https://github.com/KabKebab/GS13.git
synced 2026-02-09 23:27:37 +00:00
Merge pull request #779 from DragonTrance/drink-throwing
Bartender's Drink Flinging fix
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
possible_transfer_amounts = list(5,10,15,20,25,30,50)
|
||||
volume = 50
|
||||
resistance_flags = NONE
|
||||
var/isGlass = TRUE //Whether the 'bottle' is made of glass or not so that milk cartons dont shatter when someone gets hit by it
|
||||
var/isGlass = TRUE //Whether the container is made of glass or not so that milk cartons dont shatter when someone gets hit by it
|
||||
splashable = TRUE
|
||||
|
||||
/obj/item/reagent_containers/food/drinks/on_reagent_change(changetype)
|
||||
@@ -105,34 +105,45 @@
|
||||
/obj/item/reagent_containers/food/drinks/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum)
|
||||
. = ..()
|
||||
if(!.) //if the bottle wasn't caught
|
||||
smash(hit_atom, throwingdatum?.thrower, TRUE)
|
||||
smash(hit_atom, throwingdatum.thrower, TRUE)
|
||||
|
||||
/obj/item/reagent_containers/food/drinks/after_throw(datum/callback/callback)
|
||||
. = ..()
|
||||
if (!isGlass)
|
||||
return
|
||||
if (!QDELETED(src) || !QDELING(src)) //If we didn't get qdeleted by smash(), assume we got flung by a bartender
|
||||
transform = initial(transform)
|
||||
to_chat(viewers(8, get_turf(src)), "<span class='notice'>\The [src] lands upright without spilling a drop!</span>")
|
||||
|
||||
/obj/item/reagent_containers/food/drinks/proc/smash(atom/target, mob/thrower, ranged = FALSE)
|
||||
if(!isGlass)
|
||||
if (!isGlass)
|
||||
return
|
||||
if(QDELING(src) || !target) //Invalid loc
|
||||
if (QDELING(src) || !target) //Invalid loc
|
||||
return
|
||||
if(bartender_check(target) && ranged)
|
||||
if (bartender_check(thrower) && istype(target, /turf/open) && ranged) //Smash against windows and players, but not on floors or tables. The target is always an open turf if there is no density
|
||||
return
|
||||
|
||||
SplashReagents(target)
|
||||
var/obj/item/broken_bottle/B = new (loc)
|
||||
B.icon_state = icon_state
|
||||
var/icon/I = new('icons/obj/drinks.dmi', src.icon_state)
|
||||
var/icon/I = new(icon, 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(ranged)
|
||||
transfer_fingerprints_to(B)
|
||||
qdel(src)
|
||||
if (ranged)
|
||||
var/matrix/M = matrix(B.transform)
|
||||
M.Turn(rand(-170, 170))
|
||||
B.transform = M
|
||||
B.pixel_x = rand(-12, 12)
|
||||
B.pixel_y = rand(-12, 12)
|
||||
if(prob(33))
|
||||
new/obj/item/shard(drop_location())
|
||||
else
|
||||
thrower.put_in_hands(B)
|
||||
if (prob(33))
|
||||
new/obj/item/shard(get_turf(target))
|
||||
playsound(src, "shatter", 70, 1)
|
||||
transfer_fingerprints_to(B)
|
||||
qdel(src)
|
||||
|
||||
|
||||
|
||||
@@ -305,28 +316,6 @@
|
||||
icon_state = "juicebox"
|
||||
volume = 15 //I figure if you have to craft these it should at least be slightly better than something you can get for free from a watercooler
|
||||
|
||||
/obj/item/reagent_containers/food/drinks/sillycup/smallcarton/smash(atom/target, mob/thrower, ranged = FALSE)
|
||||
if(bartender_check(target) && ranged)
|
||||
return
|
||||
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."
|
||||
if(ranged)
|
||||
var/matrix/M = matrix(B.transform)
|
||||
M.Turn(rand(-170, 170))
|
||||
B.transform = M
|
||||
B.pixel_x = rand(-12, 12)
|
||||
B.pixel_y = rand(-12, 12)
|
||||
transfer_fingerprints_to(B)
|
||||
qdel(src)
|
||||
|
||||
/obj/item/reagent_containers/food/drinks/sillycup/smallcarton/on_reagent_change(changetype)
|
||||
if (reagents.reagent_list.len)
|
||||
switch(reagents.get_master_reagent_id())
|
||||
|
||||
@@ -16,40 +16,6 @@
|
||||
isGlass = TRUE
|
||||
foodtype = ALCOHOL
|
||||
|
||||
|
||||
/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
|
||||
var/obj/item/broken_bottle/B = new (loc)
|
||||
if(!ranged)
|
||||
thrower.put_in_hands(B)
|
||||
else
|
||||
var/matrix/M = matrix(B.transform)
|
||||
M.Turn(rand(-170, 170))
|
||||
B.transform = M
|
||||
B.pixel_x = rand(-12, 12)
|
||||
B.pixel_y = rand(-12, 12)
|
||||
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))
|
||||
new/obj/item/shard(drop_location())
|
||||
playsound(src, "shatter", 70, 1)
|
||||
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)
|
||||
|
||||
qdel(src)
|
||||
|
||||
/obj/item/reagent_containers/food/drinks/bottle/attack(mob/living/target, mob/living/user)
|
||||
|
||||
if(!target)
|
||||
|
||||
@@ -85,10 +85,10 @@
|
||||
/obj/item/reagent_containers/proc/bartender_check(atom/target)
|
||||
. = FALSE
|
||||
var/turf/T = get_turf(src)
|
||||
if(!T || target.CanPass(src, T) || !thrownby || !thrownby.actions)
|
||||
if(!T || !thrownby || !thrownby.actions)
|
||||
return
|
||||
for(var/datum/action/innate/drink_fling/D in thrownby.actions)
|
||||
if(D.active)
|
||||
for(var/datum/action/innate/D in thrownby.actions)
|
||||
if(D.active && istype(D, /datum/action/innate/drink_fling))
|
||||
return TRUE
|
||||
|
||||
|
||||
@@ -107,17 +107,16 @@
|
||||
target.visible_message("<span class='danger'>[M] has been splashed with something!</span>", \
|
||||
"<span class='userdanger'>[M] has been splashed with something!</span>")
|
||||
for(var/datum/reagent/A in reagents.reagent_list)
|
||||
R += A.type + " ("
|
||||
R += num2text(A.volume) + "),"
|
||||
R += "[A.type] ([num2text(A.volume)]), "
|
||||
|
||||
if(thrownby)
|
||||
log_combat(thrownby, M, "splashed", R)
|
||||
reagents.reaction(target, TOUCH)
|
||||
|
||||
else if(bartender_check(target) && thrown)
|
||||
visible_message("<span class='notice'>[src] lands onto the [target.name] without spilling a single drop.</span>")
|
||||
transform = initial(transform)
|
||||
addtimer(CALLBACK(src, .proc/ForceResetRotation), 1)
|
||||
if(!istype(src, /obj/item/reagent_containers/food/drinks)) //drinks smash against solid objects
|
||||
visible_message("<span class='notice'>[src] lands upright without spilling a single drop!</span>")
|
||||
transform = initial(transform)
|
||||
return
|
||||
|
||||
else
|
||||
|
||||
@@ -63,7 +63,6 @@
|
||||
log_game("[key_name(user)] fired Space lube from \a [src] at [AREACOORD(T)].")
|
||||
return
|
||||
|
||||
|
||||
/obj/item/reagent_containers/spray/proc/spray(atom/A)
|
||||
var/range = CLAMP(get_dist(src, A), 1, current_range)
|
||||
var/obj/effect/decal/chempuff/D = new /obj/effect/decal/chempuff(get_turf(src))
|
||||
|
||||
Reference in New Issue
Block a user