Compare commits

..

No commits in common. "38221b86e656c17828d7288ab46aba653aea2c85" and "8e13206e26cd8322e5b063e780fece34d84ef754" have entirely different histories.

2 changed files with 140 additions and 103 deletions

View File

@ -14,7 +14,7 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*QUAKED SHScientist (0 0.8 0.8) (-16 -16 0) (16 16 72)
/*QUAKED monster_scientist (0 0.8 0.8) (-16 -16 0) (16 16 72)
HALF-LIFE (1998) ENTITY
@ -69,9 +69,9 @@ enum
SCIA_DEADTABLE3
};
class SHScientist:NSTalkMonster
class monster_scientist:NSTalkMonster
{
void(void) SHScientist;
void(void) monster_scientist;
/* override */
virtual void(void) SeeThink;
@ -80,22 +80,28 @@ class SHScientist:NSTalkMonster
virtual float(void) GetRunSpeed;
virtual void(void) PanicFrame;
virtual void(void) Spawned;
virtual void(void) Respawn;
virtual void(void) Pain;
virtual void(void) Death;
virtual void(void) PlayerUse;
virtual void(void) TalkPanic;
virtual int(void) AnimIdle;
virtual int(void) AnimWalk;
virtual int(void) AnimRun;
virtual int(void) AttackMelee;
virtual void(void) AttackNeedle;
virtual void(void) FallNoise;
virtual void(string, string) SpawnKey;
};
/* Players scare scientists if they see them in Stealth Hunting */
void
SHScientist::SeeThink(void)
monster_scientist::SeeThink(void)
{
/* let's call the original monster SeeThink function */
super::SeeThink();
@ -120,28 +126,28 @@ SHScientist::SeeThink(void)
/* scientist's speed is controlled via cvar */
void
SHScientist::PanicFrame(void)
monster_scientist::PanicFrame(void)
{
super::PanicFrame();
input_movevalues = [6 * cvar("sh_scispeed"), 0, 0];
}
float
SHScientist::GetWalkSpeed(void)
monster_scientist::GetWalkSpeed(void)
{
super::GetWalkSpeed();
return 1.6 * cvar("sh_scispeed");
}
float
SHScientist::GetChaseSpeed(void)
monster_scientist::GetChaseSpeed(void)
{
super:: GetChaseSpeed();
return 6 * cvar("sh_scispeed");
}
float
SHScientist::GetRunSpeed(void)
monster_scientist::GetRunSpeed(void)
{
super::GetRunSpeed();
return 3.5 * cvar("sh_scispeed");
@ -149,13 +155,13 @@ SHScientist::GetRunSpeed(void)
void
SHScientist::FallNoise(void)
monster_scientist::FallNoise(void)
{
Sound_Speak(this, "monster_scientist.fall");
}
int
SHScientist::AttackMelee(void)
monster_scientist::AttackMelee(void)
{
/* visual */
AnimPlay(61);
@ -186,7 +192,7 @@ SHScientist::AttackMelee(void)
/* a function for poison that slowly kills the target */
static void
SHScientist_NeedleAttack(entity target)
monster_scientist_NeedleAttack(entity target)
{
bool isDead = false;
bool isHealed = false;
@ -223,11 +229,11 @@ SHScientist_NeedleAttack(entity target)
}
void
SHScientist::AttackNeedle(void)
monster_scientist::AttackNeedle(void)
{
/* implement our special function so we know who are we attacking */
static void AttackNeedle_PoisonDamage(void) {
SHScientist_NeedleAttack(self);
monster_scientist_NeedleAttack(self);
}
/* look for our victim */
@ -250,12 +256,31 @@ SHScientist::AttackNeedle(void)
trace_ent.poisonTimer = trace_ent.poisonTimer.ScheduleTimer(trace_ent, AttackNeedle_PoisonDamage, 3.0f, true);
/* apply our poison attack to the victim */
SHScientist_NeedleAttack(trace_ent);
monster_scientist_NeedleAttack(trace_ent);
}
}
/* TODO someday these will use the ACT system */
int
monster_scientist::AnimIdle(void)
{
return SCIA_IDLE1;
}
int
monster_scientist::AnimWalk(void)
{
return SCIA_WALK;
}
int
monster_scientist::AnimRun(void)
{
return SCIA_RUN;
}
void
SHScientist::TalkPanic(void)
monster_scientist::TalkPanic(void)
{
/* it's annoying and prevents the laugh in these gamemodes */
if (g_chosen_mode == SHMODE_MADNESS || g_chosen_mode == SHMODE_INVASION)
@ -320,9 +345,9 @@ SHScientist::TalkPanic(void)
}
void
SHScientist::PlayerUse(void)
monster_scientist::PlayerUse(void)
{
if (spawnflags & MSF_RESERVED3) {
if (spawnflags & MSF_PREDISASTER) {
Sentence("!SC_POK");
return;
}
@ -336,7 +361,7 @@ SHScientist::PlayerUse(void)
}
void
SHScientist::Pain(void)
monster_scientist::Pain(void)
{
/* make everyone on edge */
WarnAllies();
@ -345,6 +370,10 @@ SHScientist::Pain(void)
return;
}
if (random() < 0.25f) {
return;
}
if (IsAlive() == true) {
Sound_Speak(this, "monster_scientist.pain");
SetFrame(SCIA_FLINCH + floor(random(0, 6)));
@ -354,7 +383,7 @@ SHScientist::Pain(void)
}
void
SHScientist::Death(void)
monster_scientist::Death(void)
{
bool deathcheck = false;
HLGameRules rules = (HLGameRules)g_grMode;
@ -368,7 +397,7 @@ SHScientist::Death(void)
rules.ScientistKill((player)g_dmg_eAttacker, (entity)this);
Plugin_PlayerObituary(g_dmg_eAttacker, this, g_dmg_iWeapon, g_dmg_iHitBody, g_dmg_iDamage);
Sound_Speak(this, "SHScientist.die");
Sound_Speak(this, "monster_scientist.die");
deathcheck = true;
}
@ -388,7 +417,7 @@ SHScientist::Death(void)
}
void
SHScientist::Respawn(void)
monster_scientist::Respawn(void)
{
HLGameRules rules = (HLGameRules)g_grMode;
@ -418,9 +447,7 @@ SHScientist::Respawn(void)
m_iFlags |= MONSTER_FEAR;
}
if ((cvar("sh_scirand") == 1) || (m_iBody == 0)) {
m_iBody = floor(random(1,5));
}
m_iBody = floor(random(1,5));
SetSkin(0);
@ -428,23 +455,19 @@ SHScientist::Respawn(void)
case 1:
m_flPitch = 105;
netname = "Walter";
SetBodyInGroup(1, 1);
break;
case 2:
m_flPitch = 100;
netname = "Einstein";
SetBodyInGroup(1, 2);
break;
case 3:
m_flPitch = 95;
netname = "Luther";
SetBodyInGroup(1, 3);
SetSkin(1);
break;
default:
m_flPitch = 100;
netname = "Slick";
SetBodyInGroup(1, 4);
}
/* recount to update sciscore and so on */
@ -452,7 +475,95 @@ SHScientist::Respawn(void)
}
void
SHScientist::SHScientist(void)
monster_scientist::SpawnKey(string strKey, string strValue)
{
switch (strKey) {
case "body":
SetBody(stoi(strValue) + 1);
break;
default:
super::SpawnKey(strKey, strValue);
}
}
void
monster_scientist::Spawned(void)
{
if (spawnflags & MSF_PREDISASTER) {
m_talkAsk = "";
m_talkPlayerAsk = "!SC_PQUEST";
m_talkPlayerGreet = "!SC_PHELLO";
m_talkPlayerIdle = "!SC_PIDLE";
} else {
m_talkAsk = "!SC_QUESTION";
m_talkPlayerAsk = "!SC_QUESTION";
m_talkPlayerGreet = "!SC_HELLO";
m_talkPlayerIdle = "!SC_PIDLE";
}
m_talkAnswer = "!SC_ANSWER";
m_talkAllyShot = "!SC_PLFEAR";
m_talkGreet = "!SC_HELLO";
m_talkIdle = "!SC_IDLE";
m_talkHearing = "!SC_HEAR";
m_talkSmelling = "!SC_SMELL";
m_talkStare = "!SC_STARE";
m_talkSurvived = "!SC_WOUND";
m_talkWounded = "!SC_MORTAL";
/* they seem to use predisaster lines regardless of disaster state */
m_talkPlayerWounded1 = "!SC_CUREA";
m_talkPlayerWounded2 = "!SC_CUREB";
m_talkPlayerWounded3 = "!SC_CUREC";
m_talkUnfollow = "!SC_WAIT";
m_talkFollow = "!SC_OK";
m_talkStopFollow = "!SC_STOP";
if (cvar("sh_scirand") == 1) {
m_iBody = -1;
} else {
m_iBody = "";
}
model = "models/scientist.mdl";
base_mins = [-16,-16,0];
base_maxs = [16,16,72];
base_health = Skill_GetValue("scientist_health", 20);
super::Spawned();
Sound_Precache("monster_scientist.die");
Sound_Precache("monster_scientist.pain");
Sound_Precache("monster_scientist.laugh");
Sound_Precache("monster_scientist.fall");
/* has the body not been overriden, etc. choose a character for us */
if (m_iBody == -1) {
SetBody((int)floor(random(1,5)));
}
switch (m_iBody) {
case 1:
m_flPitch = 105;
netname = "Walter";
break;
case 2:
m_flPitch = 100;
netname = "Einstein";
break;
case 3:
m_flPitch = 95;
netname = "Luther";
SetSkin(1);
break;
default:
m_flPitch = 100;
netname = "Slick";
}
}
void
monster_scientist::monster_scientist(void)
{
}

View File

@ -1,74 +0,0 @@
entityDef monster_scientist
{
"spawnclass" "SHScientist"
"model" "models/scientist.mdl"
"netname" "Scientist"
"health" "skill:scientist_health"
"mins" "-16 -16 0"
"maxs" "16 16 72"
"eye_height" "64"
"team" "0"
"propdata" "actor_human"
"follow_on_use" "1"
"speed_walk" "64"
"speed_run" "364"
"snd_pain" "monster_scientist.pain"
"snd_death" "monster_scientist.die"
"snd_thud" "monster_scientist.thud"
"talk_answer" "!SC_ANSWER"
"talk_ask" "!SC_QUESTION"
"talk_ally_shoot" "!SC_PLFEAR"
"talk_idle" "!SC_IDLE"
"talk_hearing" "!SC_HEAR"
"talk_smelling" "!SC_SMELL"
"talk_stare" "!SC_STARE"
"talk_survived" "!SC_WOUND"
"talk_wounded" "!SC_MORTAL"
"talk_player_ask" "!SC_QUESTION"
"talk_player_greet" "!SC_HELLO"
"talk_player_idle" "!SC_PIDLE"
"talk_player_wounded1" "!SC_CUREA"
"talk_player_wounded2" "!SC_CUREB"
"talk_player_wounded3" "!SC_CUREC"
"talk_unfollow" "!SC_WAIT"
"talk_follow" "!SC_OK"
"talk_stop_follow" "!SC_STOP"
"talk_deny_follow" "!SC_POK"
when "body" equals "1" {
"pitch" "105"
"netname" "Walter"
"body1" "1"
}
when "body" equals "2" {
"pitch" "100"
"netname" "Einstein"
"body1" "2"
}
when "body" equals "3" {
"pitch" "95"
"netname" "Luther"
"skin" "1"
"body1" "3"
}
when "body" equals "4" {
"pitch" "105"
"netname" "Slick"
"body1" "4"
}
// pre-disaster
when "spawnflags" equals "256" {
"talk_ask" ""
"talk_player_ask" "!SC_PQUEST"
"talk_player_greet" "!SC_PHELLO"
"talk_player_idle" "!SC_PIDLE"
"follow_on_use" "0"
}
}