‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
archetype_mannequin.gsc
Go to the documentation of this file.
1 #using scripts\shared\spawner_shared;
2 #using scripts\shared\ai\zombie;
3 #using scripts\shared\ai\zombie_utility;
4 #using scripts\shared\ai\archetype_mannequin_interface;
5 #using scripts\shared\ai\systems\ai_interface;
6 #using scripts\shared\ai\systems\behavior_tree_utility;
7 
8 #insert scripts\shared\ai\utility.gsh;
9 #insert scripts\shared\ai\systems\behavior.gsh;
10 #insert scripts\shared\archetype_shared\archetype_shared.gsh;
11 #insert scripts\shared\shared.gsh;
12 
13 #namespace MannequinBehavior;
14 
15 function autoexec ‪init()
16 {
17  level.zm_variant_type_max = [];
18  level.zm_variant_type_max[ "walk" ] = [];
19  level.zm_variant_type_max[ "run" ] = [];
20  level.zm_variant_type_max[ "sprint" ] = [];
21  level.zm_variant_type_max[ "walk" ][ "down" ] = 14;
22  level.zm_variant_type_max[ "walk" ][ "up" ] = 16;
23  level.zm_variant_type_max[ "run" ][ "down" ] = 13;
24  level.zm_variant_type_max[ "run" ][ "up" ] = 12;
25  level.zm_variant_type_max[ "sprint" ][ "down" ] = 7;
26  level.zm_variant_type_max[ "sprint" ][ "up" ] = 6;
27 
28  // INIT BLACKBOARD
31 
32  // INIT ZOMBIE ON SPAWN
35 
37 
38  ‪BT_REGISTER_API( "mannequinCollisionService", &‪mannequinCollisionService );
39  ‪BT_REGISTER_API( "mannequinShouldMelee", &‪mannequinShouldMelee );
40 }
41 
42 function ‪mannequinCollisionService( entity )
43 {
44  if ( IsDefined( entity.enemy ) &&
45  DistanceSquared( entity.origin, entity.enemy.origin ) > ‪SQR( 300 ) )
46  {
47  // Allow clipping with other AI's at a distance, this helps when the AI's move diagonally into each other.
48  entity PushActors( false );
49  }
50  else
51  {
52  // Force AI's to push each other close to their enemy.
53  entity PushActors( true );
54  }
55 }
56 
57 function ‪mannequinSpawnSetup( entity )
58 {
59 }
60 
61 #define MANNEQUIN_MELEE_HEIGHT 72
62 #define MANNEQUIN_MELEE_DIST_SQ SQR( 64 )
63 #define MANNEQUIN_MELEE_YAW 45
64 function private ‪mannequinShouldMelee( entity )
65 {
66  if( !IsDefined( entity.enemy ) )
67  {
68  return false;
69  }
70 
71  if( IsDefined( entity.marked_for_death ) )
72  {
73  return false;
74  }
75 
76  if( ‪IS_TRUE( entity.ignoreMelee ) )
77  {
78  return false;
79  }
80 
81  if( Distance2DSquared( entity.origin, entity.enemy.origin ) > ‪MANNEQUIN_MELEE_DIST_SQ )
82  {
83  return false;
84  }
85 
86  if( abs( entity.origin[2] - entity.enemy.origin[2] ) > ‪MANNEQUIN_MELEE_HEIGHT )
87  {
88  return false;
89  }
90 
91  yawToEnemy = AngleClamp180( entity.angles[ 1 ] - ‪GET_YAW( entity, entity.enemy.origin ) );
92  if( abs( yawToEnemy ) > ‪MANNEQUIN_MELEE_YAW )
93  {
94  return false;
95  }
96 
97  return true;
98 }
‪MANNEQUIN_MELEE_YAW
‪#define MANNEQUIN_MELEE_YAW
Definition: archetype_mannequin.gsc:63
‪BT_REGISTER_API
‪#define BT_REGISTER_API(name, function)
Definition: behavior.gsh:1
‪GET_YAW
‪#define GET_YAW(__self, __org)
Definition: utility.gsh:26
‪ARCHETYPE_MANNEQUIN
‪#define ARCHETYPE_MANNEQUIN
Definition: archetype_shared.gsh:18
‪IS_TRUE
‪#define IS_TRUE(__a)
Definition: shared.gsh:251
‪SQR
‪#define SQR(__var)
Definition: shared.gsh:293
‪RegisterMannequinInterfaceAttributes
‪function RegisterMannequinInterfaceAttributes()
Definition: archetype_mannequin_interface.gsc:6
‪mannequinCollisionService
‪function mannequinCollisionService(entity)
Definition: archetype_mannequin.gsc:42
‪mannequinSpawnSetup
‪function mannequinSpawnSetup(entity)
Definition: archetype_mannequin.gsc:57
‪init
‪function autoexec init()
Definition: archetype_mannequin.gsc:15
‪MANNEQUIN_MELEE_HEIGHT
‪#define MANNEQUIN_MELEE_HEIGHT
Definition: archetype_mannequin.gsc:61
‪add_archetype_spawn_function
‪function add_archetype_spawn_function(archetype, spawn_func)
Definition: ai_shared.csc:23
‪mannequinShouldMelee
‪function private mannequinShouldMelee(entity)
Definition: archetype_mannequin.gsc:64
‪MANNEQUIN_MELEE_DIST_SQ
‪#define MANNEQUIN_MELEE_DIST_SQ
Definition: archetype_mannequin.gsc:62
‪ArchetypeZombieBlackboardInit
‪function ArchetypeZombieBlackboardInit()
Definition: zombie.gsc:132
‪zombieSpawnSetup
‪function zombieSpawnSetup()
Definition: zombie_utility.gsc:28
‪ArchetypeZombieDeathOverrideInit
‪function ArchetypeZombieDeathOverrideInit()
Definition: zombie.gsc:1494