Server: Shuffle some code inside the monster files around so that we re-set starting values after all constructors have executed

This commit is contained in:
Marco Cawthorne 2023-02-07 09:08:55 -08:00
parent c8397d2474
commit 22d5b36d1c
Signed by: eukara
GPG key ID: CE2032F0A2882A22
16 changed files with 244 additions and 120 deletions

View file

@ -48,6 +48,7 @@ class monster_barney:NSTalkMonster
{
void(void) monster_barney;
virtual void(void) Spawned;
virtual void(void) Respawn;
virtual void(void) OnPlayerUse;
virtual void(void) Pain;
@ -188,7 +189,7 @@ monster_barney::Respawn(void)
}
void
monster_barney::monster_barney(void)
monster_barney::Spawned(void)
{
Sound_Precache("monster_barney.die");
Sound_Precache("monster_barney.pain");
@ -223,4 +224,12 @@ monster_barney::monster_barney(void)
base_mins = [-16,-16,0];
base_maxs = [16,16,72];
m_iAlliance = MAL_FRIEND;
super::Spawned();
}
void
monster_barney::monster_barney(void)
{
}

View file

@ -63,18 +63,50 @@ class monster_houndeye:NSMonster
{
float m_flIdleTime;
void(void) monster_houndeye;
void monster_houndeye(void);
virtual void(void) Spawned;
virtual void(void) Pain;
virtual void(void) Death;
virtual void(void) IdleNoise;
virtual void(void) Respawn;
virtual void Spawned(void);
virtual void Pain(void);
virtual void Death(void);
virtual void IdleNoise(void);
virtual void Respawn(void);
virtual int(void) AttackMelee;
virtual void(void) AttackBlast;
virtual int AnimIdle(void);
virtual int AnimWalk(void);
virtual int AnimRun(void);
virtual int AttackMelee(void);
virtual void AttackBlast(void);
virtual float MeleeMaxDistance(void);
};
/* The maximum distance to which we should attempt an attack */
float
monster_houndeye::MeleeMaxDistance(void)
{
return HE_BLAST_RADIUS/2;
}
int
monster_houndeye::AnimIdle(void)
{
return HE_IDLE;
}
int
monster_houndeye::AnimWalk(void)
{
return HE_WALK2;
}
int
monster_houndeye::AnimRun(void)
{
return HE_RUN;
}
int
monster_houndeye::AttackMelee(void)
{
@ -187,6 +219,12 @@ monster_houndeye::Respawn(void)
void
monster_houndeye::Spawned(void)
{
netname = "Houndeye";
model = "models/houndeye.mdl";
base_health = Skill_GetValue("houndeye_health", 20);
base_mins = [-16,-16,0];
base_maxs = [16,16,36];
m_iAlliance = MAL_ALIEN;
super::Spawned();
Sound_Precache("monster_houndeye.alert");
@ -200,10 +238,4 @@ monster_houndeye::Spawned(void)
void
monster_houndeye::monster_houndeye(void)
{
netname = "Houndeye";
model = "models/houndeye.mdl";
base_health = Skill_GetValue("houndeye_health", 20);
base_mins = [-16,-16,0];
base_maxs = [16,16,36];
m_iAlliance = MAL_ALIEN;
}

View file

@ -51,8 +51,14 @@ class monster_human_assassin:NSMonster
virtual void(void) Death;
virtual void(void) Respawn;
virtual void Spawned(void);
};
void
monster_human_assassin::monster_human_assassin(void)
{
}
void
monster_human_assassin::Death(void)
{
@ -75,19 +81,22 @@ monster_human_assassin::Death(void)
super::Death();
}
void
monster_human_assassin::Respawn(void)
{
super::Respawn();
frame = HAS_IDLE;
}
void
monster_human_assassin::monster_human_assassin(void)
monster_human_assassin::Spawned(void)
{
netname = "Assassin";
model = "models/hassassin.mdl";
base_health = Skill_GetValue("hassassin_health", 50);
base_mins = [-16,-16,0];
base_maxs = [16,16,72];
m_iAlliance = MAL_ENEMY;
super::Spawned();
}
void
monster_human_assassin::Respawn(void)
{
super::Respawn();
frame = HAS_IDLE;
}

View file

@ -113,23 +113,26 @@ class monster_human_grunt:NSTalkMonster
{
float m_flIdleTime;
int m_iMP5Burst;
float m_flAlertNoiseTime;
void(void) monster_human_grunt;
virtual void(void) Scream;
virtual void(void) IdleChat;
virtual void(void) Respawn;
virtual void(void) Spawned;
virtual void(void) Pain;
virtual void(void) Death;
void monster_human_grunt(void);
virtual int(void) AnimIdle;
virtual int(void) AnimWalk;
virtual int(void) AnimRun;
virtual void Scream(void);
virtual void IdleChat(void);
virtual void Respawn(void);
virtual void Spawned(void);
virtual void Pain(void);
virtual void Death(void);
virtual int(void) AttackRanged;
virtual int(void) AttackMelee;
virtual void(void) AttackKick;
virtual int AnimIdle(void);
virtual int AnimWalk(void);
virtual int AnimRun(void);
virtual int AttackRanged(void);
virtual int AttackMelee(void);
virtual void AttackKick(void);
virtual void AlertNoise(void);
};
@ -151,6 +154,15 @@ monster_human_grunt::AnimRun(void)
return GR_RUN;
}
void
monster_human_grunt::AlertNoise(void)
{
if (m_flAlertNoiseTime > time)
return;
Sentence("!HG_CHECK");
m_flAlertNoiseTime = time + 15.0f;
}
int
monster_human_grunt::AttackMelee(void)
{
@ -196,7 +208,6 @@ monster_human_grunt::AttackRanged(void)
}
/* functional */
v_angle = vectoangles(m_eEnemy.origin - origin);
TraceAttack_FireBullets(1, origin + [0,0,16], 8, [0.01,0.01], 2);
return (1);
}
@ -278,14 +289,6 @@ monster_human_grunt::Respawn(void)
void
monster_human_grunt::Spawned(void)
{
super::Spawned();
Sound_Precache("monster_human_grunt.die");
Sound_Precache("monster_human_grunt.pain");
}
void monster_human_grunt::monster_human_grunt(void)
{
/* Adding some into other slots in hopes it feels right
* listed below are other setences that might need their own:
@ -320,4 +323,12 @@ void monster_human_grunt::monster_human_grunt(void)
base_mins = [-16,-16,0];
base_maxs = [16,16,72];
m_iAlliance = MAL_ENEMY;
super::Spawned();
Sound_Precache("monster_human_grunt.die");
Sound_Precache("monster_human_grunt.pain");
}
void monster_human_grunt::monster_human_grunt(void)
{
}

View file

@ -125,6 +125,10 @@ monster_ichthyosaur::Respawn(void)
void
monster_ichthyosaur::Spawned(void)
{
netname = "Ichthyosaur";
model = "models/icky.mdl";
base_mins = [-32,-32,0];
base_maxs = [32,32,64];
super::Spawned();
Sound_Precache("monster_ichthyosaur.alert");
@ -137,8 +141,4 @@ monster_ichthyosaur::Spawned(void)
void
monster_ichthyosaur::monster_ichthyosaur(void)
{
netname = "Ichthyosaur";
model = "models/icky.mdl";
base_mins = [-32,-32,0];
base_maxs = [32,32,64];
}

View file

@ -76,6 +76,10 @@ monster_leech::Respawn(void)
void
monster_leech::Spawned(void)
{
netname = "Leech";
model = "models/leech.mdl";
base_mins = [-6,-6,0];
base_maxs = [6,6,6];
super::Spawned();
Sound_Precache("monster_leech.alert");
@ -84,8 +88,4 @@ monster_leech::Spawned(void)
void monster_leech::monster_leech(void)
{
netname = "Leech";
model = "models/leech.mdl";
base_mins = [-6,-6,0];
base_maxs = [6,6,6];
}

View file

@ -35,12 +35,21 @@ enum
class monster_miniturret:NSMonster
{
void(void) monster_miniturret;
virtual void Spawned(void);
};
void monster_miniturret::monster_miniturret(void)
{
}
void monster_miniturret::Spawned(void)
{
netname = "Mini-Turret";
model = "models/miniturret.mdl";
base_mins = [-16,-16,-32];
base_maxs = [16,16,32];
super::Spawned();
}

View file

@ -120,6 +120,11 @@ monster_nihilanth::Respawn(void)
void
monster_nihilanth::Spawned(void)
{
netname = "Nihilanth";
model = "models/nihilanth.mdl";
base_health = Skill_GetValue("nihilanth_health", 800);
base_mins = [-192,-192,-32];
base_maxs = [192,192,384];
super::Spawned();
Sound_Precache("monster_nihilanth.attack");
@ -134,9 +139,4 @@ monster_nihilanth::Spawned(void)
void
monster_nihilanth::monster_nihilanth(void)
{
netname = "Nihilanth";
model = "models/nihilanth.mdl";
base_health = Skill_GetValue("nihilanth_health", 800);
base_mins = [-192,-192,-32];
base_maxs = [192,192,384];
}

View file

@ -26,19 +26,27 @@ class monster_osprey:NSMonster
{
void(void) monster_osprey;
virtual void(void) Respawn;
virtual void Spawned(void);
};
void monster_osprey::monster_osprey(void)
{
}
void monster_osprey::Spawned(void)
{
netname = "Osprey";
model = "models/osprey.mdl";
base_mins = [-480,-480,-112];
base_maxs = [480,480,24];
super::Spawned();
}
void monster_osprey::Respawn(void)
{
super::Respawn();
takedamage = DAMAGE_NO;
iBleeds = FALSE;
}
void monster_osprey::monster_osprey(void)
{
netname = "Osprey";
model = "models/osprey.mdl";
base_mins = [-480,-480,-112];
base_maxs = [480,480,24];
}
}

View file

@ -25,6 +25,8 @@ Rat
class monster_rat:NSMonster
{
void(void) monster_rat;
virtual void Spawned(void);
};
void monster_rat::monster_rat(void)
@ -34,3 +36,13 @@ void monster_rat::monster_rat(void)
base_mins = [-6,-6,-0];
base_maxs = [6,6,6];
}
void monster_rat::Spawned(void)
{
netname = "Rat";
model = "models/bigrat.mdl";
base_mins = [-6,-6,-0];
base_maxs = [6,6,6];
super::Spawned();
}

View file

@ -149,39 +149,6 @@ monster_scientist::SpawnKey(string strKey, string strValue)
void
monster_scientist::Spawned(void)
{
super::Spawned();
Sound_Precache("monster_scientist.die");
Sound_Precache("monster_scientist.pain");
/* 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)
{
if (spawnflags & MSF_PREDISASTER) {
m_talkAsk = "";
@ -218,4 +185,38 @@ monster_scientist::monster_scientist(void)
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");
/* 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

@ -68,6 +68,12 @@ monster_sentry::Respawn(void)
void
monster_sentry::Spawned(void)
{
netname = "Sentry";
model = "models/sentry.mdl";
base_health = Skill_GetValue("sentry_health", 40);
base_mins = [-16,-16,0];
base_maxs = [16,16,72];
super::Spawned();
Sound_Precache("monster_sentry.alert");
@ -78,9 +84,4 @@ monster_sentry::Spawned(void)
void monster_sentry::monster_sentry(void)
{
netname = "Sentry";
model = "models/sentry.mdl";
base_health = Skill_GetValue("sentry_health", 40);
base_mins = [-16,-16,0];
base_maxs = [16,16,72];
}

View file

@ -105,6 +105,8 @@ monster_sitting_scientist::SpawnKey(string strKey, string strValue)
void
monster_sitting_scientist::Spawned(void)
{
model = "models/scientist.mdl";
super::Spawned();
/* has the body not been overriden, etc. choose a character for us */
@ -135,5 +137,4 @@ monster_sitting_scientist::Spawned(void)
void
monster_sitting_scientist::monster_sitting_scientist(void)
{
model = "models/scientist.mdl";
}

View file

@ -121,19 +121,19 @@ monster_tentacle::Respawn(void)
void
monster_tentacle::Spawned(void)
{
super::Spawned();
Sound_Precache("monster_tentacle.alert");
Sound_Precache("monster_tentacle.attack");
Sound_Precache("monster_tentacle.die");
Sound_Precache("monster_tentacle.idle");
netname = "Tentacle";
model = "models/tentacle2.mdl";
base_mins = [-32,-32,0];
base_maxs = [32,32,64];
super::Spawned();
}
void
monster_tentacle::monster_tentacle(void)
{
netname = "Tentacle";
model = "models/tentacle2.mdl";
base_mins = [-32,-32,0];
base_maxs = [32,32,64];
}

View file

@ -35,12 +35,20 @@ enum
class monster_turret:NSMonster
{
void(void) monster_turret;
virtual void Spawned(void);
};
void monster_turret::monster_turret(void)
{
}
void monster_turret::Spawned(void)
{
netname = "Turret";
model = "models/turret.mdl";
base_mins = [-16,-16,0];
base_maxs = [16,16,72];
super::Spawned();
}

View file

@ -88,8 +88,31 @@ class monster_zombie:NSMonster
virtual int(void) AttackMelee;
virtual void(void) AttackFlail;
virtual float GetWalkSpeed(void);
virtual float GetChaseSpeed(void);
virtual float GetRunSpeed(void);
};
float
monster_zombie::GetWalkSpeed(void)
{
return 64;
}
float
monster_zombie::GetChaseSpeed(void)
{
return 64;
}
float
monster_zombie::GetRunSpeed(void)
{
return 64;
}
int
monster_zombie::AnimIdle(void)
{
@ -207,23 +230,23 @@ monster_zombie::Respawn(void)
void
monster_zombie::Spawned(void)
{
super::Spawned();
Sound_Precache("monster_zombie.alert");
Sound_Precache("monster_zombie.attack");
Sound_Precache("monster_zombie.attackhit");
Sound_Precache("monster_zombie.attackmiss");
Sound_Precache("monster_zombie.idle");
Sound_Precache("monster_zombie.pain");
}
void
monster_zombie::monster_zombie(void)
{
netname = "Zombie";
model = "models/zombie.mdl";
base_health = Skill_GetValue("zombie_health", 50);
base_mins = [-16,-16,0];
base_maxs = [16,16,72];
m_iAlliance = MAL_ALIEN;
super::Spawned();
}
void
monster_zombie::monster_zombie(void)
{
}