Mohc's MadMatch MOD v 2.0b 12/14/98 (works with Shogo 2.1)

***** This is a server side ONLY mod*******
You do not need to download anything if you are a client, only server admins
need to get the object.lto file.

Purpose: To provide a modification of Shogo allowing basic DeathMatch TeamPlay for
Matches or FFA. Also to allow client administration of these Matches or FFA's via
a client voting system so that the server admin need not be present. If you are a
server admin, and are not running any specific MOD, please consider this MOD. You will
not lose any functionality over the default server, and if you really wanted to you can
turn voting off and the server will run exactly like a regular server. But with voting
on, or some of the TeamPlay or MatchMode variables on, you allow those that can not run 
a server to run their own matches. Basically I am trying to make the QWRing MOD from 
QuakeWorld for Shogo(without any of the source of course ;) .

Installation:
If you unrezed your files, backup your current object.lto and then copy this into
your default rez directory, you will lose no functionality over the default 
object.lto. Otherwise rez the object.lto up and place into a custom directory and
add that to your -rez arguments. If you need help please contact me at mohc@home.com

Adds new variables to the server

1. TeamPlay: (Applied Instantly, Defaults to 0)

	TeamPlay 0 : FFA(Free For All), just like normal play ["TeamPlay 0" in server console without quotes]
	TeamPlay 1 : Standard Teamplay, lose a frag for killing a teammate ["TeamPlay 1" in server consoles without quotes]
	TeamPlay 2 : Alternate Teamplay, no damage to teammates, including yourself ["TeamPlay 2" in server console without quotes]   

	Teams are based on color
		
2. Match Mode: (Level Must Change to Take Effect, Defaults to 0)

	MatchMode 0 : Regular play, any TeamPlay setting is allowed ["MatchMode 0" in server console without quotes]
	MatchMode 1 : Match play, only TeamPlay 1 or 2 allowed, score updates are made ["MatchMode 1" in server console without quotes]
	MatchMode 2 : Pre-Match, no damage can be done to anyone ["MatchMode 2" in server console without the quotes]

	While in MatchMode 2 players can not damage one another and lets players prepare for a match.
	Once all clients have typed "READY" as a message the server will start a 10 second count down to restarting the level
	in matchmode 1 (Match Play). At any time before the countdown is over or before it begins a player may type "NOTREADY"
	and the countdown either will not begin or will be halted. In MatchMode 1, a TeamPlay of 0 results in TeamPlay 1 since
	only TeamPlay 1 or 2 are allowed. There is a countdown starting at 10 seconds left in Match Mode 1.

3. Score Update: (Level Must Change to Take Effect, Defaults to 2)

	["ScoreUpdate <int>" in server console without the quotes, <int> being any integer]

	This setting sets the interval for how many minutes there are between score updates.
	Setting this to 1 will update the score every minute, setting to 2 would update every 2 minutes, etc. 
	In MatchMode 1 scoreupdates are made at an interval set by the scoreupdate variable. The scoreupdate will show the time 
	remaining in the match followed by the scores of each of the teams playing. A ScoreUpdate value of 0 results in no score
	updates, as well as negative values or values greater than the time limit. Timelimit must be enabled for this to work.
	
4. Match Lock: (Applied Instantly, Defaults to 0)

	MatchLock 0 : Match Lock Off, anyone may join during a match ["MatchLock 0" in server console without the quotes]
	MatchLock 1 : Match Lock On, teams are locked at a certain size ["MatchLock 1" in server console without the quotes]

	If a Match is about to start and MatchLock is on, the team sizes are recorded and during the match these sizes
	can not be exceeded. If a new player tries to join the server on a team that is full, he will be kicked instantly.
	Any team with 0 players at time the team sizes are recorded will not be allowed during the match. Effectively,
	with Match Lock on, the only way to join the server is to join after someone drops and have your color set properly
	to join the team of the player that dropped.
	

5. Vote Margin: (Applied Instantly, Defaults to .666666)

	This setting sets the percentage of Yes votes needed to pass a client initiated vote.
	Setting this to .5 would require a simple majority, setting to .666666 would require a 2/3rds majority.
	["VoteMargin <float>" in the server console without the quotes, <float> being some float from 0-1]

	The inverse of the Vote Margin is used to test for No Votes. Only the server can set this.

6. Voting: (Applied Instantly, Defaults to 1)

	Voting 0 : Voting Off, clients can not vote on settings ["Voting 0" in server console without the quotes]
	Voting 1 : Voting On, clients may vote on server settings ["Voting 1" in server console without the quotes]

	Clients may vote on certain variables and on certain functions. Once a client has initiated a vote, no other votes can
	be initiated unless the first vote passes or fails. Votes fail if they are not passed within 30 seconds, or if a sufficient
	number of No votes are received. Votes pass only if enough Yes votes to overcome the vote margin are received within 30 
	seconds. The person that initiates the vote is assumed to have voted yes and everyone only gets one vote, but may change it
	at anytime before the vote passes or fails with another Yes or No Vote. Only the server can set this.
	
	Voting Options:(All votes are sent as messages without the quotes and must be in caps)

		1.TeamPlay: "VOTE TEAMPLAY 0", "VOTE TEAMPLAY 1", or "VOTE TEAMPLAY 2" if passed will set TeamPlay to the 
		specified value. If the setting specified is already set, the vote will be ignored.

		2.MatchMode: "VOTE MATCHMODE" if passed will switch to MatchMode 2 if the server is in MatchMode 0 or will
		switch to MatchMode 0 if the server is in MatchMode 1 or 2. (To get to MatchMode 1 clients will use "Ready"
		while in MatchMode 2)

		3.ScoreUpdate: "VOTE SCOREUPDATE <int>" (<int> being some positive integer) if passed will set ScoreUpdate
		to the specified value, invalid values are ignored.

		4.MacthLock: "VOTE MATCHLOCK" if passed will switch MatchLock On if it is currently Off or will switch MatchLock 
		Off if it is currently On.

		5.NextLevel: "VOTE NEXTLEVEL" if passed will send the server to the next level in the server's list

		6.Kick: "VOTE KICK <client name>" (<client name> being some clients name) if passed will kick that client off
		the server.

		7.Yes: "VOTE YES" votes in favor of a pending vote.

		8.No: "VOTE NO" votes against a pending vote.

	Listing Options:(List requests must be sent as messages without the quotes and must be in caps)

		1.Variables: "LIST VARIABLES" will display current values for TeamPlay, MatchMode, ScoreUdpate,
		and MatchLock to all players. Disabled in MatchMode 1.

		2.Commands: "LIST COMMANDS" will display all commands(votes and lists) that a client can make to all players.

Also Added:
	Player obituaries(death messages) are echoed to the server console(to give those bored admins something to read).
	

Known Issues:
Team Kills are reported as self kills, this is because scoring is done client side.
In order for a client to reduce someone's frag count, it must receive a self kill 
message, so this object.lto sends a self kill message on a team kill. While it
would have been possible to work around this by editing cshell.dll, the primary
purpose of this mod is to make a server-side only mod.
The Kicking resulting both from a client vote and a MatchLock do not execute as cleanly as 
a server kick. The Disconnected from server box does not come up but instead you are left at the
loading screen. On a client vote kick it will be obvious why you are dropped but on a MatchLock
one could be confused. In either case the client can simply type quit to exit the program.

Unknown Issues:
I am not entirely sure how this will handle telefrags from a teammate in TeamPlay 2(No Team Damage). I added a flag such
that the damage will not be set to 0 if a teammate damages you with a telefrag, but I never got around to testing if I
did it correctly as this was my only change to the PlayerObj.cpp file.

***Update*** Hint to all MOD Makers...do not leave unknown issues in your MOD. This came back to bite my ass.
The issue listed above ended causing Teamplay 2 to be disabled once anyone has been telefragged. Easy fix though and 
TeamPlay 2 works properly after a telefrag

To be added in upcoming versions:
1. MessageMode 2: Team Messages
2. Message of the Day: Allow Servers to set up a message to display to clients at startup(maybe via a textfile)
3. Weapon/Death-Type Specific Obituaries: Allow servers to set up different messages for different types of deaths.
Note: All 3 of these will probably break the cshell.dll and so I am reluctant to do so, but I will try to make it so
the default cshell.dll does not freak out if I do implement these settings. 
4. Level Warp: Allows players to warp to a specific level with a vote.

I am sure I left out something.

Send any suggestions you have to mohc@home.com

Thanks to all of those in Skull Squadron who helped me test this out, especially Fwiffo, he spent many many hours helping me
test out these new settings and features and I greatly appreciate him bearing with me while I spent 5 hours alone trying to
figure out that damn MatchLock setting. 

Mohc[SS]