//-----------------------------------------------------------------------------
// Here's where we deal with weapons, ladders, etc.
//-----------------------------------------------------------------------------
void CVehicleTeleportStation::OnItemPostFrame( CBaseTFPlayer *pDriver )
{
	// I can't do anything if I'm not active
	if ( !ShouldBeActive() )
		return;

	if ( GetPassengerRole( pDriver ) != VEHICLE_DRIVER )
		return;

	if ( !IsDeployed() && ( pDriver->m_afButtonPressed & IN_ATTACK ) )
	{
		if ( ValidDeployPosition() )
		{
			Deploy();
		}
	}
	else if ( IsDeployed() && ( pDriver->m_afButtonPressed & IN_ATTACK ) )
	{
		UnDeploy();

		SetControlPanelsActive( false );
		SetBodygroup( 1, true );
		RemoveCornerSprites();
		SetContextThink( NULL, 0, TELEPORT_STATION_THINK_CONTEXT );
	}
}
ModConfig::ModConfig()
{
	mod_config = this;

	Load();
	FindMods();
	Deploy();
}
void
ModConfig::Redeploy()
{
	Undeploy();
	Deploy();

	Campaign::Close();
	Campaign::Initialize();
	Campaign::SelectCampaign("Single Missions");
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CVehicleSiegeTower::InternalDeploy( void )
{
	// Deploy
	if ( !Deploy() )
		return;

	InputTurnOff( inputdata_t() );

	// Create the ladder.
	Vector vecOrigin;
	QAngle vecAngle;
	GetAttachment( "ladder", vecOrigin, vecAngle );
	CreateLadder( vecOrigin, vecAngle );
}
Esempio n. 5
0
/**
 *
 * Decodes a package from a file, extracts its payload,
 * expands the payload into a temporary directory, and then executes
 * the command specified in the package.
 *
 * @param   [IN]  file  The package file
 * @returns DEPLOYPKG_STATUS_SUCCESS on success
 *          DEPLOYPKG_STATUS_CLOUD_INIT_DELEGATED if customization task is
 *          delegated to cloud-init.
 *          DEPLOYPKG_STATUS_ERROR on error
 *
 **/
DeployPkgStatus
DeployPkg_DeployPackageFromFileEx(const char* file)
{
   DeployPkgStatus retStatus;

   sLog(log_info, "Initializing deployment module. \n");
   Init();

   sLog(log_info, "Deploying cabinet file %s. \n", file);
   retStatus = Deploy(file);

   if (retStatus != DEPLOYPKG_STATUS_SUCCESS &&
       retStatus != DEPLOYPKG_STATUS_CLOUD_INIT_DELEGATED) {
      sLog(log_error, "Deploy error: %s \n", GetDeployError());
   }

   free(gDeployError);
   gDeployError = NULL;

   return retStatus;
}
bool CVehicleMortar::ClientCommand( CBaseTFPlayer *pPlayer, const char *pCmd, ICommandArguments *pArg )
{
	ResetDeteriorationTime();

	if ( !Q_stricmp( pCmd, "Deploy" ) )
	{
		Deploy();
		return true;
	}
	else if ( !Q_stricmp( pCmd, "Undeploy" ) )
	{
		UnDeploy();
	}
	else if ( !Q_stricmp( pCmd, "CancelDeploy" ) )
	{
		CancelDeploy();
		return true;
	}
	else if ( !Q_stricmp( pCmd, "FireMortar" ) )
	{
		if ( pArg->Argc() == 3 )
		{
			FireMortar( atof( pArg->Argv(1) ), atof( pArg->Argv(2) ), false, false );
		}
		return true;
	}
	else if ( !Q_stricmp( pCmd, "MortarYaw" ) )
	{
		if ( pArg->Argc() == 2 )
		{
			m_flMortarYaw = atof( pArg->Argv(1) );
		}
		return true;
	}

	return BaseClass::ClientCommand( pPlayer, pCmd, pArg );
}
Esempio n. 7
0
 int DynamicContextMenu::Deploy(LWPanel &panel, int select)
 {
   return Deploy(panel.GetID(), select);
 }
//-----------------------------------------------------------------------------
// Purpose: Spawn the entity
//-----------------------------------------------------------------------------
void CNPC_CombineCamera::Spawn()
{
	Precache();

	SetModel(COMBINE_CAMERA_MODEL);

	m_pEyeFlash = CSprite::SpriteCreate(COMBINE_CAMERA_FLASH_SPRITE, GetLocalOrigin(), FALSE);
	m_pEyeFlash->SetTransparency(kRenderGlow, 255, 255, 255, 0, kRenderFxNoDissipation);
	m_pEyeFlash->SetAttachment(this, 2);
	m_pEyeFlash->SetBrightness(0);
	m_pEyeFlash->SetScale(1.0);

	BaseClass::Spawn();

	m_HackedGunPos	= Vector(0, 0, 12.75);
	SetViewOffset(EyeOffset(ACT_IDLE));
	m_flFieldOfView	= CAMERA_FOV_WIDE;
	m_takedamage	= DAMAGE_YES;
	m_iHealth		= 50;
	m_bloodColor	= BLOOD_COLOR_MECH;
	
	SetSolid(SOLID_BBOX);
	AddSolidFlags(FSOLID_NOT_STANDABLE);

	SetHeight(COMBINE_CAMERA_RETRACT_HEIGHT);

	AddFlag(FL_AIMTARGET);

	SetPoseParameter(COMBINE_CAMERA_BC_YAW, 0);
	SetPoseParameter(COMBINE_CAMERA_BC_PITCH, 0);

	m_iAmmoType = GetAmmoDef()->Index("Pistol");

	// Create our eye sprite
	m_pEyeGlow = CSprite::SpriteCreate(COMBINE_CAMERA_GLOW_SPRITE, GetLocalOrigin(), false);
	m_pEyeGlow->SetTransparency(kRenderWorldGlow, 255, 0, 0, 128, kRenderFxNoDissipation);
	m_pEyeGlow->SetAttachment(this, 2);

	// Set our enabled state
	m_bEnabled = ((m_spawnflags & SF_COMBINE_CAMERA_STARTINACTIVE) == false);

	// Make sure the radii are sane.
	if (m_nOuterRadius <= 0)
	{
		m_nOuterRadius = 300;
	}

	if (m_nInnerRadius <= 0)
	{
		m_nInnerRadius = 450;
	}

	if (m_nOuterRadius < m_nInnerRadius)
	{
		swap(m_nOuterRadius, m_nInnerRadius);
	}

	// Do we start active?
	if (m_bEnabled)
	{
		Deploy();
	}
	else
	{
		SetEyeState(CAMERA_EYE_DISABLED);
	}

	//Adrian: No shadows on these guys.
	AddEffects( EF_NOSHADOW );

	// Stagger our starting times
	SetNextThink( gpGlobals->curtime + random->RandomFloat(0.1f, 0.3f) );

	// Don't allow us to skip animation setup because our attachments are critical to us!
	SetBoneCacheFlags( BCF_NO_ANIMATION_SKIP );
}
Esempio n. 9
0
void CWeapon_Manhack::Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatCharacter *pOperator )
{
	CBasePlayer *pOwner = ToBasePlayer( GetOwner() );

	switch( pEvent->event )
	{
		case EVENT_WEAPON_SEQUENCE_FINISHED:
			m_bIsDrawing = false;
			m_bIsDoingShit = false;
			m_bIsDoingShitToo = false;

			if (m_bRedraw)
			{
				m_bRedraw=false;
				Deploy();
			}
			break;

		case EVENT_WEAPON_THROW:
			if (CPropVehicleManhack::GetManhackVehicle()!=NULL)
			{
				if (m_bHasFreeSlot)	
				{
					if (CreateControllableNPCManhack( pOwner))
					{
						DecrementAmmo( pOwner );
						EnableManhackSubModel(false);
						m_bRedraw=true;

						CBasePlayer *pPlayer = ToBasePlayer( pOwner );
						if ( pPlayer != NULL && m_iManhackHintTimeShown < 2)
						{
							if (GlobalEntity_GetState("manhacks_not_controllable") == GLOBAL_ON )
								UTIL_HudHintText( pPlayer, "#HLSS_Hint_ManhackSend" );
							else
								UTIL_HudHintText( pPlayer, "#HLSS_Hint_ManhackControl" );

							m_iManhackHintTimeShown++;
						}
//						fSpawnedManhack = true;
					}
				}
			}
			else if (CreateControllableVehicleManhack( pOwner))
			{
				DecrementAmmo( pOwner );	
				EnableManhackSubModel(false);	
				m_bRedraw=true;
//				fSpawnedManhack = true;

				//CBasePlayer *pPlayer = ToBasePlayer( pOwner );
				if ( pOwner != NULL && m_iManhackHintTimeShown <2)
				{
					if (GlobalEntity_GetState("manhacks_not_controllable") == GLOBAL_ON )
						UTIL_HudHintText( pOwner, "#HLSS_Hint_ManhackSend" );
					else
						UTIL_HudHintText( pOwner, "#HLSS_Hint_ManhackControl" );

					m_iManhackHintTimeShown++;
				}
			}

			m_bToggleCallback = true;

			if (!m_bHoldingSpawn)
			{
				m_bSpawnSomeMore = false;
				m_bIsDoingController = true;
			}
			else
			{
				m_bSpawnSomeMore = true;
				m_bIsDoingController = false;
				m_bRedraw = true;
			}

			break;
		case EVENT_WEAPON_THROW2:
			if ( pOwner != NULL && pOwner->GetFlags() & FL_ONGROUND )
			{
				if (CPropVehicleManhack::GetManhackVehicle() != NULL) 
				{
					if (GlobalEntity_GetState("manhacks_not_controllable") == GLOBAL_OFF)
					{
						m_bShouldShowPanel = false;
						DriveControllableManhack();
					}
					else
					{
						if (m_bToggleCallback)
						{
							TellManhacksToGoThere();
							m_bToggleCallback = false;
						}
						else
						{
							CallManhacksBack();
							m_bToggleCallback = true;
						}

					}
				}
				else
				{
					//TERO: Lets do an error sound
				}
			}
			break;
		case EVENT_WEAPON_THROW3:
			if (m_bToggleCallback)
			{
				TellManhacksToGoThere();
				m_bToggleCallback = false;
			}
			else
			{
				CallManhacksBack();
				m_bToggleCallback = true;
			}
			break;
		default:
			BaseClass::Operator_HandleAnimEvent( pEvent, pOperator );
			break;
	}

#define RETHROW_DELAY	0.5
/*	if( fSpawnedManhack )
	{
		m_flNextPrimaryAttack	= gpGlobals->curtime + RETHROW_DELAY;
		m_flNextSecondaryAttack	= gpGlobals->curtime + RETHROW_DELAY;
		m_flTimeWeaponIdle = FLT_MAX; //NOTE: This is set once the animation has finished up!

	}
	*/
}