/////////////////////////////////////////////////////////////////////
| 3113 | |
| 3114 | ////////////////////////////////////////////////////////////////////////// |
| 3115 | int CScriptObjectEntity::SelectPipe(IFunctionHandler *pH) |
| 3116 | { |
| 3117 | // CHECK_PARAMETERS(2); |
| 3118 | |
| 3119 | int iIdentifier; |
| 3120 | int nID=0; |
| 3121 | const char *pName; |
| 3122 | const char *pTargetName=0; |
| 3123 | |
| 3124 | pH->GetParam(1,iIdentifier); |
| 3125 | pH->GetParam(2,pName); |
| 3126 | |
| 3127 | if (pH->GetParamCount() > 2) |
| 3128 | { |
| 3129 | if (pH->GetParamType(3) == svtNumber) |
| 3130 | pH->GetParam(3,nID); |
| 3131 | else |
| 3132 | pH->GetParam(3,pTargetName); |
| 3133 | } |
| 3134 | |
| 3135 | IAIObject *pTargetAI=0; |
| 3136 | if (nID) |
| 3137 | { |
| 3138 | IEntity *pTarget = m_pEntitySystem->GetEntity(nID); |
| 3139 | if (pTarget) |
| 3140 | pTargetAI = pTarget->GetAI(); |
| 3141 | } |
| 3142 | else if (pTargetName) |
| 3143 | { |
| 3144 | pTargetAI = m_pISystem->GetAISystem()->GetAIObjectByName(0,pTargetName); |
| 3145 | } |
| 3146 | |
| 3147 | IAIObject *pObject = m_pEntity->GetAI(); |
| 3148 | |
| 3149 | IPipeUser *pPipeUser; |
| 3150 | bool res = false; |
| 3151 | if (pObject) |
| 3152 | if (pObject->CanBeConvertedTo(AIOBJECT_PIPEUSER,(void**) &pPipeUser)) |
| 3153 | { |
| 3154 | if (pTargetAI) |
| 3155 | res = pPipeUser->SelectPipe(iIdentifier,pName,pTargetAI); |
| 3156 | else |
| 3157 | res = pPipeUser->SelectPipe(iIdentifier,pName); |
| 3158 | } |
| 3159 | |
| 3160 | |
| 3161 | if (!res) |
| 3162 | m_pISystem->Warning( VALIDATOR_MODULE_SYSTEM,VALIDATOR_WARNING,VALIDATOR_FLAG_AI,0,"[AIWARNING] Entity %s failed to select goal pipe %s",m_pEntity->GetName(),pName); |
| 3163 | |
| 3164 | |
| 3165 | return pH->EndFunction(); |
| 3166 | } |
| 3167 | |
| 3168 | |
| 3169 | int CScriptObjectEntity::InsertSubpipe(IFunctionHandler * pH) |
nothing calls this directly
no test coverage detected