/* =================== G_ScriptAction_TagConnect syntax: attachtotag <targetname/scriptname> <tagname> connect this entity onto the tag of another entity =================== */ qboolean G_ScriptAction_TagConnect( gentity_t *ent, char *params ) { char *pString, *token; gentity_t *parent; pString = params; token = COM_Parse( &pString ); if ( !token[0] ) { G_Error( "G_ScriptAction_TagConnect: syntax: attachtotag <targetname> <tagname>\n" ); } parent = G_Find( NULL, FOFS( targetname ), token ); if ( !parent ) { parent = G_Find( NULL, FOFS( scriptName ), token ); if ( !parent ) { G_Error( "G_ScriptAction_TagConnect: unable to find entity with targetname \"%s\"", token ); } } token = COM_Parse( &pString ); if ( !token[0] ) { G_Error( "G_ScriptAction_TagConnect: syntax: attachtotag <targetname> <tagname>\n" ); } ent->tagParent = parent; ent->tagName = G_Alloc( strlen( token ) + 1 ); Q_strncpyz( ent->tagName, token, strlen( token ) + 1 ); G_ProcessTagConnect( ent, qtrue ); return qtrue; }
/* =================== G_ScriptAction_TagConnect syntax: attachtotag <targetname/scriptname> <tagname> connect this entity onto the tag of another entity =================== */ qboolean G_ScriptAction_TagConnect( gentity_t *ent, char *params ) { char *pString, *token; gentity_t *parent; pString = params; token = COM_Parse(&pString); if (!token[0]) { G_Error( "G_ScriptAction_TagConnect: syntax: attachtotag <targetname> <tagname>\n" ); } parent = G_Find( NULL, FOFS(targetname), token ); if (!parent) { parent = G_Find( NULL, FOFS(scriptName), token ); if (!parent) { G_Error( "G_ScriptAction_TagConnect: unable to find entity with targetname \"%s\"", token ); } } token = COM_Parse(&pString); if (!token[0]) { G_Error( "G_ScriptAction_TagConnect: syntax: attachtotag <targetname> <tagname>\n" ); } ent->tagParent = parent; ent->tagName = G_Alloc(strlen(token)+1); Q_strncpyz( ent->tagName, token, strlen(token)+1 ); G_ProcessTagConnect( ent ); // clear out the angles so it always starts out facing the tag direction VectorClear( ent->s.angles ); VectorCopy( ent->s.angles, ent->s.apos.trBase ); ent->s.apos.trTime = level.time; ent->s.apos.trDuration = 0; ent->s.apos.trType = TR_STATIONARY; VectorClear( ent->s.apos.trDelta ); return qtrue; }