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.
|
<!-- friction is the friction increase when a parachute is attached.
|
||||||
time is the time an attached parachute is active
|
time is the time an attached parachute is active
|
||||||
time-other is the time a parachute attached from other kart works
|
time-other is the time a parachute attached from other kart works
|
||||||
done-fraction is the fraction of speed when lost will detach parachute -->
|
lbound-fraction is the lower bound fraction of speed when lost will detach parachute
|
||||||
<parachute friction="2.0" time="4.0" time-other="8.0" done-fraction="0.7"/>
|
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
|
<!-- time is the time till a bomb explodes. time-increase is the time added
|
||||||
to timer when bomb is passed on. -->
|
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_max_karts, "<karts max=..." );
|
||||||
CHECK_NEG(m_parachute_friction, "parachute-friction" );
|
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, "parachute-time" );
|
||||||
CHECK_NEG(m_parachute_time_other, "parachute-time-other" );
|
CHECK_NEG(m_parachute_time_other, "parachute-time-other" );
|
||||||
CHECK_NEG(m_bomb_time, "bomb-time" );
|
CHECK_NEG(m_bomb_time, "bomb-time" );
|
||||||
@ -151,14 +153,15 @@ void STKConfig::load(const std::string &filename)
|
|||||||
void STKConfig::init_defaults()
|
void STKConfig::init_defaults()
|
||||||
{
|
{
|
||||||
m_anvil_weight = m_parachute_friction =
|
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_parachute_time_other = m_anvil_speed_factor =
|
||||||
m_bomb_time = m_bomb_time_increase =
|
m_bomb_time = m_bomb_time_increase =
|
||||||
m_anvil_time = m_music_credit_time =
|
m_anvil_time = m_music_credit_time =
|
||||||
m_delay_finish_time = m_skid_fadeout_time =
|
m_delay_finish_time = m_skid_fadeout_time =
|
||||||
m_near_ground = m_item_switch_time =
|
m_near_ground = m_item_switch_time =
|
||||||
m_smooth_angle_limit =
|
m_smooth_angle_limit = m_parachute_ubound_fraction =
|
||||||
m_penalty_time = m_explosion_impulse_objects = UNDEFINED;
|
m_penalty_time = m_explosion_impulse_objects =
|
||||||
|
m_parachute_max_speed = UNDEFINED;
|
||||||
m_bubblegum_counter = -100;
|
m_bubblegum_counter = -100;
|
||||||
m_bubblegum_shield_time = -100;
|
m_bubblegum_shield_time = -100;
|
||||||
m_shield_restrict_weapos = false;
|
m_shield_restrict_weapos = false;
|
||||||
@ -300,10 +303,12 @@ void STKConfig::getAllData(const XMLNode * root)
|
|||||||
|
|
||||||
if(const XMLNode *parachute_node= root->getNode("parachute"))
|
if(const XMLNode *parachute_node= root->getNode("parachute"))
|
||||||
{
|
{
|
||||||
parachute_node->get("friction", &m_parachute_friction );
|
parachute_node->get("friction", &m_parachute_friction );
|
||||||
parachute_node->get("time", &m_parachute_time );
|
parachute_node->get("time", &m_parachute_time );
|
||||||
parachute_node->get("time-other", &m_parachute_time_other );
|
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"))
|
if(const XMLNode *bomb_node= root->getNode("bomb"))
|
||||||
|
@ -60,37 +60,40 @@ public:
|
|||||||
m_same_powerup_mode;
|
m_same_powerup_mode;
|
||||||
|
|
||||||
static float UNDEFINED;
|
static float UNDEFINED;
|
||||||
float m_anvil_weight; /**<Additional kart weight if anvil is
|
float m_anvil_weight; /**<Additional kart weight if anvil is
|
||||||
attached. */
|
attached. */
|
||||||
float m_anvil_speed_factor; /**<Speed decrease when attached first. */
|
float m_anvil_speed_factor; /**<Speed decrease when attached first. */
|
||||||
float m_parachute_friction; /**<Increased parachute air friction. */
|
float m_parachute_friction; /**<Increased parachute air friction. */
|
||||||
float m_parachute_done_fraction; /**<Fraction of speed when lost will
|
float m_parachute_ubound_fraction; /**<Upper bound fraction of speed when
|
||||||
detach parachute. */
|
lost will detach parachute. */
|
||||||
float m_parachute_time; /**<Time a parachute is active. */
|
float m_parachute_lbound_fraction; /**<Lower bound fraction of speed when
|
||||||
float m_parachute_time_other; /**<Time a parachute attached to other
|
lost will detach parachute. */
|
||||||
karts is active. */
|
float m_parachute_max_speed; /**<Max speed to rate current speed */
|
||||||
float m_bomb_time; /**<Time before a bomb explodes. */
|
float m_parachute_time; /**<Time a parachute is active. */
|
||||||
float m_bomb_time_increase; /**<Time added to bomb timer when it's
|
float m_parachute_time_other; /**<Time a parachute attached to other
|
||||||
passed on. */
|
karts is active. */
|
||||||
float m_anvil_time; /**<Time an anvil is active. */
|
float m_bomb_time; /**<Time before a bomb explodes. */
|
||||||
float m_item_switch_time; /**< Time items will be switched. */
|
float m_bomb_time_increase; /**<Time added to bomb timer when it's
|
||||||
int m_bubblegum_counter; /**< How many times bubble gums must be
|
passed on. */
|
||||||
driven over before they disappear. */
|
float m_anvil_time; /**<Time an anvil is active. */
|
||||||
float m_bubblegum_shield_time; /**<How long a bubble gum shield lasts. */
|
float m_item_switch_time; /**< Time items will be switched. */
|
||||||
bool m_shield_restrict_weapos; /**<Wether weapon usage is punished. */
|
int m_bubblegum_counter; /**< How many times bubble gums must be
|
||||||
float m_explosion_impulse_objects;/**<Impulse of explosion on moving
|
driven over before they disappear. */
|
||||||
objects, e.g. road cones, ... */
|
float m_bubblegum_shield_time; /**<How long a bubble gum shield lasts. */
|
||||||
float m_penalty_time; /**< Penalty time when starting too
|
bool m_shield_restrict_weapos; /**<Wether weapon usage is punished. */
|
||||||
early. */
|
float m_explosion_impulse_objects; /**<Impulse of explosion on moving
|
||||||
float m_delay_finish_time; /**<Delay after a race finished before
|
objects, e.g. road cones, ... */
|
||||||
the results are displayed. */
|
float m_penalty_time; /**< Penalty time when starting too
|
||||||
float m_music_credit_time; /**<Time the music credits are
|
early. */
|
||||||
displayed. */
|
float m_delay_finish_time; /**<Delay after a race finished before
|
||||||
int m_max_karts; /**<Maximum number of karts. */
|
the results are displayed. */
|
||||||
int m_max_history; /**<Maximum number of frames to save in
|
float m_music_credit_time; /**<Time the music credits are
|
||||||
a history files. */
|
displayed. */
|
||||||
bool m_smooth_normals; /**< If normals for raycasts for wheels
|
int m_max_karts; /**<Maximum number of karts. */
|
||||||
should be interpolated. */
|
int m_max_history; /**<Maximum number of frames to save in
|
||||||
|
a history files. */
|
||||||
|
bool m_smooth_normals; /**< If normals for raycasts for wheels
|
||||||
|
should be interpolated. */
|
||||||
/** If the angle between a normal on a vertex and the normal of the
|
/** If the angle between a normal on a vertex and the normal of the
|
||||||
* triangle are more than this value, the physics will use the normal
|
* triangle are more than this value, the physics will use the normal
|
||||||
* of the triangle in smoothing normal. */
|
* of the triangle in smoothing normal. */
|
||||||
|
@ -408,8 +408,12 @@ void Attachment::update(float dt)
|
|||||||
// Partly handled in Kart::updatePhysics
|
// Partly handled in Kart::updatePhysics
|
||||||
// Otherwise: disable if a certain percantage of
|
// Otherwise: disable if a certain percantage of
|
||||||
// initial speed was lost
|
// initial speed was lost
|
||||||
if(m_kart->getSpeed() <=
|
// This percentage is based on the ratio of
|
||||||
m_initial_speed*stk_config->m_parachute_done_fraction)
|
// 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;
|
m_time_left = -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user