//-----------------------------------------------------------------------------
// Purpose: Our start or end entity has changed; recalculate our bounds and midpoint.
// Input  : pObject - Entity that changed.
//-----------------------------------------------------------------------------
void CMapLine::OnNotifyDependent(CMapClass *pObject, Notify_Dependent_t eNotifyType)
{
	CMapClass::OnNotifyDependent(pObject, eNotifyType);

	CMapWorld *pWorld = (CMapWorld *)GetWorldObject(this);
	UpdateDependencies(pWorld, NULL);
}
Example #2
0
		void TeleportTo(Vector3* position)
		{
			IPlayer* me = GetMe();
			if (!me) return;

			Player* playerMe = me->GetPlayer();
			if (!playerMe) return;

			IActor* actorMe = me->vfptr->GetActorInterface(me);
			if (!actorMe) return;

			IUE4Actor* ue4actor = playerMe->baseclass_0.m_target;
			if (!ue4actor) return;

			World* GameWorld = GetWorldObject();
			if (!GameWorld) return;

			//auto const logMsg = boost::str(boost::format("TeleportTo(%.2f,%.2f,%.2f)")
			//	% position->x % position->y % position->z);
			//Chat(logMsg);

			Rotation rot{ 0, 0, 0 };
			ue4actor->vfptr->GetRotation(ue4actor, &rot);
			GameWorld->vfptr->SendRespawnEvent(GameWorld, me->GetPlayer(), position, &rot);
			ue4actor->vfptr->LocalRespawn(ue4actor, position, &rot);
		}
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : key - 
//			value - 
//-----------------------------------------------------------------------------
void CMapLine::OnParentKeyChanged( const char* key, const char* value )
{
	CMapWorld *pWorld = (CMapWorld *)GetWorldObject(this);
	if (pWorld != NULL)
	{
		if (stricmp(key, m_szStartValueKey) == 0)
		{
			m_pStartEntity = (CMapEntity *)UpdateDependency(m_pStartEntity, pWorld->FindChildByKeyValue(m_szStartKey, value));
			BuildLine();
		}
		else if (stricmp(key, m_szEndValueKey) == 0)
		{
			m_pEndEntity = (CMapEntity *)UpdateDependency(m_pEndEntity, pWorld->FindChildByKeyValue(m_szEndKey, value));
			BuildLine();
		}
	}
}
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : key - 
//			value - 
//-----------------------------------------------------------------------------
void CMapSideList::OnParentKeyChanged(char const *pszKey, char const *pszValue)
{
	CMapWorld *pWorld = GetWorldObject(this);
	if (pWorld == NULL)
	{
		// We're probably being copied into the clipboard.
		return;
	}

	//
	// Update our face list if the key we care about is changing.
	//
	if (!stricmp(pszKey, m_szKeyName))
	{
		BuildFaceListForValue(pszValue, pWorld);
	}
}
Example #5
0
		void TeleportToActor(std::string const& name)
		{
			World* GameWorld = GetWorldObject();
			if (!GameWorld) return;

			for (auto const& actorRef : GameWorld->m_actors)
			{
				IActor* actor = actorRef.m_object;
				if (actor != nullptr)
				{
					std::string blueprint(actor->vfptr->GetBlueprintName(actor));
					if (blueprint.find(name) != std::string::npos)
					{
						Vector3 pos;
						actor->vfptr->GetLookPosition(actor, &pos);
						TeleportTo(&pos);
						return;
					}
				}
			}

			//Chat("Could not find actor \"" + name + "\"");
		}
//-----------------------------------------------------------------------------
// Purpose: Rebuilds the line path between keyframe entities
//			samples the interpolator function to get an approximation of the curve
//-----------------------------------------------------------------------------
void CMapAnimator::RebuildPath( void )
{
	CMapClass *pWorld = GetWorldObject( this );
	if ( !pWorld )
	{
		// Sometimes the object isn't linked back into the world yet when RebuildPath() 
		// is called... we will be get called again when needed, but may cause an incorrect
		// (linear-only) path to get drawn temporarily.
		return;
	}

	//
	// Build the path forward from the head. Keep a list of nodes we've visited to
	// use in detecting circularities.
	//
	CMapObjectList VisitedList;
	CMapKeyFrame *pCurKey = this;
	while ( pCurKey != NULL )
	{
		VisitedList.AddTail( pCurKey );

		//
		// Attach ourselves as this keyframe's animator.
		//
		pCurKey->SetAnimator( this );

		//
		// Get the entity parent of this keyframe so we can query keyvalues.
		//
		CMapEntity *pCurEnt = dynamic_cast<CMapEntity *>( pCurKey->GetParent() );
		if ( !pCurEnt )
		{
			return;
		}

		//
		// Find the next keyframe in the path.
		//
		CMapEntity *pNextEnt = pWorld->FindChildByKeyValue( "targetname", pCurEnt->GetKeyValue( "NextKey" ) );
		CMapKeyFrame *pNextKey = NULL;

		if ( pNextEnt )
		{
			pNextKey = pNextEnt->GetChildOfType( ( CMapKeyFrame * )NULL );
			pCurKey->SetNextKeyFrame(pNextKey);
		}
		else
		{
			pCurKey->SetNextKeyFrame( NULL );
		}

		pCurKey = pNextKey;

		//
		// If we detect a circularity, stop.
		//
		if ( VisitedList.Find( pCurKey ) )
		{
			break;
		}
	}

	//
	// Now traverse the path again building the spline points, once again checking
	// the visited list for circularities.
	//
	VisitedList.RemoveAll();
	pCurKey = this;
	CMapKeyFrame *pPrevKey = this;
	while ( pCurKey != NULL )
	{
		VisitedList.AddTail( pCurKey );

		pCurKey->BuildPathSegment(pPrevKey);

		pPrevKey = pCurKey;
		pCurKey = pCurKey->m_pNextKeyFrame;

		//
		// If we detect a circularity, stop.
		//
		if ( VisitedList.Find( pCurKey ) )
		{
			break;
		}
	}
}