| 613 | extern qboolean G_CallSpawn( gentity_t *ent ); |
| 614 | |
| 615 | void UserSpawn( gentity_t *ent, const char *name ) |
| 616 | { |
| 617 | vec3_t origin; |
| 618 | vec3_t vf; |
| 619 | vec3_t angles; |
| 620 | gentity_t *ent2; |
| 621 | |
| 622 | //Spawn the ent |
| 623 | ent2 = G_Spawn(); |
| 624 | ent2->classname = G_NewString( name ); |
| 625 | |
| 626 | //TODO: This should ultimately make sure this is a safe spawn! |
| 627 | |
| 628 | //Spawn the entity and place it there |
| 629 | VectorSet( angles, 0, ent->s.apos.trBase[YAW], 0 ); |
| 630 | AngleVectors( angles, vf, NULL, NULL ); |
| 631 | VectorMA( ent->s.pos.trBase, 96, vf, origin ); //FIXME: Find the radius size of the object, and push out 32 + radius |
| 632 | |
| 633 | origin[2] += 8; |
| 634 | VectorCopy( origin, ent2->s.pos.trBase ); |
| 635 | VectorCopy( origin, ent2->s.origin ); |
| 636 | VectorCopy( ent->s.apos.trBase, ent2->s.angles ); |
| 637 | |
| 638 | gi.linkentity( ent2 ); |
| 639 | |
| 640 | //Find a valid spawning spot |
| 641 | if ( G_CallSpawn( ent2 ) == qfalse ) |
| 642 | { |
| 643 | gi.SendServerCommand( ent-g_entities, "print \"Failed to spawn '%s'\n\"", name ); |
| 644 | G_FreeEntity( ent2 ); |
| 645 | return; |
| 646 | } |
| 647 | } |
| 648 | |
| 649 | /* |
| 650 | ------------------------- |
no test coverage detected