Gamerules: Fraglimit now being respected, also registering mp_timelimit and
mp_fraglimit officially.
This commit is contained in:
parent
ed71d7a97a
commit
c45b7e2b62
2 changed files with 24 additions and 4 deletions
|
@ -38,10 +38,14 @@ class HLMultiplayerRules:HLGameRules
|
|||
int m_iIntermission;
|
||||
int m_iIntermissionTime;
|
||||
|
||||
void(void) HLMultiplayerRules;
|
||||
|
||||
virtual void(void) FrameStart;
|
||||
virtual void(void) CheckRules;
|
||||
|
||||
/* client */
|
||||
virtual void(base_player) PlayerSpawn;
|
||||
virtual void(base_player) PlayerDeath;
|
||||
virtual float(base_player, string) ConsoleCommand;
|
||||
|
||||
};
|
||||
|
|
|
@ -25,16 +25,21 @@ HLMultiplayerRules::FrameStart(void)
|
|||
IntermissionCycle();
|
||||
}
|
||||
|
||||
void
|
||||
HLMultiplayerRules::CheckRules(void)
|
||||
{
|
||||
/* last person who killed somebody has hit the limit */
|
||||
if (g_dmg_eAttacker.frags >= cvar("mp_fraglimit"))
|
||||
IntermissionStart();
|
||||
}
|
||||
|
||||
void
|
||||
HLMultiplayerRules::PlayerDeath(base_player pl)
|
||||
{
|
||||
/* obituary networking */
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_OBITUARY);
|
||||
if (g_dmg_eAttacker.netname)
|
||||
WriteString(MSG_MULTICAST, g_dmg_eAttacker.netname);
|
||||
else
|
||||
WriteString(MSG_MULTICAST, g_dmg_eAttacker.classname);
|
||||
WriteString(MSG_MULTICAST, (g_dmg_eAttacker.netname) ? g_dmg_eAttacker.netname : g_dmg_eAttacker.classname);
|
||||
WriteString(MSG_MULTICAST, pl.netname);
|
||||
WriteByte(MSG_MULTICAST, g_dmg_iWeapon);
|
||||
WriteByte(MSG_MULTICAST, 0);
|
||||
|
@ -99,6 +104,9 @@ HLMultiplayerRules::PlayerDeath(base_player pl)
|
|||
/* force respawn */
|
||||
pl.think = PutClientInServer;
|
||||
pl.nextthink = time + 4.0f;
|
||||
|
||||
/* have we gone over the fraglimit? */
|
||||
CheckRules();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -167,3 +175,11 @@ HLMultiplayerRules::ConsoleCommand(base_player pp, string cmd)
|
|||
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
HLMultiplayerRules::HLMultiplayerRules(void)
|
||||
{
|
||||
/* these lines do nothing but tell the server to register those cvars */
|
||||
autocvar(mp_timelimit, 15, "Timelimit for multiplayer rounds");
|
||||
autocvar(mp_fraglimit, 15, "Points limit for multiplayer rounds");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue