TacoServer/Classic/scripts/autoexec/NoBaseRape.cs

51 lines
1.5 KiB
C#
Raw Permalink Normal View History

2020-03-23 20:23:42 +00:00
package NoBaseRape
{
2020-08-18 17:58:49 +00:00
// From Evolution MOD
// Modified for our needs
2020-03-23 20:23:42 +00:00
function StaticShapeData::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType)
{
//echo( %targetObject.getDataBlock().getClassName() );
//echo( %targetObject.getDataBlock().getName() );
2020-08-18 17:58:49 +00:00
2020-03-23 20:23:42 +00:00
%targetname = %targetObject.getDataBlock().getName();
2020-08-18 17:58:49 +00:00
//Used on some maps to make invs invincible
if( %targetObject.invincible && %targetname $= "StationInventory" )
return;
2020-08-18 17:58:49 +00:00
if(!$Host::TournamentMode && $Host::NoBaseRapeEnabled && $Host::NoBaseRapePlayerCount > $TotalTeamPlayerCount)
2020-08-18 17:58:49 +00:00
{
2020-03-23 20:23:42 +00:00
if( %targetname $= "GeneratorLarge" || %targetname $= "StationInventory" || %targetname $= "SolarPanel" )
{
//Notify only if asset is on other team
if( %targetObject.team !$= %sourceObject.team )
2020-08-18 17:58:49 +00:00
NBRAssetMessage(%sourceObject);
2020-03-23 20:23:42 +00:00
return;
}
}
parent::damageObject(%data, %targetObject, %sourceObject, %position, %amount, %damageType);
}
2020-07-18 20:08:57 +00:00
};
// Prevent package from being activated if it is already
if (!isActivePackage(NoBaseRape))
2020-08-18 17:58:49 +00:00
activatePackage(NoBaseRape);
// Message when a player hits a protected enemy asset
function NBRAssetMessage(%sourceObject)
{
if($CurrentMissionType $= "CTF" && $Host::EnableNoBaseRapeNotify )
{
%timeDif = getSimTime() - %sourceObject.NBRTime;
if(%timeDif > 10000 || !%sourceObject.NBRTime)
{
messageClient(%sourceObject.client, 'MsgNoBaseRapeNotify', '\c2No Base Rape is enabled until %1 players.', $Host::NoBaseRapePlayerCount );
%sourceObject.NBRTime = getSimTime();
}
}
}