From dc0acaeea8964b8c4b0ba794be6bf8c1ee40b787 Mon Sep 17 00:00:00 2001 From: revolucas Date: Wed, 3 Jun 2015 09:06:12 -0400 Subject: [PATCH] = fix rpm for abakan cycle down = fix level.get_target_dist to always return range even if there is no object at cursor + added level.get_target_element which should return bone id --- src/xrGame/WeaponMagazined.cpp | 7 +++---- src/xrGame/level_script.cpp | 12 +++++++++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/xrGame/WeaponMagazined.cpp b/src/xrGame/WeaponMagazined.cpp index 94828d15adf..36b42bcea79 100644 --- a/src/xrGame/WeaponMagazined.cpp +++ b/src/xrGame/WeaponMagazined.cpp @@ -545,11 +545,10 @@ void CWeaponMagazined::state_Fire(float dt) //Alundaio: Use fModeShotTime instead of fOneShotTime if current fire mode is 2-shot burst //Alundaio: Cycle down RPM after two shots; used for Abakan/AN-94 - float rpm = fOneShotTime; if (GetCurrentFireMode() == 2 || (cycleDown == true && m_iShotNum <= 1)) - rpm = modeShotTime; - - fShotTimeCounter += rpm; + fShotTimeCounter = modeShotTime; + else + fShotTimeCounter = fOneShotTime; //Alundaio: END ++m_iShotNum; diff --git a/src/xrGame/level_script.cpp b/src/xrGame/level_script.cpp index 740b46e1633..d31a08da0d7 100644 --- a/src/xrGame/level_script.cpp +++ b/src/xrGame/level_script.cpp @@ -617,11 +617,20 @@ CScriptGameObject* g_get_target_obj() float g_get_target_dist() { collide::rq_result& RQ = HUD().GetCurrentRayQuery(); - if (RQ.O) + if (RQ.range) return RQ.range; return 0.f; } +u32 g_get_target_element() +{ + collide::rq_result& RQ = HUD().GetCurrentRayQuery(); + if (RQ.element) + return RQ.element; + + return 0; +} + //-Alundaio IC static void CLevel_Export(lua_State* luaState) @@ -638,6 +647,7 @@ IC static void CLevel_Export(lua_State* luaState) //def("ray_pick",g_ray_pick), def("get_target_obj", &g_get_target_obj), //intentionally named to what is in xray extensions def("get_target_dist", &g_get_target_dist), + def("get_target_element", &g_get_target_element), //Can get bone cursor is targetting def("spawn_item", &spawn_section), //Alundaio: END // obsolete\deprecated