#include <common/mutators/mutator/instagib/items.qh>
#include <server/campaign.qh>
#include <server/command/_mod.qh>
+#include <server/world.qh>
+#include <server/items/items.qh>
int autocvar_g_lms_extra_lives;
bool autocvar_g_lms_join_anytime;
bool autocvar_g_lms_regenerate;
// main functions
-float LMS_NewPlayerLives()
+int LMS_NewPlayerLives()
{
- float fl;
- fl = autocvar_fraglimit;
- if(fl == 0)
+ int fl = floor(autocvar_fraglimit);
+ if(fl == 0 || fl > 999)
fl = 999;
// first player has left the game for dying too much? Nobody else can get in.
return 0;
if(!autocvar_g_lms_join_anytime)
- if(lms_lowest_lives < fl - autocvar_g_lms_last_join)
+ if(lms_lowest_lives < fl - max(0, floor(autocvar_g_lms_last_join)))
return 0;
return bound(1, lms_lowest_lives, fl);
if(warmup_stage)
return false;
- if(player.frags == FRAGS_SPECTATOR)
- return true;
- if(GameRules_scoring_add(player, LMS_LIVES, 0) <= 0)
+ if(player.frags == FRAGS_SPECTATOR || GameRules_scoring_add(player, LMS_LIVES, 0) <= 0)
{
Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_LMS_NOLIVES);
return true;
{
entity frag_target = M_ARGV(2, entity);
+ float tl = GameRules_scoring_add(frag_target, LMS_LIVES, 0);
+ if (tl <= 0)
+ {
+ frag_target.respawn_flags = RESPAWN_SILENT;
+ // prevent unwanted sudden rejoin as spectator and movement of spectator camera
+ frag_target.respawn_time = time + 2;
+ }
frag_target.respawn_flags |= RESPAWN_FORCE;
}
float player_rank = GameRules_scoring_add(player, LMS_RANK, 0);
if (!player_rank)
{
- int pl_cnt = 0;
- FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME, {
- pl_cnt++;
- });
if (player.lms_spectate_warning < 2)
{
- if(IS_BOT_CLIENT(player))
- bot_clear(player);
player.frags = FRAGS_PLAYER_OUT_OF_GAME;
+ int pl_cnt = 0;
+ FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME, {
+ pl_cnt++;
+ });
GameRules_scoring_add(player, LMS_RANK, pl_cnt + 1);
}
else
{
- lms_lowest_lives = 999;
FOREACH_CLIENT(true, {
if (it.frags == FRAGS_PLAYER_OUT_OF_GAME)
{
float it_rank = GameRules_scoring_add(it, LMS_RANK, 0);
if (it_rank > player_rank && it_rank <= 256)
GameRules_scoring_add(it, LMS_RANK, -1);
- lms_lowest_lives = 0;
}
else if (it.frags != FRAGS_SPECTATOR)
{
FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME, {
pl_cnt++;
});
- if(IS_BOT_CLIENT(frag_target))
- bot_clear(frag_target);
frag_target.frags = FRAGS_PLAYER_OUT_OF_GAME;
GameRules_scoring_add(frag_target, LMS_RANK, pl_cnt);
}
MUTATOR_HOOKFUNCTION(lms, OnEntityPreSpawn)
{
+ if (MUTATOR_RETURNVALUE) return false;
if (!autocvar_g_powerups) return false;
if (!autocvar_g_lms_extra_lives) return false;
MUTATOR_HOOKFUNCTION(lms, ItemTouch)
{
+ if(MUTATOR_RETURNVALUE) return false;
+
entity item = M_ARGV(0, entity);
entity toucher = M_ARGV(1, entity);
void lms_Initialize()
{
- lms_lowest_lives = 9999;
+ lms_lowest_lives = 999;
}