Anim complete, interal completed!@

This commit is contained in:
Your Name 2020-08-12 00:24:28 -06:00
parent 617612e7bd
commit aeb9030ff8
2 changed files with 171 additions and 5 deletions

View File

@ -91,8 +91,38 @@ init()
level.bots_bloodfx = loadfx("impacts/flesh_hit_body_fatal_exit");
PrecacheMpAnim("pb_combatrun_forward_loop");
PrecacheMpAnim("pb_crouch_run_forward");
PrecacheMpAnim("pb_sprint");
PrecacheMpAnim("pb_crouch_walk_forward_shield");
PrecacheMpAnim("pb_crouch_run_forward_pistol");
PrecacheMpAnim("pb_crouch_run_forward_RPG");
PrecacheMpAnim("pb_crouch_walk_forward_akimbo");
PrecacheMpAnim("pb_combatrun_forward_shield");
PrecacheMpAnim("pb_pistol_run_fast");
PrecacheMpAnim("pb_combatrun_forward_RPG");
PrecacheMpAnim("pb_combatrun_forward_akimbo");
PrecacheMpAnim("pb_sprint_shield");
PrecacheMpAnim("pb_sprint_akimbo");
PrecacheMpAnim("pb_sprint_pistol");
PrecacheMpAnim("pb_sprint_RPG");
PrecacheMpAnim("pb_climbup");
PrecacheMpAnim("pb_prone_crawl");
PrecacheMpAnim("pb_laststand_crawl");
PrecacheMpAnim("pb_combatrun_forward_loop");
PrecacheMpAnim("pt_stand_core_pullout");
PrecacheMpAnim("pt_melee_pistol_1");
PrecacheMpAnim("pt_melee_prone_pistol");
PrecacheMpAnim("pt_melee_pistol_2");
PrecacheMpAnim("pt_laststand_melee");
PrecacheMpAnim("pt_melee_shield");
level thread fixGamemodes();
level thread onPlayerConnect();

View File

@ -56,6 +56,7 @@ connected()
self thread onPlayerSpawned();
self thread onDisconnected();
self thread onGameEnded();
self thread onGiveLoadout();
}
/*
@ -74,6 +75,17 @@ onDamage(eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint
{
}
onGiveLoadout()
{
self endon("disconnect");
for(;;)
{
self waittill("giveLoadout");
self botsDeleteFakeAnim();
}
}
onGameEnded()
{
self endon("disconnect");
@ -438,6 +450,22 @@ emptyClipShoot()
}
}
checkShouldHideAnim(shouldHideAnim)
{
isHidden = self isFakeAnimHidden();
if (self.bot.isreloading || self.bot.isfraggingafter)
shouldHideAnim = true;
if (self isInActiveAnim())
shouldHideAnim = false;
if (isHidden && !shouldHideAnim)
self showFakeAnim();
else if (!isHidden && shouldHideAnim)
self hideFakeAnim();
}
moveHack()
{
self endon("disconnect");
@ -446,11 +474,12 @@ moveHack()
self.bot.last_pos = self.origin;
self.bot.moveTo = self.origin;
timer = 0;
for (;;)
shouldHideAnim = true;
for (timer = 0;;timer += 0.05)
{
self checkShouldHideAnim(shouldHideAnim);
shouldHideAnim = true;
wait 0.05;
timer += 0.05;
self.bot.velocity = (self.origin-self.bot.last_pos)*20;
self.bot.last_pos = self.origin;
@ -469,6 +498,7 @@ moveHack()
weapClass = weaponClass(curWeap);
inLastStand = isDefined(self.lastStand);
usingRemote = self isUsingRemote();
botAnim = "";
if (!self.bot.climbing)
{
@ -574,6 +604,93 @@ moveHack()
}
}
if (inLastStand)
botAnim = "pb_laststand_crawl";
else if (self.bot.climbing)
botAnim = "pb_climbup";
else if (stance == "prone")
botAnim = "pb_prone_crawl";
else
{
if (stance == "stand")
{
if (self.bot.running)
{
// sprint
switch(weapClass)
{
case "pistol":
botAnim = "pb_sprint_pistol";
break;
case "rocketlauncher":
botAnim = "pb_sprint_RPG";
break;
default:
botAnim = "pb_sprint";
break;
}
if(self.hasRiotShieldEquipped)
botAnim = "pb_sprint_shield";
if(isSubStr(curWeap, "akimbo_"))
botAnim = "pb_sprint_akimbo";
}
else
{
// stand
switch(weapClass)
{
case "pistol":
botAnim = "pb_pistol_run_fast";
break;
case "rocketlauncher":
botAnim = "pb_combatrun_forward_RPG";
break;
default:
botAnim = "pb_combatrun_forward_loop";
break;
}
if(self.hasRiotShieldEquipped)
botAnim = "pb_combatrun_forward_shield";
if(isSubStr(curWeap, "akimbo_"))
botAnim = "pb_combatrun_forward_akimbo";
}
}
else
{
// crouch
switch(weapClass)
{
case "pistol":
botAnim = "pb_crouch_run_forward_pistol";
break;
case "rocketlauncher":
botAnim = "pb_crouch_run_forward_RPG";
break;
default:
botAnim = "pb_crouch_run_forward";
break;
}
if(self.hasRiotShieldEquipped)
botAnim = "pb_crouch_walk_forward_shield";
if(isSubStr(curWeap, "akimbo_"))
botAnim = "pb_crouch_walk_forward_akimbo";
}
}
if (botAnim != "")
{
shouldHideAnim = false;
if (!self botDoingAnim(botAnim))
self botDoAnim(botAnim);
}
moveTo = self.bot.moveTo;
completedMove = false;
@ -763,7 +880,9 @@ doSwitch(newWeapon)
if (isDefined(self.lastDroppableWeapon) && self.lastDroppableWeapon != newWeapon)
return;
self thread botDoAnim("pt_stand_core_pullout", 0.5, true);
if (!isDefined(self.lastStand))
self thread botDoAnim("pt_stand_core_pullout", 0.5, true);
self.bot.isswitching = true;
wait 1; // fast pullout?
@ -783,6 +902,7 @@ reload_watch()
{
self waittill("reload_start");
self.bot.isreloading = true;
self waittill_notify_or_timeout("reload", 7.5);
self.bot.isreloading = false;
}
@ -2012,7 +2132,7 @@ knife(ent, knifeDist)
}
else
{
if ((distsq / knifeDist) < 0.3333333)
if ((distsq / knifeDist) < 0.5)
{
self playSound("melee_swing_small");
if (stance != "prone")
@ -2316,6 +2436,14 @@ bot_lookat(pos, time)
}
}
isInActiveAnim()
{
if (!isDefined(self.bot_anim))
return false;
return (self.bot_anim.inActiveAnim);
}
botDoingAnim(animName)
{
if (!isDefined(self.bot_anim))
@ -2387,6 +2515,14 @@ botsDeleteFakeAnim()
self.bot_anim = undefined;
}
isFakeAnimHidden()
{
if (!isDefined(self.bot_anim))
return true;
return (self.bot_anim.hidden);
}
showFakeAnim()
{
if(isDefined(self))