DEFINE_ACTION_FUNCTION(AActor, A_SerpentCheckForAttack)
{
    if (!self->target)
    {
        return;
    }
    if (self->MissileState != NULL)
    {
        if (!self->CheckMeleeRange ())
        {
            self->SetState (self->FindState ("Attack"));
            return;
        }
    }
    if (P_CheckMeleeRange2 (self))
    {
        self->SetState (self->FindState ("Walk"));
    }
    else if (self->CheckMeleeRange ())
    {
        if (pr_serpentattack() < 32)
        {
            self->SetState (self->FindState ("Walk"));
        }
        else
        {
            self->SetState (self->FindState ("Attack"));
        }
    }
}
Exemple #2
0
DEFINE_ACTION_FUNCTION(AActor, A_SerpentCheckForAttack)
{
	// [BB] This is server-side.
	if (( NETWORK_GetState( ) == NETSTATE_CLIENT ) ||
		( CLIENTDEMO_IsPlaying( )))
	{
		return;
	}

	if (!self->target)
	{
		return;
	}
	if (self->MissileState != NULL)
	{
		if (!self->CheckMeleeRange ())
		{
			// [BB] If we're the server, set the thing's state.
			if ( NETWORK_GetState( ) == NETSTATE_SERVER )
				SERVERCOMMANDS_SetThingFrame( self, self->FindState ("Attack") );

			self->SetState (self->FindState ("Attack"));
			return;
		}
	}
	if (P_CheckMeleeRange2 (self))
	{
		// [BB] If we're the server, set the thing's state.
		if ( NETWORK_GetState( ) == NETSTATE_SERVER )
			SERVERCOMMANDS_SetThingFrame( self, self->FindState ("Walk") );

		self->SetState (self->FindState ("Walk"));
	}
	else if (self->CheckMeleeRange ())
	{
		if (pr_serpentattack() < 32)
		{
			// [BB] If we're the server, set the thing's state.
			if ( NETWORK_GetState( ) == NETSTATE_SERVER )
				SERVERCOMMANDS_SetThingFrame( self, self->FindState ("Walk") );

			self->SetState (self->FindState ("Walk"));
		}
		else
		{
			// [BB] If we're the server, set the thing's state.
			if ( NETWORK_GetState( ) == NETSTATE_SERVER )
				SERVERCOMMANDS_SetThingFrame( self, self->FindState ("Attack") );

			self->SetState (self->FindState ("Attack"));
		}
	}
}