burc_2004

zm_tomb_giant_robot.gsc

Oct 21st, 2015
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 69.69 KB | None | 0 0
  1. #include maps/mp/zombies/_zm;
  2. #include maps/mp/zm_tomb_vo;
  3. #include maps/mp/zombies/_zm_clone;
  4. #include maps/mp/zombies/_zm_unitrigger;
  5. #include maps/mp/zombies/_zm_audio;
  6. #include maps/mp/zombies/_zm_stats;
  7. #include maps/mp/zombies/_zm_zonemgr;
  8. #include maps/mp/zm_tomb_teleporter;
  9. #include maps/mp/zombies/_zm_weap_one_inch_punch;
  10. #include maps/mp/zombies/_zm_ai_mechz;
  11. #include maps/mp/animscripts/zm_shared;
  12. #include maps/mp/zm_tomb_giant_robot_ffotd;
  13. #include maps/mp/zombies/_zm_net;
  14. #include maps/mp/gametypes_zm/_hud;
  15. #include maps/mp/gametypes_zm/_hud_util;
  16. #include maps/mp/animscripts/zm_utility;
  17. #include maps/mp/animscripts/zm_death;
  18. #include maps/mp/zombies/_zm_laststand;
  19. #include maps/mp/zombies/_zm_score;
  20. #include maps/mp/zombies/_zm_utility;
  21. #include maps/mp/_utility;
  22. #include common_scripts/utility;
  23.  
  24. #using_animtree( "zm_tomb_giant_robot_hatch" );
  25.  
  26. init_giant_robot_glows()
  27. {
  28.     maps/mp/zm_tomb_giant_robot_ffotd::init_giant_robot_glows_start();
  29.     precacheitem( "falling_hands_tomb_zm" );
  30.     precachemodel( "veh_t6_dlc_zm_robot_foot_hatch" );
  31.     precachemodel( "veh_t6_dlc_zm_robot_foot_hatch_lights" );
  32.     flag_init( "foot_shot" );
  33.     flag_init( "three_robot_round" );
  34.     flag_init( "fire_link_enabled" );
  35.     flag_init( "timeout_vo_robot_0" );
  36.     flag_init( "timeout_vo_robot_1" );
  37.     flag_init( "timeout_vo_robot_2" );
  38.     level thread setup_giant_robot_devgui();
  39.     level.gr_foot_hatch_closed = [];
  40.     level.gr_foot_hatch_closed[ 0 ] = 1;
  41.     level.gr_foot_hatch_closed[ 1 ] = 1;
  42.     level.gr_foot_hatch_closed[ 2 ] = 1;
  43.     a_gr_head_triggers = getstructarray( "giant_robot_head_exit_trigger", "script_noteworthy" );
  44.     _a51 = a_gr_head_triggers;
  45.     _k51 = getFirstArrayKey( _a51 );
  46.     while ( isDefined( _k51 ) )
  47.     {
  48.         struct = _a51[ _k51 ];
  49.         gr_head_exit_trigger_start( struct );
  50.         _k51 = getNextArrayKey( _a51, _k51 );
  51.     }
  52.     level thread handle_wind_tunnel_bunker_collision();
  53.     level thread handle_tank_bunker_collision();
  54.     maps/mp/zm_tomb_giant_robot_ffotd::init_giant_robot_glows_end();
  55. }
  56.  
  57. init_animtree()
  58. {
  59.     scriptmodelsuseanimtree( -1 );
  60. }
  61.  
  62. init_giant_robot()
  63. {
  64.     maps/mp/zm_tomb_giant_robot_ffotd::init_giant_robot_start();
  65.     registerclientfield( "actor", "register_giant_robot", 14000, 1, "int" );
  66.     registerclientfield( "world", "start_anim_robot_0", 14000, 1, "int" );
  67.     registerclientfield( "world", "start_anim_robot_1", 14000, 1, "int" );
  68.     registerclientfield( "world", "start_anim_robot_2", 14000, 1, "int" );
  69.     registerclientfield( "world", "play_foot_stomp_fx_robot_0", 14000, 2, "int" );
  70.     registerclientfield( "world", "play_foot_stomp_fx_robot_1", 14000, 2, "int" );
  71.     registerclientfield( "world", "play_foot_stomp_fx_robot_2", 14000, 2, "int" );
  72.     registerclientfield( "world", "play_foot_open_fx_robot_0", 14000, 2, "int" );
  73.     registerclientfield( "world", "play_foot_open_fx_robot_1", 14000, 2, "int" );
  74.     registerclientfield( "world", "play_foot_open_fx_robot_2", 14000, 2, "int" );
  75.     registerclientfield( "world", "eject_warning_fx_robot_0", 14000, 1, "int" );
  76.     registerclientfield( "world", "eject_warning_fx_robot_1", 14000, 1, "int" );
  77.     registerclientfield( "world", "eject_warning_fx_robot_2", 14000, 1, "int" );
  78.     registerclientfield( "allplayers", "eject_steam_fx", 14000, 1, "int" );
  79.     registerclientfield( "allplayers", "all_tubes_play_eject_steam_fx", 14000, 1, "int" );
  80.     registerclientfield( "allplayers", "gr_eject_player_impact_fx", 14000, 1, "int" );
  81.     registerclientfield( "toplayer", "giant_robot_rumble_and_shake", 14000, 2, "int" );
  82.     registerclientfield( "world", "church_ceiling_fxanim", 14000, 1, "int" );
  83.     level thread giant_robot_initial_spawns();
  84.     level.custom_intermission = ::tomb_standard_intermission;
  85.     init_footstep_safe_spots();
  86.     maps/mp/zm_tomb_giant_robot_ffotd::init_giant_robot_end();
  87. }
  88.  
  89. init_footstep_safe_spots()
  90. {
  91.     level.giant_robot_footstep_safe_spots = [];
  92.     make_safe_spot_trigger_box_at_point( ( -493, -198, 389 ), ( 0, 0, 1 ), 80, 64, 150 );
  93. }
  94.  
  95. make_safe_spot_trigger_box_at_point( v_origin, v_angles, n_length, n_width, n_height )
  96. {
  97.     trig = spawn( "trigger_box", v_origin, 0, n_length, n_width, n_height );
  98.     trig.angles = v_angles;
  99.     level.giant_robot_footstep_safe_spots[ level.giant_robot_footstep_safe_spots.size ] = trig;
  100. }
  101.  
  102. tomb_can_revive_override( player_down )
  103. {
  104.     if ( isDefined( player_down.is_stomped ) && player_down.is_stomped )
  105.     {
  106.         return 0;
  107.     }
  108.     return 1;
  109. }
  110.  
  111. giant_robot_initial_spawns()
  112. {
  113.     flag_wait( "start_zombie_round_logic" );
  114.     level.a_giant_robots = [];
  115.     i = 0;
  116.     while ( i < 3 )
  117.     {
  118.         level.gr_foot_hatch_closed[ i ] = 1;
  119.         trig_stomp_kill_right = getent( "trig_stomp_kill_right_" + i, "targetname" );
  120.         trig_stomp_kill_left = getent( "trig_stomp_kill_left_" + i, "targetname" );
  121.         trig_stomp_kill_right enablelinkto();
  122.         trig_stomp_kill_left enablelinkto();
  123.         clip_foot_right = getent( "clip_foot_right_" + i, "targetname" );
  124.         clip_foot_left = getent( "clip_foot_left_" + i, "targetname" );
  125.         sp_giant_robot = getent( "ai_giant_robot_" + i, "targetname" );
  126.         ai = sp_giant_robot spawnactor();
  127.         ai maps/mp/zm_tomb_giant_robot_ffotd::giant_robot_spawn_start();
  128.         ai.is_giant_robot = 1;
  129.         ai.giant_robot_id = i;
  130.         tag_right_foot = ai gettagorigin( "TAG_ATTACH_HATCH_RI" );
  131.         tag_left_foot = ai gettagorigin( "TAG_ATTACH_HATCH_LE" );
  132.         trig_stomp_kill_right.origin = tag_right_foot + vectorScale( ( 0, 0, 1 ), 72 );
  133.         trig_stomp_kill_right.angles = ai gettagangles( "TAG_ATTACH_HATCH_RI" );
  134.         trig_stomp_kill_left.origin = tag_left_foot + vectorScale( ( 0, 0, 1 ), 72 );
  135.         trig_stomp_kill_left.angles = ai gettagangles( "TAG_ATTACH_HATCH_LE" );
  136.         wait 0,1;
  137.         trig_stomp_kill_right linkto( ai, "TAG_ATTACH_HATCH_RI", vectorScale( ( 0, 0, 1 ), 72 ) );
  138.         wait_network_frame();
  139.         trig_stomp_kill_left linkto( ai, "TAG_ATTACH_HATCH_LE", vectorScale( ( 0, 0, 1 ), 72 ) );
  140.         wait_network_frame();
  141.         ai.trig_stomp_kill_right = trig_stomp_kill_right;
  142.         ai.trig_stomp_kill_left = trig_stomp_kill_left;
  143.         clip_foot_right.origin = tag_right_foot + ( 0, 0, 1 );
  144.         clip_foot_left.origin = tag_left_foot + ( 0, 0, 1 );
  145.         clip_foot_right.angles = ai gettagangles( "TAG_ATTACH_HATCH_RI" );
  146.         clip_foot_left.angles = ai gettagangles( "TAG_ATTACH_HATCH_LE" );
  147.         wait 0,1;
  148.         clip_foot_right linkto( ai, "TAG_ATTACH_HATCH_RI", ( 0, 0, 1 ) );
  149.         wait_network_frame();
  150.         clip_foot_left linkto( ai, "TAG_ATTACH_HATCH_LE", ( 0, 0, 1 ) );
  151.         wait_network_frame();
  152.         ai.clip_foot_right = clip_foot_right;
  153.         ai.clip_foot_left = clip_foot_left;
  154.         ai.is_zombie = 0;
  155.         ai.targetname = "giant_robot_walker_" + i;
  156.         ai.animname = "giant_robot_walker";
  157.         ai.script_noteworthy = "giant_robot";
  158.         ai.audio_type = "giant_robot";
  159.         ai.ignoreall = 1;
  160.         ai.ignoreme = 1;
  161.         ai setcandamage( 0 );
  162.         ai magic_bullet_shield();
  163.         ai setplayercollision( 1 );
  164.         ai setforcenocull();
  165.         ai setfreecameralockonallowed( 0 );
  166.         ai.goalradius = 100000;
  167.         ai setgoalpos( ai.origin );
  168.         ai setclientfield( "register_giant_robot", 1 );
  169.         ai ghost();
  170.         ai ent_flag_init( "robot_head_entered" );
  171.         ai ent_flag_init( "kill_trigger_active" );
  172.         level.a_giant_robots[ i ] = ai;
  173.         ai maps/mp/zm_tomb_giant_robot_ffotd::giant_robot_spawn_end();
  174.         wait_network_frame();
  175.         i++;
  176.     }
  177.     level thread robot_cycling();
  178. }
  179.  
  180. robot_cycling()
  181. {
  182.     three_robot_round = 0;
  183.     last_robot = -1;
  184.     level thread giant_robot_intro_walk( 1 );
  185.     level waittill( "giant_robot_intro_complete" );
  186.     while ( 1 )
  187.     {
  188.         if ( level.round_number % 4 && three_robot_round != level.round_number )
  189.         {
  190.             flag_set( "three_robot_round" );
  191.         }
  192.         if ( flag( "ee_all_staffs_placed" ) && !flag( "ee_mech_zombie_hole_opened" ) )
  193.         {
  194.             flag_set( "three_robot_round" );
  195.         }
  196. /#
  197.         if ( isDefined( level.devgui_force_three_robot_round ) && level.devgui_force_three_robot_round )
  198.         {
  199.             flag_set( "three_robot_round" );
  200. #/
  201.         }
  202.         if ( flag( "three_robot_round" ) )
  203.         {
  204.             level.zombie_ai_limit = 22;
  205.             random_number = randomint( 3 );
  206.             if ( random_number == 2 )
  207.             {
  208.                 level thread giant_robot_start_walk( 2 );
  209.             }
  210.             else
  211.             {
  212.                 level thread giant_robot_start_walk( 2, 0 );
  213.             }
  214.             wait 5;
  215.             if ( random_number == 0 )
  216.             {
  217.                 level thread giant_robot_start_walk( 0 );
  218.             }
  219.             else
  220.             {
  221.                 level thread giant_robot_start_walk( 0, 0 );
  222.             }
  223.             wait 5;
  224.             if ( random_number == 1 )
  225.             {
  226.                 level thread giant_robot_start_walk( 1 );
  227.             }
  228.             else
  229.             {
  230.                 level thread giant_robot_start_walk( 1, 0 );
  231.             }
  232.             level waittill( "giant_robot_walk_cycle_complete" );
  233.             level waittill( "giant_robot_walk_cycle_complete" );
  234.             level waittill( "giant_robot_walk_cycle_complete" );
  235.             wait 5;
  236.             level.zombie_ai_limit = 24;
  237.             three_robot_round = level.round_number;
  238.             last_robot = -1;
  239.             flag_clear( "three_robot_round" );
  240.             continue;
  241.         }
  242.         else
  243.         {
  244.             if ( !flag( "activate_zone_nml" ) )
  245.             {
  246.                 random_number = randomint( 2 );
  247.             }
  248.             else
  249.             {
  250.                 random_number = randomint( 3 );
  251.             }
  252. /#
  253.             if ( isDefined( level.devgui_force_giant_robot ) )
  254.             {
  255.                 random_number = level.devgui_force_giant_robot;
  256. #/
  257.             }
  258.             last_robot = random_number;
  259.             level thread giant_robot_start_walk( random_number );
  260.             level waittill( "giant_robot_walk_cycle_complete" );
  261.             wait 5;
  262.         }
  263.     }
  264. }
  265.  
  266. giant_robot_intro_walk( n_robot_id )
  267. {
  268.     ai = getent( "giant_robot_walker_" + n_robot_id, "targetname" );
  269.     ai attach( "veh_t6_dlc_zm_robot_foot_hatch", "TAG_ATTACH_HATCH_LE" );
  270.     ai attach( "veh_t6_dlc_zm_robot_foot_hatch", "TAG_ATTACH_HATCH_RI" );
  271.     ai thread giant_robot_think( ai.trig_stomp_kill_right, ai.trig_stomp_kill_left, ai.clip_foot_right, ai.clip_foot_left, undefined, 3 );
  272.     level thread starting_spawn_light();
  273.     wait 0,5;
  274.     level setclientfield( "play_foot_stomp_fx_robot_" + ai.giant_robot_id, 2 );
  275.     level thread giant_robot_intro_exploder();
  276.     a_players = getplayers();
  277.     _a361 = a_players;
  278.     _k361 = getFirstArrayKey( _a361 );
  279.     while ( isDefined( _k361 ) )
  280.     {
  281.         player = _a361[ _k361 ];
  282.         player setclientfieldtoplayer( "giant_robot_rumble_and_shake", 3 );
  283.         player thread turn_clientside_rumble_off();
  284.         _k361 = getNextArrayKey( _a361, _k361 );
  285.     }
  286.     level waittill( "giant_robot_walk_cycle_complete" );
  287.     level notify( "giant_robot_intro_complete" );
  288. }
  289.  
  290. giant_robot_intro_exploder()
  291. {
  292.     exploder( 111 );
  293.     wait 3;
  294.     stop_exploder( 111 );
  295. }
  296.  
  297. giant_robot_start_walk( n_robot_id, b_has_hatch )
  298. {
  299.     if ( !isDefined( b_has_hatch ) )
  300.     {
  301.         b_has_hatch = 1;
  302.     }
  303.     ai = getent( "giant_robot_walker_" + n_robot_id, "targetname" );
  304.     level.gr_foot_hatch_closed[ n_robot_id ] = 1;
  305.     ai.b_has_hatch = b_has_hatch;
  306.     ai ent_flag_clear( "kill_trigger_active" );
  307.     ai ent_flag_clear( "robot_head_entered" );
  308.     if ( isDefined( ai.b_has_hatch ) && ai.b_has_hatch )
  309.     {
  310.         m_sole = getent( "target_sole_" + n_robot_id, "targetname" );
  311.     }
  312.     if ( isDefined( m_sole ) && isDefined( ai.b_has_hatch ) && ai.b_has_hatch )
  313.     {
  314.         m_sole setcandamage( 1 );
  315.         m_sole.health = 99999;
  316.         m_sole useanimtree( -1 );
  317.         m_sole unlink();
  318.     }
  319.     wait 10;
  320.     if ( isDefined( m_sole ) )
  321.     {
  322.         if ( cointoss() )
  323.         {
  324.             ai.hatch_foot = "left";
  325.         }
  326.         else
  327.         {
  328.             ai.hatch_foot = "right";
  329.         }
  330. /#
  331.         if ( isDefined( level.devgui_force_giant_robot_foot ) && isDefined( ai.b_has_hatch ) && ai.b_has_hatch )
  332.         {
  333.             ai.hatch_foot = level.devgui_force_giant_robot_foot;
  334. #/
  335.         }
  336.         if ( ai.hatch_foot == "left" )
  337.         {
  338.             n_sole_origin = ai gettagorigin( "TAG_ATTACH_HATCH_LE" );
  339.             v_sole_angles = ai gettagangles( "TAG_ATTACH_HATCH_LE" );
  340.             ai.hatch_foot = "left";
  341.             str_sole_tag = "TAG_ATTACH_HATCH_LE";
  342.             ai attach( "veh_t6_dlc_zm_robot_foot_hatch", "TAG_ATTACH_HATCH_RI" );
  343.         }
  344.         else
  345.         {
  346.             if ( ai.hatch_foot == "right" )
  347.             {
  348.                 n_sole_origin = ai gettagorigin( "TAG_ATTACH_HATCH_RI" );
  349.                 v_sole_angles = ai gettagangles( "TAG_ATTACH_HATCH_RI" );
  350.                 ai.hatch_foot = "right";
  351.                 str_sole_tag = "TAG_ATTACH_HATCH_RI";
  352.                 ai attach( "veh_t6_dlc_zm_robot_foot_hatch", "TAG_ATTACH_HATCH_LE" );
  353.             }
  354.         }
  355.         m_sole.origin = n_sole_origin;
  356.         m_sole.angles = v_sole_angles;
  357.         wait 0,1;
  358.         m_sole linkto( ai, str_sole_tag, ( 0, 0, 1 ) );
  359.         m_sole show();
  360.         ai attach( "veh_t6_dlc_zm_robot_foot_hatch_lights", str_sole_tag );
  361.     }
  362.     if ( isDefined( ai.b_has_hatch ) && !ai.b_has_hatch )
  363.     {
  364.         ai attach( "veh_t6_dlc_zm_robot_foot_hatch", "TAG_ATTACH_HATCH_RI" );
  365.         ai attach( "veh_t6_dlc_zm_robot_foot_hatch", "TAG_ATTACH_HATCH_LE" );
  366.     }
  367.     wait 0,05;
  368.     ai thread giant_robot_think( ai.trig_stomp_kill_right, ai.trig_stomp_kill_left, ai.clip_foot_right, ai.clip_foot_left, m_sole, n_robot_id );
  369. }
  370.  
  371. giant_robot_think( trig_stomp_kill_right, trig_stomp_kill_left, clip_foot_right, clip_foot_left, m_sole, n_robot_id )
  372. {
  373.     self thread robot_walk_animation( n_robot_id );
  374.     self show();
  375.     if ( isDefined( m_sole ) )
  376.     {
  377.         self thread sole_cleanup( m_sole );
  378.     }
  379.     self.is_walking = 1;
  380.     self thread monitor_footsteps( trig_stomp_kill_right, "right" );
  381.     self thread monitor_footsteps( trig_stomp_kill_left, "left" );
  382.     self thread monitor_footsteps_fx( trig_stomp_kill_right, "right" );
  383.     self thread monitor_footsteps_fx( trig_stomp_kill_left, "left" );
  384.     self thread monitor_shadow_notetracks( "right" );
  385.     self thread monitor_shadow_notetracks( "left" );
  386.     self thread sndgrthreads( "left" );
  387.     self thread sndgrthreads( "right" );
  388.     if ( isDefined( m_sole ) && level.gr_foot_hatch_closed[ n_robot_id ] && isDefined( self.b_has_hatch ) && self.b_has_hatch )
  389.     {
  390.         self thread giant_robot_foot_waittill_sole_shot( m_sole );
  391.     }
  392.     a_players = getplayers();
  393.     if ( n_robot_id != 3 && isDefined( level.giant_robot_discovered ) && !level.giant_robot_discovered )
  394.     {
  395.         _a511 = a_players;
  396.         _k511 = getFirstArrayKey( _a511 );
  397.         while ( isDefined( _k511 ) )
  398.         {
  399.             player = _a511[ _k511 ];
  400.             player thread giant_robot_discovered_vo( self );
  401.             _k511 = getNextArrayKey( _a511, _k511 );
  402.         }
  403.     }
  404.     else while ( flag( "three_robot_round" ) && isDefined( level.three_robot_round_vo ) && !level.three_robot_round_vo )
  405.     {
  406.         _a518 = a_players;
  407.         _k518 = getFirstArrayKey( _a518 );
  408.         while ( isDefined( _k518 ) )
  409.         {
  410.             player = _a518[ _k518 ];
  411.             player thread three_robot_round_vo( self );
  412.             _k518 = getNextArrayKey( _a518, _k518 );
  413.         }
  414.     }
  415.     while ( n_robot_id != 3 && isDefined( level.shoot_robot_vo ) && !level.shoot_robot_vo )
  416.     {
  417.         _a526 = a_players;
  418.         _k526 = getFirstArrayKey( _a526 );
  419.         while ( isDefined( _k526 ) )
  420.         {
  421.             player = _a526[ _k526 ];
  422.             player thread shoot_at_giant_robot_vo( self );
  423.             _k526 = getNextArrayKey( _a526, _k526 );
  424.         }
  425.     }
  426.     self waittill( "giant_robot_stop" );
  427.     self.is_walking = 0;
  428.     self stopanimscripted();
  429.     sp_giant_robot = getent( "ai_giant_robot_" + self.giant_robot_id, "targetname" );
  430.     self.origin = sp_giant_robot.origin;
  431.     level setclientfield( "play_foot_open_fx_robot_" + self.giant_robot_id, 0 );
  432.     self ghost();
  433.     self detachall();
  434.     level notify( "giant_robot_walk_cycle_complete" );
  435. }
  436.  
  437. sole_cleanup( m_sole )
  438. {
  439.     self endon( "death" );
  440.     self endon( "giant_robot_stop" );
  441.     wait_network_frame();
  442.     m_sole clearanim( %root, 0 );
  443.     wait_network_frame();
  444.     m_sole setanim( %ai_zombie_giant_robot_hatch_close, 1, 0,2, 1 );
  445. }
  446.  
  447. giant_robot_foot_waittill_sole_shot( m_sole )
  448. {
  449.     self endon( "death" );
  450.     self endon( "giant_robot_stop" );
  451.     if ( isDefined( self.hatch_foot ) && self.hatch_foot == "left" )
  452.     {
  453.         str_tag = "TAG_ATTACH_HATCH_LE";
  454.         n_foot = 2;
  455.     }
  456.     else
  457.     {
  458.         if ( isDefined( self.hatch_foot ) && self.hatch_foot == "right" )
  459.         {
  460.             str_tag = "TAG_ATTACH_HATCH_RI";
  461.             n_foot = 1;
  462.         }
  463.     }
  464.     self waittillmatch( "scripted_walk" );
  465.     return "kill_zombies_leftfoot_1";
  466.     wait 1;
  467.     m_sole waittill( "damage", amount, inflictor, direction, point, type, tagname, modelname, partname, weaponname, idflags );
  468.     m_sole.health = 99999;
  469.     level.gr_foot_hatch_closed[ self.giant_robot_id ] = 0;
  470.     level setclientfield( "play_foot_open_fx_robot_" + self.giant_robot_id, n_foot );
  471.     m_sole clearanim( %ai_zombie_giant_robot_hatch_close, 1 );
  472.     m_sole setanim( %ai_zombie_giant_robot_hatch_open, 1, 0,2, 1 );
  473.     n_time = getanimlength( %ai_zombie_giant_robot_hatch_open );
  474.     wait n_time;
  475.     m_sole clearanim( %ai_zombie_giant_robot_hatch_open, 1 );
  476.     m_sole setanim( %ai_zombie_giant_robot_hatch_open_idle, 1, 0,2, 1 );
  477. }
  478.  
  479. giant_robot_close_head_entrance( foot_side )
  480. {
  481.     wait 5;
  482.     level.gr_foot_hatch_closed[ self.giant_robot_id ] = 1;
  483.     level setclientfield( "play_foot_open_fx_robot_" + self.giant_robot_id, 0 );
  484.     m_sole = getent( "target_sole_" + self.giant_robot_id, "targetname" );
  485.     if ( isDefined( m_sole ) )
  486.     {
  487.         m_sole clearanim( %ai_zombie_giant_robot_hatch_open, 1 );
  488.         m_sole clearanim( %ai_zombie_giant_robot_hatch_open_idle, 1 );
  489.         m_sole setanim( %ai_zombie_giant_robot_hatch_close, 1, 0,2, 1 );
  490.     }
  491.     if ( isDefined( foot_side ) )
  492.     {
  493.         if ( foot_side == "right" )
  494.         {
  495.             str_tag = "TAG_ATTACH_HATCH_RI";
  496.         }
  497.         else
  498.         {
  499.             if ( foot_side == "left" )
  500.             {
  501.                 str_tag = "TAG_ATTACH_HATCH_LE";
  502.             }
  503.         }
  504.         self detach( "veh_t6_dlc_zm_robot_foot_hatch_lights", str_tag );
  505.     }
  506. }
  507.  
  508. robot_walk_animation( n_robot_id )
  509. {
  510.     if ( n_robot_id != 3 )
  511.     {
  512.         level setclientfield( "start_anim_robot_" + n_robot_id, 1 );
  513.         self thread start_footprint_warning_vo( n_robot_id );
  514.     }
  515.     if ( n_robot_id == 0 )
  516.     {
  517.         animationid = self getanimfromasd( "zm_robot_walk_nml", 0 );
  518.         str_anim_scripted_name = "zm_robot_walk_nml";
  519.         s_robot_path = getstruct( "anim_align_robot_nml", "targetname" );
  520.         s_robot_path.angles = ( 0, 0, 1 );
  521.         self animscripted( s_robot_path.origin, s_robot_path.angles, str_anim_scripted_name, 0 );
  522.         self thread maps/mp/animscripts/zm_shared::donotetracks( "scripted_walk" );
  523.         self waittillmatch( "scripted_walk" );
  524.         return "end";
  525.         animationid = self getanimfromasd( "zm_robot_walk_nml", 1 );
  526.         self thread maps/mp/animscripts/zm_shared::donotetracks( "scripted_walk" );
  527.         self animscripted( s_robot_path.origin, s_robot_path.angles, str_anim_scripted_name, 1 );
  528.         self waittillmatch( "scripted_walk" );
  529.         return "end";
  530.         animationid = self getanimfromasd( "zm_robot_walk_nml", 2 );
  531.         self thread maps/mp/animscripts/zm_shared::donotetracks( "scripted_walk" );
  532.         self animscripted( s_robot_path.origin, s_robot_path.angles, str_anim_scripted_name, 2 );
  533.         self waittillmatch( "scripted_walk" );
  534.         return "end";
  535.         self notify( "giant_robot_stop" );
  536.     }
  537.     else if ( n_robot_id == 1 )
  538.     {
  539.         animationid = self getanimfromasd( "zm_robot_walk_trenches", 0 );
  540.         str_anim_scripted_name = "zm_robot_walk_trenches";
  541.         s_robot_path = getstruct( "anim_align_robot_trenches", "targetname" );
  542.         s_robot_path.angles = ( 0, 0, 1 );
  543.         self animscripted( s_robot_path.origin, s_robot_path.angles, str_anim_scripted_name, 0 );
  544.         self thread maps/mp/animscripts/zm_shared::donotetracks( "scripted_walk" );
  545.         self waittillmatch( "scripted_walk" );
  546.         return "end";
  547.         animationid = self getanimfromasd( "zm_robot_walk_trenches", 1 );
  548.         self thread maps/mp/animscripts/zm_shared::donotetracks( "scripted_walk" );
  549.         self animscripted( s_robot_path.origin, s_robot_path.angles, str_anim_scripted_name, 1 );
  550.         self waittillmatch( "scripted_walk" );
  551.         return "end";
  552.         animationid = self getanimfromasd( "zm_robot_walk_trenches", 2 );
  553.         self thread maps/mp/animscripts/zm_shared::donotetracks( "scripted_walk" );
  554.         self animscripted( s_robot_path.origin, s_robot_path.angles, str_anim_scripted_name, 2 );
  555.         self waittillmatch( "scripted_walk" );
  556.         return "end";
  557.         self notify( "giant_robot_stop" );
  558.     }
  559.     else if ( n_robot_id == 2 )
  560.     {
  561.         animationid = self getanimfromasd( "zm_robot_walk_village", 0 );
  562.         str_anim_scripted_name = "zm_robot_walk_village";
  563.         s_robot_path = getstruct( "anim_align_robot_village", "targetname" );
  564.         s_robot_path.angles = ( 0, 0, 1 );
  565.         self animscripted( s_robot_path.origin, s_robot_path.angles, str_anim_scripted_name, 0 );
  566.         self thread maps/mp/animscripts/zm_shared::donotetracks( "scripted_walk" );
  567.         self waittillmatch( "scripted_walk" );
  568.         return "end";
  569.         animationid = self getanimfromasd( "zm_robot_walk_village", 1 );
  570.         self thread maps/mp/animscripts/zm_shared::donotetracks( "scripted_walk" );
  571.         self animscripted( s_robot_path.origin, s_robot_path.angles, str_anim_scripted_name, 1 );
  572.         self waittillmatch( "scripted_walk" );
  573.         return "end";
  574.         animationid = self getanimfromasd( "zm_robot_walk_village", 2 );
  575.         self thread maps/mp/animscripts/zm_shared::donotetracks( "scripted_walk" );
  576.         self animscripted( s_robot_path.origin, s_robot_path.angles, str_anim_scripted_name, 2 );
  577.         self waittillmatch( "scripted_walk" );
  578.         return "end";
  579.         self notify( "giant_robot_stop" );
  580.     }
  581.     else
  582.     {
  583.         if ( n_robot_id == 3 )
  584.         {
  585.             animationid = self getanimfromasd( "zm_robot_walk_intro", 0 );
  586.             str_anim_scripted_name = "zm_robot_walk_intro";
  587.             s_robot_path = getstruct( "anim_align_robot_trenches", "targetname" );
  588.             s_robot_path.angles = ( 0, 0, 1 );
  589.             self animscripted( s_robot_path.origin, s_robot_path.angles, str_anim_scripted_name, 0 );
  590.             self thread maps/mp/animscripts/zm_shared::donotetracks( "scripted_walk" );
  591.             self waittillmatch( "scripted_walk" );
  592.             return "end";
  593.             self notify( "giant_robot_stop" );
  594.         }
  595.     }
  596.     if ( n_robot_id != 3 )
  597.     {
  598.         level setclientfield( "start_anim_robot_" + n_robot_id, 0 );
  599.     }
  600. }
  601.  
  602. sndgrthreads( side )
  603. {
  604.     self thread sndrobot( "soundfootstart_" + side, "zmb_robot_leg_move_" + side, side );
  605.     self thread sndrobot( "soundfootwarning_" + side, "zmb_robot_foot_alarm", side );
  606.     self thread sndrobot( "soundfootdown_" + side, "zmb_robot_leg_whoosh", side );
  607.     self thread sndrobot( "soundfootalarm_" + side, "zmb_robot_pre_stomp_a", side );
  608. }
  609.  
  610. sndrobot( notetrack, alias, side )
  611. {
  612.     self endon( "giant_robot_stop" );
  613.     if ( side == "right" )
  614.     {
  615.         str_tag = "TAG_ATTACH_HATCH_RI";
  616.     }
  617.     else
  618.     {
  619.         if ( side == "left" )
  620.         {
  621.             str_tag = "TAG_ATTACH_HATCH_LE";
  622.         }
  623.     }
  624.     while ( 1 )
  625.     {
  626.         self waittillmatch( "scripted_walk" );
  627.         return notetrack;
  628.         self playsoundontag( alias, str_tag );
  629.         wait 0,1;
  630.     }
  631. }
  632.  
  633. monitor_footsteps( trig_stomp_kill, foot_side )
  634. {
  635.     self endon( "death" );
  636.     self endon( "giant_robot_stop" );
  637.     str_start_stomp = "kill_zombies_" + foot_side + "foot_1";
  638.     str_end_stomp = "footstep_" + foot_side + "_large";
  639.     while ( 1 )
  640.     {
  641.         self waittillmatch( "scripted_walk" );
  642.         return str_start_stomp;
  643.         self thread toggle_kill_trigger_flag( trig_stomp_kill, 1, foot_side );
  644.         self waittillmatch( "scripted_walk" );
  645.         return str_end_stomp;
  646.         if ( self.giant_robot_id == 0 && foot_side == "left" )
  647.         {
  648.             self thread toggle_wind_bunker_collision();
  649.         }
  650.         else
  651.         {
  652.             if ( self.giant_robot_id == 1 && foot_side == "left" )
  653.             {
  654.                 self thread toggle_tank_bunker_collision();
  655.             }
  656.         }
  657.         wait 0,5;
  658.         self thread toggle_kill_trigger_flag( trig_stomp_kill, 0, foot_side );
  659.     }
  660. }
  661.  
  662. monitor_footsteps_fx( trig_stomp_kill, foot_side )
  663. {
  664.     self endon( "death" );
  665.     self endon( "giant_robot_stop" );
  666.     str_end_stomp = "footstep_" + foot_side + "_large";
  667.     while ( 1 )
  668.     {
  669.         level setclientfield( "play_foot_stomp_fx_robot_" + self.giant_robot_id, 0 );
  670.         self waittillmatch( "scripted_walk" );
  671.         return str_end_stomp;
  672.         if ( foot_side == "right" )
  673.         {
  674.             level setclientfield( "play_foot_stomp_fx_robot_" + self.giant_robot_id, 1 );
  675.         }
  676.         else
  677.         {
  678.             level setclientfield( "play_foot_stomp_fx_robot_" + self.giant_robot_id, 2 );
  679.         }
  680.         trig_stomp_kill thread rumble_and_shake( self );
  681.         if ( self.giant_robot_id == 2 )
  682.         {
  683.             self thread church_ceiling_fxanim( foot_side );
  684.         }
  685.         else
  686.         {
  687.             if ( self.giant_robot_id == 0 )
  688.             {
  689.                 self thread play_pap_shake_fxanim( foot_side );
  690.             }
  691.         }
  692.         wait_network_frame();
  693.     }
  694. }
  695.  
  696. monitor_shadow_notetracks( foot_side )
  697. {
  698.     self endon( "death" );
  699.     self endon( "giant_robot_stop" );
  700.     while ( 1 )
  701.     {
  702.         self waittillmatch( "scripted_walk" );
  703.         return "shadow_" + foot_side;
  704.         start_robot_stomp_warning_vo( foot_side );
  705.     }
  706. }
  707.  
  708. rumble_and_shake( robot )
  709. {
  710.     a_players = get_players();
  711.     wait 0,2;
  712.     _a893 = a_players;
  713.     _k893 = getFirstArrayKey( _a893 );
  714.     while ( isDefined( _k893 ) )
  715.     {
  716.         player = _a893[ _k893 ];
  717.         if ( is_player_valid( player ) )
  718.         {
  719.             if ( isDefined( player.in_giant_robot_head ) )
  720.             {
  721.                 if ( isDefined( player.giant_robot_transition ) && player.giant_robot_transition )
  722.                 {
  723.                     break;
  724.                 }
  725.                 else
  726.                 {
  727.                     if ( player.in_giant_robot_head == robot.giant_robot_id )
  728.                     {
  729.                         player setclientfieldtoplayer( "giant_robot_rumble_and_shake", 2 );
  730.                     }
  731.                     else
  732.                     {
  733.                     }
  734.                 }
  735.                 else dist = distance( player.origin, self.origin );
  736.                 if ( dist < 1500 )
  737.                 {
  738.                     player setclientfieldtoplayer( "giant_robot_rumble_and_shake", 3 );
  739.                     level notify( "sam_clue_giant" );
  740.                 }
  741.                 else if ( dist < 3000 )
  742.                 {
  743.                     player setclientfieldtoplayer( "giant_robot_rumble_and_shake", 2 );
  744.                 }
  745.                 else if ( dist < 6000 )
  746.                 {
  747.                     player setclientfieldtoplayer( "giant_robot_rumble_and_shake", 1 );
  748.                 }
  749.                 else
  750.                 {
  751.                 }
  752.                 player thread turn_clientside_rumble_off();
  753.             }
  754.         }
  755.         _k893 = getNextArrayKey( _a893, _k893 );
  756.     }
  757. }
  758.  
  759. toggle_kill_trigger_flag( trig_stomp, b_flag, foot_side )
  760. {
  761.     if ( !isDefined( foot_side ) )
  762.     {
  763.         foot_side = undefined;
  764.     }
  765.     if ( b_flag )
  766.     {
  767.         self ent_flag_set( "kill_trigger_active" );
  768.         trig_stomp thread activate_kill_trigger( self, foot_side );
  769.     }
  770.     else
  771.     {
  772.         self ent_flag_clear( "kill_trigger_active" );
  773.         level notify( "stop_kill_trig_think" );
  774.         if ( self ent_flag( "robot_head_entered" ) )
  775.         {
  776.             self ent_flag_clear( "robot_head_entered" );
  777.             self thread giant_robot_close_head_entrance( foot_side );
  778.             level thread giant_robot_head_teleport_timeout( self.giant_robot_id );
  779.         }
  780.     }
  781. }
  782.  
  783. activate_kill_trigger( robot, foot_side )
  784. {
  785.     level endon( "stop_kill_trig_think" );
  786.     if ( foot_side == "left" )
  787.     {
  788.         str_foot_tag = "TAG_ATTACH_HATCH_LE";
  789.     }
  790.     else
  791.     {
  792.         if ( foot_side == "right" )
  793.         {
  794.             str_foot_tag = "TAG_ATTACH_HATCH_RI";
  795.         }
  796.     }
  797.     while ( robot ent_flag( "kill_trigger_active" ) )
  798.     {
  799.         a_zombies = getaispeciesarray( level.zombie_team, "all" );
  800.         a_zombies_to_kill = [];
  801.         _a985 = a_zombies;
  802.         _k985 = getFirstArrayKey( _a985 );
  803.         while ( isDefined( _k985 ) )
  804.         {
  805.             zombie = _a985[ _k985 ];
  806.             if ( distancesquared( zombie.origin, self.origin ) < 360000 )
  807.             {
  808.                 if ( isDefined( zombie.is_giant_robot ) && zombie.is_giant_robot )
  809.                 {
  810.                     break;
  811.                 }
  812.                 else
  813.                 {
  814.                     if ( isDefined( zombie.marked_for_death ) && zombie.marked_for_death )
  815.                     {
  816.                         break;
  817.                     }
  818.                     else
  819.                     {
  820.                         if ( isDefined( zombie.robot_stomped ) && zombie.robot_stomped )
  821.                         {
  822.                             break;
  823.                         }
  824.                         else
  825.                         {
  826.                             if ( zombie istouching( self ) )
  827.                             {
  828.                                 if ( isDefined( zombie.is_mechz ) && zombie.is_mechz )
  829.                                 {
  830.                                     zombie thread maps/mp/zombies/_zm_ai_mechz::mechz_robot_stomp_callback();
  831.                                     break;
  832.                                 }
  833.                                 else
  834.                                 {
  835.                                     zombie setgoalpos( zombie.origin );
  836.                                     zombie.marked_for_death = 1;
  837.                                     a_zombies_to_kill[ a_zombies_to_kill.size ] = zombie;
  838.                                     break;
  839.                                 }
  840.                                 else
  841.                                 {
  842.                                     if ( isDefined( zombie.is_mechz ) && !zombie.is_mechz && isDefined( zombie.has_legs ) && zombie.has_legs && isDefined( zombie.completed_emerging_into_playable_area ) && zombie.completed_emerging_into_playable_area )
  843.                                     {
  844.                                         n_my_z = zombie.origin[ 2 ];
  845.                                         v_giant_robot = robot gettagorigin( str_foot_tag );
  846.                                         n_giant_robot_z = v_giant_robot[ 2 ];
  847.                                         z_diff = abs( n_my_z - n_giant_robot_z );
  848.                                         if ( z_diff <= 100 )
  849.                                         {
  850.                                             zombie.v_punched_from = self.origin;
  851.                                             zombie animcustom( ::maps/mp/zombies/_zm_weap_one_inch_punch::knockdown_zombie_animate );
  852.                                         }
  853.                                     }
  854.                                 }
  855.                             }
  856.                         }
  857.                     }
  858.                 }
  859.             }
  860.             _k985 = getNextArrayKey( _a985, _k985 );
  861.         }
  862.         if ( a_zombies_to_kill.size > 0 )
  863.         {
  864.             level thread zombie_stomp_death( robot, a_zombies_to_kill );
  865.             robot thread zombie_stomped_by_gr_vo( foot_side );
  866.         }
  867.         if ( isDefined( level.maxis_quadrotor ) )
  868.         {
  869.             if ( level.maxis_quadrotor istouching( self ) )
  870.             {
  871.                 level.maxis_quadrotor thread quadrotor_stomp_death();
  872.             }
  873.         }
  874.         a_boxes = getentarray( "foot_box", "script_noteworthy" );
  875.         _a1052 = a_boxes;
  876.         _k1052 = getFirstArrayKey( _a1052 );
  877.         while ( isDefined( _k1052 ) )
  878.         {
  879.             m_box = _a1052[ _k1052 ];
  880.             if ( m_box istouching( self ) )
  881.             {
  882.                 m_box notify( "robot_foot_stomp" );
  883.             }
  884.             _k1052 = getNextArrayKey( _a1052, _k1052 );
  885.         }
  886.         players = get_players();
  887.         i = 0;
  888.         while ( i < players.size )
  889.         {
  890.             if ( is_player_valid( players[ i ], 0, 1 ) )
  891.             {
  892.                 if ( !players[ i ] istouching( self ) )
  893.                 {
  894.                     i++;
  895.                     continue;
  896.                 }
  897.                 else if ( players[ i ] is_in_giant_robot_footstep_safe_spot() )
  898.                 {
  899.                     i++;
  900.                     continue;
  901.                 }
  902.                 else if ( isDefined( players[ i ].in_giant_robot_head ) )
  903.                 {
  904.                     i++;
  905.                     continue;
  906.                 }
  907.                 else if ( isDefined( players[ i ].is_stomped ) && players[ i ].is_stomped )
  908.                 {
  909.                     i++;
  910.                     continue;
  911.                 }
  912.                 else
  913.                 {
  914.                     if ( !level.gr_foot_hatch_closed[ robot.giant_robot_id ] && isDefined( robot.hatch_foot ) && isDefined( robot.b_has_hatch ) && robot.b_has_hatch && issubstr( self.targetname, robot.hatch_foot ) && !self player_is_in_laststand() )
  915.                     {
  916.                         players[ i ].ignoreme = 1;
  917.                         players[ i ].teleport_initial_origin = self.origin;
  918.                         if ( robot.giant_robot_id == 0 )
  919.                         {
  920.                             level thread maps/mp/zm_tomb_teleporter::stargate_teleport_player( "head_0_teleport_player", players[ i ], 4, 0 );
  921.                             players[ i ].in_giant_robot_head = 0;
  922.                         }
  923.                         else if ( robot.giant_robot_id == 1 )
  924.                         {
  925.                             level thread maps/mp/zm_tomb_teleporter::stargate_teleport_player( "head_1_teleport_player", players[ i ], 4, 0 );
  926.                             players[ i ].in_giant_robot_head = 1;
  927.                             if ( players[ i ] maps/mp/zombies/_zm_zonemgr::player_in_zone( "zone_bunker_4d" ) || players[ i ] maps/mp/zombies/_zm_zonemgr::player_in_zone( "zone_bunker_4c" ) )
  928.                             {
  929.                                 players[ i ].entered_foot_from_tank_bunker = 1;
  930.                             }
  931.                         }
  932.                         else
  933.                         {
  934.                             level thread maps/mp/zm_tomb_teleporter::stargate_teleport_player( "head_2_teleport_player", players[ i ], 4, 0 );
  935.                             players[ i ].in_giant_robot_head = 2;
  936.                         }
  937.                         robot ent_flag_set( "robot_head_entered" );
  938.                         players[ i ] maps/mp/zombies/_zm_stats::increment_client_stat( "tomb_giant_robot_accessed", 0 );
  939.                         players[ i ] maps/mp/zombies/_zm_stats::increment_player_stat( "tomb_giant_robot_accessed" );
  940.                         players[ i ] playsoundtoplayer( "zmb_bot_elevator_ride_up", players[ i ] );
  941.                         start_wait = 0;
  942.                         black_screen_wait = 4;
  943.                         fade_in_time = 0,01;
  944.                         fade_out_time = 0,2;
  945.                         players[ i ] thread fadetoblackforxsec( start_wait, black_screen_wait, fade_in_time, fade_out_time, "white" );
  946.                         n_transition_time = start_wait + black_screen_wait + fade_in_time + fade_out_time;
  947.                         n_start_time = start_wait + fade_in_time;
  948.                         players[ i ] thread player_transition_into_robot_head_start( n_start_time );
  949.                         players[ i ] thread player_transition_into_robot_head_finish( n_transition_time );
  950.                         players[ i ] thread player_death_watch_on_giant_robot();
  951.                         i++;
  952.                         continue;
  953.                     }
  954.                     else if ( isDefined( players[ i ].dig_vars[ "has_helmet" ] ) && players[ i ].dig_vars[ "has_helmet" ] )
  955.                     {
  956.                         players[ i ] thread player_stomp_fake_death( robot );
  957.                     }
  958.                     else
  959.                     {
  960.                         players[ i ] thread player_stomp_death( robot );
  961.                     }
  962.                     start_wait = 0;
  963.                     black_screen_wait = 5;
  964.                     fade_in_time = 0,01;
  965.                     fade_out_time = 0,2;
  966.                     players[ i ] thread fadetoblackforxsec( start_wait, black_screen_wait, fade_in_time, fade_out_time, "black", 1 );
  967.                 }
  968.             }
  969.             i++;
  970.         }
  971.         wait 0,05;
  972.     }
  973. }
  974.  
  975. is_in_giant_robot_footstep_safe_spot()
  976. {
  977.     b_is_in_safe_spot = 0;
  978.     while ( isDefined( level.giant_robot_footstep_safe_spots ) )
  979.     {
  980.         _a1166 = level.giant_robot_footstep_safe_spots;
  981.         _k1166 = getFirstArrayKey( _a1166 );
  982.         while ( isDefined( _k1166 ) )
  983.         {
  984.             e_volume = _a1166[ _k1166 ];
  985.             if ( self istouching( e_volume ) )
  986.             {
  987.                 b_is_in_safe_spot = 1;
  988.                 break;
  989.             }
  990.             else
  991.             {
  992.                 _k1166 = getNextArrayKey( _a1166, _k1166 );
  993.             }
  994.         }
  995.     }
  996.     return b_is_in_safe_spot;
  997. }
  998.  
  999. player_stomp_death( robot )
  1000. {
  1001.     self endon( "death" );
  1002.     self endon( "disconnect" );
  1003.     self.is_stomped = 1;
  1004.     self playsound( "zmb_zombie_arc" );
  1005.     self freezecontrols( 1 );
  1006.     if ( self player_is_in_laststand() )
  1007.     {
  1008.         self shellshock( "explosion", 7 );
  1009.     }
  1010.     else
  1011.     {
  1012.         self dodamage( self.health, self.origin, robot );
  1013.     }
  1014.     self maps/mp/zombies/_zm_stats::increment_client_stat( "tomb_giant_robot_stomped", 0 );
  1015.     self maps/mp/zombies/_zm_stats::increment_player_stat( "tomb_giant_robot_stomped" );
  1016.     wait 5;
  1017.     self.is_stomped = 0;
  1018.     if ( isDefined( self.hostmigrationcontrolsfrozen ) && !self.hostmigrationcontrolsfrozen )
  1019.     {
  1020.         self freezecontrols( 0 );
  1021.     }
  1022.     self thread play_robot_crush_player_vo();
  1023. }
  1024.  
  1025. player_stomp_fake_death( robot )
  1026. {
  1027.     self endon( "death" );
  1028.     self endon( "disconnect" );
  1029.     self.is_stomped = 1;
  1030.     self playsound( "zmb_zombie_arc" );
  1031.     self freezecontrols( 1 );
  1032.     self setstance( "prone" );
  1033.     self shellshock( "explosion", 7 );
  1034.     wait 5;
  1035.     self.is_stomped = 0;
  1036.     if ( isDefined( self.hostmigrationcontrolsfrozen ) && !self.hostmigrationcontrolsfrozen )
  1037.     {
  1038.         self freezecontrols( 0 );
  1039.     }
  1040.     if ( isDefined( self.ee_stepped_on ) && !self.ee_stepped_on )
  1041.     {
  1042.         self maps/mp/zombies/_zm_audio::create_and_play_dialog( "general", "robot_crush_golden" );
  1043.         self.ee_stepped_on = 1;
  1044.     }
  1045. }
  1046.  
  1047. zombie_stomp_death( robot, a_zombies_to_kill )
  1048. {
  1049.     n_interval = 0;
  1050.     i = 0;
  1051.     while ( i < a_zombies_to_kill.size )
  1052.     {
  1053.         zombie = a_zombies_to_kill[ i ];
  1054.         if ( !isDefined( zombie ) || !isalive( zombie ) )
  1055.         {
  1056.             i++;
  1057.             continue;
  1058.         }
  1059.         else
  1060.         {
  1061.             zombie dodamage( zombie.health, zombie.origin, robot );
  1062.             n_interval++;
  1063.             if ( n_interval >= 4 )
  1064.             {
  1065.                 wait_network_frame();
  1066.                 n_interval = 0;
  1067.             }
  1068.         }
  1069.         i++;
  1070.     }
  1071. }
  1072.  
  1073. quadrotor_stomp_death()
  1074. {
  1075.     self endon( "death" );
  1076.     self delete();
  1077. }
  1078.  
  1079. toggle_wind_bunker_collision()
  1080. {
  1081.     s_org = getstruct( "wind_tunnel_bunker", "script_noteworthy" );
  1082.     v_foot = self gettagorigin( "TAG_ATTACH_HATCH_LE" );
  1083.     if ( distance2dsquared( s_org.origin, v_foot ) < 57600 )
  1084.     {
  1085.         level notify( "wind_bunker_collision_on" );
  1086.         wait 5;
  1087.         level notify( "wind_bunker_collision_off" );
  1088.     }
  1089. }
  1090.  
  1091. toggle_tank_bunker_collision()
  1092. {
  1093.     s_org = getstruct( "tank_bunker", "script_noteworthy" );
  1094.     v_foot = self gettagorigin( "TAG_ATTACH_HATCH_LE" );
  1095.     if ( distance2dsquared( s_org.origin, v_foot ) < 57600 )
  1096.     {
  1097.         level notify( "tank_bunker_collision_on" );
  1098.         wait 5;
  1099.         level notify( "tank_bunker_collision_off" );
  1100.     }
  1101. }
  1102.  
  1103. handle_wind_tunnel_bunker_collision()
  1104. {
  1105.     e_collision = getent( "clip_foot_bottom_wind", "targetname" );
  1106.     e_collision notsolid();
  1107.     e_collision connectpaths();
  1108.     while ( 1 )
  1109.     {
  1110.         level waittill( "wind_bunker_collision_on" );
  1111.         wait 0,1;
  1112.         e_collision solid();
  1113.         e_collision disconnectpaths();
  1114.         level waittill( "wind_bunker_collision_off" );
  1115.         e_collision notsolid();
  1116.         e_collision connectpaths();
  1117.     }
  1118. }
  1119.  
  1120. handle_tank_bunker_collision()
  1121. {
  1122.     e_collision = getent( "clip_foot_bottom_tank", "targetname" );
  1123.     e_collision notsolid();
  1124.     e_collision connectpaths();
  1125.     while ( 1 )
  1126.     {
  1127.         level waittill( "tank_bunker_collision_on" );
  1128.         wait 0,1;
  1129.         e_collision solid();
  1130.         e_collision disconnectpaths();
  1131.         level waittill( "tank_bunker_collision_off" );
  1132.         e_collision notsolid();
  1133.         e_collision connectpaths();
  1134.     }
  1135. }
  1136.  
  1137. church_ceiling_fxanim( foot_side )
  1138. {
  1139.     if ( foot_side == "left" )
  1140.     {
  1141.         tag_foot = self gettagorigin( "TAG_ATTACH_HATCH_LE" );
  1142.     }
  1143.     else
  1144.     {
  1145.         tag_foot = self gettagorigin( "TAG_ATTACH_HATCH_RI" );
  1146.     }
  1147.     s_church = getstruct( "giant_robot_church_marker", "targetname" );
  1148.     n_distance = distance2dsquared( tag_foot, s_church.origin );
  1149.     if ( n_distance < 1000000 )
  1150.     {
  1151.         level setclientfield( "church_ceiling_fxanim", 1 );
  1152.         wait_network_frame();
  1153.         level setclientfield( "church_ceiling_fxanim", 0 );
  1154.     }
  1155. }
  1156.  
  1157. play_pap_shake_fxanim( foot_side )
  1158. {
  1159.     if ( foot_side == "left" )
  1160.     {
  1161.         tag_foot = self gettagorigin( "TAG_ATTACH_HATCH_LE" );
  1162.     }
  1163.     else
  1164.     {
  1165.         tag_foot = self gettagorigin( "TAG_ATTACH_HATCH_RI" );
  1166.     }
  1167.     s_pap = getstruct( "giant_robot_pap_marker", "targetname" );
  1168.     wait 0,2;
  1169.     n_distance = distance2dsquared( tag_foot, s_pap.origin );
  1170.     if ( n_distance < 2250000 )
  1171.     {
  1172.         level setclientfield( "pap_monolith_ring_shake", 1 );
  1173.         wait_network_frame();
  1174.         level setclientfield( "pap_monolith_ring_shake", 0 );
  1175.     }
  1176. }
  1177.  
  1178. player_transition_into_robot_head_start( n_start_time )
  1179. {
  1180.     self endon( "death" );
  1181.     self endon( "disconnect" );
  1182.     self.giant_robot_transition = 1;
  1183.     self.dontspeak = 1;
  1184.     self setclientfieldtoplayer( "giant_robot_rumble_and_shake", 3 );
  1185.     wait 1,5;
  1186.     self setclientfieldtoplayer( "player_rumble_and_shake", 4 );
  1187. }
  1188.  
  1189. player_transition_into_robot_head_finish( n_transition_time )
  1190. {
  1191.     self endon( "death" );
  1192.     self endon( "disconnect" );
  1193.     wait n_transition_time;
  1194.     self setclientfieldtoplayer( "player_rumble_and_shake", 0 );
  1195.     self setclientfieldtoplayer( "giant_robot_rumble_and_shake", 0 );
  1196.     self.giant_robot_transition = 0;
  1197.     wait 2;
  1198.     if ( !flag( "story_vo_playing" ) )
  1199.     {
  1200.         self.dontspeak = 0;
  1201.         self maps/mp/zombies/_zm_audio::create_and_play_dialog( "general", "enter_robot" );
  1202.     }
  1203.     if ( !isDefined( level.sndrobotheadcount ) || level.sndrobotheadcount == 0 )
  1204.     {
  1205.         level.sndrobotheadcount = 4;
  1206.         level thread maps/mp/zombies/_zm_audio::sndmusicstingerevent( "zone_robot_head" );
  1207.     }
  1208.     else
  1209.     {
  1210.         level.sndrobotheadcount--;
  1211.  
  1212.     }
  1213. }
  1214.  
  1215. gr_head_exit_trigger_start( s_origin )
  1216. {
  1217.     s_origin.unitrigger_stub = spawnstruct();
  1218.     s_origin.unitrigger_stub.origin = s_origin.origin;
  1219.     s_origin.unitrigger_stub.radius = 36;
  1220.     s_origin.unitrigger_stub.height = 256;
  1221.     s_origin.unitrigger_stub.script_unitrigger_type = "unitrigger_radius_use";
  1222.     s_origin.unitrigger_stub.hint_string = &"ZM_TOMB_EHT";
  1223.     s_origin.unitrigger_stub.cursor_hint = "HINT_NOICON";
  1224.     s_origin.unitrigger_stub.require_look_at = 1;
  1225.     s_origin.unitrigger_stub.target = s_origin.target;
  1226.     s_origin.unitrigger_stub.script_int = s_origin.script_int;
  1227.     s_origin.unitrigger_stub.is_available = 1;
  1228.     s_origin.unitrigger_stub.prompt_and_visibility_func = ::gr_head_eject_trigger_visibility;
  1229.     maps/mp/zombies/_zm_unitrigger::unitrigger_force_per_player_triggers( s_origin.unitrigger_stub, 1 );
  1230.     maps/mp/zombies/_zm_unitrigger::register_static_unitrigger( s_origin.unitrigger_stub, ::player_exits_giant_robot_head_trigger_think );
  1231. }
  1232.  
  1233. gr_head_eject_trigger_visibility( player )
  1234. {
  1235.     if ( isDefined( self.stub.is_available )b_is_invis = !self.stub.is_available;
  1236.     self setinvisibletoplayer( player, b_is_invis );
  1237.     self sethintstring( self.stub.hint_string );
  1238.     return !b_is_invis;
  1239. }
  1240.  
  1241. reset_gr_head_unitriggers()
  1242. {
  1243.     maps/mp/zombies/_zm_unitrigger::unregister_unitrigger( self.unitrigger_stub );
  1244.     maps/mp/zombies/_zm_unitrigger::register_static_unitrigger( self.unitrigger_stub, ::player_exits_giant_robot_head_trigger_think );
  1245. }
  1246.  
  1247. player_exits_giant_robot_head_trigger_think()
  1248. {
  1249.     self endon( "tube_used_for_timeout" );
  1250.     while ( 1 )
  1251.     {
  1252.         self waittill( "trigger", player );
  1253.         if ( isDefined( self.stub.is_available ) && !self.stub.is_available )
  1254.         {
  1255.             continue;
  1256.         }
  1257.         if ( !isplayer( player ) || !is_player_valid( player ) )
  1258.         {
  1259.             continue;
  1260.         }
  1261.         level thread init_player_eject_logic( self.stub, player );
  1262.         self.stub.is_available = 0;
  1263.     }
  1264. }
  1265.  
  1266. init_player_eject_logic( s_unitrigger, player, b_timeout )
  1267. {
  1268.     if ( !isDefined( b_timeout ) )
  1269.     {
  1270.         b_timeout = 0;
  1271.     }
  1272.     s_unitrigger.is_available = 0;
  1273.     s_origin = getstruct( s_unitrigger.target, "targetname" );
  1274.     v_origin = s_origin.origin;
  1275.     v_angles = s_origin.angles;
  1276.     m_linkpoint = spawn_model( "tag_origin", v_origin, v_angles );
  1277.     if ( isDefined( level.giant_robot_head_player_eject_thread_custom_func ) )
  1278.     {
  1279.         player thread [[ level.giant_robot_head_player_eject_thread_custom_func ]]( m_linkpoint, s_origin.script_noteworthy, b_timeout );
  1280.     }
  1281.     else
  1282.     {
  1283.         player thread giant_robot_head_player_eject_thread( m_linkpoint, s_origin.script_noteworthy, b_timeout );
  1284.     }
  1285.     tube_clone = player maps/mp/zombies/_zm_clone::spawn_player_clone( player, player.origin, undefined );
  1286.     player thread giant_robot_eject_disconnect_watcher( m_linkpoint, tube_clone );
  1287.     tube_clone linkto( m_linkpoint, "tag_origin", ( 0, 0, 1 ), ( 0, 0, 1 ) );
  1288.     tube_clone.ignoreme = 1;
  1289.     tube_clone show();
  1290.     tube_clone detachall();
  1291.     tube_clone setvisibletoall();
  1292.     tube_clone setinvisibletoplayer( player );
  1293.     tube_clone maps/mp/zombies/_zm_clone::clone_animate( "idle" );
  1294.     tube_clone thread tube_clone_falls_to_earth( m_linkpoint );
  1295.     m_linkpoint waittill( "movedone" );
  1296.     wait 6;
  1297.     s_unitrigger.is_available = 1;
  1298. }
  1299.  
  1300. giant_robot_head_player_eject_thread( m_linkpoint, str_tube, b_timeout )
  1301. {
  1302.     if ( !isDefined( b_timeout ) )
  1303.     {
  1304.         b_timeout = 0;
  1305.     }
  1306.     self endon( "death_or_disconnect" );
  1307.     self maps/mp/zm_tomb_giant_robot_ffotd::giant_robot_head_player_eject_start();
  1308.     str_current_weapon = self getcurrentweapon();
  1309.     self disableweapons();
  1310.     self disableoffhandweapons();
  1311.     self enableinvulnerability();
  1312.     self setstance( "stand" );
  1313.     self allowstand( 1 );
  1314.     self allowcrouch( 0 );
  1315.     self allowprone( 0 );
  1316.     self playerlinktodelta( m_linkpoint, "tag_origin", 1, 20, 20, 20, 20 );
  1317.     self setplayerangles( m_linkpoint.angles );
  1318.     self ghost();
  1319.     self.dontspeak = 1;
  1320.     self setclientfieldtoplayer( "isspeaking", 1 );
  1321.     self notify( "teleport" );
  1322.     self.giant_robot_transition = 1;
  1323.     self playsoundtoplayer( "zmb_bot_timeout_alarm", self );
  1324.     self.old_angles = self.angles;
  1325.     if ( !b_timeout )
  1326.     {
  1327.         self setclientfield( "eject_steam_fx", 1 );
  1328.         self thread in_tube_manual_looping_rumble();
  1329.         wait 3;
  1330.     }
  1331.     self stopsounds();
  1332.     wait_network_frame();
  1333.     self playsoundtoplayer( "zmb_giantrobot_exit", self );
  1334.     self notify( "end_in_tube_rumble" );
  1335.     self thread exit_gr_manual_looping_rumble();
  1336.     m_linkpoint moveto( m_linkpoint.origin + vectorScale( ( 0, 0, 1 ), 2000 ), 2,5 );
  1337.     self thread fadetoblackforxsec( 0, 2, 1, 0, "white" );
  1338.     wait 1;
  1339.     m_linkpoint moveto( self.teleport_initial_origin + vectorScale( ( 0, 0, 1 ), 3000 ), 0,05 );
  1340.     m_linkpoint.angles = vectorScale( ( 0, 0, 1 ), 90 );
  1341.     self enableweapons();
  1342.     self giveweapon( "falling_hands_tomb_zm" );
  1343.     self switchtoweaponimmediate( "falling_hands_tomb_zm" );
  1344.     self setweaponammoclip( "falling_hands_tomb_zm", 0 );
  1345.     wait 1;
  1346.     self playsoundtoplayer( "zmb_giantrobot_fall", self );
  1347.     self playerlinktodelta( m_linkpoint, "tag_origin", 1, 180, 180, 20, 20 );
  1348.     m_linkpoint moveto( self.teleport_initial_origin, 3, 1 );
  1349.     m_linkpoint thread play_gr_eject_impact_player_fx( self );
  1350.     m_linkpoint notify( "start_gr_eject_fall_to_earth" );
  1351.     self thread player_screams_while_falling();
  1352.     wait 2,75;
  1353.     self thread fadetoblackforxsec( 0, 1, 0, 0,5, "black" );
  1354.     self waittill( "gr_eject_fall_complete" );
  1355.     self takeweapon( "falling_hands_tomb_zm" );
  1356.     if ( isDefined( str_current_weapon ) && str_current_weapon != "none" )
  1357.     {
  1358.         self switchtoweaponimmediate( str_current_weapon );
  1359.     }
  1360.     self enableoffhandweapons();
  1361.     self unlink();
  1362.     m_linkpoint delete();
  1363.     self teleport_player_to_gr_footprint_safe_spot();
  1364.     self show();
  1365.     self setplayerangles( self.old_angles );
  1366.     self disableinvulnerability();
  1367.     self.dontspeak = 0;
  1368.     self allowstand( 1 );
  1369.     self allowcrouch( 1 );
  1370.     self allowprone( 1 );
  1371.     self setclientfieldtoplayer( "isspeaking", 0 );
  1372.     self.in_giant_robot_head = undefined;
  1373.     self.teleport_initial_origin = undefined;
  1374.     self.old_angles = undefined;
  1375.     self thread gr_eject_landing_rumble();
  1376.     self thread gr_eject_landing_rumble_on_position();
  1377.     self setclientfield( "eject_steam_fx", 0 );
  1378.     n_post_eject_time = 2,5;
  1379.     self setstance( "prone" );
  1380.     self shellshock( "explosion", n_post_eject_time );
  1381.     self.giant_robot_transition = 0;
  1382.     self notify( "gr_eject_sequence_complete" );
  1383.     if ( !flag( "story_vo_playing" ) )
  1384.     {
  1385.         self delay_thread( 3, ::maps/mp/zombies/_zm_audio::create_and_play_dialog, "general", "air_chute_landing" );
  1386.     }
  1387. /#
  1388.     debug_level = getDvarInt( "zombie_cheat" );
  1389.     if ( isDefined( debug_level ) && debug_level )
  1390.     {
  1391.         self enableinvulnerability();
  1392. #/
  1393.     }
  1394.     wait n_post_eject_time;
  1395.     self.ignoreme = 0;
  1396.     self maps/mp/zm_tomb_giant_robot_ffotd::giant_robot_head_player_eject_end();
  1397. }
  1398.  
  1399. player_screams_while_falling()
  1400. {
  1401.     self endon( "disconnect" );
  1402.     self stopsounds();
  1403.     wait_network_frame();
  1404.     self playsoundtoplayer( "vox_plr_" + self.characterindex + "_exit_robot_0", self );
  1405. }
  1406.  
  1407. tube_clone_falls_to_earth( m_linkpoint )
  1408. {
  1409.     m_linkpoint waittill( "start_gr_eject_fall_to_earth" );
  1410.     self maps/mp/zombies/_zm_clone::clone_animate( "falling" );
  1411.     m_linkpoint waittill( "movedone" );
  1412.     self delete();
  1413. }
  1414.  
  1415. in_tube_manual_looping_rumble()
  1416. {
  1417.     self endon( "end_in_tube_rumble" );
  1418.     self endon( "death" );
  1419.     self endon( "disconnect" );
  1420.     while ( 1 )
  1421.     {
  1422.         self setclientfieldtoplayer( "giant_robot_rumble_and_shake", 1 );
  1423.         wait_network_frame();
  1424.         self setclientfieldtoplayer( "giant_robot_rumble_and_shake", 0 );
  1425.         wait_network_frame();
  1426.         wait 0,1;
  1427.     }
  1428. }
  1429.  
  1430. exit_gr_manual_looping_rumble()
  1431. {
  1432.     self endon( "end_exit_gr_rumble" );
  1433.     self endon( "death" );
  1434.     self endon( "disconnect" );
  1435.     while ( 1 )
  1436.     {
  1437.         self setclientfieldtoplayer( "giant_robot_rumble_and_shake", 1 );
  1438.         wait_network_frame();
  1439.         self setclientfieldtoplayer( "giant_robot_rumble_and_shake", 0 );
  1440.         wait_network_frame();
  1441.         wait 0,1;
  1442.     }
  1443. }
  1444.  
  1445. gr_eject_landing_rumble()
  1446. {
  1447.     self endon( "death" );
  1448.     self endon( "disconnect" );
  1449.     self notify( "end_exit_gr_rumble" );
  1450.     wait_network_frame();
  1451.     self setclientfieldtoplayer( "giant_robot_rumble_and_shake", 0 );
  1452.     wait_network_frame();
  1453.     self setclientfieldtoplayer( "giant_robot_rumble_and_shake", 3 );
  1454.     wait_network_frame();
  1455.     self setclientfieldtoplayer( "giant_robot_rumble_and_shake", 0 );
  1456. }
  1457.  
  1458. gr_eject_landing_rumble_on_position()
  1459. {
  1460.     self endon( "death" );
  1461.     self endon( "disconnect" );
  1462.     a_players = getplayers();
  1463.     _a1781 = a_players;
  1464.     _k1781 = getFirstArrayKey( _a1781 );
  1465.     while ( isDefined( _k1781 ) )
  1466.     {
  1467.         player = _a1781[ _k1781 ];
  1468.         if ( player == self )
  1469.         {
  1470.         }
  1471.         else if ( isDefined( player.giant_robot_transition ) && player.giant_robot_transition )
  1472.         {
  1473.         }
  1474.         else
  1475.         {
  1476.             if ( distance2dsquared( player.origin, self.origin ) < 250000 )
  1477.             {
  1478.                 player thread gr_eject_landing_rumble();
  1479.             }
  1480.         }
  1481.         _k1781 = getNextArrayKey( _a1781, _k1781 );
  1482.     }
  1483. }
  1484.  
  1485. teleport_player_to_gr_footprint_safe_spot()
  1486. {
  1487.     self endon( "death" );
  1488.     self endon( "disconnect" );
  1489.     if ( isDefined( self.entered_foot_from_tank_bunker ) && self.entered_foot_from_tank_bunker )
  1490.     {
  1491.         a_s_orgs = getstructarray( "tank_platform_safe_spots", "targetname" );
  1492.         _a1809 = a_s_orgs;
  1493.         _k1809 = getFirstArrayKey( _a1809 );
  1494.         while ( isDefined( _k1809 ) )
  1495.         {
  1496.             struct = _a1809[ _k1809 ];
  1497.             if ( !positionwouldtelefrag( struct.origin ) )
  1498.             {
  1499.                 self setorigin( struct.origin );
  1500.                 break;
  1501.             }
  1502.             else
  1503.             {
  1504.                 _k1809 = getNextArrayKey( _a1809, _k1809 );
  1505.             }
  1506.         }
  1507.         self.entered_foot_from_tank_bunker = 0;
  1508.         return;
  1509.     }
  1510.     a_s_footprints = getstructarray( "giant_robot_footprint", "targetname" );
  1511.     a_s_footprints = get_array_of_closest( self.teleport_initial_origin, a_s_footprints );
  1512.     s_footprint = a_s_footprints[ 0 ];
  1513.     a_v_offset = [];
  1514.     a_v_offset[ 0 ] = ( 0, 0, 1 );
  1515.     a_v_offset[ 1 ] = vectorScale( ( 0, 0, 1 ), 50 );
  1516.     a_v_offset[ 2 ] = vectorScale( ( 0, 0, 1 ), 50 );
  1517.     a_v_offset[ 3 ] = vectorScale( ( 0, 0, 1 ), 50 );
  1518.     a_v_offset[ 4 ] = vectorScale( ( 0, 0, 1 ), 50 );
  1519.     a_v_offset[ 5 ] = vectorScale( ( 0, 0, 1 ), 50 );
  1520.     a_v_offset[ 6 ] = vectorScale( ( 0, 0, 1 ), 50 );
  1521.     a_v_offset[ 7 ] = vectorScale( ( 0, 0, 1 ), 50 );
  1522.     a_v_offset[ 8 ] = vectorScale( ( 0, 0, 1 ), 50 );
  1523.     i = 0;
  1524.     while ( i < a_v_offset.size )
  1525.     {
  1526.         v_origin = s_footprint.origin + a_v_offset[ i ];
  1527.         v_trace_start = v_origin + vectorScale( ( 0, 0, 1 ), 100 );
  1528.         v_final = playerphysicstrace( v_trace_start, v_origin );
  1529.         if ( !positionwouldtelefrag( v_final ) )
  1530.         {
  1531.             self setorigin( v_final );
  1532.             return;
  1533.         }
  1534.         else
  1535.         {
  1536.             i++;
  1537.         }
  1538.     }
  1539. }
  1540.  
  1541. giant_robot_head_teleport_timeout( n_robot_id )
  1542. {
  1543.     wait 15;
  1544.     n_players_in_robot = count_players_in_gr_head( n_robot_id );
  1545.     if ( n_players_in_robot == 0 )
  1546.     {
  1547.         return;
  1548.     }
  1549.     while ( flag( "maxis_audiolog_gr" + n_robot_id + "_playing" ) )
  1550.     {
  1551.         wait 0,1;
  1552.     }
  1553.     n_players_in_robot = count_players_in_gr_head( n_robot_id );
  1554.     if ( n_players_in_robot == 0 )
  1555.     {
  1556.         return;
  1557.     }
  1558.     level thread play_timeout_warning_vo( n_robot_id );
  1559.     maps/mp/zm_tomb_vo::reset_maxis_audiolog_unitrigger( n_robot_id );
  1560.     level setclientfield( "eject_warning_fx_robot_" + n_robot_id, 1 );
  1561.     a_players = getplayers();
  1562.     a_players[ 0 ] setclientfield( "all_tubes_play_eject_steam_fx", 1 );
  1563.     level waittill( "timeout_warning_vo_complete_" + n_robot_id );
  1564.     a_gr_head_triggers = getstructarray( "giant_robot_head_exit_trigger", "script_noteworthy" );
  1565.     a_shutdown_triggers = [];
  1566.     _a1896 = a_gr_head_triggers;
  1567.     _k1896 = getFirstArrayKey( _a1896 );
  1568.     while ( isDefined( _k1896 ) )
  1569.     {
  1570.         trigger = _a1896[ _k1896 ];
  1571.         if ( trigger.script_int == n_robot_id )
  1572.         {
  1573.             if ( isDefined( trigger.unitrigger_stub.is_available ) && trigger.unitrigger_stub.is_available )
  1574.             {
  1575.                 maps/mp/zombies/_zm_unitrigger::unregister_unitrigger( trigger.unitrigger_stub );
  1576.                 a_shutdown_triggers[ a_shutdown_triggers.size ] = trigger;
  1577.             }
  1578.         }
  1579.         _k1896 = getNextArrayKey( _a1896, _k1896 );
  1580.     }
  1581.     a_players = getplayers();
  1582.     a_m_linkspots = [];
  1583.     _a1911 = a_players;
  1584.     _k1911 = getFirstArrayKey( _a1911 );
  1585.     while ( isDefined( _k1911 ) )
  1586.     {
  1587.         player = _a1911[ _k1911 ];
  1588.         if ( isDefined( player.in_giant_robot_head ) && player.in_giant_robot_head == n_robot_id )
  1589.         {
  1590.             if ( isDefined( player.giant_robot_transition ) && !player.giant_robot_transition )
  1591.             {
  1592.                 if ( player player_is_in_laststand() )
  1593.                 {
  1594.                     if ( isDefined( player.waiting_to_revive ) && player.waiting_to_revive && a_players.size <= 1 )
  1595.                     {
  1596.                         flag_set( "instant_revive" );
  1597.                         player.stopflashingbadlytime = getTime() + 1000;
  1598.                         wait_network_frame();
  1599.                         flag_clear( "instant_revive" );
  1600.                         break;
  1601.                     }
  1602.                     else
  1603.                     {
  1604.                         player thread maps/mp/zombies/_zm_laststand::bleed_out();
  1605.                         player notify( "gr_head_forced_bleed_out" );
  1606.                         break;
  1607.                     }
  1608.                 }
  1609.                 else
  1610.                 {
  1611.                     if ( isalive( player ) )
  1612.                     {
  1613.                         m_linkspot = spawn_model( "tag_origin", player.origin, player.angles );
  1614.                         a_m_linkspots[ a_m_linkspots.size ] = m_linkspot;
  1615.                         player start_drag_player_to_eject_tube( n_robot_id, m_linkspot );
  1616.                         wait 0,1;
  1617.                     }
  1618.                 }
  1619.             }
  1620.         }
  1621.         _k1911 = getNextArrayKey( _a1911, _k1911 );
  1622.     }
  1623.     wait 10;
  1624.     maps/mp/zm_tomb_vo::restart_maxis_audiolog_unitrigger( n_robot_id );
  1625.     level setclientfield( "eject_warning_fx_robot_" + n_robot_id, 0 );
  1626.     a_players = getplayers();
  1627.     a_players[ 0 ] setclientfield( "all_tubes_play_eject_steam_fx", 0 );
  1628.     _a1958 = a_shutdown_triggers;
  1629.     _k1958 = getFirstArrayKey( _a1958 );
  1630.     while ( isDefined( _k1958 ) )
  1631.     {
  1632.         trigger = _a1958[ _k1958 ];
  1633.         if ( trigger.script_int == n_robot_id )
  1634.         {
  1635.             trigger thread reset_gr_head_unitriggers();
  1636.         }
  1637.         _k1958 = getNextArrayKey( _a1958, _k1958 );
  1638.     }
  1639.     while ( a_m_linkspots.size > 0 )
  1640.     {
  1641.         i = 0;
  1642.         while ( i < a_m_linkspots.size )
  1643.         {
  1644.             if ( isDefined( a_m_linkspots[ i ] ) )
  1645.             {
  1646.                 a_m_linkspots[ i ] delete();
  1647.             }
  1648.             i++;
  1649.         }
  1650.     }
  1651. }
  1652.  
  1653. start_drag_player_to_eject_tube( n_robot_id, m_linkspot )
  1654. {
  1655.     self endon( "death" );
  1656.     self endon( "disconnect" );
  1657.     a_gr_head_triggers = getstructarray( "giant_robot_head_exit_trigger", "script_noteworthy" );
  1658.     a_gr_head_triggers = get_array_of_closest( self.origin, a_gr_head_triggers );
  1659.     _a1987 = a_gr_head_triggers;
  1660.     _k1987 = getFirstArrayKey( _a1987 );
  1661.     while ( isDefined( _k1987 ) )
  1662.     {
  1663.         trigger = _a1987[ _k1987 ];
  1664.         if ( trigger.unitrigger_stub.script_int == n_robot_id )
  1665.         {
  1666.             if ( isDefined( trigger.unitrigger_stub.is_available ) && trigger.unitrigger_stub.is_available )
  1667.             {
  1668.                 self thread in_tube_manual_looping_rumble();
  1669.                 trigger.unitrigger_stub.is_available = 0;
  1670.                 s_tube = getstruct( trigger.target, "targetname" );
  1671.                 self playerlinktodelta( m_linkspot, "tag_origin", 1, 20, 20, 20, 20 );
  1672.                 self thread move_player_to_eject_tube( m_linkspot, s_tube, trigger );
  1673.                 return;
  1674.             }
  1675.         }
  1676.         else
  1677.         {
  1678.             _k1987 = getNextArrayKey( _a1987, _k1987 );
  1679.         }
  1680.     }
  1681. }
  1682.  
  1683. move_player_to_eject_tube( m_linkspot, s_tube, trigger )
  1684. {
  1685.     self endon( "death" );
  1686.     self endon( "disconnect" );
  1687.     self.giant_robot_transition = 1;
  1688.     n_speed = 500;
  1689.     n_dist = distance( m_linkspot.origin, s_tube.origin );
  1690.     n_time = n_dist / n_speed;
  1691.     m_linkspot moveto( s_tube.origin, n_time );
  1692.     m_linkspot waittill( "movedone" );
  1693.     m_linkspot delete();
  1694.     level thread init_player_eject_logic( trigger.unitrigger_stub, self, 1 );
  1695. }
  1696.  
  1697. sndalarmtimeout()
  1698. {
  1699.     self endon( "teleport" );
  1700.     self endon( "disconnect" );
  1701.     self playsoundtoplayer( "zmb_bot_timeout_alarm", self );
  1702.     wait 2,5;
  1703.     self playsoundtoplayer( "zmb_bot_timeout_alarm", self );
  1704. }
  1705.  
  1706. play_gr_eject_impact_player_fx( player )
  1707. {
  1708.     player endon( "death" );
  1709.     player endon( "disconnect" );
  1710.     self waittill( "movedone" );
  1711.     player setclientfield( "gr_eject_player_impact_fx", 1 );
  1712.     wait_network_frame();
  1713.     player notify( "gr_eject_fall_complete" );
  1714.     wait 1;
  1715.     player setclientfield( "gr_eject_player_impact_fx", 0 );
  1716. }
  1717.  
  1718. player_death_watch_on_giant_robot()
  1719. {
  1720.     self endon( "disconnect" );
  1721.     self endon( "gr_eject_sequence_complete" );
  1722.     self waittill_either( "bled_out", "gr_head_forced_bleed_out" );
  1723.     self.entered_foot_from_tank_bunker = undefined;
  1724.     self.giant_robot_transition = undefined;
  1725.     self.in_giant_robot_head = undefined;
  1726.     self.ignoreme = 0;
  1727.     self.dontspeak = 0;
  1728. }
  1729.  
  1730. giant_robot_eject_disconnect_watcher( m_linkpoint, tube_clone )
  1731. {
  1732.     self endon( "gr_eject_sequence_complete" );
  1733.     self waittill( "disconnect" );
  1734.     if ( isDefined( m_linkpoint ) )
  1735.     {
  1736.         m_linkpoint delete();
  1737.     }
  1738.     if ( isDefined( tube_clone ) )
  1739.     {
  1740.         tube_clone delete();
  1741.     }
  1742. }
  1743.  
  1744. turn_clientside_rumble_off()
  1745. {
  1746.     self endon( "death" );
  1747.     self endon( "disconnect" );
  1748.     wait_network_frame();
  1749.     self setclientfieldtoplayer( "giant_robot_rumble_and_shake", 0 );
  1750. }
  1751.  
  1752. spawn_model( model_name, origin, angles, n_spawnflags )
  1753. {
  1754.     if ( !isDefined( n_spawnflags ) )
  1755.     {
  1756.         n_spawnflags = 0;
  1757.     }
  1758.     if ( !isDefined( origin ) )
  1759.     {
  1760.         origin = ( 0, 0, 1 );
  1761.     }
  1762.     model = spawn( "script_model", origin, n_spawnflags );
  1763.     model setmodel( model_name );
  1764.     if ( isDefined( angles ) )
  1765.     {
  1766.         model.angles = angles;
  1767.     }
  1768.     return model;
  1769. }
  1770.  
  1771. count_players_in_gr_head( n_robot_id )
  1772. {
  1773.     n_players_in_robot = 0;
  1774.     a_players = getplayers();
  1775.     _a2116 = a_players;
  1776.     _k2116 = getFirstArrayKey( _a2116 );
  1777.     while ( isDefined( _k2116 ) )
  1778.     {
  1779.         player = _a2116[ _k2116 ];
  1780.         if ( isDefined( player.in_giant_robot_head ) && player.in_giant_robot_head == n_robot_id )
  1781.         {
  1782.             n_players_in_robot++;
  1783.         }
  1784.         _k2116 = getNextArrayKey( _a2116, _k2116 );
  1785.     }
  1786.     return n_players_in_robot;
  1787. }
  1788.  
  1789. tomb_standard_intermission()
  1790. {
  1791.     self closemenu();
  1792.     self closeingamemenu();
  1793.     level endon( "stop_intermission" );
  1794.     self endon( "disconnect" );
  1795.     self endon( "death" );
  1796.     self notify( "_zombie_game_over" );
  1797.     level thread setup_giant_robots_intermission();
  1798.     self.score = self.score_total;
  1799.     self.sessionstate = "intermission";
  1800.     self.spectatorclient = -1;
  1801.     self.killcamentity = -1;
  1802.     self.archivetime = 0;
  1803.     self.psoffsettime = 0;
  1804.     self.friendlydamage = undefined;
  1805.     points = getstructarray( "intermission", "targetname" );
  1806.     if ( !isDefined( points ) || points.size == 0 )
  1807.     {
  1808.         points = getentarray( "info_intermission", "classname" );
  1809.         if ( points.size < 1 )
  1810.         {
  1811. /#
  1812.             println( "NO info_intermission POINTS IN MAP" );
  1813. #/
  1814.             return;
  1815.         }
  1816.     }
  1817.     self.game_over_bg = newclienthudelem( self );
  1818.     self.game_over_bg.horzalign = "fullscreen";
  1819.     self.game_over_bg.vertalign = "fullscreen";
  1820.     self.game_over_bg setshader( "black", 640, 480 );
  1821.     self.game_over_bg.alpha = 1;
  1822.     org = undefined;
  1823.     while ( 1 )
  1824.     {
  1825.         points = array_randomize( points );
  1826.         i = 0;
  1827.         while ( i < points.size )
  1828.         {
  1829.             point = points[ i ];
  1830.             if ( !isDefined( org ) )
  1831.             {
  1832.                 self spawn( point.origin, point.angles );
  1833.             }
  1834.             if ( isDefined( points[ i ].target ) )
  1835.             {
  1836.                 if ( !isDefined( org ) )
  1837.                 {
  1838.                     org = spawn( "script_model", self.origin + vectorScale( ( 0, 0, 1 ), 60 ) );
  1839.                     org setmodel( "tag_origin" );
  1840.                 }
  1841.                 org.origin = points[ i ].origin;
  1842.                 org.angles = points[ i ].angles;
  1843.                 j = 0;
  1844.                 while ( j < get_players().size )
  1845.                 {
  1846.                     player = get_players()[ j ];
  1847.                     player camerasetposition( org );
  1848.                     player camerasetlookat();
  1849.                     player cameraactivate( 1 );
  1850.                     j++;
  1851.                 }
  1852.                 speed = 20;
  1853.                 if ( isDefined( points[ i ].speed ) )
  1854.                 {
  1855.                     speed = points[ i ].speed;
  1856.                 }
  1857.                 target_point = getstruct( points[ i ].target, "targetname" );
  1858.                 dist = distance( points[ i ].origin, target_point.origin );
  1859.                 time = dist / speed;
  1860.                 q_time = time * 0,25;
  1861.                 if ( q_time > 1 )
  1862.                 {
  1863.                     q_time = 1;
  1864.                 }
  1865.                 self.game_over_bg fadeovertime( q_time );
  1866.                 self.game_over_bg.alpha = 0;
  1867.                 org moveto( target_point.origin, time, q_time, q_time );
  1868.                 org rotateto( target_point.angles, time, q_time, q_time );
  1869.                 wait ( time - q_time );
  1870.                 self.game_over_bg fadeovertime( q_time );
  1871.                 self.game_over_bg.alpha = 1;
  1872.                 wait q_time;
  1873.                 i++;
  1874.                 continue;
  1875.             }
  1876.             else
  1877.             {
  1878.                 self.game_over_bg fadeovertime( 1 );
  1879.                 self.game_over_bg.alpha = 0;
  1880.                 wait 5;
  1881.                 self.game_over_bg thread maps/mp/zombies/_zm::fade_up_over_time( 1 );
  1882.             }
  1883.             i++;
  1884.         }
  1885.     }
  1886. }
  1887.  
  1888. setup_giant_robots_intermission()
  1889. {
  1890.     i = 0;
  1891.     while ( i < 3 )
  1892.     {
  1893.         ai_giant_robot = getent( "giant_robot_walker_" + i, "targetname" );
  1894.         if ( !isDefined( ai_giant_robot ) )
  1895.         {
  1896.             i++;
  1897.             continue;
  1898.         }
  1899.         else
  1900.         {
  1901.             ai_giant_robot ghost();
  1902.             ai_giant_robot stopanimscripted( 0,05 );
  1903.             ai_giant_robot notify( "giant_robot_stop" );
  1904.             if ( i == 2 )
  1905.             {
  1906.                 wait_network_frame();
  1907.                 ai_giant_robot show();
  1908.                 str_anim_scripted_name = "zm_robot_walk_village";
  1909.                 s_robot_path = getstruct( "anim_align_robot_village", "targetname" );
  1910.                 s_robot_path.angles = ( 0, 0, 1 );
  1911.                 animationid = ai_giant_robot getanimfromasd( "zm_robot_walk_village", 1 );
  1912.                 ai_giant_robot thread maps/mp/animscripts/zm_shared::donotetracks( "scripted_walk" );
  1913.                 ai_giant_robot animscripted( s_robot_path.origin, s_robot_path.angles, str_anim_scripted_name, 1 );
  1914.             }
  1915.         }
  1916.         i++;
  1917.     }
  1918. }
  1919.  
  1920. giant_robot_discovered_vo( ai_giant_robot )
  1921. {
  1922.     ai_giant_robot endon( "giant_robot_stop" );
  1923.     self endon( "disconnect" );
  1924.     level endon( "giant_robot_discovered" );
  1925.     while ( 1 )
  1926.     {
  1927.         if ( distance2dsquared( self.origin, ai_giant_robot.origin ) < 16000000 )
  1928.         {
  1929.             if ( self is_player_looking_at( ai_giant_robot.origin + vectorScale( ( 0, 0, 1 ), 2000 ), 0,85 ) )
  1930.             {
  1931.                 if ( isDefined( self.dontspeak ) && !self.dontspeak )
  1932.                 {
  1933.                     self maps/mp/zombies/_zm_audio::create_and_play_dialog( "general", "discover_robot" );
  1934.                     level.giant_robot_discovered = 1;
  1935.                     level notify( "giant_robot_discovered" );
  1936.                     return;
  1937.                 }
  1938.             }
  1939.         }
  1940.         else
  1941.         {
  1942.             wait 0,1;
  1943.         }
  1944.     }
  1945. }
  1946.  
  1947. three_robot_round_vo( ai_giant_robot )
  1948. {
  1949.     ai_giant_robot endon( "giant_robot_stop" );
  1950.     self endon( "disconnect" );
  1951.     level endon( "three_robot_round_vo" );
  1952.     while ( 1 )
  1953.     {
  1954.         if ( distance2dsquared( self.origin, ai_giant_robot.origin ) < 16000000 )
  1955.         {
  1956.             if ( self is_player_looking_at( ai_giant_robot.origin + vectorScale( ( 0, 0, 1 ), 2000 ), 0,85 ) )
  1957.             {
  1958.                 if ( isDefined( self.dontspeak ) && !self.dontspeak )
  1959.                 {
  1960.                     self maps/mp/zombies/_zm_audio::create_and_play_dialog( "general", "see_robots" );
  1961.                     level.three_robot_round_vo = 1;
  1962.                     level notify( "three_robot_round_vo" );
  1963.                     return;
  1964.                 }
  1965.             }
  1966.         }
  1967.         else
  1968.         {
  1969.             wait 0,1;
  1970.         }
  1971.     }
  1972. }
  1973.  
  1974. shoot_at_giant_robot_vo( ai_giant_robot )
  1975. {
  1976.     ai_giant_robot endon( "giant_robot_stop" );
  1977.     self endon( "disconnect" );
  1978.     level endon( "shoot_robot_vo" );
  1979.     while ( 1 )
  1980.     {
  1981.         while ( distance2dsquared( self.origin, ai_giant_robot.origin ) < 16000000 && self is_player_looking_at( ai_giant_robot.origin + vectorScale( ( 0, 0, 1 ), 2000 ), 0,7 ) )
  1982.         {
  1983.             self waittill( "weapon_fired" );
  1984.             if ( distance2dsquared( self.origin, ai_giant_robot.origin ) < 16000000 && self is_player_looking_at( ai_giant_robot.origin + vectorScale( ( 0, 0, 1 ), 2000 ), 0,7 ) )
  1985.             {
  1986.                 if ( isDefined( self.dontspeak ) && !self.dontspeak )
  1987.                 {
  1988.                     self maps/mp/zombies/_zm_audio::create_and_play_dialog( "general", "shoot_robot" );
  1989.                     level.shoot_robot_vo = 1;
  1990.                     level notify( "shoot_robot_vo" );
  1991.                     return;
  1992.                 }
  1993.             }
  1994.         }
  1995.         wait 0,1;
  1996.     }
  1997. }
  1998.  
  1999. start_robot_stomp_warning_vo( foot_side )
  2000. {
  2001.     if ( foot_side == "right" )
  2002.     {
  2003.         str_tag = "TAG_ATTACH_HATCH_RI";
  2004.     }
  2005.     else
  2006.     {
  2007.         if ( foot_side == "left" )
  2008.         {
  2009.             str_tag = "TAG_ATTACH_HATCH_LE";
  2010.         }
  2011.     }
  2012.     v_origin = self gettagorigin( str_tag );
  2013.     a_s_footprint_all = getstructarray( "giant_robot_footprint_center", "targetname" );
  2014.     a_s_footprint = [];
  2015.     _a2384 = a_s_footprint_all;
  2016.     _k2384 = getFirstArrayKey( _a2384 );
  2017.     while ( isDefined( _k2384 ) )
  2018.     {
  2019.         footprint = _a2384[ _k2384 ];
  2020.         if ( footprint.script_int == self.giant_robot_id )
  2021.         {
  2022.             a_s_footprint[ a_s_footprint.size ] = footprint;
  2023.         }
  2024.         _k2384 = getNextArrayKey( _a2384, _k2384 );
  2025.     }
  2026.     if ( a_s_footprint.size == 0 )
  2027.     {
  2028.         return;
  2029.     }
  2030.     else
  2031.     {
  2032.         a_s_footprint = get_array_of_closest( v_origin, a_s_footprint );
  2033.         s_footprint = a_s_footprint[ 0 ];
  2034.     }
  2035.     a_players = getplayers();
  2036.     _a2404 = a_players;
  2037.     _k2404 = getFirstArrayKey( _a2404 );
  2038.     while ( isDefined( _k2404 ) )
  2039.     {
  2040.         player = _a2404[ _k2404 ];
  2041.         if ( distance2dsquared( player.origin, s_footprint.origin ) < 160000 )
  2042.         {
  2043.             player thread play_robot_stomp_warning_vo();
  2044.         }
  2045.         _k2404 = getNextArrayKey( _a2404, _k2404 );
  2046.     }
  2047. }
  2048.  
  2049. play_robot_stomp_warning_vo()
  2050. {
  2051.     a_players = getplayers();
  2052.     _a2417 = a_players;
  2053.     _k2417 = getFirstArrayKey( _a2417 );
  2054.     while ( isDefined( _k2417 ) )
  2055.     {
  2056.         player = _a2417[ _k2417 ];
  2057.         if ( player == self )
  2058.         {
  2059.         }
  2060.         else
  2061.         {
  2062.             if ( distance2dsquared( self.origin, player.origin ) < 640000 )
  2063.             {
  2064.                 if ( player is_player_looking_at( self.origin + vectorScale( ( 0, 0, 1 ), 60 ) ) )
  2065.                 {
  2066.                     if ( isDefined( player.dontspeak ) && !player.dontspeak )
  2067.                     {
  2068.                         player maps/mp/zombies/_zm_audio::create_and_play_dialog( "general", "warn_robot_foot" );
  2069.                         return;
  2070.                     }
  2071.                 }
  2072.             }
  2073.         }
  2074.         else
  2075.         {
  2076.             _k2417 = getNextArrayKey( _a2417, _k2417 );
  2077.         }
  2078.     }
  2079. }
  2080.  
  2081. zombie_stomped_by_gr_vo( foot_side )
  2082. {
  2083.     self endon( "giant_robot_stop" );
  2084.     if ( foot_side == "right" )
  2085.     {
  2086.         str_tag = "TAG_ATTACH_HATCH_RI";
  2087.     }
  2088.     else
  2089.     {
  2090.         if ( foot_side == "left" )
  2091.         {
  2092.             str_tag = "TAG_ATTACH_HATCH_LE";
  2093.         }
  2094.     }
  2095.     v_origin = self gettagorigin( str_tag );
  2096.     a_players = getplayers();
  2097.     _a2454 = a_players;
  2098.     _k2454 = getFirstArrayKey( _a2454 );
  2099.     while ( isDefined( _k2454 ) )
  2100.     {
  2101.         player = _a2454[ _k2454 ];
  2102.         if ( distancesquared( v_origin, player.origin ) < 640000 )
  2103.         {
  2104.             if ( player is_player_looking_at( v_origin, 0,25 ) )
  2105.             {
  2106.                 if ( isDefined( player.dontspeak ) && !player.dontspeak )
  2107.                 {
  2108.                     player maps/mp/zombies/_zm_audio::create_and_play_dialog( "general", "robot_crush_zombie" );
  2109.                     return;
  2110.                 }
  2111.             }
  2112.         }
  2113.         _k2454 = getNextArrayKey( _a2454, _k2454 );
  2114.     }
  2115. }
  2116.  
  2117. play_robot_crush_player_vo()
  2118. {
  2119.     self endon( "disconnect" );
  2120.     if ( self player_is_in_laststand() )
  2121.     {
  2122.         if ( cointoss() )
  2123.         {
  2124.             n_alt = 1;
  2125.         }
  2126.         else
  2127.         {
  2128.             n_alt = 0;
  2129.         }
  2130.         self playsoundwithnotify( "vox_plr_" + self.characterindex + "_robot_crush_player_" + n_alt, "sound_done" + "vox_plr_" + self.characterindex + "_robot_crush_player_" + n_alt );
  2131.     }
  2132. }
  2133.  
  2134. play_timeout_warning_vo( n_robot_id )
  2135. {
  2136.     flag_set( "timeout_vo_robot_" + n_robot_id );
  2137.     s_origin = getstruct( "eject_warning_fx_robot_" + n_robot_id, "targetname" );
  2138.     e_vo_origin = spawn_model( "tag_origin", s_origin.origin );
  2139.     e_vo_origin playsoundwithnotify( "vox_maxi_purge_robot_0", "vox_maxi_purge_robot_0_done" );
  2140.     e_vo_origin waittill( "vox_maxi_purge_robot_0_done" );
  2141.     a_players = getplayers();
  2142.     _a2499 = a_players;
  2143.     _k2499 = getFirstArrayKey( _a2499 );
  2144.     while ( isDefined( _k2499 ) )
  2145.     {
  2146.         player = _a2499[ _k2499 ];
  2147.         if ( isDefined( player.in_giant_robot_head ) && player.in_giant_robot_head == n_robot_id )
  2148.         {
  2149.             if ( isDefined( player.giant_robot_transition ) && !player.giant_robot_transition )
  2150.             {
  2151.                 if ( isDefined( player.dontspeak ) && !player.dontspeak )
  2152.                 {
  2153.                     player maps/mp/zombies/_zm_audio::create_and_play_dialog( "general", "purge_robot" );
  2154.                     break;
  2155.                 }
  2156.             }
  2157.         }
  2158.         else
  2159.         {
  2160.             _k2499 = getNextArrayKey( _a2499, _k2499 );
  2161.         }
  2162.     }
  2163.     while ( isDefined( player ) && isDefined( player.isspeaking ) && player.isspeaking )
  2164.     {
  2165.         wait 0,1;
  2166.     }
  2167.     wait 1;
  2168.     e_vo_origin playsoundwithnotify( "vox_maxi_purge_countdown_0", "vox_maxi_purge_countdown_0_done" );
  2169.     e_vo_origin waittill( "vox_maxi_purge_countdown_0_done" );
  2170.     wait 1;
  2171.     level notify( "timeout_warning_vo_complete_" + n_robot_id );
  2172.     e_vo_origin playsoundwithnotify( "vox_maxi_purge_now_0", "vox_maxi_purge_now_0_done" );
  2173.     e_vo_origin waittill( "vox_maxi_purge_now_0_done" );
  2174.     e_vo_origin delete();
  2175.     flag_clear( "timeout_vo_robot_" + n_robot_id );
  2176. }
  2177.  
  2178. start_footprint_warning_vo( n_robot_id )
  2179. {
  2180.     wait 20;
  2181.     a_structs = getstructarray( "giant_robot_footprint_center", "targetname" );
  2182.     _a2540 = a_structs;
  2183.     _k2540 = getFirstArrayKey( _a2540 );
  2184.     while ( isDefined( _k2540 ) )
  2185.     {
  2186.         struct = _a2540[ _k2540 ];
  2187.         if ( struct.script_int == n_robot_id )
  2188.         {
  2189.             struct thread footprint_check_for_nearby_players( self );
  2190.         }
  2191.         _k2540 = getNextArrayKey( _a2540, _k2540 );
  2192.     }
  2193. }
  2194.  
  2195. footprint_check_for_nearby_players( ai_giant_robot )
  2196. {
  2197.     level endon( "footprint_warning_vo" );
  2198.     ai_giant_robot endon( "giant_robot_stop" );
  2199.     while ( 1 )
  2200.     {
  2201.         a_players = getplayers();
  2202.         _a2558 = a_players;
  2203.         _k2558 = getFirstArrayKey( _a2558 );
  2204.         while ( isDefined( _k2558 ) )
  2205.         {
  2206.             player = _a2558[ _k2558 ];
  2207.             if ( distance2dsquared( player.origin, self.origin ) < 90000 )
  2208.             {
  2209.                 if ( distance2dsquared( player.origin, ai_giant_robot.origin ) < 16000000 )
  2210.                 {
  2211.                     if ( player.origin[ 0 ] > ai_giant_robot.origin[ 0 ] )
  2212.                     {
  2213.                         if ( isDefined( player.dontspeak ) && !player.dontspeak )
  2214.                         {
  2215.                             player do_player_general_vox( "general", "warn_robot" );
  2216.                             level.footprint_warning_vo = 1;
  2217.                             level notify( "footprint_warning_vo" );
  2218.                             return;
  2219.                         }
  2220.                     }
  2221.                 }
  2222.             }
  2223.             _k2558 = getNextArrayKey( _a2558, _k2558 );
  2224.         }
  2225.         wait 1;
  2226.     }
  2227. }
  2228.  
  2229. setup_giant_robot_devgui()
  2230. {
  2231. /#
  2232.     setdvar( "force_giant_robot_0", "off" );
  2233.     setdvar( "force_giant_robot_1", "off" );
  2234.     setdvar( "force_giant_robot_2", "off" );
  2235.     setdvar( "force_three_robot_round", "off" );
  2236.     setdvar( "force_left_foot", "off" );
  2237.     setdvar( "force_right_foot", "off" );
  2238.     adddebugcommand( "devgui_cmd "Zombies/Tomb:1/Giant Robot:1/Force Robot 0 (NML):1" "force_giant_robot_0 on"\n" );
  2239.     adddebugcommand( "devgui_cmd "Zombies/Tomb:1/Giant Robot:1/Force Robot 1 (Trench):2" "force_giant_robot_1 on"\n" );
  2240.     adddebugcommand( "devgui_cmd "Zombies/Tomb:1/Giant Robot:1/Force Robot 2 (Village):3" "force_giant_robot_2 on"\n" );
  2241.     adddebugcommand( "devgui_cmd "Zombies/Tomb:1/Giant Robot:1/Force Three Robot Round:4" "force_three_robot_round on"\n" );
  2242.     adddebugcommand( "devgui_cmd "Zombies/Tomb:1/Giant Robot:1/Force Left Foot:5" "force_left_foot on"\n" );
  2243.     adddebugcommand( "devgui_cmd "Zombies/Tomb:1/Giant Robot:1/Force Right Foot:6" "force_right_foot on"\n" );
  2244.     level thread watch_for_force_giant_robot();
  2245. #/
  2246. }
  2247.  
  2248. watch_for_force_giant_robot()
  2249. {
  2250. /#
  2251.     while ( 1 )
  2252.     {
  2253.         if ( getDvar( "force_giant_robot_0" ) == "on" )
  2254.         {
  2255.             setdvar( "force_giant_robot_0", "off" );
  2256.             if ( isDefined( level.devgui_force_giant_robot ) && level.devgui_force_giant_robot == 0 )
  2257.             {
  2258.                 level.devgui_force_giant_robot = undefined;
  2259.                 iprintlnbold( "Force Giant Robot off" );
  2260.                 break;
  2261.             }
  2262.             else
  2263.             {
  2264.                 level.devgui_force_giant_robot = 0;
  2265.                 iprintlnbold( "Force Giant Robot 0 (NML)" );
  2266.             }
  2267.         }
  2268.         if ( getDvar( "force_giant_robot_1" ) == "on" )
  2269.         {
  2270.             setdvar( "force_giant_robot_1", "off" );
  2271.             if ( isDefined( level.devgui_force_giant_robot ) && level.devgui_force_giant_robot == 1 )
  2272.             {
  2273.                 level.devgui_force_giant_robot = undefined;
  2274.                 iprintlnbold( "Force Giant Robot off" );
  2275.                 break;
  2276.             }
  2277.             else
  2278.             {
  2279.                 level.devgui_force_giant_robot = 1;
  2280.                 iprintlnbold( "Force Giant Robot 1 (Trench)" );
  2281.             }
  2282.         }
  2283.         if ( getDvar( "force_giant_robot_2" ) == "on" )
  2284.         {
  2285.             setdvar( "force_giant_robot_2", "off" );
  2286.             if ( isDefined( level.devgui_force_giant_robot ) && level.devgui_force_giant_robot == 2 )
  2287.             {
  2288.                 level.devgui_force_giant_robot = undefined;
  2289.                 iprintlnbold( "Force Giant Robot off" );
  2290.                 break;
  2291.             }
  2292.             else
  2293.             {
  2294.                 level.devgui_force_giant_robot = 2;
  2295.                 iprintlnbold( "Force Giant Robot 2 (Village)" );
  2296.             }
  2297.         }
  2298.         if ( getDvar( "force_three_robot_round" ) == "on" )
  2299.         {
  2300.             setdvar( "force_three_robot_round", "off" );
  2301.             if ( isDefined( level.devgui_force_three_robot_round ) && level.devgui_force_three_robot_round )
  2302.             {
  2303.                 level.devgui_force_three_robot_round = undefined;
  2304.                 iprintlnbold( "Force Three Robot Round off" );
  2305.                 break;
  2306.             }
  2307.             else
  2308.             {
  2309.                 level.devgui_force_three_robot_round = 1;
  2310.                 iprintlnbold( "Force Three Robot Round" );
  2311.             }
  2312.         }
  2313.         if ( getDvar( "force_left_foot" ) == "on" )
  2314.         {
  2315.             setdvar( "force_left_foot", "off" );
  2316.             if ( isDefined( level.devgui_force_giant_robot_foot ) && level.devgui_force_giant_robot_foot == "left" )
  2317.             {
  2318.                 level.devgui_force_giant_robot_foot = undefined;
  2319.                 iprintlnbold( "Force Giant Robot Foot Off" );
  2320.                 break;
  2321.             }
  2322.             else
  2323.             {
  2324.                 level.devgui_force_giant_robot_foot = "left";
  2325.                 iprintlnbold( "Force Giant Robot Hatch on Left Foot" );
  2326.             }
  2327.         }
  2328.         if ( getDvar( "force_right_foot" ) == "on" )
  2329.         {
  2330.             setdvar( "force_right_foot", "off" );
  2331.             if ( isDefined( level.devgui_force_giant_robot_foot ) && level.devgui_force_giant_robot_foot == "right" )
  2332.             {
  2333.                 level.devgui_force_giant_robot_foot = undefined;
  2334.                 iprintlnbold( "Force Giant Robot Foot Off" );
  2335.                 break;
  2336.             }
  2337.             else
  2338.             {
  2339.                 level.devgui_force_giant_robot_foot = "right";
  2340.                 iprintlnbold( "Force Giant Robot Hatch on Right Foot" );
  2341.             }
  2342.         }
  2343.         wait 0,05;
  2344. #/
  2345.     }
  2346. }
  2347.  
  2348. starting_spawn_light()
  2349. {
  2350.     light = getent( "start_bunker_footprint_light", "targetname" );
  2351.     if ( !isDefined( light ) )
  2352.     {
  2353.         return;
  2354.     }
  2355.     light setlightintensity( 0 );
  2356.     wait 5,4;
  2357.     i = 8;
  2358.     while ( i <= 16 )
  2359.     {
  2360.         light setlightintensity( i );
  2361.         wait 0,1;
  2362.         i += 8;
  2363.     }
  2364. }
Advertisement
Add Comment
Please, Sign In to add comment