2019-09-13 15:34:03 -04:00
// No Base Rape Notify Script
//
// Notifys clients if NoBase rape is on or off.
//
// Enable or Disable
// $Host::EnableNoBaseRapeNotify = 1;
2018-11-04 16:59:10 -05:00
//
2019-02-02 21:33:58 -05:00
2019-09-13 15:34:03 -04:00
// Called in GetTeamCounts.cs
2019-02-03 02:35:09 -05:00
function NBRStatusNotify ( % game )
2018-06-28 14:34:52 -04:00
{
2020-03-23 16:23:42 -04:00
if ( $ CurrentMissionType $ = "CTF" & & $ Host : : EnableNoBaseRapeNotify & & ! $ Host : : TournamentMode & & $ Host : : NoBaseRapeEnabled )
2019-12-11 16:30:37 -05:00
{
2018-11-10 19:56:13 -05:00
//On
2020-03-23 16:23:42 -04:00
if ( $ Host : : NoBaseRapePlayerCount > $ TotalTeamPlayerCount )
2018-11-10 19:56:13 -05:00
{
2019-12-11 16:30:37 -05:00
if ( $ NBRStatus ! $ = "PLAYEDON" )
$ NBRStatus = "ON" ;
2018-06-28 14:34:52 -04:00
}
2018-11-10 19:56:13 -05:00
//Off
2019-12-11 16:30:37 -05:00
else
2018-11-11 01:49:33 -05:00
{
2019-12-11 16:30:37 -05:00
if ( $ NBRStatus ! $ = "PLAYEDOFF" )
$ NBRStatus = "OFF" ;
}
switch $ ( $ NBRStatus )
{
case ON :
messageAll ( ' MsgNoBaseRapeNotify ' , ' \ c1No Base Rape : \ c0Enabled . ' ) ;
$ NBRStatus = "PLAYEDON" ;
case OFF :
messageAll ( ' MsgNoBaseRapeNotify ' , ' \ c1No Base Rape : \ c0Disabled . ~ wfx / misc / diagnostic_on . wav ' ) ;
$ NBRStatus = "PLAYEDOFF" ;
case PLAYEDON :
//Do Nothing
case PLAYEDOFF :
//Do Nothing
2018-11-11 01:49:33 -05:00
}
2018-11-10 19:56:13 -05:00
}
2018-06-28 14:34:52 -04:00
}
2019-12-11 16:30:37 -05:00
// Reset gameover
package ResetNBRNotify
2019-10-06 16:30:41 -04:00
{
function DefaultGame : : gameOver ( % game )
{
Parent : : gameOver ( % game ) ;
//Reset NoBaseRapeNotify
2019-12-11 16:30:37 -05:00
$ NBRStatus = "IDLE" ;
2019-10-06 16:30:41 -04:00
}
} ;
// Prevent package from being activated if it is already
2019-12-11 16:30:37 -05:00
if ( ! isActivePackage ( ResetNBRNotify ) )
activatePackage ( ResetNBRNotify ) ;
// This function is at StaticShapeData::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType) in the staticshape.ovl in evoClassic.vl2
// Plays a sound when a player hits a protected enemy asset
function NBRAssetSound ( % game , % sourceObject )
{
//Wont play again until the schedule is done
2020-03-23 16:23:42 -04:00
if ( ! isEventPending ( % sourceObject . NBRAssetSoundSchedule ) & & $ CurrentMissionType $ = "CTF" & & $ Host : : EnableNoBaseRapeNotify & & ! $ Host : : TournamentMode & & $ Host : : NoBaseRapeEnabled )
2019-12-11 16:30:37 -05:00
{
2020-03-23 16:23:42 -04:00
messageClient ( % sourceObject . client , ' MsgNoBaseRapeNotify ' , ' \ c2No Base Rape is enabled until % 1 players . ' , $ Host : : NoBaseRapePlayerCount ) ;
2019-12-11 16:30:37 -05:00
% sourceObject . NBRAssetSoundSchedule = schedule ( 10000 , 0 , "ResetNBRAssetSound" , % sourceObject ) ;
}
}
// Reset
function ResetNBRAssetSound ( % sourceObject )
{
if ( isEventPending ( % sourceObject . NBRAssetSoundSchedule ) )
cancel ( % sourceObject . NBRAssetSoundSchedule ) ;
}
2019-10-06 16:30:41 -04:00
2018-06-28 14:34:52 -04:00