@@ -13,6 +13,9 @@ import {
1313import { ZoneClient2016 } from "../classes/zoneclient" ;
1414import { ExplosiveEntity } from "../entities/explosiveentity" ;
1515import { AirdropConfig , AirdropTypeConfig } from "../models/config" ;
16+ import { ZombieWalker } from "../entities/zombiewalker" ;
17+
18+ const debug = require ( "debug" ) ( "airdropManager" ) ;
1619
1720interface DeliveryProgressData {
1821 progress : number ;
@@ -330,10 +333,10 @@ export class AirdropManager {
330333 ) ;
331334
332335 if ( this . spawnZombiesOnLanding ) {
333- debug ( "[AIRDROP] About to spawn zombies" ) ;
334- this . spawnAirdropZombies ( position ) ;
335- debug ( "[AIRDROP] Finished spawning zombies" ) ;
336- }
336+ debug ( "[AIRDROP] About to spawn zombies" ) ;
337+ this . spawnAirdropZombies ( position ) ;
338+ debug ( "[AIRDROP] Finished spawning zombies" ) ;
339+ }
337340 } ,
338341 Math . floor ( tickAtPos + crateDropSpeed )
339342 ) ;
@@ -501,56 +504,52 @@ export class AirdropManager {
501504 * Called once the crate has finished its delivery animation.
502505 */
503506 spawnAirdropZombies (
504- position : Float32Array ,
505- count : number = this . zombiesPerAirdrop ,
506- radius : number = this . zombieSpawnRadius
507- ) {
508- for ( let i = 0 ; i < count ; i ++ ) {
509- const angle = ( i / count ) * Math . PI * 2 ;
510-
511- const spawnPos = new Float32Array ( [
512- position [ 0 ] + Math . cos ( angle ) * radius ,
513- position [ 1 ] ,
514- position [ 2 ] + Math . sin ( angle ) * radius ,
515- 0
516- ] ) ;
517-
518- const modelId =
519- Math . random ( ) < 0.5
520- ? ModelIds . ZOMBIE_MALE_WALKER
521- : ModelIds . ZOMBIE_FEMALE_WALKER ;
507+ position : Float32Array ,
508+ count : number = this . zombiesPerAirdrop ,
509+ radius : number = this . zombieSpawnRadius
510+ ) {
511+ for ( let i = 0 ; i < count ; i ++ ) {
512+ const angle = ( i / count ) * Math . PI * 2 ;
522513
523- const rotation = eul2quat (
524- new Float32Array ( [
525- 0 ,
526- Math . random ( ) * Math . PI * 2 ,
514+ const spawnPos = new Float32Array ( [
515+ position [ 0 ] + Math . cos ( angle ) * radius ,
516+ position [ 1 ] ,
517+ position [ 2 ] + Math . sin ( angle ) * radius ,
527518 0
528- ] )
529- ) ;
519+ ] ) ;
530520
531- const characterId = this . server . generateGuid ( ) ;
532- const transientId = this . server . getTransientId ( characterId ) ;
521+ const modelId =
522+ Math . random ( ) < 0.5
523+ ? ModelIds . ZOMBIE_MALE_WALKER
524+ : ModelIds . ZOMBIE_FEMALE_WALKER ;
533525
534- const zombie = new ZombieWalker (
535- characterId ,
536- transientId ,
537- modelId ,
538- spawnPos ,
539- rotation ,
540- this . server
541- ) ;
526+ const rotation = eul2quat (
527+ new Float32Array ( [ 0 , Math . random ( ) * Math . PI * 2 , 0 ] )
528+ ) ;
542529
543- this . server . _npcs [ characterId ] = zombie ;
530+ const characterId = this . server . generateGuid ( ) ;
531+ const transientId = this . server . getTransientId ( characterId ) ;
544532
545- console . log (
546- `[AIRDROP ZOMBIE] spawned ${ characterId } ` +
547- `model=${ modelId } ` +
548- `pos=[${ spawnPos [ 0 ] . toFixed ( 2 ) } , ` +
549- `${ spawnPos [ 1 ] . toFixed ( 2 ) } , ` +
550- `${ spawnPos [ 2 ] . toFixed ( 2 ) } ]`
551- ) ;
533+ const zombie = new ZombieWalker (
534+ characterId ,
535+ transientId ,
536+ modelId ,
537+ spawnPos ,
538+ rotation ,
539+ this . server
540+ ) ;
541+
542+ this . server . _npcs [ characterId ] = zombie ;
543+
544+ debug (
545+ `[AIRDROP ZOMBIE] spawned ${ characterId } ` +
546+ `model=${ modelId } ` +
547+ `pos=[${ spawnPos [ 0 ] . toFixed ( 2 ) } , ` +
548+ `${ spawnPos [ 1 ] . toFixed ( 2 ) } , ` +
549+ `${ spawnPos [ 2 ] . toFixed ( 2 ) } ]`
550+ ) ;
551+ }
552552 }
553- }
554553
555554 broadcastDeliveryInfo ( client : ZoneClient2016 | undefined = undefined ) {
556555 for ( const [ airdropId , airdrop ] of this . activeAirdrops . entries ( ) ) {
0 commit comments