MCPcopy Create free account
hub / github.com/JACoders/OpenJK / scriptrunner_run

Function scriptrunner_run

code/game/g_target.cpp:722–796  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

720
721int numNewICARUSEnts = 0;
722void scriptrunner_run (gentity_t *self)
723{
724 /*
725 if (self->behaviorSet[BSET_USE])
726 {
727 char newname[MAX_FILENAME_LENGTH];
728
729 sprintf((char *) &newname, "%s/%s", Q3_SCRIPT_DIR, self->behaviorSet[BSET_USE] );
730
731 ICARUS_RunScript( self, newname );
732 }
733 */
734
735 if ( self->count != -1 )
736 {
737 if ( self->count <= 0 )
738 {
739 self->e_UseFunc = useF_NULL;
740 self->behaviorSet[BSET_USE] = NULL;
741 return;
742 }
743 else
744 {
745 --self->count;
746 }
747 }
748
749 if (self->behaviorSet[BSET_USE])
750 {
751 if ( self->spawnflags & 1 )
752 {
753 if ( !self->activator )
754 {
755 Quake3Game()->DebugPrint( IGameInterface::WL_ERROR, "target_scriptrunner tried to run on invalid entity!\n");
756 return;
757 }
758
759 if ( self->activator->m_iIcarusID == IIcarusInterface::ICARUS_INVALID )
760 {//Need to be initialized through ICARUS
761 if ( !self->activator->script_targetname || !self->activator->script_targetname[0] )
762 {
763 //We don't have a script_targetname, so create a new one
764 self->activator->script_targetname = va( "newICARUSEnt%d", numNewICARUSEnts++ );
765 }
766
767 if ( Quake3Game()->ValidEntity( self->activator ) )
768 {
769 Quake3Game()->InitEntity( self->activator );
770 }
771 else
772 {
773 Quake3Game()->DebugPrint( IGameInterface::WL_ERROR, "target_scriptrunner tried to run on invalid ICARUS activator!\n");
774 return;
775 }
776 }
777
778 Quake3Game()->DebugPrint( IGameInterface::WL_VERBOSE, "target_scriptrunner running %s on activator %s\n", self->behaviorSet[BSET_USE], self->activator->targetname );
779

Callers 1

target_scriptrunner_useFunction · 0.70

Calls 7

Quake3GameFunction · 0.85
DebugPrintMethod · 0.80
ValidEntityMethod · 0.80
InitEntityMethod · 0.80
RunScriptMethod · 0.80
G_ActivateBehaviorFunction · 0.70
vaFunction · 0.50

Tested by

no test coverage detected