Nial
07-09-2007, 08:11 AM
I'm trying to create a logic entity that will coordinate my MP mod game. I have a number of questions, so here goes:
My coordinator entity works like so:
DEFINE_INPUTFUNC( FIELD_INTEGER, "Set_Door_Status", SetDoorStatus ),
DEFINE_OUTPUT( m_bDoorState, "Door_State" ),
void CNbN_GameCoordinator::SetDoorStatus( inputdata_t &inputData )
{
switch( inputData.value.Int() )
{
case 0:
m_bDoorState.FireOutput( inputData.pActivator, this );
break;
}
}
The idea here is that a mapper could then create a trigger which would toggle the door state. The trigger would be linked to the GameCoordinator and fire an Output to it. The GameCoordinator receives it, checks its value and acts accordingly, sending out an Output to every other entity that's been linked to it.
Is my code and logic correct here? If so, I have the following question:
1) Is it possible to spawn such a logic entity in code (rather than forcing a mapper to place it) and still have other entities within the map communicate with it via inputs?
My coordinator entity works like so:
DEFINE_INPUTFUNC( FIELD_INTEGER, "Set_Door_Status", SetDoorStatus ),
DEFINE_OUTPUT( m_bDoorState, "Door_State" ),
void CNbN_GameCoordinator::SetDoorStatus( inputdata_t &inputData )
{
switch( inputData.value.Int() )
{
case 0:
m_bDoorState.FireOutput( inputData.pActivator, this );
break;
}
}
The idea here is that a mapper could then create a trigger which would toggle the door state. The trigger would be linked to the GameCoordinator and fire an Output to it. The GameCoordinator receives it, checks its value and acts accordingly, sending out an Output to every other entity that's been linked to it.
Is my code and logic correct here? If so, I have the following question:
1) Is it possible to spawn such a logic entity in code (rather than forcing a mapper to place it) and still have other entities within the map communicate with it via inputs?