etqw-sdk/base/script/teams/strogg.script

380 lines
11 KiB
Text
Raw Normal View History

2008-05-29 00:00:00 +00:00
object team_strogg {
void preinit();
void syncFields();
void destroy();
boolean OnAllowRespawn( entity p );
void RespawnWaves();
void OnNextRespawnTimeChanged();
void SetRespawnTimer( float t );
float GetMineLimit();
void GiveSpawnItems( entity p );
float GetHealthBoost( entity p );
void UpdateStealth( entity p );
void OnTankUpgrade( entity p, float oldLevel, float newLevel, boolean isSpawn );
void OnInfiltratorUpgrade( entity p, float oldLevel, float newLevel, boolean isSpawn );
void OnBattleSenseUpgrade( entity p, float oldLevel, float newLevel, boolean isSpawn );
void OnLightWeaponsUpgrade( entity p, float oldLevel, float newLevel, boolean isSpawn );
void OnProficiencyUpgrade( entity p, float type, float oldLevel, float newLevel );
float GetFireSupportDelayScale();
void RegenPulse( entity p );
float GetWeaponSpeedBonus( entity p );
float GetMaxReviveCount() { return 21.f; }
boolean HasConstructionBonus( entity p );
boolean HasDisarmBonus( entity p );
boolean HasSelfArmingMines( entity p );
boolean HasChargeArmBonus( entity p );
boolean HasFastFireSupportLock( entity p );
boolean HasFastFireSupportRecharge( entity p );
boolean HasFastHackBonus( entity p );
boolean HasVehicleArmorBonus( entity p );
boolean HasFastRevive( entity p );
boolean HasEnhancedRadar( entity p );
boolean HasFastDisguise( entity p );
boolean HasFastTargetLock( entity p );
boolean CanRequestVehicle( entity p );
boolean HasEfficientDecoys( entity p );
boolean HasSpreadBonus( entity p );
boolean CanStab( entity p );
void CreatePersonnelAuras( entity p );
boolean CanTransferStroyent( entity p );
void KillSpawnWaves();
void SetRespawnWait( float time );
void OnMapStart();
float allowRespawnTime;
float nextRespawnTime;
float GetNextRespawnTime() { return nextRespawnTime; }
};
void team_strogg::syncFields() {
syncBroadcast( "nextRespawnTime" );
syncCallback( "nextRespawnTime", "OnNextRespawnTimeChanged" );
}
void team_strogg::OnNextRespawnTimeChanged() {
SetRespawnTimer( nextRespawnTime );
}
void team_strogg::preinit() {
stroggTeam = self;
repairItem = "inventory/tools/repair_drone";
hackItem = "inventory/tools/spike_infiltrator";
chargeArmItem = "inventory/tools/spike/charge";
chargeDisarmItem = "inventory/tools/repair_drone";
armItem = "inventory/tools/repair_drone";
constructItem = "inventory/tools/repair_drone";
disguiseItem = "inventory/tools/spike_infiltrator";
spawnHostItem = "inventory/tools/spike_meditech";
reviveItem = "inventory/tools/spike_meditech";
stabItem = "inventory/weapons/spikes";
disguisedStabItem = "inventory/weapons/knife/strogg";
plantItem = "inventory/items/plasma_charge";
flyerDroneItem = "inventory/items/flyer_hive";
respawnWait = 20.f;
structureName = sys.localizeString( "game/struct/dominationhub" );
spottingProficiency = GetProficiency( "pro_infiltrator_spot" );
radarSpottingProficiency = GetProficiency( "pro_infiltrator_radar_spot" );
repairProficiency = GetProficiency( "pro_constructor_repair" );
reviveProficiency = GetProficiency( "pro_technician_revive" );
reviveWaitProficiency = GetProficiency( "pro_battlesense_revive_wait" );
backstabDisguisedProficiency= GetProficiency( "pro_infiltrator_backstab_disguised" );
spawnHostMeToolTip1 = GetToolTip( getKey( "tt_player_spawnhost_1" ) );
spawnHostMeToolTip2 = GetToolTip( getKey( "tt_player_spawnhost_2" ) );
parachuteToolTip = GetToolTip( getKey( "tt_player_parachute" ) );
possessingMeToolTip = GetToolTip( getKey( "tt_possessing_me" ) );
killedByDisguisedToolTip = GetToolTip( getKey( "tt_killed_by_disguised" ) );
lowAmmoToolTip = GetToolTip( getKey( "tt_low_ammo" ) );
lowHealthToolTip = GetToolTip( getKey( "tt_low_health" ) );
lowAmmoSelfToolTip = GetToolTip( getKey( "tt_low_ammo_self" ) );
lowHealthSelfToolTip = GetToolTip( getKey( "tt_low_health_self" ) );
unconsciousToolTip = GetToolTip( getKey( "tt_unconscious" ) );
criticalClassToolTip = GetToolTip( getKey( "tt_critical_class" ) );
vehicleRepairTask = GetPlayerTask( getKey( "task_vehicle_repair" ) );
captureSpawnTask = GetPlayerTask( getKey( "task_capture_spawn" ) );
liberateSpawnTaskCovertOnly = GetPlayerTask( getKey( "task_liberate_spawn_covert" ) );
liberateSpawnTask = GetPlayerTask( getKey( "task_liberate_spawn" ) );
}
void team_strogg::KillSpawnWaves() {
sys.killThread( "RespawnWaves_strogg" );
}
void team_strogg::OnMapStart() {
OnMapStart_Base();
KillSpawnWaves();
if ( !sys.isClient() ) {
thread RespawnWaves();
}
}
void team_strogg::destroy() {
KillSpawnWaves();
}
boolean team_strogg::OnAllowRespawn( entity p ) {
return sys.getTime() < allowRespawnTime;
}
void team_strogg::RespawnWaves() {
sys.threadName( "RespawnWaves_strogg" );
allowRespawnTime = sys.getTime() + 1.f;
sys.wait( 0.5f );
while ( true ) {
nextRespawnTime = sys.getTime() + respawnWait;
SetRespawnTimer( nextRespawnTime );
sys.wait( respawnWait );
allowRespawnTime = sys.getTime() + 0.5f;
MarkWaitingPlayers();
}
}
void team_strogg::SetRespawnTimer( float t ) {
player p = sys.getLocalPlayer();
if( p != $null_entity ) {
sys.setGUIFloat( GUI_GLOBALS_HANDLE, "gameHud.stroggRespawnTime", nextRespawnTime * 1000 );
player viewPlayer = sys.getLocalViewPlayer();
if ( viewPlayer != $null_entity ) {
team_base team = viewPlayer.getGameTeam();
if ( team == stroggTeam ) {
sys.setGUIFloat( GUI_GLOBALS_HANDLE, "gameHud.spectatingRespawnTime", nextRespawnTime * 1000 );
}
}
}
}
float team_strogg::GetMineLimit() {
return 3.f;
}
void team_strogg::OnTankUpgrade( entity p, float oldLevel, float newLevel, boolean isSpawn ) {
ON_UPGRADE( 2 ) {
UpgradeClip( p, g_ammoStroyent, 200 );
UpgradeClip( p, g_ammoStroyentPacket, 2 );
if ( isSpawn ) {
UpgradeAmmo( p, g_ammoStroyent, 200 );
UpgradeAmmo( p, g_ammoStroyentPacket, 2 );
}
}
}
void team_strogg::OnBattleSenseUpgrade( entity p, float oldLevel, float newLevel, boolean isSpawn ) {
ON_UPGRADE( 1 ) {
p.setSprintScale( 1.1f );
}
ON_UPGRADE( 4 ) {
p.vStartRegenThread();
}
}
void team_strogg::OnLightWeaponsUpgrade( entity p, float oldLevel, float newLevel, boolean isSpawn ) {
ON_UPGRADE( 2 ) {
UpgradeClip( p, g_ammoGrenade, 1 );
if ( isSpawn ) {
UpgradeAmmo( p, g_ammoGrenade, 1 );
}
}
ON_UPGRADE( 1 ) {
UpgradeClip( p, g_ammoStroyent, 80 );
if ( isSpawn ) {
UpgradeAmmo( p, g_ammoStroyent, 80 );
}
}
}
void team_strogg::OnInfiltratorUpgrade( entity p, float oldLevel, float newLevel, boolean isSpawn ) {
UpdateStealth( p );
}
void team_strogg::GiveSpawnItems( entity p ) {
OnTankUpgrade( p, 0, p.getProficiency( g_proficiencyAggressor ), true );
OnInfiltratorUpgrade( p, 0, p.getProficiency( g_proficiencyInfiltrator ), true );
OnBattleSenseUpgrade( p, 0, p.getProficiency( g_proficiencyBattleSense ), true );
OnLightWeaponsUpgrade( p, 0, p.getProficiency( g_proficiencyLightWeapons ), true );
}
void team_strogg::OnProficiencyUpgrade( entity p, float type, float oldLevel, float newLevel ) {
if ( type == g_proficiencyAggressor ) {
OnTankUpgrade( p, oldLevel, newLevel, true );
} else if ( type == g_proficiencyInfiltrator ) {
OnInfiltratorUpgrade( p, oldLevel, newLevel, true );
} else if ( type == g_proficiencyBattleSense ) {
OnBattleSenseUpgrade( p, oldLevel, newLevel, true );
} else if ( type == g_proficiencyLightWeapons ) {
OnLightWeaponsUpgrade( p, oldLevel, newLevel, true );
}
}
boolean team_strogg::HasConstructionBonus( entity p ) {
return p.getProficiency( g_proficiencyConstructor ) >= 3;
}
boolean team_strogg::HasDisarmBonus( entity p ) {
return p.getProficiency( g_proficiencyConstructor ) >= 3;
}
boolean team_strogg::HasSelfArmingMines( entity p ) {
return p.getProficiency( g_proficiencyConstructor ) >= 4;
}
boolean team_strogg::HasChargeArmBonus( entity p ) {
return p.getProficiency( g_proficiencyAggressor ) >= 3;
}
boolean team_strogg::HasFastFireSupportLock( entity p ) {
return p.getProficiency( g_proficiencyOppressor ) >= 3;
}
boolean team_strogg::HasFastFireSupportRecharge( entity p ) {
return p.getProficiency( g_proficiencyOppressor ) >= 4;
}
boolean team_strogg::HasFastHackBonus( entity p ) {
return p.getProficiency( g_proficiencyInfiltrator ) >= 3;
}
boolean team_strogg::HasVehicleArmorBonus( entity p ) {
return p.getProficiency( g_proficiencyVehicle ) >= 4;
}
boolean team_strogg::HasFastRevive( entity p ) {
return p.getProficiency( g_proficiencyTechnician ) >= 3;
}
boolean team_strogg::CanTransferStroyent( entity p ) {
return true;
}
boolean team_strogg::HasEnhancedRadar( entity p ) {
return p.getProficiency( g_proficiencyInfiltrator ) >= 2;
}
boolean team_strogg::HasFastDisguise( entity p ) {
return p.getProficiency( g_proficiencyInfiltrator ) >= 4;
}
boolean team_strogg::HasFastTargetLock( entity p ) {
return p.getProficiency( g_proficiencyAggressor ) >= 1;
}
boolean team_strogg::CanRequestVehicle( entity p ) {
return p.getProficiency( g_proficiencyVehicle ) >= 1;
}
boolean team_strogg::HasEfficientDecoys( entity p ) {
return p.getProficiency( g_proficiencyVehicle ) >= 2;
}
boolean team_strogg::HasSpreadBonus( entity p ) {
return p.getProficiency( g_proficiencyLightWeapons ) >= 3;
}
boolean team_strogg::CanStab( entity p ) {
return ( p.getPlayerClass() == g_playerClassInfiltrator ) || p.isDisguised();
}
float team_strogg::GetWeaponSpeedBonus( entity p ) {
if ( p.getPlayerClass() == g_playerClassAggressor ) {
if ( p.getProficiency( g_proficiencyAggressor ) >= 4 ) {
return 0.5f;
}
}
return 0.f;
}
float team_strogg::GetHealthBoost( entity p ) {
float bonus = 0.f;
float playerClass = p.getPlayerClass();
if ( playerClass == g_playerClassAggressor ) {
bonus = bonus + 20.f;
} else if ( playerClass == g_playerClassTechnician ) {
//bonus = bonus - 10.f;
}
if ( p.getProficiency( g_proficiencyBattleSense ) >= 2 ) {
bonus = bonus + 25;
}
return bonus;
}
void team_strogg::SetRespawnWait( float time ) {
respawnWait = time;
}
void team_strogg::CreatePersonnelAuras( entity p ) {
if ( !sys.isClient() ) {
if ( p.getProficiency( g_proficiencyBattleSense ) >= 4 ) {
p.vStartRegenThread();
}
}
}
void team_strogg::RegenPulse( entity p ) {
float current = p.getAmmo( g_ammoStroyent );
float limit = p.getMaxAmmo( g_ammoStroyent );
if ( current >= limit ) {
return;
}
current = current + 5.f;
if ( current > limit ) {
current = limit;
}
p.setAmmo( g_ammoStroyent, current );
}
float team_strogg::GetFireSupportDelayScale() {
float count = CountPlayersOfClass( g_playerClassOppressor ) - 1;
float scale = 1.f;
if ( count > 0 ) {
scale = scale + ( count * 0.5f );
}
return scale;
}
void team_strogg::UpdateStealth( entity p ) {
p.disableFootsteps( false );
if ( p.getPlayerClass() == g_playerClassInfiltrator ) {
if ( !p.isDisguised() ) {
if ( p.getProficiency( g_proficiencyInfiltrator ) >= 1 ) {
p.disableFootsteps( true );
}
}
}
}