DEFINE_ACTION_FUNCTION(AActor, A_InquisitorDecide) { // [BC] This is handled server-side. if ( NETWORK_InClientMode() ) { return; } if (self->target == NULL) return; A_FaceTarget (self); if (!InquisitorCheckDistance (self)) { // [BC] Set the thing's state. if ( NETWORK_GetState( ) == NETSTATE_SERVER ) SERVERCOMMANDS_SetThingFrame( self, self->FindState("Grenade") ); self->SetState (self->FindState("Grenade")); } if (self->target->z != self->z) { if (self->z + self->height + 54*FRACUNIT < self->ceilingz) { // [BC] Set the thing's state. if ( NETWORK_GetState( ) == NETSTATE_SERVER ) SERVERCOMMANDS_SetThingFrame( self, self->FindState("Jump") ); self->SetState (self->FindState("Jump")); } } }
DEFINE_ACTION_FUNCTION(AActor, A_M_SawRefire) { // [BC] Let the server do this. if (( NETWORK_GetState( ) == NETSTATE_CLIENT ) || ( CLIENTDEMO_IsPlaying( ))) { return; } if (self->target == NULL || self->target->health <= 0) { // [BC] Update the thing's state. if ( NETWORK_GetState( ) == NETSTATE_SERVER ) SERVERCOMMANDS_SetThingFrame( self, self->state + 1 ); self->SetState (self->state + 1); return; } if (!self->CheckMeleeRange ()) { // [BC] Update the thing's state. if ( NETWORK_GetState( ) == NETSTATE_SERVER ) SERVERCOMMANDS_SetThingFrame( self, self->state + 1 ); self->SetState (self->state + 1); } }
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")); } } }
DEFINE_ACTION_FUNCTION(AActor, A_SerpentHumpDecide) { // [BB] This is server-side. if (( NETWORK_GetState( ) == NETSTATE_CLIENT ) || ( CLIENTDEMO_IsPlaying( ))) { return; } if (self->MissileState != NULL) { if (pr_serpenthump() > 30) { return; } else if (pr_serpenthump() < 40) { // Missile attack // [BB] If we're the server, set the thing's state. if ( NETWORK_GetState( ) == NETSTATE_SERVER ) SERVERCOMMANDS_SetThingState( self, STATE_MELEE ); self->SetState (self->MeleeState); return; } } else if (pr_serpenthump() > 3) { return; } if (!self->CheckMeleeRange ()) { // The hump shouldn't occur when within melee range if (self->MissileState != NULL && pr_serpenthump() < 128) { // [BB] If we're the server, set the thing's state. if ( NETWORK_GetState( ) == NETSTATE_SERVER ) SERVERCOMMANDS_SetThingState( self, STATE_MELEE ); self->SetState (self->MeleeState); } else { // [BB] If we're the server, set the thing's state and play the sound. if ( NETWORK_GetState( ) == NETSTATE_SERVER ) { SERVERCOMMANDS_SetThingFrame( self, self->FindState ("Hump") ); SERVERCOMMANDS_SoundActor( self, CHAN_BODY, "SerpentActive", 1, ATTN_NORM ); } self->SetState (self->FindState ("Hump")); S_Sound (self, CHAN_BODY, "SerpentActive", 1, ATTN_NORM); } } }
DEFINE_ACTION_FUNCTION(AActor, A_M_Refire) { // [BC] Let the server do this. if (( NETWORK_GetState( ) == NETSTATE_CLIENT ) || ( CLIENTDEMO_IsPlaying( ))) { return; } if (self->target == NULL || self->target->health <= 0) { if (self->MissileState && pr_m_refire() < 160) { // Look for a new target most of the time if (P_LookForPlayers (self, true) && P_CheckMissileRange (self)) { // Found somebody new and in range, so don't stop shooting return; } } // [BC] Update the thing's state. if ( NETWORK_GetState( ) == NETSTATE_SERVER ) SERVERCOMMANDS_SetThingFrame( self, self->state + 1 ); self->SetState (self->state + 1); return; } if ((self->MissileState == NULL && !self->CheckMeleeRange ()) || !P_CheckSight (self, self->target) || pr_m_refire() < 4) // Small chance of stopping even when target not dead { // [BC] Update the thing's state. if ( NETWORK_GetState( ) == NETSTATE_SERVER ) SERVERCOMMANDS_SetThingFrame( self, self->state + 1 ); self->SetState (self->state + 1); } }
DEFINE_ACTION_FUNCTION(AActor, A_BishopDecide) { // [BB] This is server-side. if (( NETWORK_GetState( ) == NETSTATE_CLIENT ) || ( CLIENTDEMO_IsPlaying( ))) { return; } if (pr_decide() < 220) { return; } else { // [BB] If we're the server, tell the clients to update this thing's state. if ( ( NETWORK_GetState( ) == NETSTATE_SERVER ) ) SERVERCOMMANDS_SetThingFrame( self, self->FindState ("Blur") ); self->SetState (self->FindState ("Blur")); } }
DEFINE_ACTION_FUNCTION(AActor, A_BishopPainBlur) { AActor *mo; // [BB] This is server-side. if (( NETWORK_GetState( ) == NETSTATE_CLIENT ) || ( CLIENTDEMO_IsPlaying( ))) { return; } if (pr_pain() < 64) { // [BB] If we're the server, tell the clients to update this thing's state. if ( ( NETWORK_GetState( ) == NETSTATE_SERVER ) ) SERVERCOMMANDS_SetThingFrame( self, self->FindState ("Blur") ); self->SetState (self->FindState ("Blur")); return; } fixed_t x = self->x + (pr_pain.Random2()<<12); fixed_t y = self->y + (pr_pain.Random2()<<12); fixed_t z = self->z + (pr_pain.Random2()<<11); mo = Spawn ("BishopPainBlur", x, y, z, ALLOW_REPLACE); if (mo) { mo->angle = self->angle; // [BB] If we're the server, tell the clients to spawn the thing and set its angle. if ( NETWORK_GetState( ) == NETSTATE_SERVER ) { SERVERCOMMANDS_SpawnThing( mo ); SERVERCOMMANDS_SetThingAngle( mo ); } } }