From: TimePath Date: Wed, 24 Dec 2014 03:43:49 +0000 (+1100) Subject: Merge branch 'master' into TimePath/features/jetpack_jump X-Git-Tag: xonotic-v0.8.0~52^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0986191f6eaee31bb1dcd6a663b821370c964509;p=xonotic%2Fxonotic-data.pk3dir.git Merge branch 'master' into TimePath/features/jetpack_jump Conflicts: qcsrc/server/cl_physics.qc --- 0986191f6eaee31bb1dcd6a663b821370c964509 diff --cc qcsrc/server/cl_physics.qc index 34e3e8f5d,08f9dee95..900f65bc8 --- a/qcsrc/server/cl_physics.qc +++ b/qcsrc/server/cl_physics.qc @@@ -153,41 -151,11 +153,41 @@@ void CheckWaterJump( } } } + +.float jetpack_stopped; +// Hack: shouldn't need to know about this +.float multijump_count; void CheckPlayerJump() { - if (self.BUTTON_JUMP) - PlayerJump (); + 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) + { + 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 (was_flying) - sprint(self, "You ran out of fuel for the ^2Jetpack\n"); ++ if (was_flying) // TODO: ran out of fuel message ++ Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_JETPACK_NOFUEL); + else - sprint(self, "You don't have any fuel for the ^2Jetpack\n"); ++ Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_JETPACK_NOFUEL); + self.jetpack_stopped = TRUE; + self.items &= ~IT_USING_JETPACK; + } + else if (activate && !self.frozen) + self.items |= IT_USING_JETPACK; + } else + { + self.jetpack_stopped = FALSE; + self.items &= ~IT_USING_JETPACK; + } + if (!self.BUTTON_JUMP) self.flags |= FL_JUMPRELEASED; if (self.waterlevel == WATERLEVEL_SWIMMING)