‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
archetype_clone.gsc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\ai_shared;
4 #using scripts\shared\array_shared;
5 #using scripts\shared\callbacks_shared;
6 #using scripts\shared\clientfield_shared;
7 #using scripts\shared\fx_shared;
8 #using scripts\shared\laststand_shared;
9 #using scripts\shared\math_shared;
10 #using scripts\shared\scene_shared;
11 #using scripts\shared\spawner_shared;
12 #using scripts\shared\util_shared;
13 #using scripts\shared\visionset_mgr_shared;
14 
15 #using scripts\shared\ai\systems\ai_interface;
16 #using scripts\shared\ai\systems\animation_state_machine_utility;
17 #using scripts\shared\ai\systems\animation_state_machine_notetracks;
18 #using scripts\shared\ai\systems\animation_state_machine_mocomp;
19 #using scripts\shared\ai\archetype_utility;
20 #using scripts\shared\ai\systems\behavior_tree_utility;
21 #using scripts\shared\ai\systems\blackboard;
22 #using scripts\shared\ai\systems\debug;
23 #using scripts\shared\ai\systems\gib;
24 #using scripts\shared\ai\zombie_utility;
25 #using scripts\shared\ai\archetype_mocomps_utility;
26 
27 #insert scripts\shared\archetype_shared\archetype_shared.gsh;
28 #insert scripts\shared\ai\systems\animation_state_machine.gsh;
29 #insert scripts\shared\ai\systems\behavior.gsh;
30 #insert scripts\shared\ai\systems\behavior_tree.gsh;
31 #insert scripts\shared\ai\systems\blackboard.gsh;
32 #insert scripts\shared\ai\systems\gib.gsh;
33 #insert scripts\shared\ai\archetype_clone.gsh;
34 #insert scripts\shared\ai\utility.gsh;
35 #insert scripts\shared\shared.gsh;
36 #insert scripts\shared\version.gsh;
37 
38 #namespace CloneBehavior;
39 
40 function autoexec ‪init()
41 {
42  // INIT BEHAVIORS
44 
45  // INIT BLACKBOARD
47 
48  // INIT THRASHER ON SPAWN
50 }
51 
53 {
54 }
55 
57 {
58  entity = self;
59 
60  // CREATE BLACKBOARD
62 
63  // USE UTILITY BLACKBOARD
65 
66  // CREATE INTERFACE
68 
69  // REGISTER ANIMSCRIPTED CALLBACK
70  entity.___ArchetypeOnAnimscriptedCallback = &‪ArchetypeCloneOnAnimscriptedCallback;
71 
72  // ENABLE DEBUGGING IN ODYSSEY
74 }
75 
76 function private ‪ArchetypeCloneOnAnimscriptedCallback( entity )
77 {
78  // UNREGISTER THE BLACKBOARD
79  entity.__blackboard = undefined;
80 
81  // REREGISTER BLACKBOARD
83 }
84 
85 function private ‪perfectInfoThread()
86 {
87  entity = self;
88 
89  entity endon( "death" );
90 
91  while ( true )
92  {
93  if ( IsDefined( entity.enemy ) )
94  {
95  entity GetPerfectInfo( entity.enemy, true );
96  }
97 
98  wait ‪SERVER_FRAME;
99  }
100 }
101 
102 function private ‪cloneSpawnSetup()
103 {
104  entity = self;
105 
106  entity.ignoreme = true;
107  entity.ignoreall = true;
108  // entity.pushable = false;
109 
110  // entity PushActors( true ); // Don't collide with other actors.
111  // entity PushPlayer( true ); // Don't collide with players.
112  entity SetContents( ‪CONTENTS_CLIPSHOT ); // Collide with bullets.
113  entity SetAvoidanceMask( "avoid none" );
114 
115  entity SetClone();
116 
117  entity thread ‪perfectInfoThread();
118 }
119 
120 #namespace CloneServerUtils;
121 
122 function ‪clonePlayerLook( clone, clonePlayer, targetPlayer )
123 {
124  assert( IsActor( clone ) );
125  assert( IsPlayer( clonePlayer ) );
126  assert( IsPlayer( targetPlayer ) );
127 
128  clone.owner = clonePlayer;
129  clone SetEntityTarget( targetPlayer, 1.0 );
130  clone SetEntityOwner( clonePlayer );
131  clone DetachAll();
132 
133  // Clone player's look
134  bodyModel = clonePlayer GetCharacterBodyModel();
135  if ( IsDefined( bodyModel ) )
136  {
137  clone SetModel( bodyModel );
138  }
139 
140  headModel = clonePlayer GetCharacterHeadModel();
141  if ( IsDefined( headModel ) && headModel != "tag_origin" )
142  {
143  if ( IsDefined( clone.head ) )
144  {
145  clone Detach( clone.head );
146  }
147 
148  clone Attach( headModel );
149  }
150 
151  helmetModel = clonePlayer GetCharacterHelmetModel();
152  if ( IsDefined( helmetModel ) && headModel != "tag_origin" )
153  {
154  clone Attach( helmetModel );
155  }
156 }
‪ArchetypeCloneOnAnimscriptedCallback
‪function private ArchetypeCloneOnAnimscriptedCallback(entity)
Definition: archetype_clone.gsc:76
‪perfectInfoThread
‪function private perfectInfoThread()
Definition: archetype_clone.gsc:85
‪RegisterUtilityBlackboardAttributes
‪function RegisterUtilityBlackboardAttributes()
Definition: archetype_utility.gsc:139
‪ARCHETYPE_HUMAN_CLONE
‪#define ARCHETYPE_HUMAN_CLONE
Definition: archetype_shared.gsh:5
‪ENABLE_BLACKBOARD_DEBUG_TRACKING
‪#define ENABLE_BLACKBOARD_DEBUG_TRACKING(self)
Definition: blackboard.gsh:7
‪SERVER_FRAME
‪#define SERVER_FRAME
Definition: shared.gsh:264
‪clonePlayerLook
‪function clonePlayerLook(clone, clonePlayer, targetPlayer)
Definition: archetype_clone.gsc:122
‪init
‪function autoexec init()
Definition: archetype_clone.gsc:40
‪add_archetype_spawn_function
‪function add_archetype_spawn_function(archetype, spawn_func)
Definition: ai_shared.csc:23
‪InitThrasherBehaviorsAndASM
‪function private InitThrasherBehaviorsAndASM()
Definition: archetype_clone.gsc:52
‪CreateBlackBoardForEntity
‪function CreateBlackBoardForEntity(entity)
Definition: blackboard.gsc:77
‪cloneSpawnSetup
‪function private cloneSpawnSetup()
Definition: archetype_clone.gsc:102
‪CONTENTS_CLIPSHOT
‪#define CONTENTS_CLIPSHOT
Definition: shared.gsh:110
‪ArchetypeCloneBlackboardInit
‪function private ArchetypeCloneBlackboardInit()
Definition: archetype_clone.gsc:56
‪CreateInterfaceForEntity
‪function CreateInterfaceForEntity(entity)
Definition: ai_interface.gsc:110