From 0d6ffbc4327d4adfb793826d568fd01d16d2fca6 Mon Sep 17 00:00:00 2001 From: ancientpower Date: Tue, 4 Feb 2020 16:38:20 -0600 Subject: [PATCH] fixed it for real this time --- code/datums/action.dm | 8 -- code/modules/food_and_drinks/drinks/drinks.dm | 80 +++++++++---------- code/modules/reagents/reagent_containers.dm | 2 +- 3 files changed, 41 insertions(+), 49 deletions(-) diff --git a/code/datums/action.dm b/code/datums/action.dm index 4ed3a1d904..8659a9e7c4 100644 --- a/code/datums/action.dm +++ b/code/datums/action.dm @@ -756,11 +756,3 @@ target.layer = old_layer target.plane = old_plane current_button.appearance_cache = target.appearance - -/proc/get_action_of_type(mob/M, var/action_type) - if(!M.actions || !ispath(action_type, /datum/action)) - return - for(var/datum/action/A in M.actions) - if(istype(A, action_type)) - return A - return \ No newline at end of file diff --git a/code/modules/food_and_drinks/drinks/drinks.dm b/code/modules/food_and_drinks/drinks/drinks.dm index 6f6683c041..fd0fd8a718 100644 --- a/code/modules/food_and_drinks/drinks/drinks.dm +++ b/code/modules/food_and_drinks/drinks/drinks.dm @@ -146,50 +146,50 @@ // Attempted drink sliding if (locate(/obj/structure/table) in src_location) //Are we an expert slider? - var/datum/action/innate/A = get_action_of_type(user, /datum/action/innate/drink_fling) - if(A?.active) - if (!user.Adjacent(src)) + for(var/datum/action/innate/drink_fling/D in user.actions) + if(D.active) + if (!user.Adjacent(src)) + return + var/distance = MANHATTAN_DISTANCE(over_location, src) + if (distance >= 8 || distance == 0) // More than a full screen to go, or trying to slide to the same tile + return ..() + + // Geometrically checking if we're on a straight line. + var/vector/V = atoms2vector(src, over_location) + var/vector/V_norm = V.duplicate() + V_norm.normalize() + if (!V_norm.is_integer()) + return ..() // Only a cardinal vector (north, south, east, west) can pass this test + + // Checks if there's tables on the path. + var/turf/dest = get_translated_turf(V) + var/turf/temp_turf = src_location + + do + temp_turf = temp_turf.get_translated_turf(V_norm) + if (!locate(/obj/structure/table) in temp_turf) + var/vector/V2 = atoms2vector(src, temp_turf) + vector_translate(V2, 0.1 SECONDS) + user.visible_message("\The [user] slides \the [src] down the table... and straight into the ground!", "You slide \the [src] down the table, and straight into the ground!") + smash(over_location, user, FALSE) + return + while (temp_turf != dest) + + vector_translate(V, 0.1 SECONDS) + user.visible_message("\The [user] expertly slides \the [src] down the table.", "You slide \the [src] down the table. What a pro.") return - var/distance = MANHATTAN_DISTANCE(over_location, src) - if (distance >= 8 || distance == 0) // More than a full screen to go, or trying to slide to the same tile - return ..() - - // Geometrically checking if we're on a straight line. - var/vector/V = atoms2vector(src, over_location) - var/vector/V_norm = V.duplicate() - V_norm.normalize() - if (!V_norm.is_integer()) - return ..() // Only a cardinal vector (north, south, east, west) can pass this test - - // Checks if there's tables on the path. - var/turf/dest = get_translated_turf(V) - var/turf/temp_turf = src_location - - do - temp_turf = temp_turf.get_translated_turf(V_norm) - if (!locate(/obj/structure/table) in temp_turf) - var/vector/V2 = atoms2vector(src, temp_turf) - vector_translate(V2, 0.1 SECONDS) - user.visible_message("\The [user] slides \the [src] down the table... and straight into the ground!", "You slide \the [src] down the table, and straight into the ground!") + else + if (!(locate(/obj/structure/table) in over_location)) + return ..() + if (!user.Adjacent(src) || !src_location.Adjacent(over_location)) // Regular users can only do short slides. + return ..() + if (prob(10)) + user.visible_message("\The [user] tries to slide \the [src] down the table, but fails miserably.", "You fail to slide \the [src] down the table!") smash(over_location, user, FALSE) return - while (temp_turf != dest) - - vector_translate(V, 0.1 SECONDS) - user.visible_message("\The [user] expertly slides \the [src] down the table.", "You slide \the [src] down the table. What a pro.") - return - else - if (!(locate(/obj/structure/table) in over_location)) - return ..() - if (!user.Adjacent(src) || !src_location.Adjacent(over_location)) // Regular users can only do short slides. - return ..() - if (prob(10)) - user.visible_message("\The [user] tries to slide \the [src] down the table, but fails miserably.", "You fail to slide \the [src] down the table!") - smash(over_location, user, FALSE) + user.visible_message("\The [user] slides \the [src] down the table.", "You slide \the [src] down the table!") + forceMove(over_location) return - user.visible_message("\The [user] slides \the [src] down the table.", "You slide \the [src] down the table!") - forceMove(over_location) - return return ..() diff --git a/code/modules/reagents/reagent_containers.dm b/code/modules/reagents/reagent_containers.dm index 121999cfae..b254c6298e 100644 --- a/code/modules/reagents/reagent_containers.dm +++ b/code/modules/reagents/reagent_containers.dm @@ -105,7 +105,7 @@ /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 || !target.CanPass(src, T) || !thrownby || !thrownby.actions) return for(var/datum/action/innate/drink_fling/D in thrownby.actions) if(D.active)