Skip to content

Commit

Permalink
= fix rpm for abakan cycle down
Browse files Browse the repository at this point in the history
= 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
  • Loading branch information
revolucas authored and Xottab-DUTY committed Dec 14, 2017
1 parent a31a78b commit dc0acae
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/xrGame/WeaponMagazined.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 11 additions & 1 deletion src/xrGame/level_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit dc0acae

Please sign in to comment.