86 lines
1.8 KiB
Plaintext
86 lines
1.8 KiB
Plaintext
|
|
object vehicle_icarus : vehicle_base {
|
|
void preinit();
|
|
void init();
|
|
|
|
void OnUpdateHud( entity p, float guiHandle );
|
|
|
|
void OnWeaponSelected( entity p, float index );
|
|
|
|
boolean vRepairDroneIgnoreHidden() { return true; }
|
|
|
|
boolean vDisablePlantCharge() { return true; }
|
|
|
|
void vSetManualDeploy();
|
|
void vOnDeploy();
|
|
void DoBoundsDamageThread();
|
|
|
|
void vSetDeployableOwner( entity p );
|
|
void vRemoveObject();
|
|
|
|
boolean manualDeploy;
|
|
};
|
|
|
|
void vehicle_icarus::preinit() {
|
|
manualDeploy = false;
|
|
}
|
|
|
|
void vehicle_icarus::init() {
|
|
if ( !sys.isClient() ) {
|
|
if ( manualDeploy ) {
|
|
setTakesDamage( false );
|
|
thread DoBoundsDamageThread();
|
|
}
|
|
}
|
|
}
|
|
|
|
void vehicle_icarus::OnUpdateHud( entity p, float guiHandle ) {
|
|
entity driver = getDriver();
|
|
if ( driver == $null_entity ) {
|
|
return;
|
|
}
|
|
sys.setGUIFloat( GUI_GLOBALS_HANDLE, "vehicles.chargeValue", getChargeFraction() );
|
|
}
|
|
|
|
void vehicle_icarus::OnWeaponSelected( entity p, float index ) {
|
|
if ( index == 0 ) {
|
|
FireDecoy( p );
|
|
} else if ( index == 1 ) {
|
|
selectVehicleWeapon( p, "stroybombs" );
|
|
}
|
|
}
|
|
|
|
void vehicle_icarus::vOnDeploy() {
|
|
vector origin = getWorldOrigin();
|
|
setWorldOrigin( origin + '0 0 10' );
|
|
setLinearVelocity( vec3_origin );
|
|
sys.killThread( "DoBoundsDamageThread_" + getName() );
|
|
setTakesDamage( true );
|
|
}
|
|
|
|
void vehicle_icarus::vSetManualDeploy() {
|
|
manualDeploy = true;
|
|
}
|
|
|
|
void vehicle_icarus::DoBoundsDamageThread() {
|
|
float dmgIndex = GetDamage( getKey( "dmg_falling" ) );
|
|
|
|
while ( true ) {
|
|
BoundsDamage( self, dmgIndex );
|
|
sys.waitFrame();
|
|
}
|
|
}
|
|
|
|
void vehicle_icarus::vSetDeployableOwner( entity p ) {
|
|
if ( !sys.isClient() ) {
|
|
if ( p != $null_entity ) {
|
|
p.binAdd( self );
|
|
}
|
|
}
|
|
}
|
|
|
|
void vehicle_icarus::vRemoveObject() {
|
|
if ( isEmpty() ) {
|
|
thread DecayThread();
|
|
}
|
|
} |