seta cl_autoscreenshot 1 "Take a screenshot upon the end of a match... 0 = Disable completely, 1 = Allow sv_autoscreenshot to take a screenshot when requested, 2 = Always take an autoscreenshot anyway."
-seta cl_jetpack_jump 1 "Activate jetpack by pressing jump in the air. 0 = Disable, 1 = Enable"
+seta cl_jetpack_jump 1 "Activate jetpack by pressing jump in the air. 0 = Disable, 1 = Stop when touching ground, 2 = Enable"
// must be at the bottom of this file:
me.TD(me, 1, 3, e = makeXonoticCheckBox(1, "cl_movement_track_canjump", _("Automatically repeat jumping if holding jump")));
e.sendCvars = TRUE;
me.TR(me);
- me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_jetpack_jump", _("Activate jetpack by pressing jump in the air")));
+ me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Jetpack on jump:")));
+ me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_jetpack_jump"));
+ e.addValue(e, _("Disabled"), "0");
+ e.addValue(e, _("Air only"), "1");
+ e.addValue(e, _("All"), "2");
+ e.configureXonoticTextSliderValues(e);
e.sendCvars = TRUE;
me.TR(me);
if(cvar_type("joy_enable") & CVAR_TYPEFLAG_ENGINE)
.float multijump_count;
void CheckPlayerJump()
{
+ float was_flying = self.items & IT_USING_JETPACK;
+
+ if (self.cvar_cl_jetpack_jump < 2)
+ self.items &= ~IT_USING_JETPACK;
+
if (self.BUTTON_JUMP || self.BUTTON_JETPACK)
{
- if (self.BUTTON_JUMP && (!PlayerJump() || self.multijump_count > 0) || self.BUTTON_JETPACK)
+ float air_jump = !PlayerJump() || self.multijump_count > 0; // PlayerJump() has important side effects
+ float activate = self.cvar_cl_jetpack_jump && air_jump && self.BUTTON_JUMP || self.BUTTON_JETPACK;
+ float has_fuel = !autocvar_g_jetpack_fuel || self.ammo_fuel || self.items & IT_UNLIMITED_WEAPON_AMMO;
+ if (self.jetpack_stopped) { }
+ else if (!has_fuel)
{
- if (self.cvar_cl_jetpack_jump || self.BUTTON_JETPACK)
- if (!self.jetpack_stopped && (!autocvar_g_jetpack_fuel || self.ammo_fuel > 0 || self.items & IT_UNLIMITED_WEAPON_AMMO) && !self.frozen)
- {
- self.items |= IT_USING_JETPACK;
- }
+ if (was_flying)
+ sprint(self, "You ran out of fuel for the ^2Jetpack\n");
else
- {
- // we get here if we ran out of ammo
- if (!self.jetpack_stopped)
- sprint(self, "You don't have any fuel for the ^2Jetpack\n");
- self.jetpack_stopped = TRUE;
- self.items &= ~IT_USING_JETPACK;
- }
+ sprint(self, "You don't have any fuel for the ^2Jetpack\n");
+ self.jetpack_stopped = TRUE;
+ self.items &= ~IT_USING_JETPACK;
}
+ else if (activate && !self.frozen)
+ self.items |= IT_USING_JETPACK;
}
else
{
bot_think();
}
- self.items &= ~IT_USING_JETPACK;
-
if(IS_PLAYER(self))
{
if(self.race_penalty)