From 335c28ff2509c48e2ac54c8f3a904e4ba0595bdf Mon Sep 17 00:00:00 2001 From: ancientpower Date: Tue, 4 Feb 2020 17:02:13 -0600 Subject: [PATCH] fixes for the requested changes --- code/modules/food_and_drinks/drinks/drinks.dm | 58 +++++++++---------- code/modules/reagents/reagent_containers.dm | 2 +- 2 files changed, 29 insertions(+), 31 deletions(-) diff --git a/code/modules/food_and_drinks/drinks/drinks.dm b/code/modules/food_and_drinks/drinks/drinks.dm index 9ac81b821e..98a36bc0ba 100644 --- a/code/modules/food_and_drinks/drinks/drinks.dm +++ b/code/modules/food_and_drinks/drinks/drinks.dm @@ -149,36 +149,7 @@ return //Are we an expert slider? var/datum/action/innate/D = get_action_of_type(user, /datum/action/innate/drink_fling) - if(D.active) - 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/datum/vector/V = atoms2vector(src, over_location) - var/datum/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/datum/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 - else + if(!D?.active) 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. @@ -190,7 +161,34 @@ user.visible_message("\The [user] slides \the [src] down the table.", "You slide \the [src] down the table!") forceMove(over_location) 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/datum/vector/V = atoms2vector(src, over_location) + var/datum/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/datum/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 //////////////////////////////////////////////////////////////////////////////// diff --git a/code/modules/reagents/reagent_containers.dm b/code/modules/reagents/reagent_containers.dm index 236f2c4a56..6d5c546e7e 100644 --- a/code/modules/reagents/reagent_containers.dm +++ b/code/modules/reagents/reagent_containers.dm @@ -108,7 +108,7 @@ if(!T || !target.CanPass(src, T) || !thrownby || !thrownby.actions) return var/datum/action/innate/D = get_action_of_type(thrownby, /datum/action/innate/drink_fling) - if(D.active) + if(D?.active) return TRUE /obj/item/reagent_containers/proc/ForceResetRotation()