importonly abstract class questIQuestsSystem extends IReplicatedGameSystem
{
}

importonly final class FactChangedEvent extends Event
{
	public import const function GetFactName() : CName;
}

import struct EntityReference
{
	import const var reference : NodeRef;
}

importonly final class MappinVariantChangedEvent extends Event
{
	public import const function GetEntry() : weak< JournalEntry >;
	public import const function GetPhase() : gamedataMappinPhase;
	public import const function GetVariant() : gamedataMappinVariant;
}

importonly final class QuestsSystem extends questIQuestsSystem
{
	public import function GetFact( factName : CName ) : Int32;
	public import function GetFactStr( factName : String ) : Int32;
	public import function SetFact( factName : CName, value : Int32 );
	public import function SetFactStr( factName : String, value : Int32 );
	public import function RegisterListener( factName : CName, listener : IScriptable, funcName : CName ) : Uint32;
	public import function UnregisterListener( factName : CName, id : Uint32 );
	public import function RegisterEntity( factName : CName, entityId : EntityID ) : Uint32;
	public import function UnregisterEntity( factName : CName, callbackId : Uint32 );
	public import function GetGameplayTimerData( out seconds : Float, out percent : Float );
}

import function GetFixedEntityIdsFromEntityReference( puppetRef : EntityReference, gameInstance : GameInstance, out outEntityIds : array< EntityID > );
import function GetFixedEntityIdsFromSpawnerEntityID( entityID : EntityID, communityEntryNames : array< CName >, gameInstance : GameInstance, out outEntityIds : array< EntityID > );
import function GetGameObjectsFromSpawnerEntityID( entityID : EntityID, communityEntryNames : array< CName >, gameInstance : GameInstance, out outGameObjects : array< GameObject > );
import function CreateEntityReference( const nodeRefString : ref< String >, communityEntryNames : array< CName > ) : EntityReference;

function GetGameObjectFromEntityReference( const reference : EntityReference, gameInstance : GameInstance, out target : weak< GameObject > ) : Bool
{
	var entityIds : array< EntityID >;
	var nullArrayOfNames : array< CName >;
	if( !( GameInstance.IsValid( gameInstance ) ) )
	{
		return false;
	}
	GetFixedEntityIdsFromEntityReference( reference, gameInstance, entityIds );
	if( entityIds.Size() > 0 )
	{
		target = ( ( GameObject )( GameInstance.FindEntityByID( gameInstance, entityIds[ 0 ] ) ) );
	}
	else
	{
		if( CreateEntityReference( "#player", nullArrayOfNames ) == reference )
		{
			target = GameInstance.GetPlayerSystem( gameInstance ).GetLocalPlayerControlledGameObject();
		}
	}
	if( !( target ) )
	{
		return false;
	}
	return true;
}

