2020-10-17 07:30:36 -07:00
|
|
|
/*
|
2022-07-07 09:10:14 -07:00
|
|
|
* Copyright (c) 2016-2022 Vera Visions LLC.
|
2020-10-17 07:30:36 -07:00
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
|
|
|
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
2022-07-07 09:10:14 -07:00
|
|
|
*/
|
2020-10-17 07:30:36 -07:00
|
|
|
|
|
|
|
/* NPCs are more advanced than regular monsters in that they express emotions
|
|
|
|
* and are able to interact more with the environment */
|
|
|
|
|
2021-10-19 16:18:36 -07:00
|
|
|
#ifdef SERVER
|
2020-10-17 07:30:36 -07:00
|
|
|
#define PLAYER_DETECT_RADIUS 512
|
|
|
|
|
|
|
|
enumflags
|
|
|
|
{
|
|
|
|
MONSTER_USED,
|
|
|
|
MONSTER_FEAR,
|
|
|
|
MONSTER_METPLAYER,
|
|
|
|
MONSTER_CANFOLLOW
|
|
|
|
};
|
2021-10-19 16:18:36 -07:00
|
|
|
#endif
|
2020-10-17 07:30:36 -07:00
|
|
|
|
2021-10-19 16:18:36 -07:00
|
|
|
class NSTalkMonster:NSMonster
|
2020-10-17 07:30:36 -07:00
|
|
|
{
|
2021-10-19 16:18:36 -07:00
|
|
|
#ifdef SERVER
|
2020-10-17 07:30:36 -07:00
|
|
|
/* our NPCs can have a unique pitch to their voice */
|
|
|
|
float m_flPitch;
|
|
|
|
float m_flNextSentence;
|
|
|
|
int m_iFlags;
|
|
|
|
|
|
|
|
entity m_eFollowing;
|
|
|
|
entity m_eFollowingChain;
|
|
|
|
vector m_vecLastUserPos;
|
|
|
|
float m_flChangePath;
|
|
|
|
float m_flTraceTime;
|
|
|
|
|
|
|
|
/* sentences identifiers */
|
|
|
|
string m_talkAnswer; /* random answer to whenever a question is asked */
|
|
|
|
string m_talkAsk; /* asks a random generic question */
|
|
|
|
string m_talkAllyShot; /* asks to not shoot an ally further */
|
|
|
|
string m_talkGreet; /* greet other NPCs */
|
|
|
|
string m_talkIdle; /* idle chatter */
|
2021-03-06 08:43:08 -08:00
|
|
|
string m_talkPanic; /* panic screams */
|
2020-10-17 07:30:36 -07:00
|
|
|
string m_talkHearing; /* what did we just hear? */
|
|
|
|
string m_talkSmelling; /* is something smelling bad? */
|
|
|
|
string m_talkStare; /* when NPC is being stared at */
|
|
|
|
string m_talkSurvived; /* we're near death */
|
|
|
|
string m_talkWounded; /* we've sustained light wounds */
|
|
|
|
|
|
|
|
/* things that NPCs will only say to the player */
|
|
|
|
string m_talkPlayerAsk; /* ask player some question */
|
|
|
|
string m_talkPlayerGreet; /* say hello to the player */
|
|
|
|
string m_talkPlayerIdle; /* idle chatter with the player */
|
|
|
|
string m_talkPlayerWounded1; /* slightly wounded player comment */
|
|
|
|
string m_talkPlayerWounded2; /* a bit worse */
|
|
|
|
string m_talkPlayerWounded3; /* yup, got thus far */
|
|
|
|
string m_talkUnfollow; /* when the player asks us to stop following */
|
|
|
|
string m_talkFollow; /* whenever player asks the NPC to follow */
|
|
|
|
string m_talkStopFollow; /* we have to stop following */
|
2021-10-19 16:18:36 -07:00
|
|
|
#else
|
|
|
|
/* sentence system */
|
|
|
|
float m_flSentenceTime;
|
|
|
|
sound_t *m_pSentenceQue;
|
|
|
|
int m_iSentenceCount;
|
|
|
|
int m_iSentencePos;
|
2022-05-04 10:59:42 -07:00
|
|
|
float m_sndVoiceOffs;
|
|
|
|
bool m_bWasPaused;
|
2021-10-19 16:18:36 -07:00
|
|
|
#endif
|
2020-10-17 07:30:36 -07:00
|
|
|
|
2021-10-19 16:18:36 -07:00
|
|
|
void(void) NSTalkMonster;
|
|
|
|
|
|
|
|
#ifdef SERVER
|
2020-10-17 07:30:36 -07:00
|
|
|
virtual void(string) Speak;
|
|
|
|
virtual void(string) Sentence;
|
|
|
|
virtual void(void) WarnAllies;
|
2021-03-06 08:43:08 -08:00
|
|
|
virtual void(void) StartleAllies;
|
2020-10-17 07:30:36 -07:00
|
|
|
virtual void(void) FollowPlayer;
|
|
|
|
virtual void(void) FollowChain;
|
2022-07-17 20:34:19 -07:00
|
|
|
virtual void(void) RunAI;
|
2020-11-25 01:32:42 -08:00
|
|
|
virtual void(void) OnPlayerUse;
|
2020-10-17 07:30:36 -07:00
|
|
|
virtual void(void) PanicFrame;
|
|
|
|
virtual void(void) Hide;
|
|
|
|
virtual void(void) Respawn;
|
|
|
|
|
|
|
|
/*virtual void(void) TalkAnswer;
|
|
|
|
virtual void(void) TalkAsk;
|
|
|
|
virtual void(void) TalkAllyShot;
|
|
|
|
virtual void(void) TalkGreet;
|
|
|
|
virtual void(void) TalkIdle;
|
|
|
|
virtual void(void) TalkHearing;
|
|
|
|
virtual void(void) TalkSmelling;
|
|
|
|
virtual void(void) TalkStare;
|
|
|
|
virtual void(void) TalkSurvived;
|
|
|
|
virtual void(void) TalkWounded;*/
|
2021-03-06 08:43:08 -08:00
|
|
|
virtual void(void) TalkPanic;
|
2020-10-17 07:30:36 -07:00
|
|
|
virtual void(void) TalkPlayerAsk;
|
|
|
|
virtual void(void) TalkPlayerGreet;
|
|
|
|
virtual void(void) TalkPlayerIdle;
|
|
|
|
virtual void(void) TalkPlayerWounded1;
|
|
|
|
virtual void(void) TalkPlayerWounded2;
|
|
|
|
virtual void(void) TalkPlayerWounded3;
|
|
|
|
virtual void(void) TalkUnfollow;
|
|
|
|
virtual void(void) TalkFollow;
|
|
|
|
virtual void(void) TalkStopFollow;
|
|
|
|
virtual void(string, string) SpawnKey;
|
2021-10-19 16:18:36 -07:00
|
|
|
virtual float(entity, float) SendEntity;
|
2021-10-22 11:51:51 -07:00
|
|
|
virtual void(float) Save;
|
|
|
|
virtual void(string,string) Restore;
|
2021-10-19 16:18:36 -07:00
|
|
|
#else
|
|
|
|
|
|
|
|
virtual float(void) predraw;
|
|
|
|
virtual void(string) SentenceSample;
|
|
|
|
virtual void(string) Sentence;
|
|
|
|
virtual void(void) ProcessWordQue;
|
2022-01-21 12:24:25 -08:00
|
|
|
virtual void(float,float) ReceiveEntity;
|
2021-10-19 16:18:36 -07:00
|
|
|
#endif
|
2020-10-17 07:30:36 -07:00
|
|
|
};
|