Tweaked the logic of parachutes to be more modifiable. There now is an upper bound percentage and lower bound percentage which will be applied if you are driving faster and slower respectively. Also added those values in stk_config.xml to make playtesting easier (ticket #1135)
This commit is contained in:
parent
14d6e6ae7e
commit
89a336ff9a
@ -94,8 +94,10 @@
|
||||
<!-- friction is the friction increase when a parachute is attached.
|
||||
time is the time an attached parachute is active
|
||||
time-other is the time a parachute attached from other kart works
|
||||
done-fraction is the fraction of speed when lost will detach parachute -->
|
||||
<parachute friction="2.0" time="4.0" time-other="8.0" done-fraction="0.7"/>
|
||||
lbound-fraction is the lower bound fraction of speed when lost will detach parachute
|
||||
ubound-fraction is the upper bound fraction of speed when lost will detach parachute
|
||||
max-speed is a factor that decides the impact of rate of speed (distance between bounds) -->
|
||||
<parachute friction="2.0" time="4.0" time-other="8.0" lbound-fraction="0.5" ubound-fraction="0.95" max-speed="30"/>
|
||||
|
||||
<!-- time is the time till a bomb explodes. time-increase is the time added
|
||||
to timer when bomb is passed on. -->
|
||||
|
@ -109,7 +109,9 @@ void STKConfig::load(const std::string &filename)
|
||||
|
||||
CHECK_NEG(m_max_karts, "<karts max=..." );
|
||||
CHECK_NEG(m_parachute_friction, "parachute-friction" );
|
||||
CHECK_NEG(m_parachute_done_fraction, "parachute-done-fraction" );
|
||||
CHECK_NEG(m_parachute_lbound_fraction, "parachute-lbound-fraction" );
|
||||
CHECK_NEG(m_parachute_ubound_fraction, "parachute-ubound-fraction" );
|
||||
CHECK_NEG(m_parachute_max_speed, "parachute-max-speed" );
|
||||
CHECK_NEG(m_parachute_time, "parachute-time" );
|
||||
CHECK_NEG(m_parachute_time_other, "parachute-time-other" );
|
||||
CHECK_NEG(m_bomb_time, "bomb-time" );
|
||||
@ -151,14 +153,15 @@ void STKConfig::load(const std::string &filename)
|
||||
void STKConfig::init_defaults()
|
||||
{
|
||||
m_anvil_weight = m_parachute_friction =
|
||||
m_parachute_time = m_parachute_done_fraction =
|
||||
m_parachute_time = m_parachute_lbound_fraction =
|
||||
m_parachute_time_other = m_anvil_speed_factor =
|
||||
m_bomb_time = m_bomb_time_increase =
|
||||
m_anvil_time = m_music_credit_time =
|
||||
m_delay_finish_time = m_skid_fadeout_time =
|
||||
m_near_ground = m_item_switch_time =
|
||||
m_smooth_angle_limit =
|
||||
m_penalty_time = m_explosion_impulse_objects = UNDEFINED;
|
||||
m_smooth_angle_limit = m_parachute_ubound_fraction =
|
||||
m_penalty_time = m_explosion_impulse_objects =
|
||||
m_parachute_max_speed = UNDEFINED;
|
||||
m_bubblegum_counter = -100;
|
||||
m_bubblegum_shield_time = -100;
|
||||
m_shield_restrict_weapos = false;
|
||||
@ -303,7 +306,9 @@ void STKConfig::getAllData(const XMLNode * root)
|
||||
parachute_node->get("friction", &m_parachute_friction );
|
||||
parachute_node->get("time", &m_parachute_time );
|
||||
parachute_node->get("time-other", &m_parachute_time_other );
|
||||
parachute_node->get("done-fraction", &m_parachute_done_fraction);
|
||||
parachute_node->get("lbound-fraction", &m_parachute_lbound_fraction);
|
||||
parachute_node->get("ubound-fraction", &m_parachute_ubound_fraction);
|
||||
parachute_node->get("max-speed", &m_parachute_max_speed );
|
||||
}
|
||||
|
||||
if(const XMLNode *bomb_node= root->getNode("bomb"))
|
||||
|
@ -64,8 +64,11 @@ public:
|
||||
attached. */
|
||||
float m_anvil_speed_factor; /**<Speed decrease when attached first. */
|
||||
float m_parachute_friction; /**<Increased parachute air friction. */
|
||||
float m_parachute_done_fraction; /**<Fraction of speed when lost will
|
||||
detach parachute. */
|
||||
float m_parachute_ubound_fraction; /**<Upper bound fraction of speed when
|
||||
lost will detach parachute. */
|
||||
float m_parachute_lbound_fraction; /**<Lower bound fraction of speed when
|
||||
lost will detach parachute. */
|
||||
float m_parachute_max_speed; /**<Max speed to rate current speed */
|
||||
float m_parachute_time; /**<Time a parachute is active. */
|
||||
float m_parachute_time_other; /**<Time a parachute attached to other
|
||||
karts is active. */
|
||||
|
@ -408,8 +408,12 @@ void Attachment::update(float dt)
|
||||
// Partly handled in Kart::updatePhysics
|
||||
// Otherwise: disable if a certain percantage of
|
||||
// initial speed was lost
|
||||
if(m_kart->getSpeed() <=
|
||||
m_initial_speed*stk_config->m_parachute_done_fraction)
|
||||
// This percentage is based on the ratio of
|
||||
// initial_speed / initial_max_speed
|
||||
|
||||
if(m_kart->getSpeed() <= m_initial_speed * (stk_config->m_parachute_lbound_fraction +
|
||||
((m_initial_speed / stk_config->m_parachute_max_speed) * (stk_config->m_parachute_ubound_fraction -
|
||||
stk_config->m_parachute_lbound_fraction))))
|
||||
{
|
||||
m_time_left = -1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user